Skip to content

Commit 14e9893

Browse files
author
mejrs
committed
Print out the proper crate path
1 parent 3699c24 commit 14e9893

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1779,11 +1779,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
17791779
.tcx
17801780
.parent_module_from_def_id(defid.expect_local())
17811781
.to_def_id();
1782-
let module_name =
1783-
self.tcx.def_path(module).to_string_no_crate_verbose();
1784-
format!(
1785-
"{name} is defined in module {module_name} of the current crate"
1786-
)
1782+
let module_name = self.tcx.def_path(module).to_string_no_crate_verbose();
1783+
format!("{name} is defined in module `crate{module_name}` of the current crate")
17871784
} else if defid.is_local() {
17881785
format!("{name} is defined in the current crate")
17891786
} else {

compiler/rustc_infer/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#![cfg_attr(bootstrap, feature(label_break_value))]
2121
#![feature(let_chains)]
2222
#![cfg_attr(bootstrap, feature(let_else))]
23-
#![feature(let_else)]
2423
#![feature(if_let_guard)]
2524
#![feature(min_specialization)]
2625
#![feature(never_type)]

src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ LL | return x;
77
| ^ expected enum `y::Foo`, found enum `x::Foo`
88
|
99
= note: enum `x::Foo` and enum `y::Foo` have similar names, but are actually distinct types
10-
note: enum `x::Foo` is defined in module ::x of the current crate
10+
note: enum `x::Foo` is defined in module `crate::x` of the current crate
1111
--> $DIR/fully-qualified-type-name2.rs:4:5
1212
|
1313
LL | pub enum Foo { }
1414
| ^^^^^^^^^^^^
15-
note: enum `y::Foo` is defined in module ::y of the current crate
15+
note: enum `y::Foo` is defined in module `crate::y` of the current crate
1616
--> $DIR/fully-qualified-type-name2.rs:8:5
1717
|
1818
LL | pub enum Foo { }

src/test/ui/mismatched_types/show_module.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ LL | meh::Foo
77
| ^^^^^^^^ expected struct `baz::Foo`, found struct `meh::Foo`
88
|
99
= note: struct `meh::Foo` and struct `baz::Foo` have similar names, but are actually distinct types
10-
note: struct `meh::Foo` is defined in module ::meh of the current crate
10+
note: struct `meh::Foo` is defined in module `crate::meh` of the current crate
1111
--> $DIR/show_module.rs:8:5
1212
|
1313
LL | pub struct Foo;
1414
| ^^^^^^^^^^^^^^
15-
note: struct `baz::Foo` is defined in module ::blah::baz of the current crate
15+
note: struct `baz::Foo` is defined in module `crate::blah::baz` of the current crate
1616
--> $DIR/show_module.rs:3:9
1717
|
1818
LL | pub struct Foo;

0 commit comments

Comments
 (0)