about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-12-06 19:43:01 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-12-09 21:55:13 +0000
commit148a77dfde03dba553b2e4f3cf817cd6d105b3e6 (patch)
tree016057d45826592ba0cfefbb119ec8f50183f1ae
parente0752ad2572218dfc7764951b72d4e3e84ea842c (diff)
downloadrust-148a77dfde03dba553b2e4f3cf817cd6d105b3e6.tar.gz
rust-148a77dfde03dba553b2e4f3cf817cd6d105b3e6.zip
review comments: rewordings
-rw-r--r--compiler/rustc_ast_lowering/messages.ftl2
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs2
-rw-r--r--compiler/rustc_middle/src/ty/adt.rs4
-rw-r--r--compiler/rustc_mir_build/src/build/expr/into.rs2
-rw-r--r--compiler/rustc_resolve/src/late.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-default-field-values.rs22
-rw-r--r--tests/ui/feature-gates/feature-gate-default-field-values.stderr22
-rw-r--r--tests/ui/parser/struct-default-values-and-missing-field-separator.rs20
-rw-r--r--tests/ui/parser/struct-default-values-and-missing-field-separator.stderr20
-rw-r--r--tests/ui/structs/default-field-values-failures.rs2
-rw-r--r--tests/ui/structs/default-field-values-failures.stderr2
11 files changed, 50 insertions, 50 deletions
diff --git a/compiler/rustc_ast_lowering/messages.ftl b/compiler/rustc_ast_lowering/messages.ftl
index b31e21f5c35..f96c9fe8e32 100644
--- a/compiler/rustc_ast_lowering/messages.ftl
+++ b/compiler/rustc_ast_lowering/messages.ftl
@@ -53,7 +53,7 @@ ast_lowering_closure_cannot_be_static = closures cannot be static
 ast_lowering_coroutine_too_many_parameters =
     too many parameters for a coroutine (expected 0 or 1 parameters)
 
-ast_lowering_default_field_in_tuple = default field in tuple struct
+ast_lowering_default_field_in_tuple = default fields are not supported in tuple structs
     .label = default fields are only supported on structs
 
 ast_lowering_does_not_support_modifiers =
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index 688d4d635cf..aa3b772efb1 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -557,7 +557,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
     gate_all!(explicit_tail_calls, "`become` expression is experimental");
     gate_all!(generic_const_items, "generic const items are experimental");
     gate_all!(guard_patterns, "guard patterns are experimental", "consider using match arm guards");
-    gate_all!(default_field_values, "default values on `struct` fields aren't supported");
+    gate_all!(default_field_values, "default values on fields are experimental");
     gate_all!(fn_delegation, "functions delegation is not yet fully implemented");
     gate_all!(postfix_match, "postfix match is experimental");
     gate_all!(mut_ref, "mutable by-reference bindings are experimental");
diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs
index 9678863ee4d..447cbc8932e 100644
--- a/compiler/rustc_middle/src/ty/adt.rs
+++ b/compiler/rustc_middle/src/ty/adt.rs
@@ -259,10 +259,10 @@ impl Into<DataTypeKind> for AdtKind {
     }
 }
 
-impl<'tcx> AdtDefData {
+impl AdtDefData {
     /// Creates a new `AdtDefData`.
     pub(super) fn new(
-        tcx: TyCtxt<'tcx>,
+        tcx: TyCtxt<'_>,
         did: DefId,
         kind: AdtKind,
         variants: IndexVec<VariantIdx, VariantDef>,
diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs
index b31f61a75ff..a3d5376dcd4 100644
--- a/compiler/rustc_mir_build/src/build/expr/into.rs
+++ b/compiler/rustc_mir_build/src/build/expr/into.rs
@@ -352,7 +352,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                     AdtExprBase::Base(FruInfo { base, field_types }) => {
                         let place_builder = unpack!(block = this.as_place_builder(block, *base));
 
-                        // MIR does not natively support FRU, so for each
+                        // We desugar FRU as we lower to MIR, so for each
                         // base-supplied field, generate an operand that
                         // reads it from the base.
                         itertools::zip_eq(field_names, &**field_types)
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index f5e1a598864..789d74876f7 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -752,7 +752,7 @@ impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'r
         self.parent_scope.macro_rules = old_macro_rules;
     }
     fn visit_anon_const(&mut self, constant: &'ast AnonConst) {
-        bug!("encountered anon const without a manual call to `resolve_anon_const` {constant:#?}");
+        bug!("encountered anon const without a manual call to `resolve_anon_const`: {constant:#?}");
     }
     fn visit_expr(&mut self, expr: &'ast Expr) {
         self.resolve_expr(expr, None);
diff --git a/tests/ui/feature-gates/feature-gate-default-field-values.rs b/tests/ui/feature-gates/feature-gate-default-field-values.rs
index 01441de67e0..d2e41a71602 100644
--- a/tests/ui/feature-gates/feature-gate-default-field-values.rs
+++ b/tests/ui/feature-gates/feature-gate-default-field-values.rs
@@ -5,26 +5,26 @@ pub struct S;
 
 #[derive(Default)]
 pub struct Foo {
-    pub bar: S = S, //~ ERROR default values on `struct` fields aren't supported
-    pub baz: i32 = 42 + 3, //~ ERROR default values on `struct` fields aren't supported
+    pub bar: S = S, //~ ERROR default values on fields are experimental
+    pub baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental
 }
 
 #[derive(Default)]
 pub enum Bar {
     #[default]
     Foo { //~ ERROR the `#[default]` attribute may only be used on unit enum variants
-        bar: S = S, //~ ERROR default values on `struct` fields aren't supported
-        baz: i32 = 42 + 3, //~ ERROR default values on `struct` fields aren't supported
+        bar: S = S, //~ ERROR default values on fields are experimental
+        baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental
     }
 }
 
 #[derive(Default)]
 pub struct Qux<A, const C: i32> {
-    bar: S = Qux::<A, C>::S, //~ ERROR default values on `struct` fields aren't supported
-    baz: i32 = foo(), //~ ERROR default values on `struct` fields aren't supported
-    bat: i32 = <Qux<A, C> as T>::K, //~ ERROR default values on `struct` fields aren't supported
-    bay: i32 = C, //~ ERROR default values on `struct` fields aren't supported
-    bak: Vec<A> = Vec::new(), //~ ERROR default values on `struct` fields aren't supported
+    bar: S = Qux::<A, C>::S, //~ ERROR default values on fields are experimental
+    baz: i32 = foo(), //~ ERROR default values on fields are experimental
+    bat: i32 = <Qux<A, C> as T>::K, //~ ERROR default values on fields are experimental
+    bay: i32 = C, //~ ERROR default values on fields are experimental
+    bak: Vec<A> = Vec::new(), //~ ERROR default values on fields are experimental
 }
 
 impl<A, const C: i32> Qux<A, C> {
@@ -46,7 +46,7 @@ const fn foo() -> i32 {
 #[derive(Default)]
 pub struct Opt {
     mandatory: Option<()>,
-    optional: () = (), //~ ERROR default values on `struct` fields aren't supported
+    optional: () = (), //~ ERROR default values on fields are experimental
 }
 
 #[derive(Default)]
@@ -54,7 +54,7 @@ pub enum OptEnum {
     #[default]
     Variant { //~ ERROR the `#[default]` attribute may only be used on unit enum variants
         mandatory: Option<()>,
-        optional: () = (), //~ ERROR default values on `struct` fields aren't supported
+        optional: () = (), //~ ERROR default values on fields are experimental
     }
 }
 
diff --git a/tests/ui/feature-gates/feature-gate-default-field-values.stderr b/tests/ui/feature-gates/feature-gate-default-field-values.stderr
index a24217c0727..d882c322c8e 100644
--- a/tests/ui/feature-gates/feature-gate-default-field-values.stderr
+++ b/tests/ui/feature-gates/feature-gate-default-field-values.stderr
@@ -14,7 +14,7 @@ LL |     Variant {
    |
    = help: consider a manual implementation of `Default`
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:8:15
    |
 LL |     pub bar: S = S,
@@ -24,7 +24,7 @@ LL |     pub bar: S = S,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:9:17
    |
 LL |     pub baz: i32 = 42 + 3,
@@ -34,7 +34,7 @@ LL |     pub baz: i32 = 42 + 3,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:16:15
    |
 LL |         bar: S = S,
@@ -44,7 +44,7 @@ LL |         bar: S = S,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:17:17
    |
 LL |         baz: i32 = 42 + 3,
@@ -54,7 +54,7 @@ LL |         baz: i32 = 42 + 3,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:23:11
    |
 LL |     bar: S = Qux::<A, C>::S,
@@ -64,7 +64,7 @@ LL |     bar: S = Qux::<A, C>::S,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:24:13
    |
 LL |     baz: i32 = foo(),
@@ -74,7 +74,7 @@ LL |     baz: i32 = foo(),
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:25:13
    |
 LL |     bat: i32 = <Qux<A, C> as T>::K,
@@ -84,7 +84,7 @@ LL |     bat: i32 = <Qux<A, C> as T>::K,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:26:13
    |
 LL |     bay: i32 = C,
@@ -94,7 +94,7 @@ LL |     bay: i32 = C,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:27:16
    |
 LL |     bak: Vec<A> = Vec::new(),
@@ -104,7 +104,7 @@ LL |     bak: Vec<A> = Vec::new(),
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:49:17
    |
 LL |     optional: () = (),
@@ -114,7 +114,7 @@ LL |     optional: () = (),
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/feature-gate-default-field-values.rs:57:21
    |
 LL |         optional: () = (),
diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.rs b/tests/ui/parser/struct-default-values-and-missing-field-separator.rs
index 8ecf042ad38..bb9de98bddb 100644
--- a/tests/ui/parser/struct-default-values-and-missing-field-separator.rs
+++ b/tests/ui/parser/struct-default-values-and-missing-field-separator.rs
@@ -5,21 +5,21 @@ enum E {
 }
 
 struct S {
-    field1: i32 = 42, //~ ERROR default values on `struct` fields aren't supported
-    field2: E = E::A, //~ ERROR default values on `struct` fields aren't supported
-    field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported
-    field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported
-    field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported
-    field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported
+    field1: i32 = 42, //~ ERROR default values on fields are experimental
+    field2: E = E::A, //~ ERROR default values on fields are experimental
+    field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental
+    field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental
+    field5: E = foo(42), //~ ERROR default values on fields are experimental
+    field6: E = { foo(42) }, //~ ERROR default values on fields are experimental
 }
 
 struct S1 {
     field1: i32 //~ ERROR expected `,`, or `}`, found `field2`
     field2: E //~ ERROR expected `,`, or `}`, found `field3`
-    field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported
-    field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported
-    field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported
-    field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported
+    field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental
+    field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental
+    field5: E = foo(42), //~ ERROR default values on fields are experimental
+    field6: E = { foo(42) }, //~ ERROR default values on fields are experimental
 }
 
 struct S2 {
diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr
index 669147c5685..fdd9f0d6dce 100644
--- a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr
+++ b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr
@@ -28,7 +28,7 @@ LL |     field2; E,
    |           expected `:`
    |           help: field names and their types are separated with `:`
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:8:16
    |
 LL |     field1: i32 = 42,
@@ -38,7 +38,7 @@ LL |     field1: i32 = 42,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:9:14
    |
 LL |     field2: E = E::A,
@@ -48,7 +48,7 @@ LL |     field2: E = E::A,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:10:16
    |
 LL |     field3: i32 = 1 + 2,
@@ -58,7 +58,7 @@ LL |     field3: i32 = 1 + 2,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:11:16
    |
 LL |     field4: i32 = { 1 + 2 },
@@ -68,7 +68,7 @@ LL |     field4: i32 = { 1 + 2 },
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:12:14
    |
 LL |     field5: E = foo(42),
@@ -78,7 +78,7 @@ LL |     field5: E = foo(42),
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:13:14
    |
 LL |     field6: E = { foo(42) },
@@ -88,7 +88,7 @@ LL |     field6: E = { foo(42) },
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:19:16
    |
 LL |     field3: i32 = 1 + 2,
@@ -98,7 +98,7 @@ LL |     field3: i32 = 1 + 2,
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:20:16
    |
 LL |     field4: i32 = { 1 + 2 },
@@ -108,7 +108,7 @@ LL |     field4: i32 = { 1 + 2 },
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:21:14
    |
 LL |     field5: E = foo(42),
@@ -118,7 +118,7 @@ LL |     field5: E = foo(42),
    = help: add `#![feature(default_field_values)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: default values on `struct` fields aren't supported
+error[E0658]: default values on fields are experimental
   --> $DIR/struct-default-values-and-missing-field-separator.rs:22:14
    |
 LL |     field6: E = { foo(42) },
diff --git a/tests/ui/structs/default-field-values-failures.rs b/tests/ui/structs/default-field-values-failures.rs
index e850ad387aa..d67bea18c69 100644
--- a/tests/ui/structs/default-field-values-failures.rs
+++ b/tests/ui/structs/default-field-values-failures.rs
@@ -23,7 +23,7 @@ pub struct Qux<const C: i32> {
     bay: i32 = C,
 }
 
-pub struct Rak(i32 = 42); //~ ERROR default field in tuple struct
+pub struct Rak(i32 = 42); //~ ERROR default fields are not supported in tuple structs
 
 impl<const C: i32> Qux<C> {
     const S: S = S;
diff --git a/tests/ui/structs/default-field-values-failures.stderr b/tests/ui/structs/default-field-values-failures.stderr
index bd8d1922e91..195ee0dbb5f 100644
--- a/tests/ui/structs/default-field-values-failures.stderr
+++ b/tests/ui/structs/default-field-values-failures.stderr
@@ -7,7 +7,7 @@ LL |     bat: i32 = <Qux<{ C }> as T>::K,
    = help: const parameters may only be used as standalone arguments, i.e. `C`
    = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
 
-error: default field in tuple struct
+error: default fields are not supported in tuple structs
   --> $DIR/default-field-values-failures.rs:26:22
    |
 LL | pub struct Rak(i32 = 42);