Skip to content

Commit de01134

Browse files
committed
Reword "crate not found" resolve message
``` error[E0432]: unresolved import `some_novel_crate` --> file.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` ```
1 parent 917a50a commit de01134

File tree

104 files changed

+256
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+256
-256
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
20312031
(format!("`_` is not a valid crate or module name"), None)
20322032
} else if self.tcx.sess.is_rust_2015() {
20332033
(
2034-
format!("you might be missing crate `{ident}`"),
2034+
format!("use of unresolved module or unlinked crate `{ident}`"),
20352035
Some((
20362036
vec![(
20372037
self.current_crate_outer_attr_insert_span,
@@ -2216,7 +2216,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
22162216
let descr = binding.res().descr();
22172217
(format!("{descr} `{ident}` is not a crate or module"), suggestion)
22182218
} else {
2219-
(format!("use of undeclared crate or module `{ident}`"), suggestion)
2219+
(format!("use of unresolved module or unlinked crate `{ident}`"), suggestion)
22202220
}
22212221
}
22222222
}

tests/rustdoc-ui/ice-unresolved-import-100241.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `inner`
22
--> $DIR/ice-unresolved-import-100241.rs:9:13
33
|
44
LL | pub use inner::S;
5-
| ^^^^^ you might be missing crate `inner`
5+
| ^^^^^ use of unresolved module or unlinked crate `inner`
66
|
77
help: consider importing the `inner` crate
88
|

tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0433]: failed to resolve: you might be missing crate `unresolved_crate`
1+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_crate`
22
--> $DIR/unresolved-import-recovery.rs:3:5
33
|
44
LL | use unresolved_crate::module::Name;
5-
| ^^^^^^^^^^^^^^^^ you might be missing crate `unresolved_crate`
5+
| ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved_crate`
66
|
77
help: consider importing the `unresolved_crate` crate
88
|
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// This previously triggered an ICE.
22

33
pub(in crate::r#mod) fn main() {}
4-
//~^ ERROR failed to resolve: you might be missing crate `r#mod`
4+
//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `r#mod`

tests/rustdoc-ui/issues/issue-61732.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0433]: failed to resolve: you might be missing crate `r#mod`
1+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `r#mod`
22
--> $DIR/issue-61732.rs:3:15
33
|
44
LL | pub(in crate::r#mod) fn main() {}
5-
| ^^^^^ you might be missing crate `r#mod`
5+
| ^^^^^ use of unresolved module or unlinked crate `r#mod`
66
|
77
help: consider importing the `r#mod` crate
88
|

tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ enum DiagnosticOnEnum {
5656
#[derive(Diagnostic)]
5757
#[diag(no_crate_example, code = E0123)]
5858
#[diag = "E0123"]
59-
//~^ ERROR failed to resolve: you might be missing crate `core`
59+
//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `core`
6060
struct WrongStructAttrStyle {}
6161

6262
#[derive(Diagnostic)]
@@ -801,15 +801,15 @@ struct SuggestionsNoItem {
801801
struct SuggestionsInvalidItem {
802802
#[suggestion(code(foo))]
803803
//~^ ERROR `code(...)` must contain only string literals
804-
//~| ERROR failed to resolve: you might be missing crate `core`
804+
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `core`
805805
sub: Span,
806806
}
807807

808808
#[derive(Diagnostic)] //~ ERROR cannot find value `__code_34` in this scope
809809
#[diag(no_crate_example)]
810810
struct SuggestionsInvalidLiteral {
811811
#[suggestion(code = 3)]
812-
//~^ ERROR failed to resolve: you might be missing crate `core`
812+
//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `core`
813813
sub: Span,
814814
}
815815

tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ struct G {
9494

9595
#[derive(Subdiagnostic)]
9696
#[label("...")]
97-
//~^ ERROR failed to resolve: you might be missing crate `core`
98-
//~| NOTE you might be missing crate `core`
97+
//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `core`
98+
//~| NOTE use of unresolved module or unlinked crate `core`
9999
struct H {
100100
#[primary_span]
101101
span: Span,
@@ -310,8 +310,8 @@ struct AB {
310310

311311
#[derive(Subdiagnostic)]
312312
union AC {
313-
//~^ ERROR failed to resolve: you might be missing crate `core`
314-
//~| NOTE you might be missing crate `core`
313+
//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `core`
314+
//~| NOTE use of unresolved module or unlinked crate `core`
315315
span: u32,
316316
b: u64,
317317
}
@@ -581,8 +581,8 @@ struct BD {
581581
span2: Span,
582582
#[suggestion_part(foo = "bar")]
583583
//~^ ERROR `code` is the only valid nested attribute
584-
//~| ERROR failed to resolve: you might be missing crate `core`
585-
//~| NOTE you might be missing crate `core`
584+
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `core`
585+
//~| NOTE use of unresolved module or unlinked crate `core`
586586
span4: Span,
587587
#[suggestion_part(code = "...")]
588588
//~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
@@ -674,8 +674,8 @@ enum BL {
674674
struct BM {
675675
#[suggestion_part(code("foo"))]
676676
//~^ ERROR expected exactly one string literal for `code = ...`
677-
//~| ERROR failed to resolve: you might be missing crate `core`
678-
//~| NOTE you might be missing crate `core`
677+
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `core`
678+
//~| NOTE use of unresolved module or unlinked crate `core`
679679
span: Span,
680680
r#type: String,
681681
}
@@ -685,8 +685,8 @@ struct BM {
685685
struct BN {
686686
#[suggestion_part(code("foo", "bar"))]
687687
//~^ ERROR expected exactly one string literal for `code = ...`
688-
//~| ERROR failed to resolve: you might be missing crate `core`
689-
//~| NOTE you might be missing crate `core`
688+
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `core`
689+
//~| NOTE use of unresolved module or unlinked crate `core`
690690
span: Span,
691691
r#type: String,
692692
}
@@ -696,8 +696,8 @@ struct BN {
696696
struct BO {
697697
#[suggestion_part(code(3))]
698698
//~^ ERROR expected exactly one string literal for `code = ...`
699-
//~| ERROR failed to resolve: you might be missing crate `core`
700-
//~| NOTE you might be missing crate `core`
699+
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `core`
700+
//~| NOTE use of unresolved module or unlinked crate `core`
701701
span: Span,
702702
r#type: String,
703703
}
@@ -718,8 +718,8 @@ struct BP {
718718
#[multipart_suggestion(no_crate_example)]
719719
struct BQ {
720720
#[suggestion_part(code = 3)]
721-
//~^ ERROR failed to resolve: you might be missing crate `core`
722-
//~| NOTE you might be missing crate `core`
721+
//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `core`
722+
//~| NOTE use of unresolved module or unlinked crate `core`
723723
span: Span,
724724
r#type: String,
725725
}
@@ -811,8 +811,8 @@ struct SuggestionStyleInvalid3 {
811811
#[derive(Subdiagnostic)]
812812
#[suggestion(no_crate_example, code = "", style("foo"))]
813813
//~^ ERROR expected `= "xxx"`
814-
//~| ERROR failed to resolve: you might be missing crate `core`
815-
//~| NOTE you might be missing crate `core`
814+
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `core`
815+
//~| NOTE use of unresolved module or unlinked crate `core`
816816
struct SuggestionStyleInvalid4 {
817817
#[primary_span]
818818
sub: Span,

tests/ui/attributes/check-builtin-attr-ice.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
error[E0433]: failed to resolve: use of undeclared crate or module `should_panic`
1+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
22
--> $DIR/check-builtin-attr-ice.rs:43:7
33
|
44
LL | #[should_panic::skip]
5-
| ^^^^^^^^^^^^ use of undeclared crate or module `should_panic`
5+
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
66

7-
error[E0433]: failed to resolve: use of undeclared crate or module `should_panic`
7+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
88
--> $DIR/check-builtin-attr-ice.rs:47:7
99
|
1010
LL | #[should_panic::a::b::c]
11-
| ^^^^^^^^^^^^ use of undeclared crate or module `should_panic`
11+
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
1212

13-
error[E0433]: failed to resolve: use of undeclared crate or module `deny`
13+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny`
1414
--> $DIR/check-builtin-attr-ice.rs:55:7
1515
|
1616
LL | #[deny::skip]
17-
| ^^^^ use of undeclared crate or module `deny`
17+
| ^^^^ use of unresolved module or unlinked crate `deny`
1818

1919
error: aborting due to 3 previous errors
2020

tests/ui/attributes/check-cfg_attr-ice.stderr

+26-26
Original file line numberDiff line numberDiff line change
@@ -17,83 +17,83 @@ LL | #[cfg_attr::no_such_thing]
1717
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
1818
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1919

20-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
20+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
2121
--> $DIR/check-cfg_attr-ice.rs:52:3
2222
|
2323
LL | #[cfg_attr::no_such_thing]
24-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
24+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
2525

26-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
26+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
2727
--> $DIR/check-cfg_attr-ice.rs:55:7
2828
|
2929
LL | #[cfg_attr::no_such_thing]
30-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
30+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
3131

32-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
32+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
3333
--> $DIR/check-cfg_attr-ice.rs:57:17
3434
|
3535
LL | GiveYouUp(#[cfg_attr::no_such_thing] u8),
36-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
36+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
3737

38-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
38+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
3939
--> $DIR/check-cfg_attr-ice.rs:64:11
4040
|
4141
LL | #[cfg_attr::no_such_thing]
42-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
42+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
4343

44-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
44+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
4545
--> $DIR/check-cfg_attr-ice.rs:41:7
4646
|
4747
LL | #[cfg_attr::no_such_thing]
48-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
48+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
4949

50-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
50+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
5151
--> $DIR/check-cfg_attr-ice.rs:43:15
5252
|
5353
LL | fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This {
54-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
54+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
5555

56-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
56+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
5757
--> $DIR/check-cfg_attr-ice.rs:45:11
5858
|
5959
LL | #[cfg_attr::no_such_thing]
60-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
60+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
6161

62-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
62+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
6363
--> $DIR/check-cfg_attr-ice.rs:32:3
6464
|
6565
LL | #[cfg_attr::no_such_thing]
66-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
66+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
6767

68-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
68+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
6969
--> $DIR/check-cfg_attr-ice.rs:24:3
7070
|
7171
LL | #[cfg_attr::no_such_thing]
72-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
72+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
7373

74-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
74+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
7575
--> $DIR/check-cfg_attr-ice.rs:27:7
7676
|
7777
LL | #[cfg_attr::no_such_thing]
78-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
78+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
7979

80-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
80+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
8181
--> $DIR/check-cfg_attr-ice.rs:16:3
8282
|
8383
LL | #[cfg_attr::no_such_thing]
84-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
84+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
8585

86-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
86+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
8787
--> $DIR/check-cfg_attr-ice.rs:19:7
8888
|
8989
LL | #[cfg_attr::no_such_thing]
90-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
90+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
9191

92-
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
92+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
9393
--> $DIR/check-cfg_attr-ice.rs:12:3
9494
|
9595
LL | #[cfg_attr::no_such_thing]
96-
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
96+
| ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
9797

9898
error: aborting due to 15 previous errors
9999

tests/ui/attributes/field-attributes-vis-unresolved.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
error[E0433]: failed to resolve: you might be missing crate `nonexistent`
1+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
22
--> $DIR/field-attributes-vis-unresolved.rs:17:12
33
|
44
LL | pub(in nonexistent) field: u8
5-
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
5+
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistent`
66
|
77
help: consider importing the `nonexistent` crate
88
|
99
LL + extern crate nonexistent;
1010
|
1111

12-
error[E0433]: failed to resolve: you might be missing crate `nonexistent`
12+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
1313
--> $DIR/field-attributes-vis-unresolved.rs:22:12
1414
|
1515
LL | pub(in nonexistent) u8
16-
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
16+
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistent`
1717
|
1818
help: consider importing the `nonexistent` crate
1919
|

tests/ui/coherence/conflicting-impl-with-err.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
error[E0433]: failed to resolve: use of undeclared crate or module `nope`
1+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope`
22
--> $DIR/conflicting-impl-with-err.rs:4:11
33
|
44
LL | impl From<nope::Thing> for Error {
5-
| ^^^^ use of undeclared crate or module `nope`
5+
| ^^^^ use of unresolved module or unlinked crate `nope`
66

7-
error[E0433]: failed to resolve: use of undeclared crate or module `nope`
7+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope`
88
--> $DIR/conflicting-impl-with-err.rs:5:16
99
|
1010
LL | fn from(_: nope::Thing) -> Self {
11-
| ^^^^ use of undeclared crate or module `nope`
11+
| ^^^^ use of unresolved module or unlinked crate `nope`
1212

1313
error: aborting due to 2 previous errors
1414

tests/ui/delegation/bad-resolve.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Trait for S {
4040
}
4141

4242
mod prefix {}
43-
reuse unresolved_prefix::{a, b, c}; //~ ERROR use of undeclared crate or module `unresolved_prefix`
43+
reuse unresolved_prefix::{a, b, c}; //~ ERROR use of unresolved module or unlinked crate
4444
reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
4545

4646
fn main() {}

tests/ui/delegation/bad-resolve.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ LL | type Type;
8181
LL | impl Trait for S {
8282
| ^^^^^^^^^^^^^^^^ missing `Type` in implementation
8383

84-
error[E0433]: failed to resolve: use of undeclared crate or module `unresolved_prefix`
84+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_prefix`
8585
--> $DIR/bad-resolve.rs:43:7
8686
|
8787
LL | reuse unresolved_prefix::{a, b, c};
88-
| ^^^^^^^^^^^^^^^^^ use of undeclared crate or module `unresolved_prefix`
88+
| ^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved_prefix`
8989

9090
error[E0433]: failed to resolve: `crate` in paths can only be used in start position
9191
--> $DIR/bad-resolve.rs:44:29

tests/ui/delegation/glob-bad-path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ trait Trait {}
55
struct S;
66

77
impl Trait for u8 {
8-
reuse unresolved::*; //~ ERROR failed to resolve: use of undeclared crate or module `unresolved`
8+
reuse unresolved::*; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `unresolved`
99
reuse S::*; //~ ERROR expected trait, found struct `S`
1010
}
1111

tests/ui/delegation/glob-bad-path.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error: expected trait, found struct `S`
44
LL | reuse S::*;
55
| ^ not a trait
66

7-
error[E0433]: failed to resolve: use of undeclared crate or module `unresolved`
7+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved`
88
--> $DIR/glob-bad-path.rs:8:11
99
|
1010
LL | reuse unresolved::*;
11-
| ^^^^^^^^^^ use of undeclared crate or module `unresolved`
11+
| ^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved`
1212

1313
error: aborting due to 2 previous errors
1414

0 commit comments

Comments
 (0)