rust
rust copied to clipboard
Fix implied outlives bounds logic for projections
The logic here is subtly wrong. I put a bit of an explanation in a767d7b5165cea8ee5cbe494a4a636c50ef67c9c.
TL;DR: we register outlives predicates to be proved, because wf code normalizes projections (from the unnormalized types) to type variables. This causes us to register those as constraints instead of implied. This was "fine", because we later added that implied bound in the normalized type, and delayed registering constraints. When I went to cleanup free_region_relations to not delay adding constraints, this bug was uncovered.
cc. @aliemjay because this caused your test failure in #99832 (I only realized as I was writing this)
r? @nikomatsakis
@bors try
:hourglass: Trying commit 79367191d3c2148648e4167e4e366a538c2f7650 with merge 77b749d3ae4f115e3b8cef8a0e20da0998461320...
The job dist-x86_64-linux failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
[2022-09-11T09:06:41Z DEBUG collector::execute] Benchmark iteration 1/1
[2022-09-11T09:06:41Z INFO collector::execute] run_rustc with incremental=false, profile=Debug, scenario=Some(Full), patch=None
[2022-09-11T09:06:41Z DEBUG collector::execute] "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "rustc" "--manifest-path" "Cargo.toml" "-p" "file:///tmp/.tmpRowc8Z#[email protected]" "--features=client,http1,http2,server,stream" "--" "--wrap-rustc-with" "Eprintln"
Finished benchmark hyper-0.14.18 (3/7)
collector error: Failed to profile 'hyper-0.14.18' with Eprintln, recorded: expected success, got exit status: 101
stderr= Compiling hyper v0.14.18 (/tmp/.tmpRowc8Z)
thread 'main' panicked at 'command did not complete successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--crate-name" "hyper" "--edition=2018" "src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "embed-bitcode=no" "-C" "debuginfo=2" "--cfg" "feature=\"client\"" "--cfg" "feature=\"default\"" "--cfg" "feature=\"h2\"" "--cfg" "feature=\"http1\"" "--cfg" "feature=\"http2\"" "--cfg" "feature=\"server\"" "--cfg" "feature=\"stream\"" "-C" "metadata=768f0c04e21aba47" "-C" "extra-filename=-768f0c04e21aba47" "--out-dir" "/tmp/.tmpRowc8Z/target/debug/deps" "-C" "linker=clang" "-L" "dependency=/tmp/.tmpRowc8Z/target/debug/deps" "--extern" "bytes=/tmp/.tmpRowc8Z/target/debug/deps/libbytes-5e8424a0f7103369.rmeta" "--extern" "futures_channel=/tmp/.tmpRowc8Z/target/debug/deps/libfutures_channel-67fe39b4da76530d.rmeta" "--extern" "futures_core=/tmp/.tmpRowc8Z/target/debug/deps/libfutures_core-2cccdbab4f5fe80d.rmeta" "--extern" "futures_util=/tmp/.tmpRowc8Z/target/debug/deps/libfutures_util-6995f12715d86cf5.rmeta" "--extern" "h2=/tmp/.tmpRowc8Z/target/debug/deps/libh2-f02f007a0c3becce.rmeta" "--extern" "http=/tmp/.tmpRowc8Z/target/debug/deps/libhttp-4da2cfc5497c929c.rmeta" "--extern" "http_body=/tmp/.tmpRowc8Z/target/debug/deps/libhttp_body-b3012d31e53829d4.rmeta" "--extern" "httparse=/tmp/.tmpRowc8Z/target/debug/deps/libhttparse-f903fce033082f33.rmeta" "--extern" "httpdate=/tmp/.tmpRowc8Z/target/debug/deps/libhttpdate-bf6df8bd166604f2.rmeta" "--extern" "itoa=/tmp/.tmpRowc8Z/target/debug/deps/libitoa-02bdd2be5ac8e9f1.rmeta" "--extern" "pin_project_lite=/tmp/.tmpRowc8Z/target/debug/deps/libpin_project_lite-d4223cfaa04037d7.rmeta" "--extern" "tokio=/tmp/.tmpRowc8Z/target/debug/deps/libtokio-a385249852872367.rmeta" "--extern" "tower_service=/tmp/.tmpRowc8Z/target/debug/deps/libtower_service-a0bac867cff4e01f.rmeta" "--extern" "tracing=/tmp/.tmpRowc8Z/target/debug/deps/libtracing-ef3c41caadd020c0.rmeta" "--extern" "want=/tmp/.tmpRowc8Z/target/debug/deps/libwant-b283267483779076.rmeta" "-Adeprecated" "-Aunknown-lints" "-Zincremental-verify-ich"', collector/src/rustc-fake.rs:24:5
error: could not compile `hyper`
stdout=
:broken_heart: Test failed - checks-actions
Spurious?
@bors try
:hourglass: Trying commit 79367191d3c2148648e4167e4e366a538c2f7650 with merge d752302224558bd75a97bd19853f642147a9d13b...
:broken_heart: Test failed - checks-actions
The job dist-x86_64-linux failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
[2022-09-11T09:34:25Z DEBUG collector::execute] Benchmark iteration 1/1
[2022-09-11T09:34:26Z INFO collector::execute] run_rustc with incremental=false, profile=Debug, scenario=Some(Full), patch=None
[2022-09-11T09:34:26Z DEBUG collector::execute] "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "rustc" "--manifest-path" "Cargo.toml" "-p" "file:///tmp/.tmpM6D8Fk#[email protected]" "--features=client,http1,http2,server,stream" "--" "--wrap-rustc-with" "Eprintln"
Finished benchmark hyper-0.14.18 (3/7)
collector error: Failed to profile 'hyper-0.14.18' with Eprintln, recorded: expected success, got exit status: 101
stderr= Compiling hyper v0.14.18 (/tmp/.tmpM6D8Fk)
thread 'main' panicked at 'command did not complete successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--crate-name" "hyper" "--edition=2018" "src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "embed-bitcode=no" "-C" "debuginfo=2" "--cfg" "feature=\"client\"" "--cfg" "feature=\"default\"" "--cfg" "feature=\"h2\"" "--cfg" "feature=\"http1\"" "--cfg" "feature=\"http2\"" "--cfg" "feature=\"server\"" "--cfg" "feature=\"stream\"" "-C" "metadata=768f0c04e21aba47" "-C" "extra-filename=-768f0c04e21aba47" "--out-dir" "/tmp/.tmpM6D8Fk/target/debug/deps" "-C" "linker=clang" "-L" "dependency=/tmp/.tmpM6D8Fk/target/debug/deps" "--extern" "bytes=/tmp/.tmpM6D8Fk/target/debug/deps/libbytes-5e8424a0f7103369.rmeta" "--extern" "futures_channel=/tmp/.tmpM6D8Fk/target/debug/deps/libfutures_channel-67fe39b4da76530d.rmeta" "--extern" "futures_core=/tmp/.tmpM6D8Fk/target/debug/deps/libfutures_core-2cccdbab4f5fe80d.rmeta" "--extern" "futures_util=/tmp/.tmpM6D8Fk/target/debug/deps/libfutures_util-6995f12715d86cf5.rmeta" "--extern" "h2=/tmp/.tmpM6D8Fk/target/debug/deps/libh2-f02f007a0c3becce.rmeta" "--extern" "http=/tmp/.tmpM6D8Fk/target/debug/deps/libhttp-4da2cfc5497c929c.rmeta" "--extern" "http_body=/tmp/.tmpM6D8Fk/target/debug/deps/libhttp_body-b3012d31e53829d4.rmeta" "--extern" "httparse=/tmp/.tmpM6D8Fk/target/debug/deps/libhttparse-f903fce033082f33.rmeta" "--extern" "httpdate=/tmp/.tmpM6D8Fk/target/debug/deps/libhttpdate-bf6df8bd166604f2.rmeta" "--extern" "itoa=/tmp/.tmpM6D8Fk/target/debug/deps/libitoa-02bdd2be5ac8e9f1.rmeta" "--extern" "pin_project_lite=/tmp/.tmpM6D8Fk/target/debug/deps/libpin_project_lite-d4223cfaa04037d7.rmeta" "--extern" "tokio=/tmp/.tmpM6D8Fk/target/debug/deps/libtokio-a385249852872367.rmeta" "--extern" "tower_service=/tmp/.tmpM6D8Fk/target/debug/deps/libtower_service-a0bac867cff4e01f.rmeta" "--extern" "tracing=/tmp/.tmpM6D8Fk/target/debug/deps/libtracing-ef3c41caadd020c0.rmeta" "--extern" "want=/tmp/.tmpM6D8Fk/target/debug/deps/libwant-b283267483779076.rmeta" "-Adeprecated" "-Aunknown-lints" "-Zincremental-verify-ich"', collector/src/rustc-fake.rs:24:5
error: could not compile `hyper`
stdout=
@bors try
:hourglass: Trying commit f8f8a505a452d64a978d75d91d8b5c0699c8d2a0 with merge ee93ebe8ef8a3e16bffdd473f324fc515dec2948...
:broken_heart: Test failed - checks-actions
The job dist-x86_64-linux failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
[2022-09-11T17:09:47Z DEBUG collector::execute] Benchmark iteration 1/1
[2022-09-11T17:09:47Z INFO collector::execute] run_rustc with incremental=false, profile=Debug, scenario=Some(Full), patch=None
[2022-09-11T17:09:47Z DEBUG collector::execute] "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "rustc" "--manifest-path" "Cargo.toml" "-p" "file:///tmp/.tmp8aGysl#[email protected]" "--features=client,http1,http2,server,stream" "--" "--wrap-rustc-with" "Eprintln"
Finished benchmark hyper-0.14.18 (3/7)
collector error: Failed to profile 'hyper-0.14.18' with Eprintln, recorded: expected success, got exit status: 101
stderr= Compiling hyper v0.14.18 (/tmp/.tmp8aGysl)
thread 'main' panicked at 'command did not complete successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--crate-name" "hyper" "--edition=2018" "src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "embed-bitcode=no" "-C" "debuginfo=2" "--cfg" "feature=\"client\"" "--cfg" "feature=\"default\"" "--cfg" "feature=\"h2\"" "--cfg" "feature=\"http1\"" "--cfg" "feature=\"http2\"" "--cfg" "feature=\"server\"" "--cfg" "feature=\"stream\"" "-C" "metadata=768f0c04e21aba47" "-C" "extra-filename=-768f0c04e21aba47" "--out-dir" "/tmp/.tmp8aGysl/target/debug/deps" "-C" "linker=clang" "-L" "dependency=/tmp/.tmp8aGysl/target/debug/deps" "--extern" "bytes=/tmp/.tmp8aGysl/target/debug/deps/libbytes-5e8424a0f7103369.rmeta" "--extern" "futures_channel=/tmp/.tmp8aGysl/target/debug/deps/libfutures_channel-67fe39b4da76530d.rmeta" "--extern" "futures_core=/tmp/.tmp8aGysl/target/debug/deps/libfutures_core-2cccdbab4f5fe80d.rmeta" "--extern" "futures_util=/tmp/.tmp8aGysl/target/debug/deps/libfutures_util-6995f12715d86cf5.rmeta" "--extern" "h2=/tmp/.tmp8aGysl/target/debug/deps/libh2-f02f007a0c3becce.rmeta" "--extern" "http=/tmp/.tmp8aGysl/target/debug/deps/libhttp-4da2cfc5497c929c.rmeta" "--extern" "http_body=/tmp/.tmp8aGysl/target/debug/deps/libhttp_body-b3012d31e53829d4.rmeta" "--extern" "httparse=/tmp/.tmp8aGysl/target/debug/deps/libhttparse-f903fce033082f33.rmeta" "--extern" "httpdate=/tmp/.tmp8aGysl/target/debug/deps/libhttpdate-bf6df8bd166604f2.rmeta" "--extern" "itoa=/tmp/.tmp8aGysl/target/debug/deps/libitoa-02bdd2be5ac8e9f1.rmeta" "--extern" "pin_project_lite=/tmp/.tmp8aGysl/target/debug/deps/libpin_project_lite-d4223cfaa04037d7.rmeta" "--extern" "tokio=/tmp/.tmp8aGysl/target/debug/deps/libtokio-a385249852872367.rmeta" "--extern" "tower_service=/tmp/.tmp8aGysl/target/debug/deps/libtower_service-a0bac867cff4e01f.rmeta" "--extern" "tracing=/tmp/.tmp8aGysl/target/debug/deps/libtracing-ef3c41caadd020c0.rmeta" "--extern" "want=/tmp/.tmp8aGysl/target/debug/deps/libwant-b283267483779076.rmeta" "-Adeprecated" "-Aunknown-lints" "-Zincremental-verify-ich"', collector/src/rustc-fake.rs:24:5
error: could not compile `hyper`
stdout=
@bors try
:hourglass: Trying commit 9e6234b294bc5aae0b6fcf8d7b0a73e55459d67d with merge e79c9799a5ffd821c63b799b91e8aa87fd7ebb1e...
The job mingw-check failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
configure: rust.debug-assertions := True
configure: rust.overflow-checks := True
configure: llvm.assertions := True
configure: dist.missing-tools := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure:
configure: run `python /checkout/x.py --help`
Attempting with retry: make prepare
:sunny: Try build successful - checks-actions
Build commit: e79c9799a5ffd821c63b799b91e8aa87fd7ebb1e (e79c9799a5ffd821c63b799b91e8aa87fd7ebb1e)
@craterbot check
:ok_hand: Experiment pr-101680 created and queued.
:robot: Automatically detected try build e79c9799a5ffd821c63b799b91e8aa87fd7ebb1e
:mag: You can check out the queue and this experiment's details.
:information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
:construction: Experiment pr-101680 is now running
:information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
:tada: Experiment pr-101680 is completed!
:bar_chart: 30 regressed and 8 fixed (243192 total)
:newspaper: Open the full report.
:warning: If you notice any spurious failure please add them to the blacklist! :information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
There is indeed a regression in dialectic-tokio-serde-0.1.0. Here's a minimization.
pub trait By<'a, C> {
type Type;
}
pub struct Ref;
impl<'a, T: 'a> By<'a, Ref> for T {
type Type = &'a T;
}
pub trait Transmit<T, C> {
fn send<'a: 'a>(message: <T as By<'a, C>>::Type)
where
T: By<'a, C>;
}
impl<T> Transmit<T, Ref> for () {
fn send<'a: 'a>(_message: <T as By<'a, Ref>>::Type) {}
}
fn main() {}
Haven't looked really into it too much, yet. But this is a bit weird. There actually two reasons why we might end up with T: 'a as a bound: 1) Because of the T: 'a bound on the <T as By<'a, Ref>> impl 2) Because that projection normalizes to &'a T.
Interestingly, if you look at the error message:
error[E0309]: the parameter type `T` may not live long enough
|
help: consider adding an explicit lifetime bound...
|
25| impl<T: 'a> Transmit<T, Ref> for () {
| ++++
there's not really a "reason" there.
However, if you change the type T on the impl to just be = T, then you get the following error on both nightly and in this PR:
error[E0309]: the parameter type `T` may not live long enough
--> src/main.rs:22:5
|
22 | fn send<'a: 'a>(_message: <T as By<'a, Ref>>::Type) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
21 | impl<T: 'a> Transmit<T, Ref> for () {
| ++++
So seems to point towards the lack of the implied bound from &'a T.
@bors try @rust-timer queue
Awaiting bors try build completion.
@rustbot label: +S-waiting-on-perf
:hourglass: Trying commit 488e05cde0e9484ff8aee4e6eb57abc06f4dc931 with merge 8903464aaedc720ac0fcead62a3101ba4f33d2a3...
:sunny: Try build successful - checks-actions
Build commit: 8903464aaedc720ac0fcead62a3101ba4f33d2a3 (8903464aaedc720ac0fcead62a3101ba4f33d2a3)
Queued 8903464aaedc720ac0fcead62a3101ba4f33d2a3 with parent a37499ae66ec5fc52a93d71493b78fb141c32f6b, future comparison URL.
Finished benchmarking commit (8903464aaedc720ac0fcead62a3101ba4f33d2a3): comparison URL.
Overall result: ❌ regressions - no action needed
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
Instruction count
This is a highly reliable metric that was used to determine the overall result at the top of this comment.
| mean[^1] | range | count[^2] | |
|---|---|---|---|
| Regressions ❌ (primary) |
0.3% | [0.3%, 0.3%] | 1 |
| Regressions ❌ (secondary) |
0.3% | [0.3%, 0.3%] | 1 |
| Improvements ✅ (primary) |
- | - | 0 |
| Improvements ✅ (secondary) |
- | - | 0 |
| All ❌✅ (primary) | 0.3% | [0.3%, 0.3%] | 1 |
Max RSS (memory usage)
Results
This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
| mean[^1] | range | count[^2] | |
|---|---|---|---|
| Regressions ❌ (primary) |
- | - | 0 |
| Regressions ❌ (secondary) |
- | - | 0 |
| Improvements ✅ (primary) |
- | - | 0 |
| Improvements ✅ (secondary) |
-2.7% | [-3.1%, -2.3%] | 2 |
| All ❌✅ (primary) | - | - | 0 |
Cycles
Results
This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
| mean[^1] | range | count[^2] | |
|---|---|---|---|
| Regressions ❌ (primary) |
2.8% | [2.8%, 2.8%] | 1 |
| Regressions ❌ (secondary) |
- | - | 0 |
| Improvements ✅ (primary) |
- | - | 0 |
| Improvements ✅ (secondary) |
- | - | 0 |
| All ❌✅ (primary) | 2.8% | [2.8%, 2.8%] | 1 |
[^1]: the arithmetic mean of the percent change [^2]: number of relevant changes
I'll reassign this one for a review
r? rust-lang/compiler
r? types
There is indeed a regression in
dialectic-tokio-serde-0.1.0. Here's a minimization.
should probably add a test for that.
@jackh726 is this PR on hold until we get implied bounds or is there something else you wanted to do here?