Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not ICE on trait aliases with missing obligations
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 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)] | ||
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`. |