forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use param.name.indent().span if trait bounds not exists.
fix it, Diagnostic suggests adding : ?Sized in an incorrect place if a type parameter default is present fix: rust-lang#120878 Use param.name.indent().span if type parameter default exists. change span.hi if exists default. Diagnostic suggests adding : ?Sized in an incorrect place if a type parameter default is present If there are no bounds, you should always use param.name, so there is no need to branch. add test add test
- Loading branch information
1 parent
5a29471
commit 61095e3
Showing
3 changed files
with
28 additions
and
1 deletion.
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,9 @@ | ||
fn main() { | ||
struct StructA<A, B =A> { | ||
_marker: std::marker::PhantomData<fn() -> (A, B)>, | ||
} | ||
|
||
struct StructB { | ||
a: StructA<isize, [u8]>, | ||
} | ||
} |
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,18 @@ | ||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | ||
--> $DIR\issue-120878.rs:7: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\issue-120878.rs:2: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> { | ||
| ++++++++ | ||
|
||
For more information about this error, try `rustc --explain E0277`. |