diff options
| author | bors <bors@rust-lang.org> | 2022-11-22 10:17:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-22 10:17:09 +0000 |
| commit | b7463e8bdb7b039e75241dcc4ea65bbd24d5c608 (patch) | |
| tree | 837bf66b75c278b9baeb86df6ed75a3230f62fef /src/test/ui/pattern | |
| parent | a78c9bee4d9d51a3891bd8ecae1f28a93b83653b (diff) | |
| parent | 7a5376d23cb3324edcfaa278a9387898960d5f7c (diff) | |
| download | rust-b7463e8bdb7b039e75241dcc4ea65bbd24d5c608.tar.gz rust-b7463e8bdb7b039e75241dcc4ea65bbd24d5c608.zip | |
Auto merge of #103578 - petrochenkov:nofict, r=nagisa
Unreserve braced enum variants in value namespace
With this PR braced enum variants (`enum E { V { /*...*/ } }`) no longer take a slot in value namespace, so the special case mentioned in the note in https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md#braced-structs is removed.
Report - https://github.com/rust-lang/rust/pull/103578#issuecomment-1292594900.
Diffstat (limited to 'src/test/ui/pattern')
| -rw-r--r-- | src/test/ui/pattern/pattern-binding-disambiguation.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/pattern/pattern-binding-disambiguation.stderr | 20 |
2 files changed, 3 insertions, 21 deletions
diff --git a/src/test/ui/pattern/pattern-binding-disambiguation.rs b/src/test/ui/pattern/pattern-binding-disambiguation.rs index 2e80ea345dc..ce1d8c6c047 100644 --- a/src/test/ui/pattern/pattern-binding-disambiguation.rs +++ b/src/test/ui/pattern/pattern-binding-disambiguation.rs @@ -33,7 +33,7 @@ fn main() { TupleVariant => {} //~ ERROR match bindings cannot shadow tuple variants } match doesnt_matter { - BracedVariant => {} //~ ERROR match bindings cannot shadow struct variants + BracedVariant => {} // OK, `BracedVariant` is a fresh binding } match CONST { CONST => {} // OK, `CONST` is a const pattern @@ -50,7 +50,7 @@ fn main() { let BracedStruct = doesnt_matter; // OK, `BracedStruct` is a fresh binding let UnitVariant = UnitVariant; // OK, `UnitVariant` is a unit variant pattern let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow tuple variants - let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow struct variants + let BracedVariant = doesnt_matter; // OK, `BracedVariant` is a fresh binding let CONST = CONST; // OK, `CONST` is a const pattern let STATIC = doesnt_matter; //~ ERROR let bindings cannot shadow statics let function = doesnt_matter; // OK, `function` is a fresh binding diff --git a/src/test/ui/pattern/pattern-binding-disambiguation.stderr b/src/test/ui/pattern/pattern-binding-disambiguation.stderr index 1529e538b55..d54467b3c0c 100644 --- a/src/test/ui/pattern/pattern-binding-disambiguation.stderr +++ b/src/test/ui/pattern/pattern-binding-disambiguation.stderr @@ -22,15 +22,6 @@ LL | TupleVariant => {} | cannot be named the same as a tuple variant | help: try specify the pattern arguments: `TupleVariant(..)` -error[E0530]: match bindings cannot shadow struct variants - --> $DIR/pattern-binding-disambiguation.rs:36:9 - | -LL | use E::*; - | ---- the struct variant `BracedVariant` is imported here -... -LL | BracedVariant => {} - | ^^^^^^^^^^^^^ cannot be named the same as a struct variant - error[E0530]: match bindings cannot shadow statics --> $DIR/pattern-binding-disambiguation.rs:42:9 | @@ -58,15 +49,6 @@ LL | use E::*; LL | let TupleVariant = doesnt_matter; | ^^^^^^^^^^^^ cannot be named the same as a tuple variant -error[E0530]: let bindings cannot shadow struct variants - --> $DIR/pattern-binding-disambiguation.rs:53:9 - | -LL | use E::*; - | ---- the struct variant `BracedVariant` is imported here -... -LL | let BracedVariant = doesnt_matter; - | ^^^^^^^^^^^^^ cannot be named the same as a struct variant - error[E0530]: let bindings cannot shadow statics --> $DIR/pattern-binding-disambiguation.rs:55:9 | @@ -76,6 +58,6 @@ LL | static STATIC: () = (); LL | let STATIC = doesnt_matter; | ^^^^^^ cannot be named the same as a static -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0530`. |
