-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Refractor a few more types to rustc_type_ir
#79951
Conversation
68708ea
to
181f860
Compare
This comment has been minimized.
This comment has been minimized.
181f860
to
5593c61
Compare
This comment has been minimized.
This comment has been minimized.
5593c61
to
d4e717b
Compare
This comment has been minimized.
This comment has been minimized.
d4e717b
to
f16992c
Compare
This comment has been minimized.
This comment has been minimized.
f16992c
to
56fb77a
Compare
This comment has been minimized.
This comment has been minimized.
56fb77a
to
4012d6f
Compare
This comment has been minimized.
This comment has been minimized.
4012d6f
to
e0d64b9
Compare
impl<CTX> HashStable<CTX> for DebruijnIndex { | ||
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { | ||
self.as_u32().hash_stable(ctx, hasher); | ||
} | ||
} | ||
|
||
impl<CTX> HashStable<CTX> for IntTy { |
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.
Since you are binging in rustc_macros
, can all these impls be replaced by the adequate #[derive(HashStable)]
?
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.
#[derive(HashStable)]
depends on rustc_middle
:
rust/compiler/rustc_macros/src/hash_stable.rs
Lines 115 to 130 in 73f233b
s.bound_impl( | |
quote!( | |
::rustc_data_structures::stable_hasher::HashStable< | |
::rustc_middle::ich::StableHashingContext<'__ctx>, | |
> | |
), | |
quote! { | |
fn hash_stable( | |
&self, | |
__hcx: &mut ::rustc_middle::ich::StableHashingContext<'__ctx>, | |
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { | |
#discriminant | |
match *self { #body } | |
} | |
}, | |
) |
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.
Sorry, I meant HashStable_Generic. It does not depend on rustc_middle, instead it requires a HashStableContext
trait at crate toplevel.
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.
If that's better I'll do that 👍
use rustc_macros::HashStable; | ||
|
||
/// Types that are represented as ints. | ||
#[derive(Copy, Clone, Debug, PartialEq, Eq)] | ||
pub enum IntTy { | ||
U(ast::UintTy), | ||
U(ty::UintTy), |
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 did not see a re-export of rustc_type_ir::UintTy
in rustc_ast
. Are both the same type?
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 guess it could make sense to do that, but that means having rustc_ast
depend on rustc_type_ir
... 🤷♂️
@bors r+ Thanks @LeSeulArtichaut ! |
📌 Commit e0d64b9 has been approved by |
@bors rollup |
Rollup of 13 pull requests Successful merges: - rust-lang#70904 (Stabilize `Seek::stream_position` (feature `seek_convenience`)) - rust-lang#79951 (Refractor a few more types to `rustc_type_ir` ) - rust-lang#80868 (Print failure message on all tests that should panic, but don't) - rust-lang#81062 (Improve diagnostics for Precise Capture) - rust-lang#81277 (Make more traits of the From/Into family diagnostic items) - rust-lang#81284 (Make `-Z time-passes` less noisy) - rust-lang#81379 (Improve URLs handling) - rust-lang#81416 (Tweak suggestion for missing field in patterns) - rust-lang#81426 (const_evaluatable: expand abstract consts in try_unify) - rust-lang#81428 (compiletest: Add two more unit tests) - rust-lang#81430 (add const_evaluatable_checked test) - rust-lang#81433 (const_evaluatable: stop looking into type aliases) - rust-lang#81445 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Refractor a few more types to `rustc_type_ir` In the continuation of rust-lang#79169, ~~blocked on that PR~~. This PR: - moves `IntVarValue`, `FloatVarValue`, `InferTy` (and friends) and `Variance` - creates the `IntTy`, `UintTy` and `FloatTy` enums in `rustc_type_ir`, based on their `ast` and `chalk_ir` equilavents, and uses them for types in the rest of the compiler. ~~I will split up that commit to make this easier to review and to have a better commit history.~~ EDIT: done, I split the PR in commits of 200-ish lines each r? `````@nikomatsakis````` cc `````@jackh726`````
In the continuation of #79169,
blocked on that PR.This PR:
IntVarValue
,FloatVarValue
,InferTy
(and friends) andVariance
IntTy
,UintTy
andFloatTy
enums inrustc_type_ir
, based on theirast
andchalk_ir
equilavents, and uses them for types in the rest of the compiler.I will split up that commit to make this easier to review and to have a better commit history.EDIT: done, I split the PR in commits of 200-ish lines each
r? @nikomatsakis cc @jackh726