Closed
Description
Ran into an ICE on stable, threw together a quick minimization. There's probably a lot more room here for minimization but some other things I tried mostly wrt switching Debug
/format_args!
out for something generic weren't immediately successful at reproducing it.
Code
use core::{fmt, marker::PhantomData};
pub trait WrapperTrait {
type Assoc;
}
pub trait Trait {
type Assoc;
}
pub struct Ice<T>(<<Dynamic<T> as WrapperTrait>::Assoc as Trait>::Assoc);
impl<T> fmt::Debug for Ice<T>
where
<<Dynamic<T> as WrapperTrait>::Assoc as Trait>::Assoc: fmt::Debug,
{
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
format_args!("{:?}", self.0);
todo!()
}
}
pub struct TraitImplementor;
impl Trait for TraitImplementor {
type Assoc = ConcreteAssoc;
}
pub struct ConcreteAssoc;
impl<T> WrapperTrait for Dynamic<T> {
type Assoc = TraitImplementor;
}
pub struct Dynamic<T>(PhantomData<T>);
Meta
rustc --version --verbose
:
rustc 1.55.0 (c8dfcfe04 2021-09-06)
binary: rustc
commit-hash: c8dfcfe046a7680554bf4eb612bad840e7631c4b
commit-date: 2021-09-06
host: x86_64-unknown-linux-gnu
release: 1.55.0
LLVM version: 12.0.1
Error output
warning: Error finalizing incremental compilation session directory `<local working dir elided>/target/debug/incremental/ice_repro-2wh62tfxoond5/s-g39h6fbohq-1vpmobs-working`: No such file or directory (os error 2)
error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<ConcreteAssoc as std::fmt::Debug>, [])` during codegen
|
= note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:68:32
Backtrace
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050:13
stack backtrace:
0: rust_begin_unwind
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
1: std::panicking::begin_panic_fmt
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:457:5
2: rustc_errors::HandlerInner::flush_delayed
3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
4: core::ptr::drop_in_place<rustc_session::parse::ParseSess>
5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
6: core::ptr::drop_in_place<rustc_interface::interface::Compiler>
7: rustc_span::with_source_map
8: rustc_interface::interface::create_compiler_and_run
9: scoped_tls::ScopedKey<T>::set