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 with GAT + HRTB #92954

Closed
SevenO2 opened this issue Jan 16, 2022 · 2 comments · Fixed by #93227
Closed

ICE with GAT + HRTB #92954

SevenO2 opened this issue Jan 16, 2022 · 2 comments · Fixed by #93227
Assignees
Labels
C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs glacier ICE tracked in rust-lang/glacier. 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.

Comments

@SevenO2
Copy link

SevenO2 commented Jan 16, 2022

Code

#![feature(generic_associated_types)]
pub trait EphemeralContext {
    type Context<'c> where Self: 'c;
    fn handle(&self) -> Vec<Box<dyn 'static + for<'c> FnOnce(&Self::Context<'c>)>>;
    fn run_requests<'c>(&mut self, context: &Self::Context<'c>);
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (1bd4fdc94 2022-01-12)
binary: rustc
commit-hash: 1bd4fdc943513e1004f498bbf289279c9784fc6f
commit-date: 2022-01-12
host: x86_64-pc-windows-msvc
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler\rustc_infer\src\infer\lexical_region_resolve\mod.rs:376:17: cannot relate region: LUB(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:7 ~ testy_tanky[1935]::EphemeralContext::handle::'c), 'c) }), ReFree(DefId(0:6 ~ testy_tanky[1935]::EphemeralContext::handle), BrAnon(0)))
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', compiler\rustc_errors\src\lib.rs:1169:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.60.0-nightly (1bd4fdc94 2022-01-12) running on x86_64-pc-windows-msvc

note: compiler flags: -Z share-generics=n -C embed-bitcode=no -C debuginfo=1 -C linker=rust-lld.exe -C incremental -C link-args=/debug:fastlink /opt:ref,noicf --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_trait_item_well_formed] checking that `EphemeralContext::Context` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack

@SevenO2 SevenO2 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 Jan 16, 2022
@jackh726 jackh726 added the F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs label Jan 16, 2022
@compiler-errors
Copy link
Member

compiler-errors commented Jan 16, 2022

Slightly minimized:

#![feature(generic_associated_types)]

pub trait Foo {
    type Assoc<'c>
    where
        Self: 'c;
        
    fn function() -> for<'x> fn(Self::Assoc<'x>);
}

fn main() {}

@compiler-errors
Copy link
Member

I understand the issue here, and have a solution but it might not be optimal.

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs glacier ICE tracked in rust-lang/glacier. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants