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

Projections, lifetimes, and WF tracking issue (RFC 1214) #27579

Closed
9 of 17 tasks
nikomatsakis opened this issue Aug 7, 2015 · 13 comments
Closed
9 of 17 tasks

Projections, lifetimes, and WF tracking issue (RFC 1214) #27579

nikomatsakis opened this issue Aug 7, 2015 · 13 comments
Labels
A-typesystem Area: The type system B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. S-tracking-needs-summary Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language 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

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Aug 7, 2015

Tracking issue for rust-lang/rfcs#1214

After warning cycle is complete

  • Remove old WF check
  • Remove RFC1214 origins and warnings
  • Remove special treatment of ReEmpty in the outlives relation

Testing chart

Subject Tests Issues
OutlivesScalar regions-outlives-scalar.rs
OutlivesNominalType regions-outlives-nominal-type-struct.rs
regions-outlives-nominal-type-enum.rs
OutlivesReference all of the other tests
OutlivesObject compile-fail/wf-in-obj-type-static.rs
OutlivesProjectionEnv compile-fail/wf-in-obj-type-static.rs
WfObject, lifetime bounds compile-fail/regions-wf-trait-object.rs
WfSlice compile-file/wf-array-elem-sized.rs
const wf-const-type.rs
struct, bound wf-struct-bound.rs
struct, field ...many other tests...
enum, bound wf-enum-bound.rs
enum, field ...many other tests...
trait, bound wf-trait-bound.rs
trait, assoc type default wf-trait-associated-type-trait.rs
wf-trait-associated-type-region.rs
trait, assoc type bound wf-trait-associated-type-bound.rs
trait, default fn, arg wf-trait-default-fn-arg.rs
trait, default fn, return wf-trait-default-fn-ret.rs
trait, default fn, where clause wf-trait-default-fn-where-clause.rs
trait, fn, arg wf-trait-fn-arg.rs
trait, fn, return wf-trait-fn-ret.rs
trait, fn, where clause wf-trait-fn-where-clause.rs
fn item, argument type wf-in-fn-arg.rs
fn item, return type wf-in-fn-ret.rs
fn item, where clause wf-in-fn-where-clause.rs
inherent impl, where clause wf-inherent-impl-where-clause.rs
inherent impl, fn, where clause wf-inherent-impl-method-where-clause.rs
impl, assoc type default wf-impl-associated-type-region.rs
wf-impl-associated-type-trait.rs
fn type, argument type wf-in-fn-type-arg.rs
fn type, return type wf-in-fn-type-ret.rs
wf-in-fn-type-static.rs
object type arg compile-fail/wf-in-obj-type-static.rs
compile-fail/wf-in-obj-type-region.rs
object safety compile-fail/wf-object-safe.rs #21953
fn(T): 'a affects T compile-fail/wf-outlives-ty-in-fn-or-trait.rs
OutlivesProjection* compile-fail/associated-types-outlives.rs #24622
OutlivesProjection* compile-fail/regions-assoc-type-outlives-container*.rs
OutlivesProjectionComponents compile-fail/regions-close-associated-type-into-object.rs
implied bounds projection gap compile-fail/regions-implied-bounds-projection-gap*rs
@jroesch
Copy link
Member

jroesch commented Aug 9, 2015

cc me

@jroesch jroesch added the A-typesystem Area: The type system label Aug 9, 2015
bors added a commit that referenced this issue Aug 14, 2015
This PR implements the majority of RFC 1214. In particular, it implements:

- the new outlives relation
- comprehensive WF checking

For the most part, new code receives warnings, not errors, though 3 regressions were found via a crater run. 

There are some deviations from RFC 1214. Most notably:

- we still consider implied bounds from fn ret; this intersects other soundness issues that I intend to address in detail in a follow-up RFC. Fixing this without breaking a lot of code probably requires rewriting compare-method somewhat (which is probably a good thing).
- object types do not check trait bounds for fear of encountering `Self`; this was left as an unresolved question in RFC 1214, but ultimately feels inconsistent.

Both of those two issues are highlighted in the tracking issue, #27579. #27579 also includes a testing matrix with new tests that I wrote -- these probably duplicate some existing tests, I tried to check but wasn't quite sure what to look for. I tried to be thorough in testing the WF relation, at least, but would welcome suggestions for missing tests.

r? @nrc (or perhaps someone else?)
@frewsxcv
Copy link
Member

frewsxcv commented Sep 5, 2015

#27592 and #27583 can be checked-off in the original description

also, is there a way to determine which crates are impacted by the changes proposed by RFC 1214?

@mitchmindtree
Copy link
Contributor

Just wanted to mention that I'm really excited for these changes to land on stable 😸 I have a lot of where clauses that look something like this:

where
    P::HLI: 'a + 'b,
    P::PatternGenerator: 'a + 'b,
    P::PhraseGenerator: 'a + 'b,
    P::Instrument: 'a + 'b,
    <P::Instrument as Instrument>::Source: 'a + 'b,
    P::Effect: 'a + 'b,
    P::Sample: 'a + 'b,
    P::BusId: 'a + 'b,

If I understand these WF changes correctly, they will save me hundreds of lines being able to simply write

where P: 'a + 'b`

instead.

@Stebalien
Copy link
Contributor

Also fixes #21837.

@nikomatsakis
Copy link
Contributor Author

@Stebalien

Also fixes #21837.

Not quite, because the interaction of implied bounds with variance is still not being properly handled.

@Stebalien
Copy link
Contributor

@nikomatsakis sorry, it fixes the current test case so I assumed it fixed the bug.

@mitchmindtree
Copy link
Contributor

I'd love to know the status of this 😸

BTW, It looks like we may be able to check off some of the related issues in the original comment: #24622, #23442, #21748, #25692, #21953 and as @frewsxcv mentioned, #27592 and #27583.

@nikomatsakis nikomatsakis added the P-high High priority label Jan 18, 2016
@brson
Copy link
Contributor

brson commented Jun 23, 2016

@nikomatsakis Is this still P-high? Can it be lowered or assigned?

@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 23, 2016
@pnkfelix
Copy link
Member

assigning to self to double-check what's done and what's not

@pnkfelix pnkfelix self-assigned this Jun 23, 2016
@pnkfelix
Copy link
Member

pnkfelix commented Jul 7, 2016

I don't know with tracking issues in terms of the P-markings. I treat tracking bugs like this like metabugs, so I'm going to remove the P-high since I don't think we should assign priorities to metabugs.

@pnkfelix pnkfelix removed P-high High priority I-nominated labels Jul 7, 2016
critiqjo pushed a commit to critiqjo/rustdoc that referenced this issue Dec 16, 2016
This PR implements the majority of RFC 1214. In particular, it implements:

- the new outlives relation
- comprehensive WF checking

For the most part, new code receives warnings, not errors, though 3 regressions were found via a crater run. 

There are some deviations from RFC 1214. Most notably:

- we still consider implied bounds from fn ret; this intersects other soundness issues that I intend to address in detail in a follow-up RFC. Fixing this without breaking a lot of code probably requires rewriting compare-method somewhat (which is probably a good thing).
- object types do not check trait bounds for fear of encountering `Self`; this was left as an unresolved question in RFC 1214, but ultimately feels inconsistent.

Both of those two issues are highlighted in the tracking issue, rust-lang/rust#27579. #27579 also includes a testing matrix with new tests that I wrote -- these probably duplicate some existing tests, I tried to check but wasn't quite sure what to look for. I tried to be thorough in testing the WF relation, at least, but would welcome suggestions for missing tests.

r? @nrc (or perhaps someone else?)
@Mark-Simulacrum Mark-Simulacrum added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Jul 22, 2017
@pnkfelix
Copy link
Member

unassigning self; i haven't done anything with this and I don't think I'm the right person to take charge here.

@pnkfelix pnkfelix removed their assignment Feb 21, 2019
@jonas-schievink jonas-schievink added the B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. label Aug 16, 2019
@pnkfelix
Copy link
Member

pnkfelix commented Mar 4, 2022

Discussed at today's T-compiler backlog bonanza.

@rustbot label +T-lang +WG-traits +S-tracking-needs-summary

@rustbot rustbot added S-tracking-needs-summary Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation. T-lang Relevant to the language 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 Mar 4, 2022
@nikomatsakis
Copy link
Contributor Author

Discussed in @rust-lang/types triage today. Decided to close this issue -- RFC 1214 is long-since stabilized, and the work on a-mir-formality will help us deal with ensuring exhaustive testing.

spikespaz pushed a commit to spikespaz/dotwalk-rs that referenced this issue Aug 29, 2024
This PR implements the majority of RFC 1214. In particular, it implements:

- the new outlives relation
- comprehensive WF checking

For the most part, new code receives warnings, not errors, though 3 regressions were found via a crater run. 

There are some deviations from RFC 1214. Most notably:

- we still consider implied bounds from fn ret; this intersects other soundness issues that I intend to address in detail in a follow-up RFC. Fixing this without breaking a lot of code probably requires rewriting compare-method somewhat (which is probably a good thing).
- object types do not check trait bounds for fear of encountering `Self`; this was left as an unresolved question in RFC 1214, but ultimately feels inconsistent.

Both of those two issues are highlighted in the tracking issue, rust-lang/rust#27579. #27579 also includes a testing matrix with new tests that I wrote -- these probably duplicate some existing tests, I tried to check but wasn't quite sure what to look for. I tried to be thorough in testing the WF relation, at least, but would welcome suggestions for missing tests.

r? @nrc (or perhaps someone else?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. S-tracking-needs-summary Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language 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

No branches or pull requests

10 participants