about summary refs log tree commit diff
path: root/src/test/ui/suggestions
AgeCommit message (Collapse)AuthorLines
2019-11-18review comments: tweak prefix stringsEsteban Küber-4/+4
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-68/+68
2019-11-18Update ui testsGuillaume Gomez-0/+1
2019-11-16Suggest calling async closure when neededEsteban Küber-3/+42
When using an async closure as a value in a place that expects a future, suggest calling the closure. Fix #65923.
2019-11-16Account for `rustc_on_unimplemented`Esteban Küber-1/+2
2019-11-16Remove unnecessary noteEsteban Küber-1/+0
2019-11-16Modify primary label message to be inline with error messageEsteban Küber-1/+1
2019-11-16Suggest borrowing when it would satisfy an unmet trait boundEsteban Küber-3/+5
When there are multiple implementors for the same trait that is present in an unmet binding, modify the E0277 error to refer to the parent obligation and verify whether borrowing the argument being passed in would satisfy the unmet bound. If it would, suggest it.
2019-11-08Rollup merge of #66007 - estebank:remove-here, r=CentrilMazdak Farrokhzad-2/+2
Remove "here" from "expected one of X here"
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-8/+13
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
2019-11-07Rollup merge of #66087 - tmiasko:ui-mode, r=CentrilMazdak Farrokhzad-1/+1
Update some build-pass ui tests to use check-pass where applicable Helps with issue https://github.com/rust-lang/rust/issues/62277.
2019-11-06Remove "here" from "expected one of X here"Esteban Küber-2/+2
2019-11-06Suggest missing item from `trait` in `impl`Esteban Küber-0/+61
2019-11-06parenthesized_params_in_types_and_modules -> errorMazdak Farrokhzad-8/+13
2019-11-06Apply review suggestionsTomasz Miąsko-1/+1
2019-11-05Account for typo in turbofish and suggest `::`Esteban Küber-1/+1
2019-11-04Detect `::` -> `:` typo when involving turbofishEsteban Küber-0/+18
2019-11-04Use build-pass in ui tests where appropriateTomasz Miąsko-1/+1
2019-10-28Auto merge of #65421 - estebank:variants, r=petrochenkovbors-0/+2
Point at local similarly named element and tweak references to variants Partially address #65386.
2019-10-27Point at local similarly named element and tweak references to variantsEsteban Küber-0/+2
Point at the span for the definition of ADTs internal to the current crate. Look at the leading char of the ident to determine whether we're expecting a likely fn or any of a fn, a tuple struct or a tuple variant. Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-27Rollup merge of #65566 - estebank:let-expr-as-ty, r=CentrilMazdak Farrokhzad-0/+40
Use heuristics to suggest assignment When detecting a possible `=` -> `:` typo in a `let` binding, suggest assigning instead of setting the type. Partially address #57828.
2019-10-27Auto merge of #65288 - estebank:point-at-assoc-type, r=nikomatsakisbors-7/+13
Point at associated type for some obligations Partially address #57663.
2019-10-26review comments and tweaksEsteban Küber-5/+3
2019-10-26Remove unnecessary error in testEsteban Küber-14/+4
2019-10-26Use heuristics to suggest assignmentEsteban Küber-0/+52
When detecting a possible `=` -> `:` typo in a `let` binding, suggest assigning instead of setting the type.
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+11
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-22Fix rebaseEsteban Küber-7/+13
2019-10-19Rollup merge of #65192 - estebank:restrict-bound, r=matthewjasperMazdak Farrokhzad-0/+182
Use structured suggestion for restricting bounds When a trait bound is not met and restricting a type parameter would make the restriction hold, use a structured suggestion pointing at an appropriate place (type param in param list or `where` clause). Account for opaque parameters where instead of suggesting extending the `where` clause, we suggest appending the new restriction: `fn foo(impl Trait + UnmetTrait)`. Fix #64565, fix #41817, fix #24354, cc #26026, cc #37808, cc #24159, fix #37138, fix #24354, cc #20671.
2019-10-15Suggest associated bound restrictions in `impl`sEsteban Küber-0/+68
2019-10-15Use structured suggestion for restricting boundsEsteban Küber-0/+114
When a trait bound is not met and restricting a type parameter would make the restriction hold, use a structured suggestion pointing at an appropriate place (type param in param list or `where` clause). Account for opaque parameters where instead of suggesting extending the `where` clause, we suggest appending the new restriction: `fn foo(impl Trait + UnmetTrait)`.
2019-10-15Fix suggestion to constrain trait for method to be foundEsteban Küber-0/+121
2019-10-10Auto merge of #65077 - estebank:mut-trait-expected, r=nikomatsakisbors-0/+127
Note when a mutable trait object is needed Fix https://github.com/rust-lang/rust/issues/63619, fix https://github.com/rust-lang/rust/issues/37914. CC https://github.com/rust-lang/rust/issues/64068.
2019-10-09Only suggest change mut if vars are resolvedEsteban Küber-1/+0
2019-10-09Tweak wordingEsteban Küber-6/+6
2019-10-09Note when a mutable trait object is neededEsteban Küber-0/+128
2019-10-08Rollup merge of #65194 - estebank:remove_str, r=petrochenkovMazdak Farrokhzad-4/+4
Use structured suggestion for removal of `as_str()` call Follow up to #64739.
2019-10-08Rollup merge of #65145 - estebank:turbofish-assoc-fn-call, r=varkorMazdak Farrokhzad-0/+65
When suggesting assoc function with type params, include turbofish Fix https://github.com/rust-lang/rust/issues/61412, fix https://github.com/rust-lang/rust/issues/61411.
2019-10-07Use structured suggestion for removal of `as_str()` callEsteban Küber-4/+4
2019-10-07Auto merge of #64739 - guanqun:remove-as-str, r=estebankbors-0/+48
Remove as_str if the type is already &str Fix https://github.com/rust-lang/rust/issues/62642 r? @estebank do you think the suggestion tip is good enough?
2019-10-05Account for derefs when suggesting assoc functionEsteban Küber-0/+32
2019-10-05When suggesting assoc function with type params, include turbofishEsteban Küber-0/+33
2019-10-02syntax: improve parameter without type suggestionsDavid Wood-0/+44
This commit improves the suggestions provided when function parameters do not have types: - A new suggestion is added for arbitrary self types, which suggests adding `self: ` before the type. - Existing suggestions are now provided when a `<` is found where a `:` was expected (previously only `,` and `)` or trait items), this gives suggestions in the case where the unnamed parameter type is generic in a free function. - The suggestion that a type name be provided (e.g. `fn foo(HashMap<u32>)` -> `fn foo(HashMap: TypeName<u32>)`) will no longer occur when a `<` was found instead of `:`. - The ident will not be used for recovery when a `<` was found instead of `:`. Signed-off-by: David Wood <david@davidtw.co>
2019-10-02fix unit testsGuanqun Lu-4/+4
2019-10-02comment fixesGuanqun Lu-4/+4
2019-10-02add test filesGuanqun Lu-0/+48
2019-09-29Rollup merge of #64825 - estebank:match-unit, r=CentrilMazdak Farrokhzad-0/+72
Point at enclosing match when expecting `()` in arm When encountering code like the following: ```rust fn main() { match 3 { 4 => 1, 3 => { println!("Yep it maches."); 2 } _ => 2 } println!("Bye!") } ``` point at the enclosing `match` expression and suggest ignoring the returned value: ``` error[E0308]: mismatched types --> $DIR/match-needing-semi.rs:8:13 | LL | / match 3 { LL | | 4 => 1, LL | | 3 => { LL | | 2 | | ^ expected (), found integer LL | | } LL | | _ => 2 LL | | } | | -- help: consider using a semicolon here | |_____| | expected this to be `()` | = note: expected type `()` found type `{integer} ``` Fix #40799.
2019-09-29Rollup merge of #64691 - estebank:unexpected-variant, r=CentrilMazdak Farrokhzad-0/+6
Point at definition when misusing ADT When given `struct Foo(usize)` and using it as `Foo {}` or `Foo`, point at `Foo`'s definition in the error.
2019-09-28review commentsEsteban Küber-2/+2
2019-09-28Point at enclosing match when expecting `()` in armEsteban Küber-0/+72
When encountering code like the following: ```rust fn main() { match 3 { 4 => 1, 3 => { println!("Yep it maches."); 2 } _ => 2 } println!("Bye!") } ``` point at the enclosing `match` expression and suggest ignoring the returned value: ``` error[E0308]: mismatched types --> $DIR/match-needing-semi.rs:8:13 | LL | / match 3 { LL | | 4 => 1, LL | | 3 => { LL | | 2 | | ^ expected (), found integer LL | | } LL | | _ => 2 LL | | } | | -- help: consider using a semicolon here | |_____| | expected this to be `()` | = note: expected type `()` found type `{integer} ``` Fix #40799.
2019-09-28Improve diagnostic for `let A = 0;`Mazdak Farrokhzad-0/+25
where `A` is a constant, not a new variable.