about summary refs log tree commit diff
path: root/src/test/ui/span
AgeCommit message (Collapse)AuthorLines
2020-04-29Rollup merge of #71217 - estebank:tail-borrow-sugg, r=pnkfelixDylan DPC-3/+18
Suggest `;` or assignment to drop borrows in tail exprs Address the diagnostics part of #70844. ``` error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | LL | if let Ok(_) = counter.lock() { } | ^^^^^^^------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... ... LL | } | - | | | `counter` dropped here while still borrowed | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result<MutexGuard<'_>, ()>` | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | LL | if let Ok(_) = counter.lock() { }; | ^ ```
2020-04-28Suggest `;` or assignment to drop borrows in tail exprsEsteban Küber-3/+18
Address the diagnostics part of #70844. ``` error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | LL | if let Ok(_) = counter.lock() { } | ^^^^^^^------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... ... LL | } | - | | | `counter` dropped here while still borrowed | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result<MutexGuard<'_>, ()>` | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | LL | if let Ok(_) = counter.lock() { }; | ^ ```
2020-04-23Moving more build-pass tests to check-passVal Markovic-2/+2
One or two tests became build-pass without the FIXME because they really needed build-pass (were failing without it). Helps with #62277
2020-04-14Rename AssocKind::Method to AssocKind::FnRustin-Liu-10/+10
Rename fn_has_self_argument to fn_has_self_parameter Rename AssocItemKind::Method to AssocItemKind::Fn Refine has_no_input_arg Refine has_no_input_arg Revert has_no_input_arg Refine suggestion_descr Move as_def_kind into AssocKind Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> Fix tidy check issue Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-11rustc: Add a warning count upon completionRoccoDev-0/+8
2020-03-24fix rebase falloutMazdak Farrokhzad-0/+2
2020-03-23Rollup merge of #70300 - aleksator:66636_reword_unused_variable_warning, ↵Mazdak Farrokhzad-1/+1
r=Dylan-DPC Reword unused variable warning Fixes #66636
2020-03-23Reword unused variable warningAlex Tokarev-1/+1
2020-03-22Increase verbosity when suggesting subtle code changesEsteban Küber-4/+5
2020-03-18Properly handle Spans that reference imported SourceFilesAaron Hill-0/+44
Previously, metadata encoding used DUMMY_SP to represent any spans that referenced an 'imported' SourceFile - e.g. a SourceFile from an upstream dependency. These leads to sub-optimal error messages in certain cases (see the included test). This PR changes how we encode and decode spans in crate metadata. We encode spans in one of two ways: * 'Local' spans, which reference non-imported SourceFiles, are encoded exactly as before. * 'Foreign' spans, which reference imported SourceFiles, are encoded with the CrateNum of their 'originating' crate. Additionally, their 'lo' and 'high' values are rebased on top of the 'originating' crate, which allows them to be used with the SourceMap data encoded for that crate. The `ExternalSource` enum is renamed to `ExternalSourceKind`. There is now a struct called `ExternalSource`, which holds an `ExternalSourceKind` along with the original line number information for the file. This is used during `Span` serialization to rebase spans onto their 'owning' crate.
2020-03-12update testsMark Mansi-1/+1
2020-02-20Rollup merge of #68877 - estebank:point-at-params, r=petrochenkovMazdak Farrokhzad-20/+32
On mismatched argument count point at arguments
2020-02-17Do not emit note suggesting to implement trait to foreign typeLeSeulArtichaut-4/+0
Update tests Extend to other operations Refractor check in a separate function Fix more tests
2020-02-11On mismatched argument count point at argumentsEsteban Küber-20/+32
2020-02-09--bless --compare-mode=nllMatthias Prechtl-2/+2
2020-02-09Auto merge of #68689 - estebank:where-clause-sugg-missing-fn, r=varkorbors-1/+1
When suggesting associated fn with type parameters, include in the structured suggestion Address #50734. ``` error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `baz` --> file.rs:14:1 | 14 | impl TraitA<()> for S { | ^^^^^^^^^^^^^^^^^^^^^ missing `foo`, `bar`, `baz` in implementation | = help: implement the missing item: `fn foo<T>(_: T) -> Self where T: TraitB, TraitB::Item = A { unimplemented!() }` = help: implement the missing item: `fn bar<T>(_: T) -> Self { unimplemented!() }` = help: implement the missing item: `fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: std::marker::Copy { unimplemented!() }` ``` It doesn't work well for associated types with `ty::Predicate::Projection`s as we need to resugar `T: Trait, Trait::Assoc = K` → `T: Trait<Assoc = K>`.
2020-02-08review commentEsteban Küber-1/+1
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-3/+8
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-3/+3
2020-02-02Rollup merge of #68764 - Centril:self-semantic, r=petrochenkovMazdak Farrokhzad-0/+8
parser: syntactically allow `self` in all `fn` contexts Part of https://github.com/rust-lang/rust/pull/68728. `self` parameters are now *syntactically* allowed as the first parameter irrespective of item context (and in function pointers). Instead, semantic validation (`ast_validation`) is used. r? @petrochenkov
2020-02-02parser: address review comments re. `self`.Mazdak Farrokhzad-0/+8
2020-02-02Do not suggest duplicate boundsYuki Okushi-9/+4
2020-01-24Normalise notes with the/isvarkor-5/+5
2020-01-11Rollup merge of #68014 - estebank:unify-e0599, r=cramertjYuki Okushi-5/+5
Unify output of "variant not found" errors Fix #49566.
2020-01-09Update testsVadim Petrochenkov-1/+28
2020-01-08Unify output of "variant not found" errorsEsteban Küber-5/+5
2019-12-24Fix suggestion span for typo in associated type nameEsteban Küber-2/+2
2019-12-24Fix case in `associated-type-projection-from-multiple-supertraits.rs`Esteban Küber-1/+1
This still doesn't handle the case entirely correctly, requiring a more targeted approach with a better suggestion, but at least now the suggested syntax makes *some* sense.
2019-12-20Rollup merge of #67285 - ohadravid:indicate-origin-of-where-type-parameter, ↵Mazdak Farrokhzad-1/+1
r=estebank Indicate origin of where type parameter for uninferred types Based on #65951 (which is not merge yet), fixes #67277. This PR improves a little the diagnostic for code like: ``` async fn foo() { bar().await; } async fn bar<T>() -> () {} ``` by showing: ``` error[E0698]: type inside `async fn` body must be known in this context --> unresolved_type_param.rs:9:5 | 9 | bar().await; | ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ... ``` (The ``` declared on the function `bar` ``` part is new) A small side note: `Vec` and `slice` seem to resist this change, because querying `item_name()` panics, and `get_opt_name()` returns `None`. r? @estebank
2019-12-20Rollup merge of #67127 - estebank:disambiguate-suggestion, r=varkorMazdak Farrokhzad-10/+40
Use structured suggestion for disambiguating method calls Fix #65635.
2019-12-19Rollup merge of #67406 - ohadravid:suggest-assoc-type, r=estebankMazdak Farrokhzad-1/+1
Suggest associated type when the specified one cannot be found Fixes #67386, so code like this: ``` use std::ops::Deref; fn homura<T: Deref<Trget = i32>>(_: T) {} fn main() {} ``` results in: ``` error[E0220]: associated type `Trget` not found for `std::ops::Deref` --> type-binding.rs:6:20 | 6 | fn homura<T: Deref<Trget = i32>>(_: T) {} | ^^^^^^^^^^^ help: there is an associated type with a similar name: `Target` error: aborting due to previous error ``` (The `help` is new) I used an `all_candidates: impl Fn() -> Iterator<...>` instead of `collect`ing to avoid the cost of allocating the Vec when no errors are found, at the expense of a little added complexity. r? @estebank
2019-12-19Rollup merge of #67189 - LeSeulArtichaut:binop-wording, r=estebankMazdak Farrokhzad-26/+26
Unify binop wording Closes #60497 r? @estebank
2019-12-18Suggest associated type when the specified one cannot be foundOhad Ravid-1/+1
2019-12-14Indicate origin of where type parameter for uninferred typesOhad Ravid-1/+1
2019-12-12Update testsLeSeulArtichaut-13/+13
2019-12-12Update UI test expectationsLeSeulArtichaut-13/+13
2019-12-11Use structured suggestion for disambiguating method callsEsteban Küber-10/+40
Fix #65635.
2019-12-11Add more context for type parametersEsteban Küber-2/+2
2019-12-10Use the appropriate number of type arguments in suggestionEsteban Küber-1/+1
2019-12-10Point at method call when type annotations are neededEsteban Küber-7/+9
2019-12-06derive: avoid parse_in_attrMazdak Farrokhzad-8/+1
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-6/+11
2019-11-18Surround types with backticks in type errorsEsteban Küber-6/+6
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-18/+2
2019-11-18review comments: tweak prefix stringsEsteban Küber-2/+2
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-16/+16
2019-11-11Evaluate borrow and struct expressions in `into`Matthew Jasper-2/+2
This fixes some ordering problems around assignment expressions.
2019-11-09Remove `#[feature(custom_attribute)]`Vadim Petrochenkov-2/+4
2019-11-08Rollup merge of #66007 - estebank:remove-here, r=CentrilMazdak Farrokhzad-3/+3
Remove "here" from "expected one of X here"
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.