Skip to content

Conversation

varkor
Copy link
Member

@varkor varkor commented Feb 25, 2018

Part of the generic parameter refactoring effort, split off from #48149. Contains the ty-relative refactoring.

r? @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 25, 2018
@bors
Copy link
Collaborator

bors commented Feb 25, 2018

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

@bors bors 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 Feb 25, 2018
@varkor varkor force-pushed the generics-ty-generalisations branch 5 times, most recently from 2a0b89e to b4dbc02 Compare February 25, 2018 16:04
@shepmaster
Copy link
Member

Ping from triage, @varkor ! You have some merge conflicts you need to address, will you be able to get to those soon?

@varkor
Copy link
Member Author

varkor commented Mar 2, 2018

@shepmaster: the merge conflicts should all be fairly routine (this code has a reasonably high bitrot rate) — I should be able to fix them without issue after a review, so I'll wait for now to avoid repeatedly fixing new conflicts as they arise.

@shepmaster shepmaster added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 3, 2018
@shepmaster
Copy link
Member

Ping from triage, @eddyb !

pub fn own_count(&self) -> usize {
self.regions.len() + self.types.len()
self.params.len()
}
Copy link
Member

Choose a reason for hiding this comment

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

This method can be inlined everywhere it's used.

regions.into_iter().map(|lt| ty::GenericParam::Lifetime(lt)).collect();
let types: Vec<ty::GenericParam> =
types.into_iter().map(|ty| ty::GenericParam::Type(ty)).collect();
let params = lifetimes.into_iter().chain(types.into_iter()).collect();
Copy link
Member

Choose a reason for hiding this comment

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

This should ideally not allocate for "lifetimes" / "types".

if let Some(index) = param.index.checked_sub(self.parent_count() as u32) {
&self.regions[index as usize - self.has_self as usize]
if let Some(index) = param.index.checked_sub(self.parent_count as u32) {
// We're currently assuming that lifetimes precede other generic parameters.
Copy link
Member

Choose a reason for hiding this comment

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

Self should come before lifetimes, such that indexing is trivial.

}
};
assert_eq!(def.index() as usize, substs.len());
substs.push(param.pack());
Copy link
Member

Choose a reason for hiding this comment

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

Please do not call pack outside of the From impls.

@bors
Copy link
Collaborator

bors commented Mar 6, 2018

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

@bors bors 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 Mar 6, 2018
@varkor varkor force-pushed the generics-ty-generalisations branch from b4dbc02 to d0b0eb7 Compare March 8, 2018 10:34
@bors
Copy link
Collaborator

bors commented Mar 8, 2018

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

@varkor varkor force-pushed the generics-ty-generalisations branch 2 times, most recently from 937afe9 to 689b927 Compare March 8, 2018 12:12
@pietroalbini pietroalbini added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 12, 2018
@pietroalbini
Copy link
Member

@eddyb ping from triage! This PR has new commits that needs to be reviewed.

@varkor varkor force-pushed the generics-ty-generalisations branch from 8c72a03 to 5ea91ac Compare May 15, 2018 13:25
@rust-highfive

This comment has been minimized.

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 15, 2018
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented May 15, 2018

📌 Commit 5be2bdb 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 May 15, 2018
@kennytm
Copy link
Member

kennytm commented May 15, 2018

@bors p=1

Unblocks #48149.

@bors
Copy link
Collaborator

bors commented May 15, 2018

⌛ Testing commit 5be2bdb with merge e44fc6c...

bors added a commit that referenced this pull request May 15, 2018
…akis

The Great Generics Generalisation: Ty Edition

Part of the generic parameter refactoring effort, split off from #48149. Contains the `ty`-relative refactoring.

r? @eddyb
@bors
Copy link
Collaborator

bors commented May 16, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing e44fc6c to master...

@bors bors merged commit 5be2bdb into rust-lang:master May 16, 2018
@rust-highfive
Copy link
Contributor

📣 Toolstate changed by #48523!

Tested on commit e44fc6c.
Direct link to PR: #48523

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request May 16, 2018
Tested on commit rust-lang/rust@e44fc6c.
Direct link to PR: <rust-lang/rust#48523>

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants