about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-05-09 18:45:38 +0200
committerGitHub <noreply@github.com>2022-05-09 18:45:38 +0200
commit84a8f8dedf0b16561c1f0992f8d251185c4409f9 (patch)
tree329e29fdc1c6a6f0dc4cfbda7f6f975a5c5c03d0 /src
parentf4bef2e41caf1cd1f7d0f48688499c8607de286e (diff)
parent84adf0d8dd5fa68050ef0f3684ab701f5fc5a4cf (diff)
downloadrust-84a8f8dedf0b16561c1f0992f8d251185c4409f9.tar.gz
rust-84a8f8dedf0b16561c1f0992f8d251185c4409f9.zip
Rollup merge of #96844 - Badel2:actually-fix-96583, r=compiler-errors
Actually fix ICE from #96583

PR #96746 fixed a very similar bug, so the same logic is used in a different place.

I originally concluded that the two issues (#96583 and #96738) were identical by comparing the backtrace, but I didn't look close enough.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/typeck/issue-96738.rs1
-rw-r--r--src/test/ui/typeck/issue-96738.stderr18
2 files changed, 17 insertions, 2 deletions
diff --git a/src/test/ui/typeck/issue-96738.rs b/src/test/ui/typeck/issue-96738.rs
index 7f1d1428eb9..ce2556f869c 100644
--- a/src/test/ui/typeck/issue-96738.rs
+++ b/src/test/ui/typeck/issue-96738.rs
@@ -1,3 +1,4 @@
 fn main() {
     Some.nonexistent_method(); //~ ERROR: no method named `nonexistent_method` found
+    Some.nonexistent_field; //~ ERROR: no field `nonexistent_field`
 }
diff --git a/src/test/ui/typeck/issue-96738.stderr b/src/test/ui/typeck/issue-96738.stderr
index 58c83a36a3b..32f53849848 100644
--- a/src/test/ui/typeck/issue-96738.stderr
+++ b/src/test/ui/typeck/issue-96738.stderr
@@ -11,6 +11,20 @@ help: call the constructor
 LL |     (Some)(_).nonexistent_method();
    |     +    ++++
 
-error: aborting due to previous error
+error[E0609]: no field `nonexistent_field` on type `fn(_) -> Option<_> {Option::<_>::Some}`
+  --> $DIR/issue-96738.rs:3:10
+   |
+LL |     Some.nonexistent_field;
+   |     ---- ^^^^^^^^^^^^^^^^^
+   |     |
+   |     this is the constructor of an enum variant
+   |
+help: call the constructor
+   |
+LL |     (Some)(_).nonexistent_field;
+   |     +    ++++
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0599`.
+Some errors have detailed explanations: E0599, E0609.
+For more information about an error, try `rustc --explain E0599`.