Skip to content

E0320 error huge type name output #79972

Open
@minaminao

Description

@minaminao

I tried this code:

enum A<T> {
	B,
	C(T, Box<A<(T, T)>>)
}
fn main(){
	A::<i32>::B;
}

Compilation resulted in the E0320 error of 3.7MB:

error[E0320]: overflow while adding drop-check rules for A<i32>
 --> a.rs:6:2
  |
6 |     A::<i32>::B;
  |     ^^^^^^^^^^^
  |
  = note: overflowed on A<(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32)))), ((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))))), (((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32)))), ((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32)))))), ((((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32)))), ((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))))), (((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32)))), ((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))))))), (((((((i32, i32), (i32, i32)), ((i32, i32), (i32, i32))), (((i32, i32

(snip)

Since the error output is very large and taints the terminal, It might be better to use the same error output format as in the recursion limit error. Its format as follows.

In #72412, long type name is omitted:

 error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`

In #76843, the full type name of the omitted type is saved to a file:

= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552/issue-67552.long-type.txt'

Meta

rustc --version --verbose:

rustc 1.48.0 (7eac88abb 2020-11-16)
binary: rustc
commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4
commit-date: 2020-11-16
host: x86_64-apple-darwin
release: 1.48.0
LLVM version: 11.0

The same error occurs in Ubuntu nightly version.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions