review comments: rewordings

This commit is contained in:
Esteban Küber 2024-12-06 19:43:01 +00:00
parent e0752ad257
commit 148a77dfde
11 changed files with 50 additions and 50 deletions

View file

@ -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 =

View file

@ -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");

View file

@ -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>,

View file

@ -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)

View file

@ -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);

View file

@ -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
}
}

View file

@ -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: () = (),

View file

@ -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 {

View file

@ -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) },

View file

@ -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;

View file

@ -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);