-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
ReErased regions are local #107688
ReErased regions are local #107688
Conversation
r? @wesleywiser (rustbot has picked a reviewer for you, use r? to override) |
Is there any explanation for why this fixes the issue? The description is a bit light |
Ok so basically there's this function rust/compiler/rustc_middle/src/ty/visit.rs Lines 160 to 165 in 0c13c17
For example: fn generic<T>() {
let a = Vec::<i32>::new(); // The type `Vec<i32>` is "global".
let a = Vec::<T>::new(); // The type `Vec<T>` is "local", because it depends on `T`.
} This information is then used to "simplify" trait resolution in several places, for example: (1): rust/compiler/rustc_middle/src/ty/mod.rs Lines 1722 to 1728 in 0c13c17
(2): rust/compiler/rustc_trait_selection/src/traits/select/mod.rs Lines 1005 to 1014 in 0c13c17
(3): rust/compiler/rustc_trait_selection/src/traits/fulfill.rs Lines 629 to 639 in 0c13c17
In particular, for the following code, (1) will delete the caller bounds from this code if the lifetime impl<'a> Trait1 for &'a str
where
&'a str: Trait2 // <- the caller bounds
{
fn foo(_: <&'a str as Trait2>::Assoc) {}
} As far as I can tell this has been wrong forever, but in most real-world cases happened to "work fine" until recently, presumably due to caching. In particular this code happens compile (mostly) fine if Additionally, (3) will lead to worse diagnostics for https://github.com/rust-lang/rust/blob/0c13c172507f01d921808107d2c4ec37b43b982d/tests/ui/recursion/issue-83150.rs at best and cause catastrophic unsoundness at worst, but I haven't been able to produce a concrete example for this and it might not be an issue at all. This patch fixes all of the above by considering Update: After looking at this again, it seems like (2) is actually a no-op since |
Would a bisect help, as this has started happening relatively recently? |
Bisect for the vector issue is in #107440 (comment), which points at the rollup #104600. This regressed in #104411. (I manually checked the try build from #104600 (comment)) Both #107267 and #104411 only reveal this issue. This has been broken since these kind of where clauses have been allowed in 1.7.0: godbolt link. |
Curious to see what happens to perf with this. Other than that, I guess this is technically ok -- @bors try @rust-timer queue cc @rust-lang/types |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit e2a1a2a with merge 1c249e27a88dc284475b988d5fea5ec8f06f8ae8... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
r=me with good perf |
Finished benchmarking commit (1c249e27a88dc284475b988d5fea5ec8f06f8ae8): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking 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 Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
very nice @bors r=jackh726 |
@bors p=20 This is blocking Cargo's CI (and I assume others). |
Rust 1.67.0 introduced a regression that caused an ICE when building Vector. https://hydra.nixos.org/build/207931877 rust-lang/rust#107691 rust-lang/rust#107688
☀️ Test successful - checks-actions |
Rust 1.67.0 introduced a regression that caused an ICE when building Vector. https://hydra.nixos.org/build/207931877 rust-lang/rust#107691 rust-lang/rust#107688
Finished benchmarking commit (b082e80): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
fix #107678
fix #107684
fix #107686
fix #107691
fix #107730