Skip to content

Commit bf7b981

Browse files
gnzlbgcrlf0710
authored andcommitted
Display name of crate requiring rustc_private
1 parent 527dce7 commit bf7b981

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/librustc/middle/stability.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,15 @@ impl<'tcx> Index<'tcx> {
431431
// while maintaining the invariant that all sysroot crates are unstable
432432
// by default and are unable to be used.
433433
if tcx.sess.opts.debugging_opts.force_unstable_if_unmarked {
434-
let reason = "this crate is being loaded from the sysroot, an \
435-
unstable location; did you mean to load this crate \
436-
from crates.io via `Cargo.toml` instead?";
434+
let reason = format!(
435+
"crate \"{}\" is being loaded from the sysroot, an \
436+
unstable location; did you mean to load this crate \
437+
from crates.io via `Cargo.toml` instead?",
438+
tcx.crate_name(LOCAL_CRATE)
439+
);
437440
let stability = tcx.intern_stability(Stability {
438441
level: attr::StabilityLevel::Unstable {
439-
reason: Some(Symbol::intern(reason)),
442+
reason: Some(Symbol::intern(&reason)),
440443
issue: 27812,
441444
},
442445
feature: sym::rustc_private,

0 commit comments

Comments
 (0)