-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Implement unstable trait impl #140399
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
Open
tiif
wants to merge
12
commits into
rust-lang:master
Choose a base branch
from
tiif:unstable_impl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+862
−10
Open
Implement unstable trait impl #140399
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7ac74c5
Setup unstable feature bound attribute
tiif 0751165
Lower the unstable feature bound attribute to UnstableFeature predicate
tiif 0d5693b
Add the core logic in both old solver and new solver
tiif 98216fb
Implement other logics
tiif 39c5866
Make stability attribute not to error when unstable feature bound is …
tiif 373f6dd
Add tests
tiif a90c483
Fix rebase error
tiif 820dcf4
Emit better ambiguity error for UnstableFeature
tiif 929baca
Use #[type_foldable(identity)] and #[type_visitable(ignore)] for Symbol
tiif e9b76a1
Apply suggestions from code review
tiif 81deb7d
Make the test crate stable to remove the error
tiif 7f35491
Slightly tweak the error message's wording
tiif 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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -148,6 +148,37 @@ where | |||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
fn compute_unstable_feature_goal( | ||||||||||
&mut self, | ||||||||||
param_env: <I as Interner>::ParamEnv, | ||||||||||
symbol: <I as Interner>::Symbol, | ||||||||||
) -> QueryResult<I> { | ||||||||||
// Iterate through all goals in param_env to find the one that has the same symbol. | ||||||||||
for pred in param_env.caller_bounds().iter() { | ||||||||||
if let ty::ClauseKind::UnstableFeature(sym) = pred.kind().skip_binder() { | ||||||||||
if sym == symbol { | ||||||||||
return self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes); | ||||||||||
} | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
// During codegen we must assume that all feature bounds hold as we may be | ||||||||||
// monomorphizing a body from an upstream crate which had an unstable feature | ||||||||||
// enabled that we do not. | ||||||||||
// | ||||||||||
// Note: `feature_bound_holds_in_crate` does not consider a feature to be enabled | ||||||||||
// if we are in std/core even if there is a corresponding `feature` attribute on the crate. | ||||||||||
if self.cx().features().feature_bound_holds_in_crate(symbol) | ||||||||||
|| (self.typing_mode() == TypingMode::PostAnalysis) | ||||||||||
Comment on lines
+171
to
+172
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls add comment why
Suggested change
|
||||||||||
{ | ||||||||||
return self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes); | ||||||||||
} else { | ||||||||||
return self.evaluate_added_goals_and_make_canonical_response(Certainty::Maybe( | ||||||||||
MaybeCause::Ambiguity, | ||||||||||
)); | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
#[instrument(level = "trace", skip(self))] | ||||||||||
fn compute_const_evaluatable_goal( | ||||||||||
&mut self, | ||||||||||
|
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.