-
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
beta regression: assembunny-plus 0.0.3 #40951
Comments
OK, I did some digging around. I believe this regression is a bug. Here is a minimal test case: const FOO: [&'static str; 1] = ["foo"];
fn find<T: PartialEq>(t: &[T], element: &T) { }
fn main() {
let x = format!("hi");
find(&FOO, &&*x);
} Specifically what is happening is that we used to infer the cc @eddyb |
(Nominating for compiler team triage -- I can't attend mtg this week, but suggest P-high.) |
There should be enough subtyping to make that work, I'm not sure where it goes wrong. It's broken on nightly too, right? |
This is actually #18653. I will see about fixing that. |
I'm going to mark this as P-high and assign myself. I am investigating. |
triage: P-high |
assigning niko to hold him to his earlier comment. 😄 |
Backports are best in by this friday, next thursday is the absolute deadline. cc @nikomatsakis |
@brson working on it :) |
When we are generalizing a super/sub-type, we have to replace type variables with a fresh variable (and not just region variables). So if we know that `Box<?T> <: ?U`, for example, we instantiate `?U` with `Box<?V>` and then relate `Box<?T>` to `Box<?V>` (and hence require that `?T <: ?V`). This change has some complex interactions, however: First, the occurs check must be updated to detect constraints like `?T <: ?U` and `?U <: Box<?T>`. If we're not careful, we'll create a never-ending sequence of new variables. To address this, we add a second unification set into `type_variables` that tracks type variables related through **either** equality **or** subtyping, and use that during the occurs-check. Second, the "fudge regions if ok" code was expecting no new type variables to be created. It must be updated to create new type variables outside of the probe. This is relatively straight-forward under the new scheme, since type variables are now independent from one another, and any relations are moderated by pending subtype obliations and so forth. This part would be tricky to backport though. cc rust-lang#18653 cc rust-lang#40951
OK, this is fixed be #40570, but I think I also have a more tailored fix that we can backport to beta. |
Status:
|
After discussion in the @rust-lang/compiler meeting, we decided not to backport the fix for this to beta, as it is non-trivial. The problem is fixed on nightly, and I'll offer a patch to the |
Looks fixed on nightly in assembunny-plus as well, and due to decision to not backport closing. Thanks for the fixes @nikomatsakis! |
The assembunny-plus crate has regressed on beta:
cc @broad-well
broad-well/assembunny-plus@4ed0f0d
The text was updated successfully, but these errors were encountered: