-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Rustdoc ICE when checking blanket impls #55258
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,31 @@ | ||
// Regression test for issue #55001. Previously, we would incorrectly | ||
// cache certain trait selection results when checking for blanket impls, | ||
// resulting in an ICE when we tried to confirm the cached ParamCandidate | ||
// against an obligation. | ||
|
||
pub struct DefaultAllocator; | ||
pub struct Standard; | ||
pub struct Inner; | ||
|
||
pub trait Rand {} | ||
|
||
pub trait Distribution<T> {} | ||
pub trait Allocator<N> {} | ||
|
||
impl<T> Rand for T where Standard: Distribution<T> {} | ||
|
||
impl<A> Distribution<Point<A>> for Standard | ||
where | ||
DefaultAllocator: Allocator<A>, | ||
Standard: Distribution<A> {} | ||
|
||
impl Distribution<Inner> for Standard {} | ||
|
||
|
||
pub struct Point<N> | ||
where DefaultAllocator: Allocator<N> | ||
{ | ||
field: N | ||
} | ||
|
||
fn main() {} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to
trait_ref.needs_infer()
, but potentially much slower (since methods likeneeds_infer
rely on precomputed flags), I wonder how much of a perf regression this is.Both
TraitRef::input_types
andTy::walk
are warning flags, we might want to audit their uses (and makeTy::walk
more annoying to use, probably).cc @nikomatsakis @pnkfelix @matthewjasper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, @eddyb is correct, this does seem slower (I hadn't noticed this PR at the time, though I agree also with @arielb1's comment that it's a bit surprising to see inference variables in the param env, though I suppose there may be some path by which it can occur -- and eventually it'll be true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I don't think I agree that
input_types
is a warning flag, though --walk
maybe is..?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, should we open an issue to try converting this to use the
needs_infer
call?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's included in #69294 (comment), I haven't had the chance to split that into its own PR for perf testing (presumably we can just land it with
rollup=never
and see the results there. it can't be slower thanwalk
-ing, anyway).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it a leftover from the days of "output" modes on parameters? Like before associated types fully became a thing?
Also it's going to get really bad with
const
generics, so @varkor or @yodaldevoid would probably have to removeinput_types
just to make its callsites correct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like it just screens out lifetime parameters. I guess you're right that there is probably generally little reason to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And const parameters 😨 (presumably), hence my comments on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. And I suppose it's probably just wrong to ignore needs-infer in lifetime parameters anyway. OK, I agree it's probably a 'red flag' of some kind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it seems like you're going to fix this in #69294, so that's good.