Skip to content

Commit 69bcbb2

Browse files
committed
Do not use question as label
We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
1 parent 2a1c384 commit 69bcbb2

40 files changed

+118
-110
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20122012
)
20132013
} else if ident.name == sym::core {
20142014
(
2015-
format!("maybe a missing crate `{ident}`?"),
2015+
format!("you might be missing crate `{ident}`"),
20162016
Some((
20172017
vec![(ident.span, "std".to_string())],
20182018
"try using `std` instead of `core`".to_string(),
@@ -2021,7 +2021,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20212021
)
20222022
} else if self.tcx.sess.is_rust_2015() {
20232023
(
2024-
format!("maybe a missing crate `{ident}`?"),
2024+
format!("you might be missing crate `{ident}`"),
20252025
Some((
20262026
vec![],
20272027
format!(

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-
| ^^^^^ maybe a missing crate `inner`?
5+
| ^^^^^ you might be missing crate `inner`
66
|
77
= help: consider adding `extern crate inner` to use 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: maybe a missing crate `unresolved_crate`?
1+
error[E0433]: failed to resolve: you might be missing crate `unresolved_crate`
22
--> $DIR/unresolved-import-recovery.rs:3:5
33
|
44
LL | use unresolved_crate::module::Name;
5-
| ^^^^^^^^^^^^^^^^ maybe a missing crate `unresolved_crate`?
5+
| ^^^^^^^^^^^^^^^^ you might be missing crate `unresolved_crate`
66
|
77
= help: consider adding `extern crate unresolved_crate` to use 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: maybe a missing crate `r#mod`
4+
//~^ ERROR failed to resolve: you might be missing 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: maybe a missing crate `r#mod`?
1+
error[E0433]: failed to resolve: you might be missing crate `r#mod`
22
--> $DIR/issue-61732.rs:3:15
33
|
44
LL | pub(in crate::r#mod) fn main() {}
5-
| ^^^^^ maybe a missing crate `r#mod`?
5+
| ^^^^^ you might be missing crate `r#mod`
66
|
77
= help: consider adding `extern crate r#mod` to use the `r#mod` crate
88

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error[E0433]: failed to resolve: maybe a missing crate `nonexistent`?
1+
error[E0433]: failed to resolve: you might be missing crate `nonexistent`
22
--> $DIR/field-attributes-vis-unresolved.rs:17:12
33
|
44
LL | pub(in nonexistent) field: u8
5-
| ^^^^^^^^^^^ maybe a missing crate `nonexistent`?
5+
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
66
|
77
= help: consider adding `extern crate nonexistent` to use the `nonexistent` crate
88

9-
error[E0433]: failed to resolve: maybe a missing crate `nonexistent`?
9+
error[E0433]: failed to resolve: you might be missing crate `nonexistent`
1010
--> $DIR/field-attributes-vis-unresolved.rs:22:12
1111
|
1212
LL | pub(in nonexistent) u8
13-
| ^^^^^^^^^^^ maybe a missing crate `nonexistent`?
13+
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
1414
|
1515
= help: consider adding `extern crate nonexistent` to use the `nonexistent` crate
1616

tests/ui/error-codes/E0432.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `something`
22
--> $DIR/E0432.rs:1:5
33
|
44
LL | use something::Foo;
5-
| ^^^^^^^^^ maybe a missing crate `something`?
5+
| ^^^^^^^^^ you might be missing crate `something`
66
|
77
= help: consider adding `extern crate something` to use the `something` crate
88

tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ error[E0432]: unresolved import `core`
44
LL | use core::default;
55
| ^^^^
66
| |
7-
| maybe a missing crate `core`?
7+
| you might be missing crate `core`
88
| help: try using `std` instead of `core`: `std`
99

10-
error[E0433]: failed to resolve: maybe a missing crate `core`?
10+
error[E0433]: failed to resolve: you might be missing crate `core`
1111
--> $DIR/feature-gate-extern_absolute_paths.rs:4:19
1212
|
1313
LL | let _: u8 = ::core::default::Default();
14-
| ^^^^ maybe a missing crate `core`?
14+
| ^^^^ you might be missing crate `core`
1515
|
1616
help: try using `std` instead of `core`
1717
|

tests/ui/imports/import-from-missing-star-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `spam`
22
--> $DIR/import-from-missing-star-2.rs:2:9
33
|
44
LL | use spam::*;
5-
| ^^^^ maybe a missing crate `spam`?
5+
| ^^^^ you might be missing crate `spam`
66
|
77
= help: consider adding `extern crate spam` to use the `spam` crate
88

tests/ui/imports/import-from-missing-star-3.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ error[E0432]: unresolved import `spam`
22
--> $DIR/import-from-missing-star-3.rs:2:9
33
|
44
LL | use spam::*;
5-
| ^^^^ maybe a missing crate `spam`?
5+
| ^^^^ you might be missing crate `spam`
66
|
77
= help: consider adding `extern crate spam` to use the `spam` crate
88

99
error[E0432]: unresolved import `spam`
1010
--> $DIR/import-from-missing-star-3.rs:27:13
1111
|
1212
LL | use spam::*;
13-
| ^^^^ maybe a missing crate `spam`?
13+
| ^^^^ you might be missing crate `spam`
1414
|
1515
= help: consider adding `extern crate spam` to use the `spam` crate
1616

tests/ui/imports/import-from-missing-star.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `spam`
22
--> $DIR/import-from-missing-star.rs:1:5
33
|
44
LL | use spam::*;
5-
| ^^^^ maybe a missing crate `spam`?
5+
| ^^^^ you might be missing crate `spam`
66
|
77
= help: consider adding `extern crate spam` to use the `spam` crate
88

tests/ui/imports/import3.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `main`
22
--> $DIR/import3.rs:2:5
33
|
44
LL | use main::bar;
5-
| ^^^^ maybe a missing crate `main`?
5+
| ^^^^ you might be missing crate `main`
66
|
77
= help: consider adding `extern crate main` to use the `main` crate
88

tests/ui/imports/issue-109343.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved`
22
--> $DIR/issue-109343.rs:4:9
33
|
44
LL | pub use unresolved::f;
5-
| ^^^^^^^^^^ maybe a missing crate `unresolved`?
5+
| ^^^^^^^^^^ you might be missing crate `unresolved`
66
|
77
= help: consider adding `extern crate unresolved` to use the `unresolved` crate
88

tests/ui/imports/issue-1697.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Testing that we don't fail abnormally after hitting the errors
22

3-
use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432]
4-
//~^ maybe a missing crate `unresolved`?
3+
use unresolved::*;
4+
//~^ ERROR unresolved import `unresolved` [E0432]
5+
//~| NOTE you might be missing crate `unresolved`
6+
//~| HELP consider adding `extern crate unresolved` to use the `unresolved` crate
57

68
fn main() {}

tests/ui/imports/issue-1697.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved`
22
--> $DIR/issue-1697.rs:3:5
33
|
44
LL | use unresolved::*;
5-
| ^^^^^^^^^^ maybe a missing crate `unresolved`?
5+
| ^^^^^^^^^^ you might be missing crate `unresolved`
66
|
77
= help: consider adding `extern crate unresolved` to use the `unresolved` crate
88

tests/ui/imports/issue-33464.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ error[E0432]: unresolved import `abc`
22
--> $DIR/issue-33464.rs:3:5
33
|
44
LL | use abc::one_el;
5-
| ^^^ maybe a missing crate `abc`?
5+
| ^^^ you might be missing crate `abc`
66
|
77
= help: consider adding `extern crate abc` to use the `abc` crate
88

99
error[E0432]: unresolved import `abc`
1010
--> $DIR/issue-33464.rs:5:5
1111
|
1212
LL | use abc::{a, bbb, cccccc};
13-
| ^^^ maybe a missing crate `abc`?
13+
| ^^^ you might be missing crate `abc`
1414
|
1515
= help: consider adding `extern crate abc` to use the `abc` crate
1616

1717
error[E0432]: unresolved import `a_very_long_name`
1818
--> $DIR/issue-33464.rs:7:5
1919
|
2020
LL | use a_very_long_name::{el, el2};
21-
| ^^^^^^^^^^^^^^^^ maybe a missing crate `a_very_long_name`?
21+
| ^^^^^^^^^^^^^^^^ you might be missing crate `a_very_long_name`
2222
|
2323
= help: consider adding `extern crate a_very_long_name` to use the `a_very_long_name` crate
2424

tests/ui/imports/issue-36881.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `issue_36881_aux`
22
--> $DIR/issue-36881.rs:5:9
33
|
44
LL | use issue_36881_aux::Foo;
5-
| ^^^^^^^^^^^^^^^ maybe a missing crate `issue_36881_aux`?
5+
| ^^^^^^^^^^^^^^^ you might be missing crate `issue_36881_aux`
66
|
77
= help: consider adding `extern crate issue_36881_aux` to use the `issue_36881_aux` crate
88

tests/ui/imports/issue-37887.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `test`
22
--> $DIR/issue-37887.rs:3:9
33
|
44
LL | use test::*;
5-
| ^^^^ maybe a missing crate `test`?
5+
| ^^^^ you might be missing crate `test`
66
|
77
= help: consider adding `extern crate test` to use the `test` crate
88

tests/ui/imports/issue-53269.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `nonexistent_module`
22
--> $DIR/issue-53269.rs:6:9
33
|
44
LL | use nonexistent_module::mac;
5-
| ^^^^^^^^^^^^^^^^^^ maybe a missing crate `nonexistent_module`?
5+
| ^^^^^^^^^^^^^^^^^^ you might be missing crate `nonexistent_module`
66
|
77
= help: consider adding `extern crate nonexistent_module` to use the `nonexistent_module` crate
88

tests/ui/imports/issue-55457.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error[E0432]: unresolved import `non_existent`
1111
--> $DIR/issue-55457.rs:2:5
1212
|
1313
LL | use non_existent::non_existent;
14-
| ^^^^^^^^^^^^ maybe a missing crate `non_existent`?
14+
| ^^^^^^^^^^^^ you might be missing crate `non_existent`
1515
|
1616
= help: consider adding `extern crate non_existent` to use the `non_existent` crate
1717

tests/ui/imports/issue-81413.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `doesnt_exist`
22
--> $DIR/issue-81413.rs:7:9
33
|
44
LL | pub use doesnt_exist::*;
5-
| ^^^^^^^^^^^^ maybe a missing crate `doesnt_exist`?
5+
| ^^^^^^^^^^^^ you might be missing crate `doesnt_exist`
66
|
77
= help: consider adding `extern crate doesnt_exist` to use the `doesnt_exist` crate
88

tests/ui/imports/tool-mod-child.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy::a; //~ ERROR unresolved import `clippy`
2-
use clippy::a::b; //~ ERROR failed to resolve: maybe a missing crate `clippy`?
2+
use clippy::a::b; //~ ERROR failed to resolve: you might be missing crate `clippy`
33

44
use rustdoc::a; //~ ERROR unresolved import `rustdoc`
5-
use rustdoc::a::b; //~ ERROR failed to resolve: maybe a missing crate `rustdoc`?
5+
use rustdoc::a::b; //~ ERROR failed to resolve: you might be missing crate `rustdoc`
66

77
fn main() {}

tests/ui/imports/tool-mod-child.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
error[E0433]: failed to resolve: maybe a missing crate `clippy`?
1+
error[E0433]: failed to resolve: you might be missing crate `clippy`
22
--> $DIR/tool-mod-child.rs:2:5
33
|
44
LL | use clippy::a::b;
5-
| ^^^^^^ maybe a missing crate `clippy`?
5+
| ^^^^^^ you might be missing crate `clippy`
66
|
77
= help: consider adding `extern crate clippy` to use the `clippy` crate
88

99
error[E0432]: unresolved import `clippy`
1010
--> $DIR/tool-mod-child.rs:1:5
1111
|
1212
LL | use clippy::a;
13-
| ^^^^^^ maybe a missing crate `clippy`?
13+
| ^^^^^^ you might be missing crate `clippy`
1414
|
1515
= help: consider adding `extern crate clippy` to use the `clippy` crate
1616

17-
error[E0433]: failed to resolve: maybe a missing crate `rustdoc`?
17+
error[E0433]: failed to resolve: you might be missing crate `rustdoc`
1818
--> $DIR/tool-mod-child.rs:5:5
1919
|
2020
LL | use rustdoc::a::b;
21-
| ^^^^^^^ maybe a missing crate `rustdoc`?
21+
| ^^^^^^^ you might be missing crate `rustdoc`
2222
|
2323
= help: consider adding `extern crate rustdoc` to use the `rustdoc` crate
2424

2525
error[E0432]: unresolved import `rustdoc`
2626
--> $DIR/tool-mod-child.rs:4:5
2727
|
2828
LL | use rustdoc::a;
29-
| ^^^^^^^ maybe a missing crate `rustdoc`?
29+
| ^^^^^^^ you might be missing crate `rustdoc`
3030
|
3131
= help: consider adding `extern crate rustdoc` to use the `rustdoc` crate
3232

tests/ui/imports/unresolved-imports-used.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@ error[E0432]: unresolved import `foo`
1414
--> $DIR/unresolved-imports-used.rs:11:5
1515
|
1616
LL | use foo::bar;
17-
| ^^^ maybe a missing crate `foo`?
17+
| ^^^ you might be missing crate `foo`
1818
|
1919
= help: consider adding `extern crate foo` to use the `foo` crate
2020

2121
error[E0432]: unresolved import `baz`
2222
--> $DIR/unresolved-imports-used.rs:12:5
2323
|
2424
LL | use baz::*;
25-
| ^^^ maybe a missing crate `baz`?
25+
| ^^^ you might be missing crate `baz`
2626
|
2727
= help: consider adding `extern crate baz` to use the `baz` crate
2828

2929
error[E0432]: unresolved import `foo2`
3030
--> $DIR/unresolved-imports-used.rs:14:5
3131
|
3232
LL | use foo2::bar2;
33-
| ^^^^ maybe a missing crate `foo2`?
33+
| ^^^^ you might be missing crate `foo2`
3434
|
3535
= help: consider adding `extern crate foo2` to use the `foo2` crate
3636

3737
error[E0432]: unresolved import `baz2`
3838
--> $DIR/unresolved-imports-used.rs:15:5
3939
|
4040
LL | use baz2::*;
41-
| ^^^^ maybe a missing crate `baz2`?
41+
| ^^^^ you might be missing crate `baz2`
4242
|
4343
= help: consider adding `extern crate baz2` to use the `baz2` crate
4444

tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error[E0432]: unresolved import `r#extern`
1313
--> $DIR/keyword-extern-as-identifier-use.rs:1:5
1414
|
1515
LL | use extern::foo;
16-
| ^^^^^^ maybe a missing crate `r#extern`?
16+
| ^^^^^^ you might be missing crate `r#extern`
1717
|
1818
= help: consider adding `extern crate r#extern` to use the `r#extern` crate
1919

tests/ui/macros/meta-item-absolute-path.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
error[E0433]: failed to resolve: maybe a missing crate `Absolute`?
1+
error[E0433]: failed to resolve: you might be missing crate `Absolute`
22
--> $DIR/meta-item-absolute-path.rs:1:12
33
|
44
LL | #[derive(::Absolute)]
5-
| ^^^^^^^^ maybe a missing crate `Absolute`?
5+
| ^^^^^^^^ you might be missing crate `Absolute`
66

7-
error[E0433]: failed to resolve: maybe a missing crate `Absolute`?
7+
error[E0433]: failed to resolve: you might be missing crate `Absolute`
88
--> $DIR/meta-item-absolute-path.rs:1:12
99
|
1010
LL | #[derive(::Absolute)]
11-
| ^^^^^^^^ maybe a missing crate `Absolute`?
11+
| ^^^^^^^^ you might be missing crate `Absolute`
1212
|
1313
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1414

tests/ui/privacy/restricted/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ fn main() {
4747
}
4848

4949
mod pathological {
50-
pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing crate `bad`?
50+
pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: you might be missing crate `bad`
5151
pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules
5252
}

tests/ui/privacy/restricted/test.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0433]: failed to resolve: maybe a missing crate `bad`?
1+
error[E0433]: failed to resolve: you might be missing crate `bad`
22
--> $DIR/test.rs:50:12
33
|
44
LL | pub(in bad::path) mod m1 {}
5-
| ^^^ maybe a missing crate `bad`?
5+
| ^^^ you might be missing crate `bad`
66
|
77
= help: consider adding `extern crate bad` to use the `bad` crate
88

tests/ui/resolve/editions-crate-root-2015.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
mod inner {
44
fn global_inner(_: ::nonexistant::Foo) {
5-
//~^ ERROR failed to resolve: maybe a missing crate `nonexistant`?
5+
//~^ ERROR failed to resolve: you might be missing crate `nonexistant`
66
}
77
fn crate_inner(_: crate::nonexistant::Foo) {
8-
//~^ ERROR failed to resolve: maybe a missing crate `nonexistant`?
8+
//~^ ERROR failed to resolve: you might be missing crate `nonexistant`
99
}
1010

1111
fn bare_global(_: ::nonexistant) {

0 commit comments

Comments
 (0)