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

hang: issue-55608-captures-empty-region.rs with -Zmir-opt-level=2 #75051

Closed
matthiaskrgr opened this issue Aug 2, 2020 · 3 comments · Fixed by #75076
Closed

hang: issue-55608-captures-empty-region.rs with -Zmir-opt-level=2 #75051

matthiaskrgr opened this issue Aug 2, 2020 · 3 comments · Fixed by #75076
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Aug 2, 2020

Code

./src/test/ui/impl-trait/issues/issue-55608-captures-empty-region.rs

// This used to ICE because it creates an `impl Trait` that captures a
// hidden empty region.

// check-pass

fn server() -> impl FilterBase2 {
    segment2(|| { loop { } }).map2(|| "")
}

trait FilterBase2 {
    fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } }
}

struct Map2<F> { _func: F }

impl<F> FilterBase2 for Map2<F> { }

fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> {
    loop { }
}

fn main() { server(); }

Meta

repo @ 12799ad

Error output

Rustc simply hangs when running
build/x86_64-unknown-linux-gnu/stage1/bin/rustc ./src/test/ui/impl-trait/issues/issue-55608-captures-empty-region.rs -Zmir-opt-level=2

Edit: perf top while rustc is crunching on the hang:

  45,75%  librustc_driver-3c13214d88d90089.so  [.] rustc_mir::transform::simplify::CfgSimplifier::collapse_goto_chain
  28,35%  librustc_driver-3c13214d88d90089.so  [.] rustc_mir::transform::simplify::CfgSimplifier::simplify
   7,00%  [kernel]                             [k] mwait_idle_with_hints.constprop.0
   2,16%  librustc_driver-3c13214d88d90089.so  [.] rustc_middle::mir::terminator::TerminatorKind::successors_mut
   1,00%  librustc_driver-3c13214d88d90089.so  [.] rustc_middle::mir::terminator::Terminator::successors_mut
@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 2, 2020
@jonas-schievink jonas-schievink added A-mir-opt Area: MIR optimizations I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. requires-nightly This issue requires a nightly compiler in some way. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Aug 2, 2020
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Aug 2, 2020

cc @oli-obk ?

edit: I assume this is due to aba0251

@oli-obk
Copy link
Contributor

oli-obk commented Aug 2, 2020

O_o yea, I'll have a look

@jonas-schievink
Copy link
Contributor

jonas-schievink commented Aug 2, 2020

Wild speculation: #75074 might have the same cause

(EDIT: Backtrace says yes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants