Print out the proper crate path

This commit is contained in:
mejrs 2022-09-18 02:59:32 +02:00
parent 3699c2497b
commit 14e9893023
4 changed files with 6 additions and 10 deletions

View File

@ -1779,11 +1779,8 @@ enum Similar<'tcx> {
.tcx
.parent_module_from_def_id(defid.expect_local())
.to_def_id();
let module_name =
self.tcx.def_path(module).to_string_no_crate_verbose();
format!(
"{name} is defined in module {module_name} of the current crate"
)
let module_name = self.tcx.def_path(module).to_string_no_crate_verbose();
format!("{name} is defined in module `crate{module_name}` of the current crate")
} else if defid.is_local() {
format!("{name} is defined in the current crate")
} else {

View File

@ -20,7 +20,6 @@
#![cfg_attr(bootstrap, feature(label_break_value))]
#![feature(let_chains)]
#![cfg_attr(bootstrap, feature(let_else))]
#![feature(let_else)]
#![feature(if_let_guard)]
#![feature(min_specialization)]
#![feature(never_type)]

View File

@ -7,12 +7,12 @@ LL | return x;
| ^ expected enum `y::Foo`, found enum `x::Foo`
|
= note: enum `x::Foo` and enum `y::Foo` have similar names, but are actually distinct types
note: enum `x::Foo` is defined in module ::x of the current crate
note: enum `x::Foo` is defined in module `crate::x` of the current crate
--> $DIR/fully-qualified-type-name2.rs:4:5
|
LL | pub enum Foo { }
| ^^^^^^^^^^^^
note: enum `y::Foo` is defined in module ::y of the current crate
note: enum `y::Foo` is defined in module `crate::y` of the current crate
--> $DIR/fully-qualified-type-name2.rs:8:5
|
LL | pub enum Foo { }

View File

@ -7,12 +7,12 @@ LL | meh::Foo
| ^^^^^^^^ expected struct `baz::Foo`, found struct `meh::Foo`
|
= note: struct `meh::Foo` and struct `baz::Foo` have similar names, but are actually distinct types
note: struct `meh::Foo` is defined in module ::meh of the current crate
note: struct `meh::Foo` is defined in module `crate::meh` of the current crate
--> $DIR/show_module.rs:8:5
|
LL | pub struct Foo;
| ^^^^^^^^^^^^^^
note: struct `baz::Foo` is defined in module ::blah::baz of the current crate
note: struct `baz::Foo` is defined in module `crate::blah::baz` of the current crate
--> $DIR/show_module.rs:3:9
|
LL | pub struct Foo;