Closed
Description
rustc currently lacks any checks to ensure that relating ty/const infer vars with ty/const placeholders in higher universes fails. I am not entirely sure whether this is problematic for stable rust or just feature(non_lifetime_binders)
I think exploiting this would require us to create obligations with type/const binders. We currently create param envs with for<T>
predicates on stable for checking gat bounds, but I couldn't find anywhere that we create obligations with type/const bound vars.
Code
#![feature(non_lifetime_binders)]
#![allow(incomplete_features)]
trait Other<U: ?Sized> {}
impl<U: ?Sized> Other<U> for U {}
// - o: `for<T> T: Trait<?0>`
// - c: `for<U> U: Trait<U>`
// - U = ?1
// - T = ?1
// - ?0 = ?1
#[rustfmt::skip]
fn foo<U: ?Sized>()
where
for<T> T: Other<U> {}
fn bar() {
foo::<_>();
}
Meta
rustc --version --verbose
:
rustc 1.70.0-nightly (8a73f50d8 2023-03-11)
binary: rustc
commit-hash: 8a73f50d875840b8077b8ec080fa41881d7ce40d
commit-date: 2023-03-11
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7
Error output
Backtrace
no backtrace because github claims "Comment is too long" 🙄
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(non_lifetime_binders)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.