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 outlives::{components,verify} agree #97406

Merged
merged 2 commits into from
Jul 15, 2022

Conversation

aliemjay
Copy link
Member

@aliemjay aliemjay commented May 25, 2022

fixes #97405

cc @oli-obk this is should fix #95474 (comment)

r? @oli-obk

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 25, 2022
@aliemjay aliemjay force-pushed the verify-bounds-fix-master branch from a935b8e to 574dd0e Compare May 26, 2022 03:20
@aliemjay aliemjay marked this pull request as ready for review May 26, 2022 03:32
@aliemjay
Copy link
Member Author

r? @oli-obk

@oli-obk oli-obk added the I-types-nominated Nominated for discussion during a types team meeting. label May 27, 2022
@oli-obk
Copy link
Contributor

oli-obk commented May 27, 2022

Nominating for T-types discussion:

fn opaque<F>(_: F) -> impl Iterator { b"".iter() }
fn assert_static<T: 'static>(_: T) {}

fn good_generic_fn<T>() {
    // proving `<OpaqueTy<type_of(async {})> as Iterator>::Item: 'static`
    // somehow requires `T: 'static`.
    assert_static(opaque(async {}).next());
    assert_static(opaque(|| {}).next());
    assert_static(opaque(opaque(async {}).next()).next());
}

does not compile right now, because the T of good_generic_fn is inherited by generators and closures, even if they do not capture any types that relate to T. This PR does not change that, but it instead adjusts the algorithm figuring out which types and lifetimes must be considered for an outlives bound to only look at captured things in the generators or closures.

This scheme already works on stable for simpler cases, but in associated types it breaks down. Thus I nominate for T-types instead of T-lang, since imo this is just-an-impl-bug and the behaviour intended by the lang team.

@aliemjay
Copy link
Member Author

aliemjay commented May 27, 2022

a less contrived example that should be pass now:

fn from_fn<F>(_: F) -> impl IntoIterator<Item = u8> { [] }

fn generic_fn<T>() -> Box<dyn Iterator<Item = u8>> {
    Box::new(from_fn(|| {}).into_iter())
    //~^ ERROR the associated type `<impl IntoIterator<Item = u8> as IntoIterator>::IntoIter` may not live long enough
}

@aliemjay aliemjay force-pushed the verify-bounds-fix-master branch from 574dd0e to de2750f Compare May 27, 2022 15:38
@oli-obk oli-obk added T-types Relevant to the types team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-types-nominated Nominated for discussion during a types team meeting. labels May 27, 2022
@aliemjay
Copy link
Member Author

aliemjay commented May 30, 2022

@rustbot review
@rustbot label S-waiting-on-team

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels May 30, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Jun 15, 2022

Let's see if this opens a zulip thread automagically

@oli-obk oli-obk added the I-types-nominated Nominated for discussion during a types team meeting. label Jun 15, 2022
@aliemjay
Copy link
Member Author

oli-obk is in vacation, so
r? @nikomatsakis

@nikomatsakis choosed you because you recently touched VerifyBounds and types tests, and this PR basically fixes malformed verify bounds for projection tys. Feel free to reassign if you like.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 15, 2022

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 15, 2022
@bors
Copy link
Contributor

bors commented Jun 15, 2022

⌛ Trying commit de2750fde4f48b772a0f60ebfa69192ece57c805 with merge adb581d2e9a6bc04d25a117528c5bb41de56d059...

@bors
Copy link
Contributor

bors commented Jun 15, 2022

☀️ Try build successful - checks-actions
Build commit: adb581d2e9a6bc04d25a117528c5bb41de56d059 (adb581d2e9a6bc04d25a117528c5bb41de56d059)

@rust-timer
Copy link
Collaborator

Queued adb581d2e9a6bc04d25a117528c5bb41de56d059 with parent ebe184a, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (adb581d2e9a6bc04d25a117528c5bb41de56d059): comparison url.

Instruction count

  • Primary benchmarks: 🎉 relevant improvements found
  • Secondary benchmarks: no relevant changes found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-0.8% -0.9% 5
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) -0.8% -0.9% 5

Max RSS (memory usage)

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regression found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
4.1% 4.1% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
2.5% 2.5% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-1.7% -1.7% 1
All 😿🎉 (primary) N/A N/A 0

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

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@aliemjay aliemjay force-pushed the verify-bounds-fix-master branch from fb6a645 to 4215a9f Compare July 14, 2022 00:09
@aliemjay aliemjay force-pushed the verify-bounds-fix-master branch from fcfe34d to 570cf75 Compare July 14, 2022 00:14
@aliemjay
Copy link
Member Author

I have rebased to adjust for NLL diagnostic regressions. The first commit has not changed.

r? @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Jul 14, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jul 14, 2022

📌 Commit 570cf75 has been approved by oli-obk

It is now in the queue for this repository.

@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 Jul 14, 2022
@bors
Copy link
Contributor

bors commented Jul 15, 2022

⌛ Testing commit 570cf75 with merge f097ed2c9de38bd491399e96de8e1f1d1321d2f9...

@bors
Copy link
Contributor

bors commented Jul 15, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 15, 2022
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.......... (60/66)
.....     (66/66)


/checkout/src/test/rustdoc-gui/search-result-display.goml search-result-display... FAILED
[ERROR] (line 5) Error: The following CSS selector "#search-settings" was not found: for command `wait-for: "#search-settings"`
Build completed unsuccessfully in 0:00:46

@jackh726
Copy link
Member

Spurious?

@bors retry

@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 Jul 15, 2022
@bors
Copy link
Contributor

bors commented Jul 15, 2022

⌛ Testing commit 570cf75 with merge b90a0ed...

@bors
Copy link
Contributor

bors commented Jul 15, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing b90a0ed to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 15, 2022
@bors bors merged commit b90a0ed into rust-lang:master Jul 15, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 15, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b90a0ed): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 🎉 relevant improvement found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-0.5% -0.5% 1
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
3.5% 4.4% 2
Regressions 😿
(secondary)
3.1% 3.8% 3
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.1% -2.1% 1
All 😿🎉 (primary) 3.5% 4.4% 2

Cycles

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: no relevant changes found
mean1 max count2
Regressions 😿
(primary)
1.3% 1.3% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-2.5% -2.5% 1
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) -0.6% -2.5% 2

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

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@aliemjay aliemjay deleted the verify-bounds-fix-master branch July 15, 2022 09:04
@jackh726 jackh726 removed the I-types-nominated Nominated for discussion during a types team meeting. label Jul 29, 2022
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. 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. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outlives bounds for projections are broken when used with generators/closures
10 participants