about summary refs log tree commit diff
path: root/src/test/ui/use
AgeCommit message (Collapse)AuthorLines
2021-11-28Rollup merge of #90131 - camsteffen:fmt-args-span-fix, r=cjgillotMatthias Krüger-0/+2
Fix a format_args span to be expansion I found this while exploring solutions for rust-lang/rust-clippy#7843. r? `@m-ou-se`
2021-11-08Don't abort compilation after giving a lint errorJoshua Nelson-5/+4
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
2021-10-29Fix a format_args span to be expansionCameron Steffen-0/+2
2021-10-02resolve: Cache module loading for all foreign modulesVadim Petrochenkov-1/+1
It was previously cached for modules loaded from `fn get_module`, but not for modules loaded from `fn build_reduced_graph_for_external_crate_res`. This also makes all foreign modules use their real parent, span and expansion instead of possibly a parent/span/expansion of their reexport. An ICE happening on attempt to decode expansions for foreign enums and traits is avoided. Also local enums and traits are now added to the module map.
2021-09-30Auto merge of #89110 - Aaron1011:adjustment-span, r=estebankbors-1/+1
Use larger span for adjustment THIR expressions 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. These spans are recoded when we first create the adjustment during typecheck. For example, an autoref adjustment triggered by a method call will record the span of the entire method call. 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-09-26Remove box syntax from most places in src/test outside of the issues direst31-9/+10
2021-09-25Use larger span for adjustments on method callsAaron Hill-1/+1
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-11Modify structured suggestion outputEsteban Küber-12/+16
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-01-08Change wording of noteAaron Hill-2/+2
2020-09-09Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasperTyler Mandry-4/+4
Improve unresolved use error message "use of undeclared type or module `foo`" doesn't mention that it could be a crate. This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate. I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-2/+2
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-09-01Clarify message about unresolved useKornel-4/+4
2020-06-26Explain move errors that occur due to method calls involving `self`Aaron Hill-2/+14
This is a re-attempt of #72389 (which was reverted in #73594) Instead of using `ExpnKind::Desugaring` to represent operators, this PR checks the lang item directly.
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-14/+2
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-11Use `fn_span` to point to the actual method callAaron Hill-2/+2
2020-06-11Explain move errors that occur due to method calls involving `self`Aaron Hill-2/+14
2020-05-19Alter wording for `use foo::self` helpmibac138-8/+8
2020-05-19Add error recovery for `use foo::self`mibac138-1/+63
2020-05-19Suggest fixes for `use foo::self`mibac138-5/+23
2020-05-07reword "possible candidate" import suggestionAndy Russell-1/+1
2020-03-22Normalize wording of privacy access labelsEsteban Küber-4/+4
2020-01-31Auto merge of #68080 - varkor:declared-here, r=petrochenkovbors-1/+1
Address inconsistency in using "is" with "declared here" "is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout. r? @Centril
2020-01-24Normalise notes with the/isvarkor-1/+1
2020-01-23add a test for #60976Tuomas Lappeteläinen-0/+10
The test fails on 1.36.0 but passes on master.
2020-01-16resolve: Point at the private item definitions in privacy errorsVadim Petrochenkov-4/+28
2020-01-09Update testsVadim Petrochenkov-3/+10
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+1
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-13Update ui testsGuillaume Gomez-0/+1
2019-10-04metadata: Remove `locator::Context::ident`Vadim Petrochenkov-2/+2
It's a crate name after renaming, so it's entirely irrelevant to crate loading
2019-08-05Don't recommend `extern crate` syntaxKornel-1/+1
2019-05-29Update ui test suite to use dynmemoryruins-2/+2
2019-04-22update tests for migrate mode by defaultMatthew Jasper-72/+20
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-8/+7
2019-04-10clarify what the item is in "not a module" errorAndy Russell-21/+36
2019-03-23Mark duplicate import removal suggestion tool onlyEsteban Küber-1/+0
2019-03-23Tweak unnecessary import suggestionEsteban Küber-4/+2
2019-03-14Moved issue tests to subdirs and normalised names.Alexander Regueiro-1/+20
2019-03-11Update NLL testsVadim Petrochenkov-3/+3
2019-03-11Update testsVadim Petrochenkov-17/+17
2019-03-09use structured suggestions for E0432Andy Russell-1/+4
2019-02-11Use hidden suggestions for unused imports lintEsteban Küber-5/+3
2019-02-08unused_imports: update testsPietro Albini-6/+8
2019-01-31Add suggestion for duplicated import.David Wood-10/+8
This commit adds a suggestion when a import is duplicated (ie. the same name is used twice trying to import the same thing) to remove the second import.
2019-01-24Fix --compare-mode=nll testsEsteban Küber-8/+9
2018-12-29add non-copy note to stderrcsmoe-1/+3
2018-12-27retrieve ty info from place_tycsmoe-1/+1
describe index with _
2018-12-25Remove licensesMark Rousskov-229/+47
2018-11-18resolve: Avoid sentence breaks in diagnosticsVadim Petrochenkov-15/+15
2018-10-28resolve: More precise spans for privacy errorsVadim Petrochenkov-14/+14
2018-10-23Auto merge of #55113 - mockersf:master, r=estebankbors-2/+2
#45829 when a renamed import conflict with a previous import Fix the suggestion when a renamed import conflict. It check if the snipped contains `" as "`, and if so uses everything before for the suggestion.