Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: Rust spins when referencing associated types in where clause #62430

Closed
Tracked by #61960
andymac-2 opened this issue Jul 6, 2019 · 7 comments
Closed
Tracked by #61960

ICE: Rust spins when referencing associated types in where clause #62430

andymac-2 opened this issue Jul 6, 2019 · 7 comments
Assignees
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@andymac-2
Copy link

The following code broke the the text editor I was editing it in:

Version

rustc 1.35.0 (3c235d5 2019-05-20)

Minimal test case:

struct MyStruct<'a, 'b, A, B, F>(F, &'a A, &'b B);

trait MyTrait {
    type Input;
    type Output;
}

trait MyOtherTrait<A, B> {};

impl<'a, 'b, A, B, F> MyTrait for MyStruct<'a, 'b, A, B, F> where
    F: MyOtherTrait<Self::Input, Self::Output>
{
    type Input = A;
    type Output = B;
}

fn garbage () {
    This function body can contain garbage.

    We can put anything here as long as we don't write a close brace
    and the program will still try to compile.

    ((((((( [[[[[[[[ {{{{{
}

Output:

rustc will print any errors that occur, but will still try to compile, hanging indefinitely at the build stage and consuming all system memory.

Expected output:

Compilation failure.

@andymac-2 andymac-2 changed the title Rust spins when referencing associated types in where clause ICE: Rust spins when referencing associated types in where clause Jul 6, 2019
@Centril Centril added I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. A-parser Area: The parsing of Rust source code to an AST T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 6, 2019
@estebank
Copy link
Contributor

estebank commented Jul 6, 2019

There seems to be some kind of loop when evaluating try_print_visible_def_path:

DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: cur_def_key=DefKey { parent: Some(DefIndex(1432)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("Sized"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate2, id=DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("marker"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(2:1432 ~ core[f7fb]::marker[0])
DEBUG 2019-07-06T16:31:24Z: rustc::ty::query::plumbing: ty::query::get_query<visible_parent_map>(key=crate0, span=file6.rs:1:1: 1:1)
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: cur_def_key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("marker"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate1, id=DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate1 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(1:0 ~ std[e8ce])
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate1, id=DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate1 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::query::plumbing: ty::query::get_query<extern_crate>(key=DefId(1:0 ~ std[e8ce]), span=file6.rs:1:1: 1:1)
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(11))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("std"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:11 ~ file6[317d]::std[0])
DEBUG 2019-07-06T16:31:24Z: rustc::ty::query::plumbing: ty::query::get_query<crate_name>(key=crate1, span=file6.rs:1:1: 1:1)
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate1, id=DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate1 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate2, id=DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: visible_parent=DefId(1:0 ~ std[e8ce]) actual_parent=Some(DefId(2:0 ~ core[f7fb]))
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate1, id=DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate1 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate2, id=DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: data=TypeNs("marker") visible_parent=DefId(1:0 ~ std[e8ce]) actual_parent=Some(DefId(2:0 ~ core[f7fb]))
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate1, id=DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate1 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::query::plumbing: ty::query::get_query<item_children>(key=DefId(1:0 ~ std[e8ce]), span=file6.rs:1:1: 1:1)
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: data=TypeNs("marker")
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate2, id=DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("marker"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate2, id=DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("marker"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: visible_parent=DefId(2:1432 ~ core[f7fb]::marker[0]) actual_parent=Some(DefId(2:1432 ~ core[f7fb]::marker[0]))
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate2, id=DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("marker"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc_metadata::decoder: def_path(cnum=crate2, id=DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(1432))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("marker"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate2 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: data=TypeNs("Sized") visible_parent=DefId(2:1432 ~ core[f7fb]::marker[0]) actual_parent=Some(DefId(2:1432 ~ core[f7fb]::marker[0]))
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: data=TypeNs("Sized")
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(23))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(22)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("Input"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(22))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print: default_print_def_path: def_id=DefId(0:23 ~ file6[317d]::MyTrait[0]::Input[0]), substs=[Self]
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print: default_print_def_path: key=DefKey { parent: Some(DefIndex(22)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("Input"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(23))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(22)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("Input"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(22))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::query::plumbing: ty::query::get_query<generics_of>(key=DefId(0:23 ~ file6[317d]::MyTrait[0]::Input[0]), span=file6.rs:1:1: 1:1)
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(22))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::query::plumbing: ty::query::get_query<generics_of>(key=DefId(0:22 ~ file6[317d]::MyTrait[0]), span=file6.rs:1:1: 1:1)
DEBUG 2019-07-06T16:31:24Z: rustc::ty::fold: HasTypeFlagsVisitor: t=Self t.flags=HAS_SELF | HAS_FREE_LOCAL_NAMES self.flags=KEEP_IN_LOCAL_TCX
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(22))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print: default_print_def_path: def_id=DefId(0:22 ~ file6[317d]::MyTrait[0]), substs=[Self]
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print: default_print_def_path: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(22))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::query::plumbing: ty::query::get_query<generics_of>(key=DefId(0:22 ~ file6[317d]::MyTrait[0]), span=file6.rs:1:1: 1:1)
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(22))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:22 ~ file6[317d]::MyTrait[0])
DEBUG 2019-07-06T16:31:24Z: rus^CDEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print: default_print_def_path: def_id=DefId(0:22 ~ file6[317d]::MyTrait[0]), substs=[]
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print: default_print_def_path: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("MyTrait"), disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: krate=crate0 index=Some(DefIndex(0))
DEBUG 2019-07-06T16:31:24Z: rustc::hir::map::definitions: DefPath::make: key=DefKey { parent: None, disambiguated_data: DisambiguatedDefPathData { data: CrateRoot, disambiguator: 0 } }
DEBUG 2019-07-06T16:31:24Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:0 ~ file6[317d])

@estebank estebank added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jul 15, 2019
@estebank
Copy link
Contributor

This used to fail in a graceful manner in 1.30:

error[E0309]: the parameter type `A` may not live long enough
 --> <source>:3:37
  |
3 | struct MyStruct<'a, 'b, A, B, F>(F, &'a A, &'b B);
  |                         -           ^^^^^
  |                         |
  |                         help: consider adding an explicit lifetime bound `A: 'a`...
  |
note: ...so that the reference type `&'a A` does not outlive the data it points at
 --> <source>:3:37
  |
3 | struct MyStruct<'a, 'b, A, B, F>(F, &'a A, &'b B);
  |                                     ^^^^^

error[E0309]: the parameter type `B` may not live long enough
 --> <source>:3:44
  |
3 | struct MyStruct<'a, 'b, A, B, F>(F, &'a A, &'b B);
  |                            -               ^^^^^
  |                            |
  |                            help: consider adding an explicit lifetime bound `B: 'b`...
  |
note: ...so that the reference type `&'b B` does not outlive the data it points at
 --> <source>:3:44
  |
3 | struct MyStruct<'a, 'b, A, B, F>(F, &'a A, &'b B);
  |                                            ^^^^^

error[E0275]: overflow evaluating the requirement `<MyStruct<'_, '_, A, B, F> as MyTrait>::Input`
  --> <source>:12:1
   |
12 | / impl<'a, 'b, A, B, F> MyTrait for MyStruct<'a, 'b, A, B, F> where
13 | |     F: MyOtherTrait<Self::Input, Self::Output>
14 | | {
15 | |     type Input = A;
16 | |     type Output = B;
17 | | }
   | |_^
   |
   = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
8<8<8<8<8<8<8<8<8<8<8<
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error: aborting due to 3 previous errors

@estebank
Copy link
Contributor

This is a case of exponential explosion:

With #![recursion_limit="4"]:

$ time rustc +devel file7.rs
error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:14:1
   |
14 | / impl<'a, 'b, A, B, F> MyTrait for MyStruct<'a, 'b, A, B, F> where
15 | |     F: MyOtherTrait<Self::Input, Self::Output>
16 | | {
17 | |     type Input = A;
18 | |     type Output = B;
19 | | }
   | |_^
   |
   = help: consider adding a `#![recursion_limit="8"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:17:5
   |
17 |     type Input = A;
   |     ^^^^^^^^^^^^^^^
   |
   = help: consider adding a `#![recursion_limit="8"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:18:5
   |
18 |     type Output = B;
   |     ^^^^^^^^^^^^^^^^
   |
   = help: consider adding a `#![recursion_limit="8"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0275`.

real	0m0.128s
user	0m0.042s
sys	0m0.039s

With #![recursion_limit="8"]:

$ time rustc +devel file7.rs
error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:14:1
   |
14 | / impl<'a, 'b, A, B, F> MyTrait for MyStruct<'a, 'b, A, B, F> where
15 | |     F: MyOtherTrait<Self::Input, Self::Output>
16 | | {
17 | |     type Input = A;
18 | |     type Output = B;
19 | | }
   | |_^
   |
   = help: consider adding a `#![recursion_limit="16"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:17:5
   |
17 |     type Input = A;
   |     ^^^^^^^^^^^^^^^
   |
   = help: consider adding a `#![recursion_limit="16"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:18:5
   |
18 |     type Output = B;
   |     ^^^^^^^^^^^^^^^^
   |
   = help: consider adding a `#![recursion_limit="16"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0275`.

real	0m0.118s
user	0m0.071s
sys	0m0.038s

With #![recursion_limit="16"]:

$ time rustc +devel file7.rs
error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:14:1
   |
14 | / impl<'a, 'b, A, B, F> MyTrait for MyStruct<'a, 'b, A, B, F> where
15 | |     F: MyOtherTrait<Self::Input, Self::Output>
16 | | {
17 | |     type Input = A;
18 | |     type Output = B;
19 | | }
   | |_^
   |
   = help: consider adding a `#![recursion_limit="32"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:17:5
   |
17 |     type Input = A;
   |     ^^^^^^^^^^^^^^^
   |
   = help: consider adding a `#![recursion_limit="32"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error[E0275]: overflow evaluating the requirement `MyStruct<'_, '_, A, B, F>: MyTrait`
  --> file7.rs:18:5
   |
18 |     type Output = B;
   |     ^^^^^^^^^^^^^^^^
   |
   = help: consider adding a `#![recursion_limit="32"]` attribute to your crate
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'_, '_, A, B, F>`
   = note: required because of the requirements on the impl of `MyTrait` for `MyStruct<'a, 'b, A, B, F>`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0275`.

real	0m16.257s
user	0m14.831s
sys	0m1.363s

@estebank
Copy link
Contributor

CC #60846 #61960

@nikomatsakis I believe this is related to (not introduced in) #61754.

@nagisa
Copy link
Member

nagisa commented Jul 18, 2019

Assigning to self to get an accurate bisection.

@pnkfelix
Copy link
Member

triage: prioritizing as P-medium.

removing @nagisa from assignment. reassigning to self (for the bisection if nothing else.)

@pnkfelix pnkfelix assigned pnkfelix and unassigned nagisa Sep 26, 2019
@pnkfelix pnkfelix added the P-medium Medium priority label Sep 26, 2019
@istankovic
Copy link
Contributor

Tested with 1.73 and rustc terminates with an error, as expected, so I think this one can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants