Skip to content

Commit 207832b

Browse files
authored
Rollup merge of #77605 - da-x:fix-rustc-def-path, r=petrochenkov
Fix rustc_def_path to show the full path and not the trimmed one Follow-up fix for #73996.
2 parents 6951c31 + d25c580 commit 207832b

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

Diff for: compiler/rustc_symbol_mangling/src/test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! paths etc in all kinds of annoying scenarios.
66
77
use rustc_hir as hir;
8+
use rustc_middle::ty::print::with_no_trimmed_paths;
89
use rustc_middle::ty::{Instance, TyCtxt};
910
use rustc_span::symbol::{sym, Symbol};
1011

@@ -44,7 +45,7 @@ impl SymbolNamesTest<'tcx> {
4445
tcx.sess.span_err(attr.span, &format!("demangling-alt({:#})", demangling));
4546
}
4647
} else if tcx.sess.check_name(attr, DEF_PATH) {
47-
let path = tcx.def_path_str(def_id.to_def_id());
48+
let path = with_no_trimmed_paths(|| tcx.def_path_str(def_id.to_def_id()));
4849
tcx.sess.span_err(attr.span, &format!("def-path({})", path));
4950
}
5051

Diff for: src/test/ui/symbol-names/impl1.legacy.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ error: demangling-alt(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::A
6464
LL | #[rustc_symbol_name]
6565
| ^^^^^^^^^^^^^^^^^^^^
6666

67-
error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as Bar>::method)
67+
error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method)
6868
--> $DIR/impl1.rs:71:13
6969
|
7070
LL | #[rustc_def_path]

Diff for: src/test/ui/symbol-names/impl1.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ fn main() {
6969
//[v0]~| ERROR demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method)
7070
//[v0]~| ERROR demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method)
7171
#[rustc_def_path]
72-
//[legacy]~^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as Bar>::method)
73-
//[v0]~^^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as Bar>::method)
72+
//[legacy]~^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method)
73+
//[v0]~^^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method)
7474
fn method(&self) {}
7575
}
7676
};

Diff for: src/test/ui/symbol-names/impl1.v0.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ error: demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ..
6464
LL | #[rustc_symbol_name]
6565
| ^^^^^^^^^^^^^^^^^^^^
6666

67-
error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as Bar>::method)
67+
error: def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method)
6868
--> $DIR/impl1.rs:71:13
6969
|
7070
LL | #[rustc_def_path]

0 commit comments

Comments
 (0)