Skip to content

Commit 50ae63f

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 50ae63f

Some content is hidden

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

43 files changed

+143
-135
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-fulldeps/session-diagnostic/diagnostic-derive.rs

Lines changed: 3 additions & 3 deletions
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: maybe a missing crate `core`
59+
//~^ ERROR failed to resolve: you might be missing 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: maybe a missing crate `core`
804+
//~| ERROR failed to resolve: you might be missing 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: maybe a missing crate `core`
812+
//~^ ERROR failed to resolve: you might be missing crate `core`
813813
sub: Span,
814814
}
815815

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,23 +524,23 @@ LL | #[suggestion(no_crate_suggestion, code = "")]
524524
= help: to show a suggestion consisting of multiple parts, use a `Subdiagnostic` annotated with `#[multipart_suggestion(...)]`
525525
= help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]`
526526

527-
error[E0433]: failed to resolve: maybe a missing crate `core`?
527+
error[E0433]: failed to resolve: you might be missing crate `core`
528528
--> $DIR/diagnostic-derive.rs:58:8
529529
|
530530
LL | #[diag = "E0123"]
531-
| ^ maybe a missing crate `core`?
531+
| ^ you might be missing crate `core`
532532

533-
error[E0433]: failed to resolve: maybe a missing crate `core`?
533+
error[E0433]: failed to resolve: you might be missing crate `core`
534534
--> $DIR/diagnostic-derive.rs:802:23
535535
|
536536
LL | #[suggestion(code(foo))]
537-
| ^^^ maybe a missing crate `core`?
537+
| ^^^ you might be missing crate `core`
538538

539-
error[E0433]: failed to resolve: maybe a missing crate `core`?
539+
error[E0433]: failed to resolve: you might be missing crate `core`
540540
--> $DIR/diagnostic-derive.rs:811:25
541541
|
542542
LL | #[suggestion(code = 3)]
543-
| ^ maybe a missing crate `core`?
543+
| ^ you might be missing crate `core`
544544

545545
error: cannot find attribute `nonsense` in this scope
546546
--> $DIR/diagnostic-derive.rs:63:3

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -451,53 +451,53 @@ error: suggestion without `#[primary_span]` field
451451
LL | #[suggestion(no_crate_example, code = "")]
452452
| ^
453453

454-
error[E0433]: failed to resolve: maybe a missing crate `core`?
454+
error[E0433]: failed to resolve: you might be missing crate `core`
455455
--> $DIR/subdiagnostic-derive.rs:96:9
456456
|
457457
LL | #[label("...")]
458-
| ^^^^^ maybe a missing crate `core`?
458+
| ^^^^^ you might be missing crate `core`
459459

460-
error[E0433]: failed to resolve: maybe a missing crate `core`?
460+
error[E0433]: failed to resolve: you might be missing crate `core`
461461
--> $DIR/subdiagnostic-derive.rs:312:1
462462
|
463463
LL | union AC {
464-
| ^^^^^ maybe a missing crate `core`?
464+
| ^^^^^ you might be missing crate `core`
465465

466-
error[E0433]: failed to resolve: maybe a missing crate `core`?
466+
error[E0433]: failed to resolve: you might be missing crate `core`
467467
--> $DIR/subdiagnostic-derive.rs:582:27
468468
|
469469
LL | #[suggestion_part(foo = "bar")]
470-
| ^ maybe a missing crate `core`?
470+
| ^ you might be missing crate `core`
471471

472-
error[E0433]: failed to resolve: maybe a missing crate `core`?
472+
error[E0433]: failed to resolve: you might be missing crate `core`
473473
--> $DIR/subdiagnostic-derive.rs:675:28
474474
|
475475
LL | #[suggestion_part(code("foo"))]
476-
| ^^^^^ maybe a missing crate `core`?
476+
| ^^^^^ you might be missing crate `core`
477477

478-
error[E0433]: failed to resolve: maybe a missing crate `core`?
478+
error[E0433]: failed to resolve: you might be missing crate `core`
479479
--> $DIR/subdiagnostic-derive.rs:686:28
480480
|
481481
LL | #[suggestion_part(code("foo", "bar"))]
482-
| ^^^^^ maybe a missing crate `core`?
482+
| ^^^^^ you might be missing crate `core`
483483

484-
error[E0433]: failed to resolve: maybe a missing crate `core`?
484+
error[E0433]: failed to resolve: you might be missing crate `core`
485485
--> $DIR/subdiagnostic-derive.rs:697:28
486486
|
487487
LL | #[suggestion_part(code(3))]
488-
| ^ maybe a missing crate `core`?
488+
| ^ you might be missing crate `core`
489489

490-
error[E0433]: failed to resolve: maybe a missing crate `core`?
490+
error[E0433]: failed to resolve: you might be missing crate `core`
491491
--> $DIR/subdiagnostic-derive.rs:720:30
492492
|
493493
LL | #[suggestion_part(code = 3)]
494-
| ^ maybe a missing crate `core`?
494+
| ^ you might be missing crate `core`
495495

496-
error[E0433]: failed to resolve: maybe a missing crate `core`?
496+
error[E0433]: failed to resolve: you might be missing crate `core`
497497
--> $DIR/subdiagnostic-derive.rs:812:48
498498
|
499499
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
500-
| ^ maybe a missing crate `core`?
500+
| ^ you might be missing crate `core`
501501

502502
error: cannot find attribute `foo` in this scope
503503
--> $DIR/subdiagnostic-derive.rs:67:3

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

tests/ui/imports/import-from-missing-star.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.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

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

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

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

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

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

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

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

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

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

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

Lines changed: 2 additions & 2 deletions
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() {}

0 commit comments

Comments
 (0)