Skip to content

Commit bd2d1a8

Browse files
authored
Rollup merge of #155835 - jyn514:jyn/verify-ich-diagnostics, r=wesleywiser
couple of `crate_name` cleanups Split out from #153924; these changes should be uncontroversial.
2 parents c0e4189 + 7151184 commit bd2d1a8

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

compiler/rustc_middle/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub(crate) struct Reentrant;
143143
#[note(
144144
"an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again"
145145
)]
146-
#[note("as a workaround, you can run {$run_cmd} to allow your project to compile")]
146+
#[note("as a workaround, you can {$run_cmd} to allow your project to compile")]
147147
pub(crate) struct IncrementCompilation {
148148
pub run_cmd: String,
149149
pub dep_node: String,

compiler/rustc_middle/src/verify_ich.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use std::cell::Cell;
22

33
use rustc_data_structures::fingerprint::Fingerprint;
4+
use rustc_hir::def_id::LOCAL_CRATE;
5+
use rustc_session::utils::was_invoked_from_cargo;
46
use tracing::instrument;
57

68
use crate::dep_graph::{DepGraphData, SerializedDepNodeIndex};
@@ -66,10 +68,10 @@ fn incremental_verify_ich_failed<'tcx>(
6668
if old_in_panic {
6769
tcx.dcx().emit_err(crate::error::Reentrant);
6870
} else {
69-
let run_cmd = if let Some(crate_name) = &tcx.sess.opts.crate_name {
70-
format!("`cargo clean -p {crate_name}` or `cargo clean`")
71+
let run_cmd = if was_invoked_from_cargo() {
72+
format!("run `cargo clean -p {}` or `cargo clean`", tcx.crate_name(LOCAL_CRATE))
7173
} else {
72-
"`cargo clean`".to_string()
74+
"clean your build cache".to_owned()
7375
};
7476

7577
let dep_node = tcx.dep_graph.data().unwrap().prev_node_of(prev_index);

compiler/rustc_session/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,7 @@ impl OutputFilenames {
12051205
}
12061206

12071207
pub fn interface_path(&self) -> PathBuf {
1208+
debug!("using crate_name={} for interface_path", self.crate_stem);
12081209
self.out_directory.join(format!("lib{}.rs", self.crate_stem))
12091210
}
12101211

@@ -1214,6 +1215,7 @@ impl OutputFilenames {
12141215
let extension = flavor.extension();
12151216
match flavor {
12161217
OutputType::Metadata => {
1218+
debug!("using crate_name={} for {extension}", self.crate_stem);
12171219
self.out_directory.join(format!("lib{}.{}", self.crate_stem, extension))
12181220
}
12191221
_ => self.with_directory_and_extension(&self.out_directory, extension),
@@ -1288,6 +1290,7 @@ impl OutputFilenames {
12881290
}
12891291

12901292
pub fn with_directory_and_extension(&self, directory: &Path, extension: &str) -> PathBuf {
1293+
debug!("using filestem={} for {extension}", self.filestem);
12911294
let mut path = directory.join(&self.filestem);
12921295
path.set_extension(extension);
12931296
path

0 commit comments

Comments
 (0)