about summary refs log tree commit diff
path: root/src/librustc_trait_selection/traits/select/mod.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-2436/+0
2020-08-20Don't immediately error for cycles during normalizationMatthew Jasper-2/+8
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-2/+1
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-06Fix typo "TraitObligatiom" -> "TraitObligation"Leijurv-1/+1
2020-08-02Move IntercrateAmbiguityCause to librustc_trait_selection.Camille GILLOT-0/+41
2020-08-02Introduce an abstraction for EvaluationCache and SelectionCache.Camille GILLOT-37/+10
2020-07-27introduce PredicateAtomBastian Kauschke-18/+13
2020-07-27this might be unqualified, but at least it's now quantifiedBastian Kauschke-3/+3
2020-07-27split ignore_qualifiersBastian Kauschke-4/+6
2020-07-27reviewBastian Kauschke-1/+0
2020-07-27`PredicateKint` -> `PredicateKind`, the beginning of the endBastian Kauschke-7/+14
2020-07-15const_eval_resolveBastian Kauschke-1/+1
2020-07-15ConstKind::UnevaluatedBastian Kauschke-2/+2
2020-07-05Shrink ParamEnv to 16 bytesMark Rousskov-1/+1
2020-06-30stop taking references in RelateBastian Kauschke-4/+4
2020-06-22remove snapshot calls from "match" operations during selectNiko Matsakis-24/+5
Motivation: - we want to use leak-check sparingly, first off - these calls were essentially the same as doing the check during subtyping
2020-06-22move leak-check to during coherence, candidate evalNiko Matsakis-5/+7
In particular, it no longer occurs during the subtyping check. This is important for enabling lazy normalization, because the subtyping check will be producing sub-obligations that could affect its results. Consider an example like for<'a> fn(<&'a as Mirror>::Item) = fn(&'b u8) where `<T as Mirror>::Item = T` for all `T`. We will wish to produce a new subobligation like <'!1 as Mirror>::Item = &'b u8 This will, after being solved, ultimately yield a constraint that `'!1 = 'b` which will fail. But with the leak-check being performed on subtyping, there is no opportunity to normalize `<'!1 as Mirror>::Item` (unless we invoke that normalization directly from within subtyping, and I would prefer that subtyping and unification are distinct operations rather than part of the trait solving stack). The reason to keep the leak check during coherence and trait evaluation is partly for backwards compatibility. The coherence change permits impls for `fn(T)` and `fn(&T)` to co-exist, and the trait evaluation change means that we can distinguish those two cases without ambiguity errors. It also avoids recreating #57639, where we were incorrectly choosing a where clause that would have failed the leak check over the impl which succeeds. The other reason to keep the leak check in those places is that I think it is actually close to the model we want. To the point, I think the trait solver ought to have the job of "breaking down" higher-ranked region obligation like ``!1: '2` into into region obligations that operate on things in the root universe, at which point they should be handed off to polonius. The leak check isn't *really* doing that -- these obligations are still handed to the region solver to process -- but if/when we do adopt that model, the decision to pass/fail would be happening in roughly this part of the code. This change had somewhat more side-effects than I anticipated. It seems like there are cases where the leak-check was not being enforced during method proving and trait selection. I haven't quite tracked this down but I think it ought to be documented, so that we know what precisely we are committing to. One surprising test was `issue-30786.rs`. The behavior there seems a bit "fishy" to me, but the problem is not related to the leak check change as far as I can tell, but more to do with the closure signature inference code and perhaps the associated type projection, which together seem to be conspiring to produce an unexpected signature. Nonetheless, it is an example of where changing the leak-check can have some unexpected consequences: we're now failing to resolve a method earlier than we were, which suggests we might change some method resolutions that would have been ambiguous to be successful. TODO: * figure out remainig test failures * add new coherence tests for the patterns we ARE disallowing
2020-06-22rewrite leak check to be based on universesNiko Matsakis-9/+10
In the new leak check, instead of getting a list of placeholders to track, we look for any placeholder that is part of a universe which was created during the snapshot. We are looking for the following error patterns: * P1: P2, where P1 != P2 * P1: R, where R is in some universe that cannot name P1 This new leak check is more precise than before, in that it accepts this patterns: * R: P1, even if R cannot name P1, because R = 'static is a valid sol'n * R: P1, R: P2, as above Note that this leak check, when running during subtyping, is less efficient than before in some sense because it is going to check and re-check all the universes created since the snapshot. We're going to move when the leak check runs to try and correct that.
2020-06-20Auto merge of #73563 - Manishearth:rollup-oowgwwm, r=Manishearthbors-28/+22
Rollup of 9 pull requests Successful merges: - #72456 (Try to suggest dereferences on trait selection failed) - #72788 (Projection bound validation) - #72790 (core/time: Add Duration methods for zero) - #73227 (Allow multiple `asm!` options groups and report an error on duplicate options) - #73287 (lint: normalize projections using opaque types) - #73291 (Pre-compute `LocalDefId` <-> `HirId` mappings and remove `NodeId` <-> `HirId` conversion APIs) - #73378 (Remove use of specialization from librustc_arena) - #73411 (Update bootstrap to rustc 1.45.0-beta.2 (1dc0f6d8e 2020-06-15)) - #73443 (ci: allow gating GHA on everything but macOS) Failed merges: r? @ghost
2020-06-20Consider fewer predicates for projection candidatesMatthew Jasper-28/+22
We now require that projection candidates are applicable with the idenitity substs of the trait, rather than allowing predicates that are only applicable for certain substs.
2020-06-20int -> i32Bastian Kauschke-1/+1
2020-06-20skol -> placeholderBastian Kauschke-16/+15
2020-06-15make all uses of ty::Error or ConstKind::Error delay a span bugmark-3/+3
2020-06-04Treat selection error as ambiguous when error type is presentAaron Hill-0/+8
2020-06-03remove ignore-tidy-filelengthBastian Kauschke-2/+0
2020-06-03move confirmation into submoduleBastian Kauschke-804/+7
2020-06-03move candidate assembly into a submoduleBastian Kauschke-607/+2
2020-06-03move select into subfolderBastian Kauschke-0/+3833