-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Various refactorings of the TAIT infrastructure #87587
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d998059
Move opaque type cache into `InferCtxt`
oli-obk 14021fe
Remove a field that is computed later anyway
oli-obk 3418280
Move some code around in preparation of splitting a function
oli-obk a30b548
Split fold_opaque_ty
oli-obk c091b5c
Remove a useless feature gateing
oli-obk 816b9fc
Remove Option only used as its Some variant
oli-obk 20371b9
Immediately register new opaque types in the global list.
oli-obk b2c1919
Store the `DefId` of the currently typechecked item in `InferCtxt`
oli-obk 092e9cc
Point to the value instead of the TAIT declaration for obligation fai…
oli-obk 1b9ad13
Use existing type alias instead of manually writing it
oli-obk 238d974
Document `with_opaque_type_inference`'s use cases.
oli-obk 7af445d
bless some nll tests
oli-obk 93c4aa8
Don't collect into a `Vec` that is immediately being iterated on again.
oli-obk 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use rustc_data_structures::vec_map::VecMap; | ||
use rustc_hir as hir; | ||
use rustc_middle::ty::{OpaqueTypeKey, Ty}; | ||
use rustc_span::Span; | ||
|
||
pub type OpaqueTypeMap<'tcx> = VecMap<OpaqueTypeKey<'tcx>, OpaqueTypeDecl<'tcx>>; | ||
|
||
/// Information about the opaque types whose values we | ||
/// are inferring in this function (these are the `impl Trait` that | ||
/// appear in the return type). | ||
#[derive(Copy, Clone, Debug)] | ||
pub struct OpaqueTypeDecl<'tcx> { | ||
/// The opaque type (`ty::Opaque`) for this declaration. | ||
pub opaque_type: Ty<'tcx>, | ||
|
||
/// The span of this particular definition of the opaque type. So | ||
/// for example: | ||
/// | ||
/// ```ignore (incomplete snippet) | ||
/// type Foo = impl Baz; | ||
/// fn bar() -> Foo { | ||
/// // ^^^ This is the span we are looking for! | ||
/// } | ||
/// ``` | ||
/// | ||
/// In cases where the fn returns `(impl Trait, impl Trait)` or | ||
/// other such combinations, the result is currently | ||
/// over-approximated, but better than nothing. | ||
pub definition_span: Span, | ||
|
||
/// The type variable that represents the value of the opaque type | ||
/// that we require. In other words, after we compile this function, | ||
/// we will be created a constraint like: | ||
/// | ||
/// Foo<'a, T> = ?C | ||
/// | ||
/// where `?C` is the value of this type variable. =) It may | ||
/// naturally refer to the type and lifetime parameters in scope | ||
/// in this function, though ultimately it should only reference | ||
/// those that are arguments to `Foo` in the constraint above. (In | ||
/// other words, `?C` should not include `'b`, even though it's a | ||
/// lifetime parameter on `foo`.) | ||
pub concrete_ty: Ty<'tcx>, | ||
|
||
/// The origin of the opaque type. | ||
pub origin: hir::OpaqueTyOrigin, | ||
} |
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.