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

make lifetimes that only appear in return type early-bound #38897

Merged
merged 1 commit into from
Feb 6, 2017

Conversation

nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Jan 6, 2017

This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the ui test), sending users over to the tracking issue for a fuller explanation and offering a --explain message in some cases.

This needs a crater run before we land.

r? @arielb1

@nikomatsakis
Copy link
Contributor Author

Oh I forgot-- I should deprecate the older fwds-compat lint too. And maybe improve wording of error message? Not sure how to do that.

@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Jan 9, 2017

Crater run results: https://gist.github.com/nikomatsakis/25076c557d1c7d5ce3bcbacffdc953c9

Root regressions, sorted by rank:

@nikomatsakis
Copy link
Contributor Author

Some of the failures above may be addressed by fixing #33684, though I'm not sure. In any case, I can try to submit PRs to address the issues.

@arielb1
Copy link
Contributor

arielb1 commented Jan 19, 2017

Will review later today. Sorry I missed this.

// are named regions appearing in fn arguments that do not appear
// in where-clauses
pub late_bound: NodeMap<ty::Issue32330>,
// the set of lifetime def ids that are early-bound; early-bound
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be "that are late-bound".

@@ -637,8 +638,7 @@ impl<'tcx> RegionParameterDef<'tcx> {
}

pub fn to_bound_region(&self) -> ty::BoundRegion {
// this is an early bound region, so unaffected by #32330
ty::BoundRegion::BrNamed(self.def_id, self.name, Issue32330::WontChange)
ty::BoundRegion::BrNamed(self.def_id, self.name, self.issue_32330)
Copy link
Contributor

@arielb1 arielb1 Jan 19, 2017

Choose a reason for hiding this comment

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

So we're having that big enum on every ty::Region? I suppose we should intern the (DefId, Name, Issue32230) triple and check the perf impact. Maybe just do bitpacking to fit BoundRegion in a u32 - should check the perf impact of that.

Copy link
Contributor

@arielb1 arielb1 left a comment

Choose a reason for hiding this comment

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

r+ after we communicate with the crater crate authors and fix nits.

@arielb1
Copy link
Contributor

arielb1 commented Jan 20, 2017

tidy check (x86_64-unknown-linux-gnu)

duplicate error code: 573

/checkout/src/librustc_typeck/diagnostics.rs:4138:     E0573: r##"

/checkout/src/librustc_resolve/diagnostics.rs:1544:     E0573,

duplicate error code: 574

/checkout/src/librustc_typeck/diagnostics.rs:4175:     E0574: r##"

/checkout/src/librustc_resolve/diagnostics.rs:1545:     E0574,

thread 'main' panicked at 'some tidy checks failed', /checkout/src/tools/tidy/src/main.rs:55

note: Run with `RUST_BACKTRACE=1` for a backtrace.

@nikomatsakis
Copy link
Contributor Author

@arielb1 ok I will follow-up prob tomorrow...

@nikomatsakis nikomatsakis force-pushed the issue-32330-followup branch 2 times, most recently from 2fcd11c to eaa72d7 Compare January 25, 2017 22:11
@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Jan 25, 2017

OK, this PR is ready to land. OK, this PR is almost ready to land, see below. =)

The following are the "core crates" that appear to be affected by this change:

These crates will have to be fixed -- hopefully they are getting a lint warning now about future compatibility, though I'm not sure if the lint covers all the cases that are affected by the proper fix (that is quite challenging). Let me know if you are having trouble updating -- if I find time, I will try to prep some PRs. =)

In addition, a number of crates were affected indirectly, because they relied on an older serde release that is affected. In these cases, the ideal thing is that they would update to a modern version of serde:

We could also solve this by a new point release of the relevant serde crates (cc @dtolnay, @erickt).

UPDATE: @erickt helpfully patched serde, so this should be ok.

@nikomatsakis
Copy link
Contributor Author

@arielb1

So we're having that big enum on every ty::Region? I suppose we should intern the (DefId, Name, Issue32230) triple and check the perf impact. Maybe just do bitpacking to fit BoundRegion in a u32 - should check the perf impact of that.

Ah, I missed this comment. Yes, that's a reasonable point. I'll take a look and see what I can do.

@nikomatsakis
Copy link
Contributor Author

@arielb1

So we're having that big enum on every ty::Region? I suppose we should intern the (DefId, Name, Issue32230) triple and check the perf impact. Maybe just do bitpacking to fit BoundRegion in a u32 - should check the perf impact of that.

Fixed in latest commit. PR should be good to go.

@eddyb
Copy link
Member

eddyb commented Jan 27, 2017

  • cycling Travis to force a build from it

@bors
Copy link
Contributor

bors commented Jan 28, 2017

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

@nikomatsakis nikomatsakis force-pushed the issue-32330-followup branch 3 times, most recently from e8e60a6 to a611487 Compare February 5, 2017 20:56
nikomatsakis added a commit to nikomatsakis/lmdb-rs that referenced this pull request Feb 5, 2017
This is a problem with the code uncovered by
the fix in rust-lang/rust#38897
This is the full and proper fix for rust-lang#32330. This also makes some effort
to give a nice error message (as evidenced by the `ui` test), sending
users over to the tracking issue for a full explanation.
nikomatsakis added a commit to nikomatsakis/pippin that referenced this pull request Feb 5, 2017
These were found due to the compiler fixes in rust-lang/rust#38897
@nikomatsakis
Copy link
Contributor Author

@bors r=arielb1

@bors
Copy link
Contributor

bors commented Feb 5, 2017

📌 Commit b26120d has been approved by arielb1

@bors
Copy link
Contributor

bors commented Feb 5, 2017

⌛ Testing commit b26120d with merge a3da24b...

bors added a commit that referenced this pull request Feb 5, 2017
make lifetimes that only appear in return type early-bound

This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the `ui` test), sending users over to the tracking issue for a fuller explanation and offering a `--explain` message in some cases.

This needs a crater run before we land.

r? @arielb1
@bors
Copy link
Contributor

bors commented Feb 6, 2017

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

@bors bors merged commit b26120d into rust-lang:master Feb 6, 2017
@nikomatsakis nikomatsakis added the relnotes Marks issues that should be documented in the release notes of the next release. label Mar 2, 2017
@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Mar 2, 2017

Tagging this for release notes. Something like this:

"Lifetime parameters that do not appear in the arguments are now considered early-bound, resolving a soundness bug (#32330). The hr_lifetime_in_assoc_type future-compatibility lint has been in effect since April of 2016."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants