Skip to content

Commit 148a77d

Browse files
committed
review comments: rewordings
1 parent e0752ad commit 148a77d

File tree

11 files changed

+50
-50
lines changed

11 files changed

+50
-50
lines changed

compiler/rustc_ast_lowering/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ast_lowering_closure_cannot_be_static = closures cannot be static
5353
ast_lowering_coroutine_too_many_parameters =
5454
too many parameters for a coroutine (expected 0 or 1 parameters)
5555
56-
ast_lowering_default_field_in_tuple = default field in tuple struct
56+
ast_lowering_default_field_in_tuple = default fields are not supported in tuple structs
5757
.label = default fields are only supported on structs
5858
5959
ast_lowering_does_not_support_modifiers =

compiler/rustc_ast_passes/src/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
557557
gate_all!(explicit_tail_calls, "`become` expression is experimental");
558558
gate_all!(generic_const_items, "generic const items are experimental");
559559
gate_all!(guard_patterns, "guard patterns are experimental", "consider using match arm guards");
560-
gate_all!(default_field_values, "default values on `struct` fields aren't supported");
560+
gate_all!(default_field_values, "default values on fields are experimental");
561561
gate_all!(fn_delegation, "functions delegation is not yet fully implemented");
562562
gate_all!(postfix_match, "postfix match is experimental");
563563
gate_all!(mut_ref, "mutable by-reference bindings are experimental");

compiler/rustc_middle/src/ty/adt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ impl Into<DataTypeKind> for AdtKind {
259259
}
260260
}
261261

262-
impl<'tcx> AdtDefData {
262+
impl AdtDefData {
263263
/// Creates a new `AdtDefData`.
264264
pub(super) fn new(
265-
tcx: TyCtxt<'tcx>,
265+
tcx: TyCtxt<'_>,
266266
did: DefId,
267267
kind: AdtKind,
268268
variants: IndexVec<VariantIdx, VariantDef>,

compiler/rustc_mir_build/src/build/expr/into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
352352
AdtExprBase::Base(FruInfo { base, field_types }) => {
353353
let place_builder = unpack!(block = this.as_place_builder(block, *base));
354354

355-
// MIR does not natively support FRU, so for each
355+
// We desugar FRU as we lower to MIR, so for each
356356
// base-supplied field, generate an operand that
357357
// reads it from the base.
358358
itertools::zip_eq(field_names, &**field_types)

compiler/rustc_resolve/src/late.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'r
752752
self.parent_scope.macro_rules = old_macro_rules;
753753
}
754754
fn visit_anon_const(&mut self, constant: &'ast AnonConst) {
755-
bug!("encountered anon const without a manual call to `resolve_anon_const` {constant:#?}");
755+
bug!("encountered anon const without a manual call to `resolve_anon_const`: {constant:#?}");
756756
}
757757
fn visit_expr(&mut self, expr: &'ast Expr) {
758758
self.resolve_expr(expr, None);

tests/ui/feature-gates/feature-gate-default-field-values.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ pub struct S;
55

66
#[derive(Default)]
77
pub struct Foo {
8-
pub bar: S = S, //~ ERROR default values on `struct` fields aren't supported
9-
pub baz: i32 = 42 + 3, //~ ERROR default values on `struct` fields aren't supported
8+
pub bar: S = S, //~ ERROR default values on fields are experimental
9+
pub baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental
1010
}
1111

1212
#[derive(Default)]
1313
pub enum Bar {
1414
#[default]
1515
Foo { //~ ERROR the `#[default]` attribute may only be used on unit enum variants
16-
bar: S = S, //~ ERROR default values on `struct` fields aren't supported
17-
baz: i32 = 42 + 3, //~ ERROR default values on `struct` fields aren't supported
16+
bar: S = S, //~ ERROR default values on fields are experimental
17+
baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental
1818
}
1919
}
2020

2121
#[derive(Default)]
2222
pub struct Qux<A, const C: i32> {
23-
bar: S = Qux::<A, C>::S, //~ ERROR default values on `struct` fields aren't supported
24-
baz: i32 = foo(), //~ ERROR default values on `struct` fields aren't supported
25-
bat: i32 = <Qux<A, C> as T>::K, //~ ERROR default values on `struct` fields aren't supported
26-
bay: i32 = C, //~ ERROR default values on `struct` fields aren't supported
27-
bak: Vec<A> = Vec::new(), //~ ERROR default values on `struct` fields aren't supported
23+
bar: S = Qux::<A, C>::S, //~ ERROR default values on fields are experimental
24+
baz: i32 = foo(), //~ ERROR default values on fields are experimental
25+
bat: i32 = <Qux<A, C> as T>::K, //~ ERROR default values on fields are experimental
26+
bay: i32 = C, //~ ERROR default values on fields are experimental
27+
bak: Vec<A> = Vec::new(), //~ ERROR default values on fields are experimental
2828
}
2929

3030
impl<A, const C: i32> Qux<A, C> {
@@ -46,15 +46,15 @@ const fn foo() -> i32 {
4646
#[derive(Default)]
4747
pub struct Opt {
4848
mandatory: Option<()>,
49-
optional: () = (), //~ ERROR default values on `struct` fields aren't supported
49+
optional: () = (), //~ ERROR default values on fields are experimental
5050
}
5151

5252
#[derive(Default)]
5353
pub enum OptEnum {
5454
#[default]
5555
Variant { //~ ERROR the `#[default]` attribute may only be used on unit enum variants
5656
mandatory: Option<()>,
57-
optional: () = (), //~ ERROR default values on `struct` fields aren't supported
57+
optional: () = (), //~ ERROR default values on fields are experimental
5858
}
5959
}
6060

tests/ui/feature-gates/feature-gate-default-field-values.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | Variant {
1414
|
1515
= help: consider a manual implementation of `Default`
1616

17-
error[E0658]: default values on `struct` fields aren't supported
17+
error[E0658]: default values on fields are experimental
1818
--> $DIR/feature-gate-default-field-values.rs:8:15
1919
|
2020
LL | pub bar: S = S,
@@ -24,7 +24,7 @@ LL | pub bar: S = S,
2424
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
2525
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2626

27-
error[E0658]: default values on `struct` fields aren't supported
27+
error[E0658]: default values on fields are experimental
2828
--> $DIR/feature-gate-default-field-values.rs:9:17
2929
|
3030
LL | pub baz: i32 = 42 + 3,
@@ -34,7 +34,7 @@ LL | pub baz: i32 = 42 + 3,
3434
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
3535
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3636

37-
error[E0658]: default values on `struct` fields aren't supported
37+
error[E0658]: default values on fields are experimental
3838
--> $DIR/feature-gate-default-field-values.rs:16:15
3939
|
4040
LL | bar: S = S,
@@ -44,7 +44,7 @@ LL | bar: S = S,
4444
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
4545
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4646

47-
error[E0658]: default values on `struct` fields aren't supported
47+
error[E0658]: default values on fields are experimental
4848
--> $DIR/feature-gate-default-field-values.rs:17:17
4949
|
5050
LL | baz: i32 = 42 + 3,
@@ -54,7 +54,7 @@ LL | baz: i32 = 42 + 3,
5454
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
5555
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5656

57-
error[E0658]: default values on `struct` fields aren't supported
57+
error[E0658]: default values on fields are experimental
5858
--> $DIR/feature-gate-default-field-values.rs:23:11
5959
|
6060
LL | bar: S = Qux::<A, C>::S,
@@ -64,7 +64,7 @@ LL | bar: S = Qux::<A, C>::S,
6464
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
6565
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6666

67-
error[E0658]: default values on `struct` fields aren't supported
67+
error[E0658]: default values on fields are experimental
6868
--> $DIR/feature-gate-default-field-values.rs:24:13
6969
|
7070
LL | baz: i32 = foo(),
@@ -74,7 +74,7 @@ LL | baz: i32 = foo(),
7474
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
7575
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7676

77-
error[E0658]: default values on `struct` fields aren't supported
77+
error[E0658]: default values on fields are experimental
7878
--> $DIR/feature-gate-default-field-values.rs:25:13
7979
|
8080
LL | bat: i32 = <Qux<A, C> as T>::K,
@@ -84,7 +84,7 @@ LL | bat: i32 = <Qux<A, C> as T>::K,
8484
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
8585
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
8686

87-
error[E0658]: default values on `struct` fields aren't supported
87+
error[E0658]: default values on fields are experimental
8888
--> $DIR/feature-gate-default-field-values.rs:26:13
8989
|
9090
LL | bay: i32 = C,
@@ -94,7 +94,7 @@ LL | bay: i32 = C,
9494
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
9595
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9696

97-
error[E0658]: default values on `struct` fields aren't supported
97+
error[E0658]: default values on fields are experimental
9898
--> $DIR/feature-gate-default-field-values.rs:27:16
9999
|
100100
LL | bak: Vec<A> = Vec::new(),
@@ -104,7 +104,7 @@ LL | bak: Vec<A> = Vec::new(),
104104
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
105105
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
106106

107-
error[E0658]: default values on `struct` fields aren't supported
107+
error[E0658]: default values on fields are experimental
108108
--> $DIR/feature-gate-default-field-values.rs:49:17
109109
|
110110
LL | optional: () = (),
@@ -114,7 +114,7 @@ LL | optional: () = (),
114114
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
115115
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
116116

117-
error[E0658]: default values on `struct` fields aren't supported
117+
error[E0658]: default values on fields are experimental
118118
--> $DIR/feature-gate-default-field-values.rs:57:21
119119
|
120120
LL | optional: () = (),

tests/ui/parser/struct-default-values-and-missing-field-separator.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ enum E {
55
}
66

77
struct S {
8-
field1: i32 = 42, //~ ERROR default values on `struct` fields aren't supported
9-
field2: E = E::A, //~ ERROR default values on `struct` fields aren't supported
10-
field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported
11-
field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported
12-
field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported
13-
field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported
8+
field1: i32 = 42, //~ ERROR default values on fields are experimental
9+
field2: E = E::A, //~ ERROR default values on fields are experimental
10+
field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental
11+
field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental
12+
field5: E = foo(42), //~ ERROR default values on fields are experimental
13+
field6: E = { foo(42) }, //~ ERROR default values on fields are experimental
1414
}
1515

1616
struct S1 {
1717
field1: i32 //~ ERROR expected `,`, or `}`, found `field2`
1818
field2: E //~ ERROR expected `,`, or `}`, found `field3`
19-
field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported
20-
field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported
21-
field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported
22-
field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported
19+
field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental
20+
field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental
21+
field5: E = foo(42), //~ ERROR default values on fields are experimental
22+
field6: E = { foo(42) }, //~ ERROR default values on fields are experimental
2323
}
2424

2525
struct S2 {

tests/ui/parser/struct-default-values-and-missing-field-separator.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ LL | field2; E,
2828
| expected `:`
2929
| help: field names and their types are separated with `:`
3030

31-
error[E0658]: default values on `struct` fields aren't supported
31+
error[E0658]: default values on fields are experimental
3232
--> $DIR/struct-default-values-and-missing-field-separator.rs:8:16
3333
|
3434
LL | field1: i32 = 42,
@@ -38,7 +38,7 @@ LL | field1: i32 = 42,
3838
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

41-
error[E0658]: default values on `struct` fields aren't supported
41+
error[E0658]: default values on fields are experimental
4242
--> $DIR/struct-default-values-and-missing-field-separator.rs:9:14
4343
|
4444
LL | field2: E = E::A,
@@ -48,7 +48,7 @@ LL | field2: E = E::A,
4848
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
4949
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5050

51-
error[E0658]: default values on `struct` fields aren't supported
51+
error[E0658]: default values on fields are experimental
5252
--> $DIR/struct-default-values-and-missing-field-separator.rs:10:16
5353
|
5454
LL | field3: i32 = 1 + 2,
@@ -58,7 +58,7 @@ LL | field3: i32 = 1 + 2,
5858
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
5959
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6060

61-
error[E0658]: default values on `struct` fields aren't supported
61+
error[E0658]: default values on fields are experimental
6262
--> $DIR/struct-default-values-and-missing-field-separator.rs:11:16
6363
|
6464
LL | field4: i32 = { 1 + 2 },
@@ -68,7 +68,7 @@ LL | field4: i32 = { 1 + 2 },
6868
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
6969
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7070

71-
error[E0658]: default values on `struct` fields aren't supported
71+
error[E0658]: default values on fields are experimental
7272
--> $DIR/struct-default-values-and-missing-field-separator.rs:12:14
7373
|
7474
LL | field5: E = foo(42),
@@ -78,7 +78,7 @@ LL | field5: E = foo(42),
7878
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
7979
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
8080

81-
error[E0658]: default values on `struct` fields aren't supported
81+
error[E0658]: default values on fields are experimental
8282
--> $DIR/struct-default-values-and-missing-field-separator.rs:13:14
8383
|
8484
LL | field6: E = { foo(42) },
@@ -88,7 +88,7 @@ LL | field6: E = { foo(42) },
8888
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
8989
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9090

91-
error[E0658]: default values on `struct` fields aren't supported
91+
error[E0658]: default values on fields are experimental
9292
--> $DIR/struct-default-values-and-missing-field-separator.rs:19:16
9393
|
9494
LL | field3: i32 = 1 + 2,
@@ -98,7 +98,7 @@ LL | field3: i32 = 1 + 2,
9898
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
9999
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
100100

101-
error[E0658]: default values on `struct` fields aren't supported
101+
error[E0658]: default values on fields are experimental
102102
--> $DIR/struct-default-values-and-missing-field-separator.rs:20:16
103103
|
104104
LL | field4: i32 = { 1 + 2 },
@@ -108,7 +108,7 @@ LL | field4: i32 = { 1 + 2 },
108108
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
109109
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
110110

111-
error[E0658]: default values on `struct` fields aren't supported
111+
error[E0658]: default values on fields are experimental
112112
--> $DIR/struct-default-values-and-missing-field-separator.rs:21:14
113113
|
114114
LL | field5: E = foo(42),
@@ -118,7 +118,7 @@ LL | field5: E = foo(42),
118118
= help: add `#![feature(default_field_values)]` to the crate attributes to enable
119119
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
120120

121-
error[E0658]: default values on `struct` fields aren't supported
121+
error[E0658]: default values on fields are experimental
122122
--> $DIR/struct-default-values-and-missing-field-separator.rs:22:14
123123
|
124124
LL | field6: E = { foo(42) },

tests/ui/structs/default-field-values-failures.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct Qux<const C: i32> {
2323
bay: i32 = C,
2424
}
2525

26-
pub struct Rak(i32 = 42); //~ ERROR default field in tuple struct
26+
pub struct Rak(i32 = 42); //~ ERROR default fields are not supported in tuple structs
2727

2828
impl<const C: i32> Qux<C> {
2929
const S: S = S;

tests/ui/structs/default-field-values-failures.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | bat: i32 = <Qux<{ C }> as T>::K,
77
= help: const parameters may only be used as standalone arguments, i.e. `C`
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
99

10-
error: default field in tuple struct
10+
error: default fields are not supported in tuple structs
1111
--> $DIR/default-field-values-failures.rs:26:22
1212
|
1313
LL | pub struct Rak(i32 = 42);

0 commit comments

Comments
 (0)