about summary refs log tree commit diff
path: root/src/test/ui/methods
AgeCommit message (Collapse)AuthorLines
2021-09-28Rollup merge of #89255 - FabianWolff:issue-88806, r=cjgillotGuillaume Gomez-4/+4
Fix incorrect disambiguation suggestion for associated items Fixes #88806. I have not added a new test case, because the erroneous behavior is already present in existing test cases.
2021-09-26Remove box syntax from most places in src/test outside of the issues direst31-29/+15
2021-09-25Fix incorrect disambiguation suggestion for associated itemsFabian Wolff-4/+4
2021-09-25Use larger span for adjustments on method callsAaron Hill-2/+2
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-08-12Use smaller spans for some structured suggestionsEsteban Kuber-1/+1
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
2021-08-11Modify structured suggestion outputEsteban Küber-22/+22
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-09Use smaller spans when suggesting method call disambiguationEsteban Kuber-2/+2
2021-05-27Rollup merge of #84221 - ABouttefeux:generic-arg-elision, r=estebankDylan DPC-0/+203
E0599 suggestions and elision of generic argument if no canditate is found fixes #81576 changes: In error E0599 (method not found) generic argument are eluded if the method was not found anywhere. If the method was found in another inherent implementation suggest that it was found elsewhere. Example ```rust struct Wrapper<T>(T); struct Wrapper2<T> { x: T, } impl Wrapper2<i8> { fn method(&self) {} } fn main() { let wrapper = Wrapper(i32); wrapper.method(); let wrapper2 = Wrapper2{x: i32}; wrapper2.method(); } ``` ``` Error[E0599]: no method named `method` found for struct `Wrapper<_>` in the current scope .... error[E0599]: no method named `method` found for struct `Wrapper2<i32>` in the current scope ... = note: The method was found for Wrapper2<i8>. ``` I am not very happy with the ```no method named `test` found for struct `Vec<_, _>` in the current scope```. I think it might be better to show only one generic argument `Vec<_>` if there is a default one. But I haven't yet found a way to do that,
2021-05-25show list of candidatesAliénore Bouttefeux-8/+12
2021-05-22change from review and show full type if it can be derefAliénore Bouttefeux-16/+50
2021-05-21remove generic argument insead of displaying "_"Aliénore Bouttefeux-10/+10
2021-05-11improve diagnosts for GATsb-naber-6/+6
2021-04-15elision of generic argument in E0599 if the methode has not been found ↵Aliénore Bouttefeux-0/+165
anywhere and sugetion of type with method when found.
2021-04-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-38/+36
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
2021-03-31Fix tests and AstConv -> dyn AstConvJack Huey-18/+1
2021-03-24resolve late lifetimes by itemJack Huey-1/+18
This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.
2021-02-01Test exploring the interactions between all of the different kinds of method ↵Felix S. Klock II-0/+190
collisions I could imagine. The different impls are all guarded by cfg-flags, and the revisions could be used to cover the full power-set of combinations. (I only included 20 of the possible 32 cases here; the null-set is not interesting, and the remaining 11 all yielded ambiguous method resolution errors which did not mix well with this testing strategy; I'm not trying to check UI for the resolution diagnostics; I'm trying to create checkpoint of current resolution semantics when compilation succeeds.)
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-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-44/+86
2020-10-27Make tidy happySantiago Pastorino-14/+15
2020-10-27Add unsized_locals to INCOMPLETE_FEATURES listSantiago Pastorino-10/+20
2020-10-27Add unsized_fn_params featureSantiago Pastorino-1/+1
2020-10-19Auto merge of #77278 - camelid:use-correct-article, r=estebankbors-1/+1
Use correct article in help message for conversion or cast Before it always used `an`; now it uses the correct article for the type.
2020-10-15ensure arguments are included in count mismatch spanAndy Russell-12/+24
2020-09-29Say "doesn't" instead of "wouldn't" in convert messageCamelid-1/+1
2020-09-29Add article after "to"Camelid-1/+1
Also added missing backtick in "you can cast" message.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-16/+16
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-07-10Tweak wordingYuki Okushi-1/+1
2020-07-10Add a help to use `in_band_lifetimes` in nightlyYuki Okushi-0/+2
2020-04-14Rename AssocKind::Method to AssocKind::FnRustin-Liu-13/+13
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-13Remove `FnCtxt::impl_self_ty`Yuki Okushi-2/+2
2020-03-24rustc_typeck: remove rustc_hir_pretty usageMazdak Farrokhzad-3/+3
2020-03-22Use more targetted span for error labelEsteban Küber-2/+2
2020-03-22Add span label to primary error spanEsteban Küber-4/+4
2020-03-22Increase verbosity when suggesting subtle code changesEsteban Küber-2/+12
2020-03-12update testsMark Mansi-14/+14
2020-03-10--bless some testsMazdak Farrokhzad-2/+5
2020-03-08Rollup merge of #69422 - JohnTitor:remove-unwrap, r=XanewokMazdak Farrokhzad-0/+43
Remove use of `unwrap()` from save-analysis Fix #69409, fix #69416
2020-02-28Do not suggest implementing traits if present in predicatesEsteban Küber-3/+2
2020-02-28Review comments: split requirement text to multiple lines for readabilityEsteban Küber-1/+2
2020-02-28Show information of chain of bound obligationsEsteban Küber-1/+1
When the obligation that couldn't be fulfilled is specific to a nested obligation, maintain both the nested and parent obligations around for more accurate and detailed error reporting.
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-28Reduce vebosity of E0599Esteban Küber-1/+0
2020-02-28Add more context to E0599 errorsEsteban Küber-2/+6
Point at the intermediary unfullfilled trait bounds.
2020-02-25Tweak testsYuki Okushi-0/+43
2020-02-11On mismatched argument count point at argumentsEsteban Küber-14/+33
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-2/+0
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-1/+1
2020-01-24Normalise notes with the/isvarkor-2/+2