Change:
<ins> // Copyright 206 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::ops::Deref; // Due to aggressive error message deduplication, we require 20 *different* // unsized types (even Path and [u8] are considered the "same"). trait Foo {} trait Bar {} trait FooBar {} trait BarFoo {} trait PathHelper1 {} trait PathHelper2 {} trait PathHelper3 {} trait PathHelper4 {} struct Path1(PathHelper1); struct Path2(PathHelper2); struct Path3(PathHelper3); struct Path4(PathHelper4); enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> { // parameter VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied VB{x: X}, //~ ERROR `X: std::marker::Sized` is not satisfied VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied VD{u: isize, x: Z}, //~ ERROR `Z: std::marker::Sized` is not satisfied // slice / str VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied VF{x: str}, //~ ERROR `str: std::marker::Sized` is not satisfied VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied VH{u: isize, x: [u32]}, //~ ERROR `[u32]: std::marker::Sized` is not satisfied // unsized struct VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied VJ{x: Path2}, //~ ERROR `PathHelper2 + 'static: std::marker::Sized` is not satisfied VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied VL{u: isize, x: Path4}, //~ ERROR `PathHelper4 + 'static: std::marker::Sized` is not satisfied // plain trait VM(Foo),  //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied VN{x: Bar}, //~ ERROR `Bar + 'static: std::marker::Sized` is not satisfied VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied VP{u: isize, x: BarFoo}, //~ ERROR `BarFoo + 'static: std::marker::Sized` is not satisfied // projected VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied VR{x: <&'static [char] as Deref>::Target}, //~^ ERROR `[char]: std::marker::Sized` is not satisfied VS(isize, <&'static [f64] as Deref>::Target), //~^ ERROR `[f64]: std::marker::Sized` is not satisfied VT{u: isize, x: <&'static [i32] as Deref>::Target}, //~^ ERROR `[i32]: std::marker::Sized` is not satisfied } fn main() { } </ins>

Discussion:
Backtrace: This seems to occur when using a non-struct type that contains an unsized type. This is probably because  only handles and the base unsized types. This should be extended to handle enums and tuples as well.
This is still happening. Does this mean we should avoid using DSTs for complex custom types for now?
Visiting for triage This is still an issue:
ICE also happens with a tupled trait object:
I've seen this too with: Reproducer: Version: Backtrace:
No longer reproduces but the other tests do.
cc
Is this the same as or related to ?
leads to . As mentioned inline, using the correct type works (). I'm using the Ubuntu PPA "rust-nightly", version ~~vivid.
Does not compile for other reasons that the ICE anymore. I've adjusted to the following and could not reproduce it anymore.
Another example hitting this same ICE:
Bugs similar to this one have been reported numerous times (most of the references to this issue are duplicates). Although it would be nice for reporters to search for similar issues before filing a new one, it's hard to blame them, since the ICE message from rustc tells people to file an issue. This issue itself was opened over two years ago. Separate from fixing the underlying problem, we should at least investigate displaying a real error instead of an ICE.