Skip to content

Commit 61fd9d5

Browse files
committed
enable the feature by default
1 parent 3bea6bc commit 61fd9d5

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

compiler/rustc_hir_typeck/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16421642
if let Some(base_expr) = base_expr {
16431643
// FIXME: We are currently creating two branches here in order to maintain
16441644
// consistency. But they should be merged as much as possible.
1645-
let fru_tys = if self.tcx.features().type_changing_struct_update {
1645+
let fru_tys = if self.tcx.features().type_changing_struct_update || true {
16461646
if adt.is_struct() {
16471647
// Make some fresh substitutions for our ADT type.
16481648
let fresh_substs = self.fresh_substs_for_item(base_expr.span, adt.did());

src/test/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ fn update_to_state2() {
1818
common_field2: 2,
1919
};
2020
let m2: Machine<State2> = Machine {
21-
state: State2,
21+
state: State1,
22+
//~^ ERROR mismatched types [E0308]
2223
..m1
23-
//~^ ERROR type changing struct updating is experimental [E0658]
24-
//~| ERROR mismatched types [E0308]
2524
};
2625
assert_eq!(State2, m2.state);
2726
}
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
1-
error[E0658]: type changing struct updating is experimental
2-
--> $DIR/feature-gate.rs:22:11
3-
|
4-
LL | ..m1
5-
| ^^
6-
|
7-
= note: see issue #86555 <https://github.com/rust-lang/rust/issues/86555> for more information
8-
= help: add `#![feature(type_changing_struct_update)]` to the crate attributes to enable
9-
101
error[E0308]: mismatched types
11-
--> $DIR/feature-gate.rs:22:11
12-
|
13-
LL | ..m1
14-
| ^^ expected struct `State2`, found struct `State1`
2+
--> $DIR/feature-gate.rs:21:16
153
|
16-
= note: expected struct `Machine<State2>`
17-
found struct `Machine<State1>`
4+
LL | state: State1,
5+
| ^^^^^^ expected struct `State2`, found struct `State1`
186

19-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
208

21-
Some errors have detailed explanations: E0308, E0658.
22-
For more information about an error, try `rustc --explain E0308`.
9+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)