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

Stop enabling in_band_lifetimes in rustc_data_structures #91580

Merged
merged 1 commit into from
Dec 6, 2021

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented Dec 6, 2021

There's a conversation started in the tracking issue about possibly unaccepting in_band_lifetimes, but it's used heavily in the compiler, and thus there'd need to be a bunch of PRs like this if that were to happen.

So here's one to see how much of an impact it has. For this crate, at least, it doesn't seem like in-band was a big win -- about half the places that were using it didn't even need a named lifetime.

(Oh, and I removed nll while I was here too, since it didn't seem needed. Let me know if I should put that back.)

r? @petrochenkov

There's a conversation in the tracking issue about possibly unaccepting `in_band_lifetimes`, but it's used heavily in the compiler, and thus there'd need to be a bunch of PRs like this if that were to happen.

So here's one to see how much of an impact it has.

(Oh, and I removed `nll` while I was here too, since it didn't seem needed.  Let me know if I should put that back.)
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 6, 2021
@petrochenkov
Copy link
Contributor

Thanks!
Reviews like #44524 (comment) are very useful.

but it's used heavily in the compiler

Yeah, in-band lifetimes were dogfooded at the time, like many other unstable features.

@bors r+

@bors
Copy link
Contributor

bors commented Dec 6, 2021

📌 Commit 308fd59 has been approved by petrochenkov

@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 Dec 6, 2021
@bors
Copy link
Contributor

bors commented Dec 6, 2021

⌛ Testing commit 308fd59 with merge bc9326d...

@bors
Copy link
Contributor

bors commented Dec 6, 2021

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing bc9326d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 6, 2021
@bors bors merged commit bc9326d into rust-lang:master Dec 6, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 6, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bc9326d): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@scottmcm scottmcm deleted the less-inband-1-of-28 branch December 7, 2021 05:17
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…rochenkov

Remove `in_band_lifetimes` from `rustc_mir_transform`

Like rust-lang#91580, this was inspired by the conversation in rust-lang#44524 about possibly removing the feature from the compiler.  This crate is a heavy `'tcx` user, so is a nice case study.

r? `@petrochenkov`

Three interesting ones:

This one had the `'tcx` declared on the function, despite the trait taking a `'tcx`:
```diff
-impl Visitor<'_> for UsedLocals {
+impl<'tcx> Visitor<'tcx> for UsedLocals {
     fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
```

This one use in-band for one, and underscore for the other:
```diff
-pub fn remove_dead_blocks(tcx: TyCtxt<'tcx>, body: &mut Body<'_>) {
+pub fn remove_dead_blocks<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
```

A spurious name, since there's no single-use-lifetime warning:
```diff
-pub fn run_passes(tcx: TyCtxt<'tcx>, body: &'mir mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>]) {
+pub fn run_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>]) {
```
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…rochenkov

Remove `in_band_lifetimes` from `rustc_mir_transform`

Like rust-lang#91580, this was inspired by the conversation in rust-lang#44524 about possibly removing the feature from the compiler.  This crate is a heavy `'tcx` user, so is a nice case study.

r? ``@petrochenkov``

Three interesting ones:

This one had the `'tcx` declared on the function, despite the trait taking a `'tcx`:
```diff
-impl Visitor<'_> for UsedLocals {
+impl<'tcx> Visitor<'tcx> for UsedLocals {
     fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
```

This one use in-band for one, and underscore for the other:
```diff
-pub fn remove_dead_blocks(tcx: TyCtxt<'tcx>, body: &mut Body<'_>) {
+pub fn remove_dead_blocks<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
```

A spurious name, since there's no single-use-lifetime warning:
```diff
-pub fn run_passes(tcx: TyCtxt<'tcx>, body: &'mir mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>]) {
+pub fn run_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>]) {
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants