about summary refs log tree commit diff
path: root/src/test/ui/specialization
AgeCommit message (Collapse)AuthorLines
2021-02-21reword `;` suggestions to have consistent wordingEsteban Küber-1/+1
2021-02-17In some limited cases, suggest `where` bounds for non-type paramsEsteban Küber-0/+4
Partially address #81971.
2021-01-26Avoid describing a method as 'not found' when bounds are unsatisfiedAaron Hill-4/+4
Fixes #76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
2021-01-16fold_with not super_fold_with in TypeFoldable impl for PredicateJack Huey-1/+1
2021-01-16Remove PredicateKind::AtomJack Huey-1/+1
2020-12-29Remove `compile-fail` test suiteVadim Petrochenkov-2/+49
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-1/+1
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+45
2020-10-06Update to chalk 0.31. Implement some unimplemented. Ignore some tests in ↵Jack Huey-2/+3
compare mode chalk don't finish.
2020-10-06Avoid cycles from projection boundsMatthew Jasper-29/+17
Only check the own predicates of associated types when confirming projection candidates. Also consider implied bounds when comparing trait and impl methods.
2020-10-06Check projections are well-formed when using projection candidatesMatthew Jasper-0/+101
2020-10-06Separate bounds and predicates for associated/opaque typesMatthew Jasper-7/+7
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-1/+1
2020-09-03specialization_graph: avoid trimmed paths for OverlapErrorDan Aloni-3/+3
2020-09-02pretty: trim paths of unique symbolsDan Aloni-29/+29
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-22Use smaller def span for functionsAaron Hill-2/+2
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-07-27`PredicateKint` -> `PredicateKind`, the beginning of the endBastian Kauschke-1/+1
2020-07-19do not try fetching the ancestors of errored trait implsBastian Kauschke-0/+16
2020-07-14Remove redundant explanatory `note` for type parametersEsteban Küber-1/+0
2020-06-23Add test for issue-59435Yuki Okushi-0/+29
2020-06-23Add test for issue-44861Yuki Okushi-0/+52
2020-06-20Move bounds on associated types to the typeMatthew Jasper-7/+7
Given `trait X { type U; }` the bound `<Self as X>::U` now lives on the type, rather than the trait. This is feature gated on `feature(generic_associated_types)` for now until more testing can be done. The also enabled type-generic associated types since we no longer need "implies bounds".
2020-06-20Check associated type satisfy their boundsMatthew Jasper-0/+153
This was currently only happening due to eager normalization, which isn't possible if there's specialization or bound variables.
2020-06-16bless allRalf Jung-36/+36
2020-06-16warn against 'specialization' featureRalf Jung-59/+472
2020-05-02Point at associated types when they have a default typeEsteban Küber-2/+2
Associated types with a default type in a trait can't be relied upon to remain of that default type when in use, so literals of that type can't be used in the trait's items. Point at the associated type and state that information. Reduce verbosity for associated consts of the wrong type.
2020-05-02When a projection is expected, suggest constraining or calling methodEsteban Küber-2/+2
2020-05-02On type mismatch involving associated type, suggest constraintEsteban Küber-2/+2
When an associated type is found when a specific type was expected, if possible provide a structured suggestion constraining the associated type in a bound. ``` error[E0271]: type mismatch resolving `<T as Foo>::Y == i32` --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | LL | want_y(t); | ^^^^^^ expected `i32`, found associated type ... LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } | ----- required by this bound in `want_y` | = note: expected type `i32` found associated type `<T as Foo>::Y` help: consider constraining the associated type `<T as Foo>::Y` to `i32` | LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T) | ^^^^^^^^^ ``` ``` error[E0308]: mismatched types --> $DIR/trait-with-missing-associated-type-restriction.rs:12:9 | LL | qux(x.func()) | ^^^^^^^^ expected `usize`, found associated type | = note: expected type `usize` found associated type `<impl Trait as Trait>::A` help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize` | LL | fn foo(x: impl Trait<A = usize>) { | ^^^^^^^^^^ ```
2020-04-24Rollup merge of #71235 - estebank:lt-sugg-2, r=ecstatic-morseDylan DPC-2/+2
Tweak `'static` suggestion code Fix #71196.
2020-04-23fix error code for E0751YI-8/+8
2020-04-22Sort `MultiSpan`s on creationEsteban Küber-2/+2
2020-04-18Do not emit note for projected derived obligationsEsteban Küber-1/+0
2020-04-18Maintain chain of derived obligationsEsteban Küber-0/+4
When evaluating the derived obligations from super traits, maintain a reference to the original obligation in order to give more actionable context in the output.
2020-03-30Add a testJonas Schievink-0/+23
2020-03-29Tweak `suggest_constraining_type_param`Esteban Küber-4/+3
Some of the bound restriction structured suggestions were incorrect while others had subpar output.
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-4/+5
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-03-26make a custom error for overlap with negative implsNiko Matsakis-14/+14
2020-03-26permit negative impls for non-auto traitsNiko Matsakis-8/+13
2020-03-22Tweak output for invalid negative impl errorsEsteban Küber-8/+14
2020-03-15Consider well-formed predicates in min-specializationMatthew Jasper-0/+59
2020-03-15Implement soundness check for min_specializationMatthew Jasper-0/+382
2020-03-15Add attributes to allow specializing on traitsMatthew Jasper-0/+32
2020-03-05review commentsEsteban Küber-2/+2
2020-03-04Tweak output for invalid negative impl AST errorsEsteban Küber-1/+1
2020-02-28keep predicate order and tweak outputEsteban Küber-3/+5
2020-02-28Tweak wordingEsteban Küber-1/+1
2020-02-28Mention the full path of the implementing traitEsteban Küber-1/+1
2020-02-28Track all predicates in errors, not just trait obligationsEsteban Küber-1/+3
Surface associated type projection bounds that could not be fulfilled in E0599 errors. Always present the list of unfulfilled trait bounds, regardless of whether we're pointing at the ADT or trait that didn't satisfy it.
2020-02-28Deduplicate information in E0599Esteban Küber-3/+1
2020-02-28On single local candidate, use span labelEsteban Küber-2/+3