about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSparrowLii <liyuan179@huawei.com>2021-10-29 20:08:30 +0800
committerSparrowLii <liyuan179@huawei.com>2021-10-29 20:08:30 +0800
commit1ab2616b4da64218d359a87fdd043edf4167cf76 (patch)
treed0233fe9d87bd86ca10ff3891cc91b6156f4e22f /src
parentf3679bc23e0ae5998d5f0141a51b3d084fd66eab (diff)
downloadrust-1ab2616b4da64218d359a87fdd043edf4167cf76.tar.gz
rust-1ab2616b4da64218d359a87fdd043edf4167cf76.zip
Add feature trigger and correct `is_struct` check
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.rs5
-rw-r--r--src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr16
-rw-r--r--src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs1
-rw-r--r--src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr11
4 files changed, 17 insertions, 16 deletions
diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.rs b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.rs
index 81888ee1d4f..1e8b99ba564 100644
--- a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.rs
+++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.rs
@@ -17,10 +17,11 @@ fn update_to_state2() {
         common_field1: "hello",
         common_field2: 2,
     };
-    // FIXME: this should trigger feature gate
     let m2: Machine<State2> = Machine {
         state: State2,
-        ..m1 //~ ERROR mismatched types
+        ..m1
+        //~^ ERROR type changing struct updating is experimental [E0658]
+        //~| ERROR mismatched types [E0308]
     };
     assert_eq!(State2, m2.state);
 }
diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr
index 19059593844..2217b8c0498 100644
--- a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr
+++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr
@@ -1,5 +1,14 @@
+error[E0658]: type changing struct updating is experimental
+  --> $DIR/feature-gate.rs:22:11
+   |
+LL |         ..m1
+   |           ^^
+   |
+   = note: see issue #86555 <https://github.com/rust-lang/rust/issues/86555> for more information
+   = help: add `#![feature(type_changing_struct_update)]` to the crate attributes to enable
+
 error[E0308]: mismatched types
-  --> $DIR/feature-gate.rs:23:11
+  --> $DIR/feature-gate.rs:22:11
    |
 LL |         ..m1
    |           ^^ expected struct `State2`, found struct `State1`
@@ -7,6 +16,7 @@ LL |         ..m1
    = note: expected struct `Machine<State2>`
               found struct `Machine<State1>`
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0308`.
+Some errors have detailed explanations: E0308, E0658.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs
index d8b1396a692..dae1241d35a 100644
--- a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs
+++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.rs
@@ -50,7 +50,6 @@ fn fail_update() {
     let m3 = Machine::<i32, i32> {
         ..m1
         //~^ ERROR mismatched types [E0308]
-        //~| ERROR mismatched types [E0308]
     };
 }
 
diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr
index fa8d6ee23d5..631c8f83c91 100644
--- a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr
+++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr
@@ -16,15 +16,6 @@ LL |         ..m1
    = note: expected type `i32`
               found type `f64`
 
-error[E0308]: mismatched types
-  --> $DIR/type-generic-update.rs:51:11
-   |
-LL |         ..m1
-   |           ^^ field type mismatch: Machine.message
-   |
-   = note: expected type `i32`
-              found type `f64`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.