summary refs log tree commit diff
path: root/src/test/ui/hygiene
AgeCommit message (Collapse)AuthorLines
2020-05-17Emit a better diagnostic when function actually has a 'self' parameterAaron Hill-0/+40
Fixes #66898 When we are unable to resolve a reference to `self`, we current assume that the containing function doesn't have a `self` parameter, and emit an error message accordingly. However, if the reference to `self` was created by a macro invocation, then resolution will correctly fail, due to hygiene. In this case, we don't want to tell the user that the containing fuction doesn't have a 'self' paramter if it actually has one. This PR checks for the precense of a 'self' parameter, and adjusts the error message we emit accordingly. TODO: The exact error message we emit could probably be improved. Should we explicitly mention hygiene?
2020-05-09adjust testsRalf Jung-2/+4
2020-05-07reword "possible candidate" import suggestionAndy Russell-4/+4
2020-04-11rustc: Add a warning count upon completionRoccoDev-0/+8
2020-03-22Normalize wording of privacy access labelsEsteban Küber-9/+19
2020-03-22Add span label to primary error spanEsteban Küber-2/+2
2020-03-16Make macro metavars respect (non-)hygieneMatthew Jasper-0/+53
2020-02-24parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`Vadim Petrochenkov-2/+2
2020-02-10use `dyn Trait` more in testsMazdak Farrokhzad-2/+2
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-2/+111
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-2/+2
2020-01-26Suggest defining type parameter when appropriateEsteban Küber-8/+7
``` error[E0412]: cannot find type `T` in this scope --> file.rs:3:12 | 3 | impl Trait<T> for Struct {} | - ^ not found in this scope | | | help: you might be missing a type parameter: `<T>` ``` Fix #64298.
2020-01-16resolve: Point at the private item definitions in privacy errorsVadim Petrochenkov-1/+7
2020-01-08Unify output of "variant not found" errorsEsteban Küber-3/+3
2019-11-15Cleaned up unused labelsBart Massey-56/+58
Deleted unused labels from compiler and fixed or allowed unused labels in tests. This patch removes some gratuitous unused labels and turns off the warning for unused labels that are a necessary part of tests. This will permit setting the `unused_labels` lint to `warn`.
2019-11-10Make error and warning annotations mandatory in UI testsTomasz Miąsko-63/+116
This change makes error and warning annotations mandatory in UI tests. The only exception are tests that use error patterns to match compiler output and don't have any annotations.
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+3
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-18Change how `Symbol::Debug` works.Nicholas Nethercote-1/+1
Currently, `Symbol::Debug` and `Symbol::Display` produce the same output; neither wraps the symbol in double quotes. This commit changes `Symbol::Debug` so it wraps the symbol in quotes. This change brings `Symbol`'s behaviour in line with `String` and `InternedString`. The change requires a couple of trivial test output adjustments.
2019-10-14Use heuristics for capitalization warning in suggestionsEsteban Küber-1/+1
2019-10-13Bring attention to suggestions when the only difference is capitalizationEsteban Küber-3/+3
2019-09-30Fixed grammar in one diagnostic and blessed tests.Alexander Regueiro-2/+2
2019-09-17Rollup merge of #64486 - matthewjasper:hygiene-debugging, r=petrochenkovTyler Mandry-0/+10
Print out more information for `-Zunpretty=expanded,hygiene` I've found this helpful when trying to understand how hygiene works. Closes #16420
2019-09-17Print syntax contexts and marks when printing hygiene informationMatthew Jasper-0/+10
2019-09-15resolve: Remove `!` from "cannot find" diagnostics for macrosVadim Petrochenkov-4/+4
2019-09-08Give method not found a primary span labelEsteban Küber-2/+2
2019-09-05Make use of hygiene in AST passesMatthew Jasper-0/+30
2019-08-21Add a regression test for issue #63460Vadim Petrochenkov-0/+22
2019-08-21expand: Do not do questionable span adjustment before eagerly expanding an ↵Vadim Petrochenkov-12/+3
expression Maybe it made sense when it was introduced, but now it's doing something incorrect.
2019-08-21expand: Keep the correct current expansion ID for eager expansionsVadim Petrochenkov-0/+3
Solve the problem of `ParentScope` entries for eager expansions not exising in the resolver map by creating them on demand.
2019-08-21Add a test for an opaque macro eagerly expanding its argumentsVadim Petrochenkov-0/+26
2019-08-17Stop emulating cross-crate hygiene with gensymsMatthew Jasper-0/+22
Most `Ident`s are serialized as `InternedString`s the exceptions are: * Reexports * Attributes * Idents in macro definitions Using gensyms helped reexports emulate hygiene. However, the actual item wouldn't have a gensymmed name so would be usable cross-crate. So removing this case until we have proper cross-crate hygiene seems sensible. Codegen attributes (`inline`, `export_name`) are resolved by their `Symbol`. This meant that opaque macro-expanded codegen attributes could cause linker errors. This prevented making built-in derives hygienic.
2019-08-15resolve: Move macro resolution traces from `Module`s to `Resolver`Vadim Petrochenkov-8/+8
Traces already contain module info without that. It's easy to forget to call `finalize_*` on a module. In particular, macros enum and trait modules weren't finalized. By happy accident macros weren't placed into those modules until now.
2019-08-10resolve: Move late resolution into a separate visitorVadim Petrochenkov-0/+38
Move `Resolver` fields specific to late resolution to the new visitor. The `current_module` field from `Resolver` is replaced with two `current_module`s in `LateResolutionVisitor` and `BuildReducedGraphVisitor`. Outside of those visitors `current_module` is replaced by passing `parent_scope` to more functions and using the parent module from it. Visibility resolution no longer have access to later resolution methods and has to use early resolution, so its diagnostics in case of errors regress slightly.
2019-08-05Remove gensym from format_argsMatthew Jasper-0/+12
2019-07-30--bless tests due to INCOMPLETE_FEATURES being a lint.Mazdak Farrokhzad-0/+4
2019-07-29Add another test for const parameter (non) hygiene.Matthew Jasper-0/+38
2019-07-28Resolve const parameters with modern hygieneMatthew Jasper-14/+110
Declarations were already modernized, resulting in cases where a macro couldn't resolve it's own identifier.
2019-07-28Disallow duplicate lifetime parameters with legacy hygieneMatthew Jasper-0/+46
They were resolved with modern hygiene, making this just a strange way to shadow lifetimes.
2019-07-19Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwcobors-10/+8
resolve: Improve candidate search for unresolved macro suggestions Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names. The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around). This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086. r? @davidtwco
2019-07-18Rollup merge of #62764 - ↵Mark Rousskov-1/+1
fakenine:normalize_use_of_backticks_compiler_messages_p7, r=alexreg normalize use of backticks in compiler messages for librustc/lint https://github.com/rust-lang/rust/issues/60532
2019-07-18resolve: Attempt to resolve unresolved paths in macro namespaceVadim Petrochenkov-7/+8
2019-07-18resolve: Visit all scopes to collect suggestion candidates for unresolved macrosVadim Petrochenkov-3/+0
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532
2019-07-16Make pretty-expanded-hygiene a `ui` testMatthew Jasper-0/+35
`normalize-stdout-test` removes the need for Make, and it can be updated with `--bless` this way
2019-07-16Change all run-pass hygiene tests to `ui` testsMatthew Jasper-7/+1177
Change some tests to `check-pass` that are only testing name resolution.
2019-07-11Add a regression test for #44692Vadim Petrochenkov-0/+65
Add a test for the issue resolved by removing `resolve_macro_path` Add a test making sure that extern prelude entries introduced from an opaque macro are not visible anywhere, even it that macro Fix test output after rebase
2019-07-11resolve: Fix access to extern and stdlib prelude from opaque macrosVadim Petrochenkov-0/+40
Ok, it's hard to explain what happens, but identifier's hygienic contexts need to be "adjusted" to modules/scopes before they are resolved in them. To be resolved in all kinds on preludes the identifier needs to be adjusted to the root expansion (aka "no expansion"). Previously this was done for the `macro m() { ::my_crate::foo }` case, but forgotten for all other cases.
2019-07-06`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`Vadim Petrochenkov-4/+56
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-3/+3
2019-06-16compiletest: Remove `skip-codegen`Vadim Petrochenkov-3/+2