Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
abb86d6
Avoid alloca for fully static sizes
Sa4dUs Feb 7, 2026
30d7ed4
library/test: always enable unstable features for miri
cuviper Mar 3, 2026
fe71b66
Fix comment on `is_horizontal_whitespace`
traviscross Mar 4, 2026
d863850
Streamline cache-related query functions.
nnethercote Mar 3, 2026
d08f97d
Remove `QueryVTable::construct_dep_node`.
nnethercote Mar 3, 2026
20768d8
fix(thir): Include NoneWithError in enum struct tail assertion
TKanX Mar 4, 2026
391a755
enable `PassMode::Indirect { on_stack: true }` tail call arguments
folkertdev Mar 3, 2026
cbc711e
rustc_llvm: add missing `-` to flag-comparison logic
durin42 Mar 4, 2026
253670b
Update dispatch2
eggyal Mar 5, 2026
fb488de
Rollup merge of #153361 - folkertdev:tail-call-indirect-on-stack-true…
JonathanBrouwer Mar 5, 2026
2feb90a
Rollup merge of #153369 - cuviper:unstable-libtest, r=Kobzol
JonathanBrouwer Mar 5, 2026
7595e5b
Rollup merge of #152283 - Sa4dUs:offload-handle-alloca, r=ZuseZ4
JonathanBrouwer Mar 5, 2026
62d1a71
Rollup merge of #153323 - nnethercote:rm-impl-QueryVTable, r=Zalathar
JonathanBrouwer Mar 5, 2026
4675a29
Rollup merge of #153385 - traviscross:TC/fix-frontmatter-whitespace-c…
JonathanBrouwer Mar 5, 2026
fed3c49
Rollup merge of #153394 - TKanX:bugfix/153390-ice-enum-struct-syntax-…
JonathanBrouwer Mar 5, 2026
b8a919a
Rollup merge of #153419 - durin42:missing-dashes, r=cuviper
JonathanBrouwer Mar 5, 2026
005fc16
Rollup merge of #153423 - eggyal:update-dispatch, r=madsmtm
JonathanBrouwer Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_mir_build/src/thir/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ impl<'tcx> ThirBuildCx<'tcx> {
base,
hir::StructTailExpr::None
| hir::StructTailExpr::DefaultFields(_)
| hir::StructTailExpr::NoneWithError(_)
));

let index = adt.variant_index_with_id(variant_id);
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/structs/syntax-error-not-missing-field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

struct Foo { a: isize, b: isize }

enum Bar {
Baz { a: isize, b: isize },
}

fn make_a() -> isize { 1234 }

fn expr_wrong_separator() {
Expand Down Expand Up @@ -35,4 +39,12 @@ fn pat_missing_separator(Foo { a b }: Foo) { //~ ERROR expected `,`
fn pat_rest_trailing_comma(Foo { a, .., }: Foo) { //~ ERROR expected `}`, found `,`
}

fn enum_expr_wrong_separator() {
let e = Bar::Baz { a: make_a(); b: 2 }; //~ ERROR found `;`
}

fn enum_expr_missing_separator() {
let e = Bar::Baz { a: make_a() b: 2 }; //~ ERROR found `b`
}

fn main() {}
35 changes: 27 additions & 8 deletions tests/ui/structs/syntax-error-not-missing-field.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `;`
--> $DIR/syntax-error-not-missing-field.rs:12:30
--> $DIR/syntax-error-not-missing-field.rs:16:30
|
LL | let f = Foo { a: make_a(); b: 2 };
| --- ^
Expand All @@ -9,7 +9,7 @@ LL | let f = Foo { a: make_a(); b: 2 };
| while parsing this struct

error: expected one of `,`, `.`, `?`, `}`, or an operator, found `b`
--> $DIR/syntax-error-not-missing-field.rs:16:31
--> $DIR/syntax-error-not-missing-field.rs:20:31
|
LL | let f = Foo { a: make_a() b: 2 };
| --- -^ expected one of `,`, `.`, `?`, `}`, or an operator
Expand All @@ -18,7 +18,7 @@ LL | let f = Foo { a: make_a() b: 2 };
| while parsing this struct

error: cannot use a comma after the base struct
--> $DIR/syntax-error-not-missing-field.rs:20:32
--> $DIR/syntax-error-not-missing-field.rs:24:32
|
LL | let f = Foo { a: make_a(), ..todo!(), };
| ^^^^^^^^^
Expand All @@ -31,7 +31,7 @@ LL + let f = Foo { a: make_a(), ..todo!() };
|

error: expected one of `,`, `:`, or `}`, found `(`
--> $DIR/syntax-error-not-missing-field.rs:24:25
--> $DIR/syntax-error-not-missing-field.rs:28:25
|
LL | let f = Foo { make_a(), b: 2, };
| --- ------^ expected one of `,`, `:`, or `}`
Expand All @@ -45,23 +45,23 @@ LL | let f = Foo { make_a: make_a(), b: 2, };
| +++++++

error: expected `,`
--> $DIR/syntax-error-not-missing-field.rs:27:31
--> $DIR/syntax-error-not-missing-field.rs:31:31
|
LL | fn pat_wrong_separator(Foo { a; b }: Foo) {
| --- ^
| |
| while parsing the fields for this pattern

error: expected `,`
--> $DIR/syntax-error-not-missing-field.rs:31:34
--> $DIR/syntax-error-not-missing-field.rs:35:34
|
LL | fn pat_missing_separator(Foo { a b }: Foo) {
| --- ^
| |
| while parsing the fields for this pattern

error: expected `}`, found `,`
--> $DIR/syntax-error-not-missing-field.rs:35:39
--> $DIR/syntax-error-not-missing-field.rs:39:39
|
LL | fn pat_rest_trailing_comma(Foo { a, .., }: Foo) {
| --^
Expand All @@ -70,5 +70,24 @@ LL | fn pat_rest_trailing_comma(Foo { a, .., }: Foo) {
| | help: remove this comma
| `..` must be at the end and cannot have a trailing comma

error: aborting due to 7 previous errors
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `;`
--> $DIR/syntax-error-not-missing-field.rs:43:35
|
LL | let e = Bar::Baz { a: make_a(); b: 2 };
| -------- ^
| | |
| | expected one of `,`, `.`, `?`, `}`, or an operator
| | help: try adding a comma: `,`
| while parsing this struct

error: expected one of `,`, `.`, `?`, `}`, or an operator, found `b`
--> $DIR/syntax-error-not-missing-field.rs:47:36
|
LL | let e = Bar::Baz { a: make_a() b: 2 };
| -------- -^ expected one of `,`, `.`, `?`, `}`, or an operator
| | |
| | help: try adding a comma: `,`
| while parsing this struct

error: aborting due to 9 previous errors