Skip to content
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

Merged
merged 4 commits into from
Jan 28, 2021

Conversation

LeSeulArtichaut
Copy link
Contributor

@LeSeulArtichaut LeSeulArtichaut commented Dec 12, 2020

In the continuation of #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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 12, 2020
@jyn514 jyn514 added A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 labels Dec 12, 2020
@bors

This comment has been minimized.

@bors

This comment has been minimized.

@bors

This comment has been minimized.

@bors

This comment has been minimized.

@bors

This comment has been minimized.

@crlf0710 crlf0710 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 15, 2021
@bors

This comment has been minimized.

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 {
Copy link
Contributor

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)]?

Copy link
Contributor Author

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:

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 }
}
},
)

Copy link
Contributor

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.

Copy link
Contributor Author

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),
Copy link
Contributor

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?

Copy link
Contributor Author

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... 🤷‍♂️

@nikomatsakis
Copy link
Contributor

@bors r+

Thanks @LeSeulArtichaut !

@bors
Copy link
Contributor

bors commented Jan 26, 2021

📌 Commit e0d64b9 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 26, 2021
@nikomatsakis
Copy link
Contributor

@bors rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2021
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
@bors bors merged commit 446edd1 into rust-lang:master Jan 28, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 28, 2021
@LeSeulArtichaut LeSeulArtichaut deleted the ty-ir branch January 28, 2021 12:30
JohnTitor added a commit to JohnTitor/miri that referenced this pull request Jan 28, 2021
JohnTitor added a commit to JohnTitor/miri that referenced this pull request Jan 28, 2021
bors added a commit to rust-lang/miri that referenced this pull request Jan 28, 2021
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 30, 2021
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`````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants