Closed
Description
see the second comment for an explanation: #113278 (comment)
#![feature(trivial_bounds, type_alias_impl_trait)]
mod sus {
pub type Sep = impl Sized;
pub fn define_sep() -> Sep {
String::new()
}
pub type Tait = impl Mk;
pub trait Mk: Proj {
fn mk() -> <Self as Proj>::Assoc;
}
impl<T> Mk for T
where
T: Proj<Assoc = ()>,
{
fn mk() -> <T as Proj>::Assoc {
()
}
}
pub trait Proj {
type Assoc;
}
impl Proj for () {
type Assoc = Sep;
}
fn define() -> Tait
where
(): Proj<Assoc = ()>,
{
}
}
fn main() {
let _ = <sus::Tait as sus::Mk>::mk();
}
results in
error: internal compiler error: compiler/rustc_middle/src/ty/instance.rs:413:18: failed to resolve instance for <() as Mk>::mk
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
[..]
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
going to minimize this further and explain why it is broken
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.`#[feature(type_alias_impl_trait)]`Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessRelevant to the types team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.
Type
Projects
Status
Done