Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let mut err = struct_span_err!(self.sess, span, E0072,
"recursive type `{}` has infinite size",
self.item_path_str(type_def_id));
err.span_label(span, &format!("recursive type has infinite size"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the call to format! is unnecessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not technically required here, though harmless.

err.help(&format!("insert indirection (e.g., a `Box`, `Rc`, or `&`) \
at some point to make `{}` representable",
self.item_path_str(type_def_id)));
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0072.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

struct ListNode { //~ ERROR E0072
//~| NOTE recursive type has infinite size
head: u8,
tail: Option<ListNode>,
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-3008-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
enum foo { foo_(bar) }
struct bar { x: bar }
//~^ ERROR E0072
//~| NOTE recursive type has infinite size

fn main() {
}
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-32326.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// too big.

enum Expr { //~ ERROR E0072
//~| NOTE recursive type has infinite size
Plus(Expr, Expr),
Literal(i64),
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-3779.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

struct S { //~ ERROR E0072
//~| NOTE recursive type has infinite size
element: Option<S>
}

Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/type-recursive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

struct t1 { //~ ERROR E0072
//~| NOTE recursive type has infinite size
foo: isize,
foolish: t1
}
Expand Down