Mention implicit T: Sized bound in E0277 errors#69791
Closed
estebank wants to merge 2 commits intorust-lang:masterfrom
Closed
Mention implicit T: Sized bound in E0277 errors#69791estebank wants to merge 2 commits intorust-lang:masterfrom
T: Sized bound in E0277 errors#69791estebank wants to merge 2 commits intorust-lang:masterfrom
Conversation
Contributor
|
(rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
|
Extracted from #69709. |
Member
|
Also, I'm not sure this PR handles weird cases like |
nikomatsakis
requested changes
Mar 9, 2020
Contributor
nikomatsakis
left a comment
There was a problem hiding this comment.
As is, the message doesn't seem that helpful to me -- see thoughts below.
| | ^ doesn't have a size known at compile-time | ||
| | | ||
| = help: the trait `std::marker::Sized` is not implemented for `T` | ||
| = help: type parameters have an implicit `Sized` requirement by default |
Contributor
There was a problem hiding this comment.
Huh, these help messages seem to be kind of confusing to me. That is, just looking at the error message, I can't really tell what it's talking about here.
| | - required by this bound in `std::mem::size_of` | ||
| | | ||
| = help: the trait `std::marker::Sized` is not implemented for `U` | ||
| = help: type parameters have an implicit `Sized` requirement by default |
Contributor
There was a problem hiding this comment.
this is a case where it kind of makes sense, but I feel like we would ideally want it to be in place of the "required by this bound" message. e.g., something like
pub const fn size_of<T>
- required because of the default `Sized` requirement on this type parameter
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.