Make regionck care about placeholders in outlives components#118000
Merged
bors merged 1 commit intorust-lang:masterfrom Nov 20, 2023
Merged
Make regionck care about placeholders in outlives components#118000bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
compiler-errors
commented
Nov 17, 2023
| = note: `#[warn(incomplete_features)]` on by default | ||
|
|
||
| warning: 1 warning emitted | ||
| error[E0309]: the placeholder type `!1_"F"` may not live long enough |
Contributor
Author
There was a problem hiding this comment.
I don't really care about fixing this diagnostic regression for now, since it's behind a super unstable feature gate.
| @@ -0,0 +1,14 @@ | |||
| #![feature(negative_impls)] | |||
Contributor
Author
There was a problem hiding this comment.
This currently fails on nightly for the same root cause as #117994. Only after that PR is this behavior exploitable. I'm just committing this test here, though, since it should not regress.
aliemjay
reviewed
Nov 19, 2023
Contributor
aliemjay
left a comment
There was a problem hiding this comment.
Makes sense. You can r=me after the nits.
r? aliemjay
tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs
Outdated
Show resolved
Hide resolved
b85f1e2 to
8f267e2
Compare
Contributor
Author
|
@bors r=aliemjay |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 20, 2023
…mpiler-errors Rollup of 8 pull requests Successful merges: - rust-lang#117828 (Avoid iterating over hashmaps in astconv) - rust-lang#117832 (interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch) - rust-lang#117891 (Recover `dyn` and `impl` after `for<...>`) - rust-lang#117957 (if available use a Child's pidfd for kill/wait) - rust-lang#117988 (Handle attempts to have multiple `cfg`d tail expressions) - rust-lang#117994 (Ignore but do not assume region obligations from unifying headers in negative coherence) - rust-lang#118000 (Make regionck care about placeholders in outlives components) - rust-lang#118068 (subtree update cg_gcc 2023/11/17) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 20, 2023
…tthiaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#117828 (Avoid iterating over hashmaps in astconv) - rust-lang#117832 (interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch) - rust-lang#117891 (Recover `dyn` and `impl` after `for<...>`) - rust-lang#117957 (if available use a Child's pidfd for kill/wait) - rust-lang#117988 (Handle attempts to have multiple `cfg`d tail expressions) - rust-lang#117994 (Ignore but do not assume region obligations from unifying headers in negative coherence) - rust-lang#118000 (Make regionck care about placeholders in outlives components) - rust-lang#118068 (subtree update cg_gcc 2023/11/17) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 20, 2023
Rollup merge of rust-lang#118000 - compiler-errors:placeholder-ty-outlives, r=aliemjay Make regionck care about placeholders in outlives components Currently, we don't consider a placeholder type `!T` to be a type component when it comes to processing type-outlives obligations. This means that they are essentially treated like unit values with no sub-components, and always outlive any region. This is problematic for `non_lifetime_binders`, and even more problematic for `with_negative_coherence`, since negative coherence uses placeholders as universals. This PR adds `Component::Placeholder` which acts much like `Component::Param`. This currently causes a regression in some non-lifetime-binders tests because `for<T> T: 'static` doesn't imply itself when processing outlives obligations, so code like this will fail: ``` fn foo() where for<T> T: 'static { foo() //~ fails } ``` Since the where clause doesn't imply itself. This requires making the `MatchAgainstHigherRankedOutlives` relation smarter when it comes to binders. r? types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, we don't consider a placeholder type
!Tto be a type component when it comes to processing type-outlives obligations. This means that they are essentially treated like unit values with no sub-components, and always outlive any region. This is problematic fornon_lifetime_binders, and even more problematic forwith_negative_coherence, since negative coherence uses placeholders as universals.This PR adds
Component::Placeholderwhich acts much likeComponent::Param. This currently causes a regression in some non-lifetime-binders tests becausefor<T> T: 'staticdoesn't imply itself when processing outlives obligations, so code like this will fail:Since the where clause doesn't imply itself. This requires making the
MatchAgainstHigherRankedOutlivesrelation smarter when it comes to binders.r? types