forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#116911 - estebank:issue-85378, r=oli-obk Suggest relaxing implicit `type Assoc: Sized;` bound Fix rust-lang#85378.
- Loading branch information
Showing
5 changed files
with
67 additions
and
0 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
10 changes: 10 additions & 0 deletions
10
tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed
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,10 @@ | ||
// run-rustfix | ||
trait TraitWithAType { | ||
type Item: ?Sized; | ||
} | ||
trait Trait {} | ||
struct A {} | ||
impl TraitWithAType for A { | ||
type Item = dyn Trait; //~ ERROR E0277 | ||
} | ||
fn main() {} |
10 changes: 10 additions & 0 deletions
10
tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs
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,10 @@ | ||
// run-rustfix | ||
trait TraitWithAType { | ||
type Item; | ||
} | ||
trait Trait {} | ||
struct A {} | ||
impl TraitWithAType for A { | ||
type Item = dyn Trait; //~ ERROR E0277 | ||
} | ||
fn main() {} |
20 changes: 20 additions & 0 deletions
20
tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr
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,20 @@ | ||
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time | ||
--> $DIR/assoc_type_bounds_implicit_sized.rs:8:17 | ||
| | ||
LL | type Item = dyn Trait; | ||
| ^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `(dyn Trait + 'static)` | ||
note: required by a bound in `TraitWithAType::Item` | ||
--> $DIR/assoc_type_bounds_implicit_sized.rs:3:5 | ||
| | ||
LL | type Item; | ||
| ^^^^^^^^^^ required by this bound in `TraitWithAType::Item` | ||
help: consider relaxing the implicit `Sized` restriction | ||
| | ||
LL | type Item: ?Sized; | ||
| ++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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