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

Move structures from ty/mod.rs into their own modules #111208

Closed
wants to merge 38 commits into from

Conversation

WaffleLapkin
Copy link
Member

@WaffleLapkin WaffleLapkin commented May 4, 2023

The main goal here is to allow easier maintenance of each individual structure, but this may help us make better module structure as well.

r? @oli-obk (you are usually ok with my big dumb refactoring PRs (also I'm sorry))

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 4, 2023
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

This is a lot of submodules :/ Is there any way of grouping these up into something a bit more coherent than "one module per type"?

@WaffleLapkin
Copy link
Member Author

@compiler-errors there probably is, but my point was that with small submodules it's easier to group them, so this is the first step.

@compiler-errors
Copy link
Member

compiler-errors commented May 4, 2023

I understand the approach, but I don't think there should be, for example, a separate submodule for all the different predicate internals (clause, typredicate, projection pred, etc.).

Same with ty, term, paramterm which are conceptually grouped. Same with ADT internals (fields, variants, etc.) all should probably live together in one module** (typo).

Impl header stuff and coherence iternals (ImplHeader, ImplOverlapKind, ImplSubject) should all probably live together in one place.

Bound const should live with const related stuff.

Also this is a lot of commits for just moving stuff around...

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, here's a slightly messier but more concise summary of all the groupings I think need to be done here.

As I said before, I think the philosophy of breaking up rustc_middle::ty into more coherent groupings is a good idea, but this needs some refactoring hehe.

compiler/rustc_middle/src/ty/alias_relation_direction.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/bound_const.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/bound_constness.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/crate_inherent_impls.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,9 @@
use crate::ty::{Interned, TyKind, WithCachedTypeInfo};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there shouldn't be both an sty and ty i think lol

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll work on sty after this PR 😅

compiler/rustc_middle/src/ty/variant_def.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/variant_discr.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/variant_flags.rs Outdated Show resolved Hide resolved
use crate::ty::TyCtxt;

#[derive(Clone, Debug, PartialEq, Eq, Copy, Hash, Encodable, Decodable, HashStable)]
pub enum Visibility<Id = LocalDefId> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk... maybe this should live with adt stuff? even tho vis is used for more than that... i guess it's fine to live alone here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a submodule of rustc_middle::middle.

@compiler-errors compiler-errors self-assigned this May 4, 2023
@WaffleLapkin WaffleLapkin added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2023
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 8, 2023

☔ The latest upstream changes (presumably #111342) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels May 8, 2023
@rustbot

This comment was marked as off-topic.

@WaffleLapkin
Copy link
Member Author

Github borked my PR again, ugh. Sorry for the pings, everyone. Closing as this seems to be beyond repair similarly to #110795. Will open a new version.

@WaffleLapkin WaffleLapkin reopened this May 8, 2023
@WaffleLapkin
Copy link
Member Author

Nevermind, this time close+reopen actually helped.

@WaffleLapkin WaffleLapkin removed A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels May 8, 2023
@bors
Copy link
Contributor

bors commented May 9, 2023

☔ The latest upstream changes (presumably #111358) made this pull request unmergeable. Please resolve the merge conflicts.

@WaffleLapkin
Copy link
Member Author

Github is being weird again, so I've reopened the PR here: #111503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants