-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Misc cleanups of generic_arg_infer
related HIR logic
#142678
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
BoxyUwU
wants to merge
4
commits into
rust-lang:master
Choose a base branch
from
BoxyUwU:gai_cleanup
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.
+16
−25
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
|
@@ -407,10 +407,8 @@ impl<'hir> PathSegment<'hir> { | |
/// that are [just paths](ConstArgKind::Path) (currently just bare const params) | ||
/// versus const args that are literals or have arbitrary computations (e.g., `{ 1 + 3 }`). | ||
/// | ||
/// The `Unambig` generic parameter represents whether the position this const is from is | ||
/// unambiguously a const or ambiguous as to whether it is a type or a const. When in an | ||
/// ambiguous context the parameter is instantiated with an uninhabited type making the | ||
/// [`ConstArgKind::Infer`] variant unusable and [`GenericArg::Infer`] is used instead. | ||
/// For an explanation of the `Unambig` generic parameter see the dev-guide: | ||
/// <https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html> | ||
#[derive(Clone, Copy, Debug, HashStable_Generic)] | ||
#[repr(C)] | ||
pub struct ConstArg<'hir, Unambig = ()> { | ||
|
@@ -422,7 +420,7 @@ pub struct ConstArg<'hir, Unambig = ()> { | |
impl<'hir> ConstArg<'hir, AmbigArg> { | ||
/// Converts a `ConstArg` in an ambiguous position to one in an unambiguous position. | ||
/// | ||
/// Functions accepting an unambiguous consts may expect the [`ConstArgKind::Infer`] variant | ||
/// Functions accepting unambiguous consts may expect the [`ConstArgKind::Infer`] variant | ||
/// to be used. Care should be taken to separately handle infer consts when calling this | ||
/// function as it cannot be handled by downstream code making use of the returned const. | ||
/// | ||
|
@@ -3298,14 +3296,12 @@ impl<'hir> AssocItemConstraintKind<'hir> { | |
#[derive(Debug, Clone, Copy, HashStable_Generic)] | ||
pub enum AmbigArg {} | ||
|
||
#[derive(Debug, Clone, Copy, HashStable_Generic)] | ||
#[repr(C)] | ||
/// Represents a type in the `HIR`. | ||
/// | ||
/// The `Unambig` generic parameter represents whether the position this type is from is | ||
/// unambiguously a type or ambiguous as to whether it is a type or a const. When in an | ||
/// ambiguous context the parameter is instantiated with an uninhabited type making the | ||
/// [`TyKind::Infer`] variant unusable and [`GenericArg::Infer`] is used instead. | ||
/// For an explanation of the `Unambig` generic parameter see the dev-guide: | ||
/// <https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html> | ||
#[derive(Debug, Clone, Copy, HashStable_Generic)] | ||
#[repr(C)] | ||
pub struct Ty<'hir, Unambig = ()> { | ||
#[stable_hasher(ignore)] | ||
pub hir_id: HirId, | ||
|
@@ -3640,9 +3636,12 @@ pub enum InferDelegationKind { | |
} | ||
|
||
/// The various kinds of types recognized by the compiler. | ||
#[derive(Debug, Clone, Copy, HashStable_Generic)] | ||
/// | ||
/// For an explanation of the `Unambig` generic parameter see the dev-guide: | ||
/// <https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html> | ||
// SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind<!>` are layout compatible | ||
#[repr(u8, C)] | ||
#[derive(Debug, Clone, Copy, HashStable_Generic)] | ||
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. Why these new derives? 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. not new I just moved them below all the comments |
||
pub enum TyKind<'hir, Unambig = ()> { | ||
/// Actual type should be inherited from `DefId` signature | ||
InferDelegation(DefId, InferDelegationKind), | ||
|
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.