about summary refs log tree commit diff
path: root/src/librustc_trait_selection/traits
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-17545/+0
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-17/+14
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-08-22Use smaller def span for functionsAaron Hill-9/+10
Currently, the def span of a funtion encompasses the entire function signature and body. However, this is usually unnecessarily verbose - when we are pointing at an entire function in a diagnostic, we almost always want to point at the signature. The actual contents of the body tends to be irrelevant to the diagnostic we are emitting, and just takes up additional screen space. This commit changes the `def_span` of all function items (freestanding functions, `impl`-block methods, and `trait`-block methods) to be the span of the signature. For example, the function ```rust pub fn foo<T>(val: T) -> T { val } ``` now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T` (everything before the opening curly brace). Trait methods without a body have a `def_span` which includes the trailing semicolon. For example: ```rust trait Foo { fn bar(); }``` the function definition `Foo::bar` has a `def_span` of `fn bar();` This makes our diagnostic output much shorter, and emphasizes information that is relevant to whatever diagnostic we are reporting. We continue to use the full span (including the body) in a few of places: * MIR building uses the full span when building source scopes. * 'Outlives suggestions' use the full span to sort the diagnostics being emitted. * The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]` attribute points the entire scope body. * The 'unconditional recursion' lint uses the full span to show additional context for the recursive call. All of these cases work only with local items, so we don't need to add anything extra to crate metadata.
2020-08-20Don't immediately error for cycles during normalizationMatthew Jasper-39/+68
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-1/+1
2020-08-16Auto merge of #75536 - estebank:e0255-suggestion, r=varkorbors-4/+8
Tweak output of E0225 When encountering multiple non-auto trait bounds suggest creating a new trait and explain what auto-traits are. _Inspired by https://fasterthanli.me/articles/frustrated-its-not-you-its-rust_
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-6/+7
merge `as_local_hir_id` with `local_def_id_to_hir_id` `as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing. Don't really care about which of these 2 methods we want to keep. Does this require an MCP, considering that these methods are fairly frequently used?
2020-08-14Tweak output of E0225Esteban Küber-4/+8
When encountering multiple non-auto trait bounds suggest creating a new trait and explain what auto-traits are.
2020-08-13Auto merge of #75443 - lcnr:opaque-normalize, r=nikomatsakisbors-9/+4
allow escaping bound vars when normalizing `ty::Opaque` implements https://github.com/rust-lang/rust/issues/75313#issuecomment-672216146 and fixes #75313 cc @eddyb @RalfJung r? @nikomatsakis
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-6/+7
2020-08-12allow escaping bound vars when normalizing `ty::Opaque`Bastian Kauschke-9/+4
2020-08-12Auto merge of #75205 - Aaron1011:fix/auto-trait-proj-ice, r=nikomatsakisbors-0/+7
Handle projection predicates in the param env for auto-trait docs Fixes #72213 Any predicates in the param env are guaranteed to hold, so we don't need to do any additional processing of them if we come across them as sub-obligations of a different predicate. This allows us to avoid adding the same predicate to the computed ParamEnv multiple times (but with different regions each time), which causes an ambiguity error during fulfillment.
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-3/+2
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-3/+2
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-07fix clippy::single_char_pattern: use char instead of string single-char patternMatthias Krüger-1/+1
2020-08-06Fix typo "TraitObligatiom" -> "TraitObligation"Leijurv-1/+1
2020-08-05Handle projection predicates in the param env for auto-trait docsAaron Hill-0/+7
Fixes #72213 Any predicates in the param env are guaranteed to hold, so we don't need to do any additional processing of them if we come across them as sub-obligations of a different predicate. This allows us to avoid adding the same predicate to the computed ParamEnv multiple times (but with different regions each time), which causes an ambiguity error during fulfillment.
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-5/+5
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-08-03Auto merge of #75055 - cjgillot:clean-cache, r=oli-obkbors-37/+51
Introduce an abstraction for EvaluationCache and SelectionCache The small duplicated code has been moved to librustc_query_system. The remaining changes are some cleanups of structural impls.
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-29handle ConstEquate in rustdocBastian Kauschke-0/+32
2020-07-27Auto merge of #73503 - lcnr:forall-predicate-what-and-why-2, r=nikomatsakisbors-413/+448
convert higher ranked `Predicate`s to `PredicateKind::ForAll` implements step 2 of https://github.com/rust-lang/compiler-team/issues/285 r? @nikomatsakis
2020-07-27cleanupBastian Kauschke-1/+1
2020-07-27it works again :tada:Bastian Kauschke-34/+33
2020-07-27fix rebaseBastian Kauschke-23/+25
2020-07-27directly contain `PredicateAtom` in `PredicateKind::ForAll`Bastian Kauschke-36/+32
2020-07-27introduce PredicateAtomBastian Kauschke-307/+285
2020-07-27add reuse_or_mk_predicateBastian Kauschke-1/+1
2020-07-27this might be unqualified, but at least it's now quantifiedBastian Kauschke-22/+22
2020-07-27split ignore_qualifiersBastian Kauschke-32/+32
2020-07-27reviewBastian Kauschke-19/+11
2020-07-27fix elaborate for predicates with unbound variablesBastian Kauschke-1/+1
2020-07-27`PredicateKint` -> `PredicateKind`, the beginning of the endBastian Kauschke-157/+193
2020-07-27elaborateBastian Kauschke-5/+3
2020-07-27somewhat related cleanupBastian Kauschke-3/+3
2020-07-27wfBastian Kauschke-17/+19
2020-07-27convert trivial predicatesBastian Kauschke-2/+2
2020-07-27Handle trait/projection predicates with bound regions correctlyMatthew Jasper-69/+131
2020-07-27minimalBastian Kauschke-69/+39
2020-07-27More ensure stack to avoid segfault with increased `recursion_limit`Yuki Okushi-18/+28
2020-07-25Use the proper span when WF-checking an impl self typeAaron Hill-4/+12
2020-07-22Use `ty::Instance::resolve` to identify `'static` bound sourceEsteban Küber-1/+14
2020-07-22Increase accuracy of lifetime bound on trait object impl suggestionEsteban Küber-0/+1
2020-07-22Rollup merge of #74454 - lcnr:negative-impls, r=nikomatsakisManish Goregaokar-52/+47
small coherence cleanup r? @eddyb
2020-07-20update coherence docsBastian Kauschke-7/+7
2020-07-20reviewBastian Kauschke-1/+10
2020-07-20trait_sel: only test predicates w/ no substsDavid Wood-15/+15
This commit modifies the `substitute_normalize_and_test_predicates` query, renaming it to `impossible_predicates` and only checking predicates which do not require substs. By making this change, polymorphization doesn't have to explicitly support vtables. Signed-off-by: David Wood <david@davidtw.co>
2020-07-17refactor ty_is_non_localBastian Kauschke-15/+18
2020-07-17cleanup ty_is_~non~_local_constructorBastian Kauschke-38/+21