about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-27 00:38:06 +0000
committerbors <bors@rust-lang.org>2022-08-27 00:38:06 +0000
commitbb8a08f011ce481adc62e45150b642d1f160bd78 (patch)
treedf99bf6d92dc38fcaf9136c447825c4eb244a881 /src
parent2b443a8d97ff1f26c35e4bcf682bf9a89e8a66d2 (diff)
parent96ceadde76e204a269252b1252b916278ecc4ea7 (diff)
downloadrust-bb8a08f011ce481adc62e45150b642d1f160bd78.tar.gz
rust-bb8a08f011ce481adc62e45150b642d1f160bd78.zip
Auto merge of #101064 - compiler-errors:rollup-fwm5m5f, r=compiler-errors
Rollup of 9 pull requests

Successful merges:

 - #100724 (Migrate ast lowering to session diagnostic)
 - #100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`)
 - #100738 (Diagnostics migr const eval)
 - #100744 (Migrate rustc_mir_dataflow to diagnostic structs)
 - #100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`)
 - #100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword)
 - #100836 (Migrate `rustc_attr` crate diagnostics)
 - #100890 (Migrate rustc_driver to SessionDiagnostic)
 - #100900 (on `region_errors.rs`)

Failed merges:

 - #100831 (Migrate `symbol_mangling` module to new diagnostics structs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/suggestions/bool_typo_err_suggest.rs12
-rw-r--r--src/test/ui/suggestions/bool_typo_err_suggest.stderr25
2 files changed, 37 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/bool_typo_err_suggest.rs b/src/test/ui/suggestions/bool_typo_err_suggest.rs
new file mode 100644
index 00000000000..deab0fb05b7
--- /dev/null
+++ b/src/test/ui/suggestions/bool_typo_err_suggest.rs
@@ -0,0 +1,12 @@
+// Suggest the boolean value instead of emit a generic error that the value
+// True is not in the scope.
+
+fn main() {
+    let x = True;
+    //~^ ERROR cannot find value `True` in this scope
+    //~| HELP you may want to use a bool value instead
+
+    let y = False;
+    //~^ ERROR cannot find value `False` in this scope
+    //~| HELP you may want to use a bool value instead
+}
diff --git a/src/test/ui/suggestions/bool_typo_err_suggest.stderr b/src/test/ui/suggestions/bool_typo_err_suggest.stderr
new file mode 100644
index 00000000000..52bde07ca07
--- /dev/null
+++ b/src/test/ui/suggestions/bool_typo_err_suggest.stderr
@@ -0,0 +1,25 @@
+error[E0425]: cannot find value `True` in this scope
+  --> $DIR/bool_typo_err_suggest.rs:5:13
+   |
+LL |     let x = True;
+   |             ^^^^ not found in this scope
+   |
+help: you may want to use a bool value instead
+   |
+LL |     let x = true;
+   |             ~~~~
+
+error[E0425]: cannot find value `False` in this scope
+  --> $DIR/bool_typo_err_suggest.rs:9:13
+   |
+LL |     let y = False;
+   |             ^^^^^ not found in this scope
+   |
+help: you may want to use a bool value instead
+   |
+LL |     let y = false;
+   |             ~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0425`.