about summary refs log tree commit diff
path: root/src/test/ui/hygiene
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-3138/+0
2022-12-27Fix some totally useless suggestionsMichael Goulet-4/+1
2022-12-11Move testsCaio-0/+16
2022-11-20Update VecDeque implementationMarkus Everling-1/+1
2022-10-27Correct inconsistent error messages in testsByron Zhong-1/+1
2022-10-16Account for hygiene when suggesting typos.Camille GILLOT-9/+17
2022-10-11Report duplicate definitions in trait impls during resolution.Camille GILLOT-0/+41
2022-09-26address reviewb-naber-2/+2
2022-06-03Use the same message as type & const generics.Camille GILLOT-9/+9
2022-06-02Stop warning against unrelated labels.Camille GILLOT-67/+0
2022-06-02Bless tests.Camille GILLOT-683/+35
2022-05-20Move testsCaio-0/+29
2022-01-19Only suggest adding `!` to expressions that can be macro invocationEsteban Kuber-20/+8
2021-12-01Pretty print empty blocks as {}David Tolnay-1/+1
2021-11-18Move some tests to more reasonable directoriesCaio-0/+9
2021-11-06Move some tests to more reasonable directoriesCaio-0/+12
2021-10-28Add comments to hygiene testsMatthew Jasper-4/+37
2021-10-24Add more tests for cross-crate hygieneMatthew Jasper-0/+465
2021-10-19Rollup merge of #89956 - JohnTitor:suggest-case-insensitive-match-names, ↵Matthias Krüger-1/+15
r=estebank Suggest a case insensitive match name regardless of levenshtein distance Fixes #86170 Currently, `find_best_match_for_name` only returns a case insensitive match name depending on a Levenshtein distance. It's a bit unfortunate that that hides some suggestions for typos like `Bar` -> `BAR`. That idea is from https://github.com/rust-lang/rust/pull/46347#discussion_r153701834, but I think it still makes some sense to show a candidate when we find a case insensitive match name as it's more like a typo. Skipped the `candidate != lookup` check because the current (i.e, `levenshtein_match`) returns the exact same `Symbol` anyway but it doesn't seem to confuse anything on UI tests. r? ``@estebank``
2021-10-17Suggest a case insensitive match name regardless of levenshtein distanceYuki Okushi-1/+15
2021-10-15Bless testsCameron Steffen-54/+54
2021-09-30Rollup merge of #88838 - FabianWolff:issue-88472, r=estebankManish Goregaokar-3/+3
Do not suggest importing inaccessible items Fixes #88472. For this example: ```rust mod a { struct Foo; } mod b { type Bar = Foo; } ``` rustc currently emits: ``` error[E0412]: cannot find type `Foo` in this scope --> test.rs:6:16 | 6 | type Bar = Foo; | ^^^ not found in this scope | help: consider importing this struct | 6 | use a::Foo; | ``` this is incorrect, as applying this suggestion leads to ``` error[E0603]: struct `Foo` is private --> test.rs:6:12 | 6 | use a::Foo; | ^^^ private struct | note: the struct `Foo` is defined here --> test.rs:2:5 | 2 | struct Foo; | ^^^^^^^^^^^ ``` With my changes, I get: ``` error[E0412]: cannot find type `Foo` in this scope --> test.rs:6:16 | 6 | type Bar = Foo; | ^^^ not found in this scope | = note: this struct exists but is inaccessible: a::Foo ``` As for the wildcard mentioned in #88472, I would argue that the warning is actually correct, since the import _is_ unused. I think the real issue is the wrong suggestion, which I have fixed here.
2021-09-30Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, ↵Manish Goregaokar-1/+4
r=estebank Suggest similarly named associated items in trait impls Fix #85942 Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.
2021-09-29Suggest similarly named assoc items in trait implsHirochika Matsumoto-1/+4
Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types and constants.
2021-09-26Do not suggest importing inaccessible itemsFabian Wolff-3/+3
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-09-02Bless tests.Camille GILLOT-4/+8
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-26/+1
2021-08-11Modify structured suggestion outputEsteban Küber-3/+3
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-07-27Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by defaultAaron Hill-7/+7
2021-07-17Use LocalExpnId where possible.Camille GILLOT-4/+4
2021-07-10rustc_span: Revert addition of `proc_macro` field to `ExpnKind::Macro`Vadim Petrochenkov-1/+1
The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
2021-07-03rustc_ast_pretty: Don't print space after `$`Noah Lev-1/+1
For example, this code: $arg:expr used to be pretty-printed as: $ arg : expr but is now pretty-printed as: $arg : expr
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-60/+60
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-05-12Update stderrAaron Hill-1/+1
The spans generated by `quote!` are (intentionally) no longer all the same, so I removed that check entirely.
2021-04-23Tweak suggestion outputEsteban Küber-0/+3
2021-02-16Move some tests to more reasonable directoriesCaio-0/+17
2021-01-24Rollup merge of #80855 - m-ou-se:assert-2021, r=petrochenkovJonas Schievink-0/+9
Expand assert!(expr, args..) to include $crate for hygiene on 2021. This makes `assert!(expr, args..)` properly hygienic in Rust 2021. This is part of rust-lang/rfcs#3007, see #80162. Before edition 2021, this was a breaking change, as `std::panic` and `core::panic` are different. In edition 2021 they will be identical, making it possible to apply proper hygiene here.
2021-01-11resolve: Simplify collection of traits in scopeVadim Petrochenkov-0/+53
2021-01-09Add test for assert!() hygiene in edition 2021.Mara Bos-0/+9
2020-12-26update testsBastian Kauschke-2/+0
2020-12-02Tweak diagnostics on shadowing lifetimes/labelsYuki Okushi-56/+56
2020-11-23Qualify `panic!` as `core::panic!` in non-built-in `core` macrosCamelid-14/+3
Otherwise code like this #![no_implicit_prelude] fn main() { ::std::todo!(); ::std::unimplemented!(); } will fail to compile, which is unfortunate and presumably unintended. This changes many invocations of `panic!` in a `macro_rules!` definition to invocations of `$crate::panic!`, which makes the invocations hygienic. Note that this does not make the built-in macro `assert!` hygienic.
2020-11-13refactor: vec_deque ignore-tidy-filelengthC-1/+1
commit c547d5fabcd756515afa7263ee5304965bb4c497 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 11:22:23 2020 +0000 test: updating ui/hygiene/panic-location.rs expected commit 2af03769c4ffdbbbad75197a1ad0df8c599186be Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 10:43:30 2020 +0000 fix: documentation unresolved link commit c4b0df361ce27d7392d8016229f2e0265af32086 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 02:58:31 2020 +0000 style: compiling with Rust's style guidelines commit bdd2de5f3c09b49a18e3293f2457fcab25557c96 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 02:56:31 2020 +0000 refactor: removing ignore-tidy-filelength commit fcc4b3bc41f57244c65ebb8e4efe4cbc9460b5a9 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 02:51:35 2020 +0000 refactor: moving trait RingSlices to ring_slices.rs commit 2f0cc539c06d8841baf7f675168f68ca7c21e68e Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 02:46:09 2020 +0000 refactor: moving struct PairSlices to pair_slices.rs commit a55d3ef1dab4c3d85962b3a601ff8d1f7497faf2 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 02:31:45 2020 +0000 refactor: moving struct Iter to iter.rs commit 76ab33a12442a03726f36f606b4e0fe70f8f246b Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 02:24:32 2020 +0000 refactor: moving struct IntoIter into into_iter.rs commit abe0d9eea2933881858c3b1bc09df67cedc5ada5 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 02:19:07 2020 +0000 refactor: moving struct IterMut into iter_mut.rs commit 70ebd6420335e1895e2afa2763a0148897963e24 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 01:49:15 2020 +0000 refactor: moved macros into macros.rs commit b08dd2add994b04ae851aa065800bd8bd6326134 Author: C <DeveloperC@protonmail.com> Date: Sat Oct 31 01:05:36 2020 +0000 refactor: moving vec_deque.rs to vec_deque/mod.rs
2020-10-17Rollup merge of #77925 - JohnTitor:sugg-min-features, r=davidtwco,oli-obkYuki Okushi-0/+2
Suggest minimal subset features in `incomplete_features` lint This tells users that we have a minimal subset feature of it and they can fix the lint warning without allowing it. The wording improvement is helpful :) Fixes #77913
2020-10-17Rollup merge of #75209 - Hirrolot:suggest-macro-imports, r=estebankYuki Okushi-0/+6
Suggest imports of unresolved macros Closes https://github.com/rust-lang/rust/issues/75191.
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+2
2020-10-05Record `expansion_that_defined` into crate metadataAaron Hill-0/+47
Fixes #77523 Now that hygiene serialization is implemented, we also need to record `expansion_that_defined` so that we properly handle a foreign `SyntaxContext`.
2020-09-30Re-run tests with --blessTemirkhan Myrzamadi-0/+6
2020-09-09Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasperTyler Mandry-7/+7
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.