Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,11 @@ impl<'a> State<'a> {
self.maybe_print_comment(field.span.lo());
self.print_outer_attributes(&field.attrs);
self.print_visibility(&field.vis);
self.print_ident(field.ident.unwrap());
if let Some(ident) = field.ident {
self.print_ident(ident);
} else {
self.word("_");
}
self.word_nbsp(":");
self.print_type(&field.ty);
self.word(",");
Expand Down
9 changes: 0 additions & 9 deletions tests/crashes/140333.rs

This file was deleted.

12 changes: 12 additions & 0 deletions tests/ui/structs/struct-field-ident-issue-140333.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fn a() -> impl b< //~ ERROR cannot find trait `b` in this scope
[c; { //~ ERROR cannot find type `c` in this scope
struct D {
#[a] //~ ERROR annot find attribute `a` in this scope
bar: e, //~ ERROR cannot find type `e` in this scope
}
}],
> {
todo!("need to implement")
}

fn main() {}
40 changes: 40 additions & 0 deletions tests/ui/structs/struct-field-ident-issue-140333.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
error: cannot find attribute `a` in this scope
--> $DIR/struct-field-ident-issue-140333.rs:4:15
|
LL | #[a]
| ^
|
= note: `a` is in scope, but it is a function, not an attribute

error[E0405]: cannot find trait `b` in this scope
--> $DIR/struct-field-ident-issue-140333.rs:1:16
|
LL | fn a() -> impl b<
| ^ not found in this scope

error[E0412]: cannot find type `c` in this scope
--> $DIR/struct-field-ident-issue-140333.rs:2:6
|
LL | [c; {
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn a<c>() -> impl b<
| +++

error[E0412]: cannot find type `e` in this scope
--> $DIR/struct-field-ident-issue-140333.rs:5:18
|
LL | bar: e,
| ^ not found in this scope
|
help: you might be missing a type parameter
|
LL | struct D<e> {
| +++

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0405, E0412.
For more information about an error, try `rustc --explain E0405`.
Loading