-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Default Type Parameter Fallback: Revival #46206
Default Type Parameter Fallback: Revival #46206
Commits on Nov 27, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 7e8509f - Browse repository at this point
Copy the full SHA 7e8509fView commit details -
Refactor default type parameter fallback
The previous implementation was not very clear, this commit attempts to clarify and clean up the code that applies all defaults.
Configuration menu - View commit details
-
Copy full SHA for f20a4d8 - Browse repository at this point
Copy the full SHA f20a4d8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b07e1b - Browse repository at this point
Copy the full SHA 9b07e1bView commit details -
Configuration menu - View commit details
-
Copy full SHA for b29ba68 - Browse repository at this point
Copy the full SHA b29ba68View commit details -
Ensure defaults are normalized after application
Thanks to @eddyb for bringing this bug to my attention.
Configuration menu - View commit details
-
Copy full SHA for 233397e - Browse repository at this point
Copy the full SHA 233397eView commit details -
Configuration menu - View commit details
-
Copy full SHA for bff6d6b - Browse repository at this point
Copy the full SHA bff6d6bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 28609d5 - Browse repository at this point
Copy the full SHA 28609d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 978bbca - Browse repository at this point
Copy the full SHA 978bbcaView commit details -
infer/mod.rs, infer/type_variable.rs and error.rs were manually rebased due to being moved from librustc/middle/infer/ to librustc/infer
Configuration menu - View commit details
-
Copy full SHA for f279dd6 - Browse repository at this point
Copy the full SHA f279dd6View commit details -
Fix rebase of default-type-param-fallback branch
Had screwed up the rebase of `check/mod.rs`. The error handling code is commented out because I don't know how to rebase it.
Configuration menu - View commit details
-
Copy full SHA for d4654b1 - Browse repository at this point
Copy the full SHA d4654b1View commit details -
Configuration menu - View commit details
-
Copy full SHA for ad30796 - Browse repository at this point
Copy the full SHA ad30796View commit details -
Configuration menu - View commit details
-
Copy full SHA for e1ef324 - Browse repository at this point
Copy the full SHA e1ef324View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9e9f0f - Browse repository at this point
Copy the full SHA b9e9f0fView commit details -
Conservative default type param fallback.
User fallbacks are applied as a last ditch attempt at inference. If a type variable could gain a fallback in the future, it may not unify with anything, for future-proofing. This means adding a default is always backwards-compatible. Check `apply_user_type_parameter_fallback` for the algorithm.
Configuration menu - View commit details
-
Copy full SHA for ce861ae - Browse repository at this point
Copy the full SHA ce861aeView commit details -
Fix regression on diverging fallback, remove old user fallback implem…
…entation. Regression fixed by reverting from rebased version to `default_type_parameters` in master. Renamed it to `apply_diverging_and_numeric_type_parameter_fallback`. Removed the previous algorithm for user fallback.
Configuration menu - View commit details
-
Copy full SHA for 8b44ca5 - Browse repository at this point
Copy the full SHA 8b44ca5View commit details -
Give priority to defaults in fns and impls over defaults in types.
The origin of the type parameter had to be plumbed down to typeck, maybe there is a better way to do it?
Configuration menu - View commit details
-
Copy full SHA for 9239233 - Browse repository at this point
Copy the full SHA 9239233View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9a98d23 - Browse repository at this point
Copy the full SHA 9a98d23View commit details -
Remove default data from TypeVariableValue::Bounded.
We use the default information in TypeVariableData. Also improved some comments.
Configuration menu - View commit details
-
Copy full SHA for ced2600 - Browse repository at this point
Copy the full SHA ced2600View commit details -
Configuration menu - View commit details
-
Copy full SHA for f27f976 - Browse repository at this point
Copy the full SHA f27f976View commit details -
Set OriginOfTyParam for methods.
Fixes bug with default fallback, and small refactorings to default fallback.
Configuration menu - View commit details
-
Copy full SHA for bdda07b - Browse repository at this point
Copy the full SHA bdda07bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3857826 - Browse repository at this point
Copy the full SHA 3857826View commit details -
Tests for default fallback: ui tests, run fail test, more run pass te…
…sts. The tests under bad_messages in ui are the ones that have bad messages that need fixing.
Configuration menu - View commit details
-
Copy full SHA for 5362bbe - Browse repository at this point
Copy the full SHA 5362bbeView commit details -
We only demand equality when we are sure now, fixing bad error messages. We also skip a priority level if we detect a conflict, an improvement over the previous algorithm. But there is a bug related to normalizing dependent defaults, see FIXME.
Configuration menu - View commit details
-
Copy full SHA for 0bd87ef - Browse repository at this point
Copy the full SHA 0bd87efView commit details -
Get normalization of dependent defaults right.
Since this means there are cross-bag dependencies, we use a fixed point algorithm, looping over the bags until we can no longer solve any of them.
Configuration menu - View commit details
-
Copy full SHA for babfa76 - Browse repository at this point
Copy the full SHA babfa76View commit details -
Fallback: Don't skip conflicting defaults.
While this was future-proof wrt API evolution, it is not future proof wrt to compiler evolution, such as making priority levels more fine-grained or just fixing bugs. It's a not very useful behavior and a complexity this feature doesn't need. Refactored the fallback algorithm to be simpler. Just fails on conflicting defaults.
Configuration menu - View commit details
-
Copy full SHA for 14a9420 - Browse repository at this point
Copy the full SHA 14a9420View commit details -
Fallback: Stop relying on sty equality, use rollbacks.
I tried preventing having to rollback inference and being clever with sty equality, but dependent defaults means we need full inference here. All application of defaults goes in the same transaction, again because of dependent defaults. We can't mess with the fulfillment context in a snapshot, so we clone our own fulfillment context. The downside is that if we fail one bag we fail all, which can be very confusing as the user may be presented with several errors when only one of them is the "real one". This is not so bad because we may easily have a heuristic that solves the bags that can be solved in isolation and then puts the complicated cases in a single transaction, making the pathological situation quite rare.
Configuration menu - View commit details
-
Copy full SHA for 423de71 - Browse repository at this point
Copy the full SHA 423de71View commit details -
Make test more focused, and clarify what the bug is. Add new ui test.
Configuration menu - View commit details
-
Copy full SHA for 91da0cc - Browse repository at this point
Copy the full SHA 91da0ccView commit details
Commits on Nov 28, 2017
-
Configuration menu - View commit details
-
Copy full SHA for da4dcad - Browse repository at this point
Copy the full SHA da4dcadView commit details -
Configuration menu - View commit details
-
Copy full SHA for 90a42a8 - Browse repository at this point
Copy the full SHA 90a42a8View commit details
Commits on Nov 29, 2017
-
Test that trait definition owns the default, not the impl.
I don't know if it's what we want but it's how it works now. If we want to keep it then we should forbid writing the default in the impl.
Configuration menu - View commit details
-
Copy full SHA for d84f3ed - Browse repository at this point
Copy the full SHA d84f3edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4753319 - Browse repository at this point
Copy the full SHA 4753319View commit details -
Fix "associated type not found" when using associated type in default.
Makes associated types in defaults less verbose.
Configuration menu - View commit details
-
Copy full SHA for bad548a - Browse repository at this point
Copy the full SHA bad548aView commit details
Commits on Nov 30, 2017
-
If you propagate the origin, you propagate the default. Fixes fallback for field access. Also small refactoring in combine.
Configuration menu - View commit details
-
Copy full SHA for 5c28224 - Browse repository at this point
Copy the full SHA 5c28224View commit details -
Use fallbacks to avoid "the type of this value must be known in this …
…context" Try fallback right in `structurally_resolve_type_or_else` right before we hit "the type of this value must be known in this context". This gets casts working, and probably other things not tested for. Also remove some dead code.
Configuration menu - View commit details
-
Copy full SHA for 973f782 - Browse repository at this point
Copy the full SHA 973f782View commit details -
Fix fallback for
_
placeholders.It seems we have pretty much the same logic in three different places, so it was fixed in three different places. Took the opportunity to leave FIXMEs regarding elision of defaulted params.
Configuration menu - View commit details
-
Copy full SHA for 06e7456 - Browse repository at this point
Copy the full SHA 06e7456View commit details