about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBadel2 <2badel2@gmail.com>2022-05-08 19:57:47 +0200
committerBadel2 <2badel2@gmail.com>2022-05-08 19:57:47 +0200
commit84adf0d8dd5fa68050ef0f3684ab701f5fc5a4cf (patch)
treed1229ae506a0b95454154d0a240b9d307a6db009 /src
parented3164baf010592dda34da57c28fa8ae5e6c2ca6 (diff)
downloadrust-84adf0d8dd5fa68050ef0f3684ab701f5fc5a4cf.tar.gz
rust-84adf0d8dd5fa68050ef0f3684ab701f5fc5a4cf.zip
Actually fix ICE from #96583
PR #96746 fixed a very similar bug, so the same logic is used in a
different place.
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`.