-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #66392 - estebank:trait-alias-ice, r=eddyb
Do not ICE on trait aliases with missing obligations Fix #65673.
- Loading branch information
Showing
3 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![feature(trait_alias)] // Enabled to reduce stderr output, but can be triggered even if disabled. | ||
trait Trait {} | ||
trait WithType { | ||
type Ctx; | ||
} | ||
trait Alias<T> = where T: Trait; | ||
|
||
impl<T> WithType for T { | ||
type Ctx = dyn Alias<T>; | ||
//~^ ERROR the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time | ||
} | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time | ||
--> $DIR/issue-65673.rs:9:5 | ||
| | ||
LL | type Ctx; | ||
| --- associated type defined here | ||
... | ||
LL | impl<T> WithType for T { | ||
| ---------------------- in this `impl` item | ||
LL | type Ctx = dyn Alias<T>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)` | ||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |