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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

0 commit comments

Comments
 (0)