From 61fd9d5577d37ca4c3404de5e76ef21b7d59bbef Mon Sep 17 00:00:00 2001 From: SparrowLii Date: Fri, 11 Nov 2022 12:28:20 +0800 Subject: [PATCH] enable the feature by default --- compiler/rustc_hir_typeck/src/expr.rs | 2 +- .../feature-gate.rs | 5 ++-- .../feature-gate.stderr | 23 ++++--------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index d69eb4d513d7d..c596285e71a38 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -1642,7 +1642,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some(base_expr) = base_expr { // FIXME: We are currently creating two branches here in order to maintain // consistency. But they should be merged as much as possible. - let fru_tys = if self.tcx.features().type_changing_struct_update { + let fru_tys = if self.tcx.features().type_changing_struct_update || true { if adt.is_struct() { // Make some fresh substitutions for our ADT type. let fresh_substs = self.fresh_substs_for_item(base_expr.span, adt.did()); 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 1e8b99ba5647a..9f37011dd9e5f 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 @@ -18,10 +18,9 @@ fn update_to_state2() { common_field2: 2, }; let m2: Machine = Machine { - state: State2, + state: State1, + //~^ ERROR mismatched types [E0308] ..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 2217b8c049863..3965cbdf0d680 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,22 +1,9 @@ -error[E0658]: type changing struct updating is experimental - --> $DIR/feature-gate.rs:22:11 - | -LL | ..m1 - | ^^ - | - = note: see issue #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:22:11 - | -LL | ..m1 - | ^^ expected struct `State2`, found struct `State1` + --> $DIR/feature-gate.rs:21:16 | - = note: expected struct `Machine` - found struct `Machine` +LL | state: State1, + | ^^^^^^ expected struct `State2`, found struct `State1` -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0308, E0658. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0308`.