-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when param type has default and type in trait is generic.
- Loading branch information
1 parent
0cbef48
commit 7b8033f
Showing
5 changed files
with
64 additions
and
7 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
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 @@ | ||
// issue: 120878 | ||
fn main() { | ||
struct StructA<A, B = A> { | ||
_marker: std::marker::PhantomData<fn() -> (A, B)>, | ||
} | ||
|
||
struct StructB { | ||
a: StructA<isize, [u8]>, | ||
//~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time [E0277] | ||
} | ||
|
||
trait Trait { | ||
type P<X>; | ||
} | ||
|
||
impl Trait for () { | ||
type P<X> = [u8]; | ||
//~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time [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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/suggest-maybe-sized-bound.rs:8:12 | ||
| | ||
LL | a: StructA<isize, [u8]>, | ||
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
note: required by an implicit `Sized` bound in `StructA` | ||
--> $DIR/suggest-maybe-sized-bound.rs:3:23 | ||
| | ||
LL | struct StructA<A, B = A> { | ||
| ^^^^^ required by the implicit `Sized` requirement on this type parameter in `StructA` | ||
help: consider relaxing the implicit `Sized` restriction | ||
| | ||
LL | struct StructA<A, B: ?Sized = A> { | ||
| ++++++++ | ||
|
||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR/suggest-maybe-sized-bound.rs:17:37 | ||
| | ||
LL | type P<X> = [u8]; | ||
| ^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `[u8]` | ||
note: required by a bound in `Trait::P` | ||
--> $DIR/suggest-maybe-sized-bound.rs:13:19 | ||
| | ||
LL | type P<X>; | ||
| ^^^^^^^^^^ required by this bound in `Trait::P` | ||
help: consider relaxing the implicit `Sized` restriction | ||
| | ||
LL | type P<X>: ?Sized; | ||
| ++++++++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
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