summary refs log tree commit diff
path: root/src/test/ui/suggestions
AgeCommit message (Collapse)AuthorLines
2020-06-02Rollup merge of #72775 - JohnTitor:await-sugg, r=estebankYuki Okushi-0/+35
Return early to avoid ICE Fixes #72766
2020-05-30Rollup merge of #72668 - ↵Ralf Jung-0/+68
awoimbee:give-fn-parenthetical-notation-parentheses, r=estebank Fix missing parentheses Fn notation error Fixes #72611 Well, fixes the error output, I think E0658 is the right error to throw in this case so I didn't change that
2020-05-30Tweak wording and spans of `'static` `dyn Trait`/`impl Trait` requirementsEsteban Küber-14/+5
2020-05-30Account for enclosing item when suggesting new lifetime nameEsteban Küber-10/+63
2020-05-30Tweak type parameter errors to reduce verbosityEsteban Küber-14/+2
2020-05-30review comment: tweak wording and account for span overlapEsteban Küber-3/+3
2020-05-30Account for returned `dyn Trait` evaluating to `'static` lifetimeEsteban Küber-3/+3
Provide a suggestion for `dyn Trait + '_` when possible.
2020-05-30Fix NLL outputEsteban Küber-0/+98
2020-05-30Improve output of argument anonymous borrow missing annotation involving ↵Esteban Küber-39/+8
opaque return type Go from ``` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> file8.rs:22:5 | 22 | / move || { 23 | | *dest = g.get(); 24 | | } | |_____^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 18:1... --> file8.rs:18:1 | 18 | / fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a 19 | | where 20 | | G: Get<T> 21 | | { ... | 24 | | } 25 | | } | |_^ note: ...so that the types are compatible --> file8.rs:22:5 | 22 | / move || { //~ ERROR cannot infer an appropriate lifetime 23 | | *dest = g.get(); 24 | | } | |_____^ = note: expected `&mut T` found `&mut T` note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 18:8... --> file8.rs:18:8 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ^^ note: ...so that return value is valid for the call --> file8.rs:18:45 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ^^^^^^^^^^^^^^^^^^^^^^^ ``` to ``` error[E0621]: explicit lifetime required in the type of `dest` --> file8.rs:18:45 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ------ ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required | | | help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` ```
2020-05-30Account for missing lifetime in opaque return typeEsteban Küber-0/+246
When encountering an opaque closure return type that needs to bound a lifetime to the function's arguments, including borrows and type params, provide appropriate suggestions that lead to working code. Get the user from ```rust fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() where G: Get<T> { move || { *dest = g.get(); } } ``` to ```rust fn foo<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() +'a where G: Get<T> { move || { *dest = g.get(); } } ```
2020-05-30Test ui suggestion fn trait notationArthur Woimbée-0/+68
2020-05-30Return early to avoid ICEYuki Okushi-0/+35
2020-05-22Bless other example of #71394Dylan MacKenzie-1/+0
2020-05-22Add regression test for #71394Dylan MacKenzie-0/+16
2020-05-22Rollup merge of #72306 - Aaron1011:feature/turbo-spacing, r=petrochenkovRalf Jung-2/+9
Break tokens before checking if they are 'probably equal' Fixes #68489 Fixes #70987 When checking two `TokenStreams` to see if they are 'probably equal', we ignore the `IsJoint` information associated with each `TokenTree`. However, the `IsJoint` information determines whether adjacent tokens will be 'glued' (if possible) when construction the `TokenStream` - e.g. `[Gt Gt]` can be 'glued' to `BinOp(Shr)`. Since we are ignoring the `IsJoint` information, 'glued' and 'unglued' tokens are equivalent for determining if two `TokenStreams` are 'probably equal'. Therefore, we need to 'unglue' all tokens in the stream to avoid false negatives (which cause us to throw out the cached tokens, losing span information).
2020-05-21Rollup merge of #72149 - estebank:icemation, r=eddybRalf Jung-10/+28
Don't `type_of` on trait assoc ty without default Fix #72076.
2020-05-20Fix testsAaron Hill-2/+9
2020-05-14Rollup merge of #72127 - jademcgough:long-error-explanation-E0228, ↵Dylan DPC-1/+1
r=petrochenkov add long error explanation for E0228 Add long explanation for the E0228 error code Part of #61137 Let me know if this is wrong at all (or can be written more clearly), I'm still learning Rust.
2020-05-12add long error explanation for E0228Jade McGough-1/+1
2020-05-12Increase verbosity of bound restriction suggestionsEsteban Küber-14/+20
- Make the bound restriction suggestion `span_suggestion_verbose`. - Fix whitespace typo.
2020-05-12Don't `type_of` on trait assoc ty without defaultEsteban Küber-10/+28
Fix #72076.
2020-05-11Rollup merge of #72019 - matthewjasper:dont-skip-binder, r=davidtwcoDylan DPC-0/+36
Fix debug assertion in error code Closes #70813
2020-05-08Fix debug assertion in error codeMatthew Jasper-0/+36
2020-05-07reword "possible candidate" import suggestionAndy Russell-2/+2
2020-05-03fix rebaseEsteban Küber-2/+0
2020-05-02When a projection is expected, suggest constraining or calling methodEsteban Küber-14/+31
2020-05-02On type mismatch involving associated type, suggest constraintEsteban Küber-2/+309
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-05-01Uncomment test code for failure to use `Box::pin`Esteban Küber-16/+95
Close #69083.
2020-04-28Rollup merge of #71311 - estebank:fn-type-param, r=varkorDylan DPC-0/+16
On `FnDef` type annotation suggestion, use fn-pointer output Address the last point in #71209.
2020-04-22Revert old span changeEsteban Küber-4/+4
2020-04-22Tweak wordingEsteban Küber-17/+17
2020-04-22Tweak `'static` suggestion codeEsteban Küber-3/+337
Fix #71196.
2020-04-18On `FnDef` type annotation suggestion, use fn-pointer outputEsteban Küber-0/+16
Partly addresses #71209.
2020-04-18Add label to item source of bound obligationEsteban Küber-3/+3
2020-04-18Do not emit note for projected derived obligationsEsteban Küber-1/+0
2020-04-18Remove `AssocTypeBound` and propagate bound `Span`sEsteban Küber-6/+8
2020-04-13Remove `FnCtxt::impl_self_ty`Yuki Okushi-1/+1
2020-04-11fix rebaseEsteban Küber-5/+5
2020-04-11Try to use the first char in the trait name as type paramEsteban Küber-6/+6
2020-04-11Account for existing names when suggesting adding a type paramEsteban Küber-5/+27
2020-04-11Account for type params with boundsEsteban Küber-1/+24
2020-04-11Handle `impl Trait` where `Trait` has an assoc type with missing boundsEsteban Küber-0/+77
Fix #69638.
2020-04-10Rollup merge of #69745 - estebank:predicate-obligations-3, r=nikomatsakis,eddybMazdak Farrokhzad-17/+31
Use `PredicateObligation`s instead of `Predicate`s Keep more information about trait binding failures. Use more specific spans by pointing at bindings that introduce obligations. Subset of #69709. r? @eddyb
2020-04-08Small tweaks to required bound spanEsteban Küber-13/+13
2020-04-08Use `PredicateObligation`s instead of `Predicate`sEsteban Küber-4/+18
Keep more information about trait binding failures.
2020-04-08Rollup merge of #70912 - estebank:reduce-type-param-sugg-verbosity, r=davidtwcoDylan DPC-4/+0
Do not suggest adding type param when `use` is already suggested Fix #70365, cc #70572.
2020-04-07Do not suggest adding type param when `use` is already suggestedEsteban Küber-4/+0
Fix #70365, cc #70572.
2020-04-06Rollup merge of #70519 - estebank:constraints-before-args-spans, r=CentrilMazdak Farrokhzad-42/+66
Tweak output of type params and constraints in the wrong order r? @Centril @varkor
2020-04-05Reduce the visual clutterEsteban Küber-54/+20
Using a single label for constraints and generic arguments.
2020-04-03Auto merge of #70642 - eddyb:remap-sysroot-src, r=Mark-Simulacrumbors-22/+9
Translate the virtual `/rustc/$hash` prefix back to a real directory. Closes #53486 and fixes #53081, by undoing the remapping to `/rustc/$hash` on the fly, when appropriate (e.g. our testsuites, or user crates that depend on `libstd`), but not during the Rust build itself (as that could leak the absolute build directory into the artifacts, breaking deterministic builds). Tested locally by setting `remap-debuginfo = true` in `config.toml`, which without these changes, was causing 56 tests to fail (see https://github.com/rust-lang/rust/issues/53081#issuecomment-606703215 for more details). cc @Mark-Simulacrum @alexcrichton @ehuss