about summary refs log tree commit diff
path: root/compiler/rustc_resolve
AgeCommit message (Collapse)AuthorLines
2024-05-21Make early lints translatableXiretza-24/+15
2024-05-21Convert uses of BuiltinLintDiag::Normal to custom variantsXiretza-36/+54
This ensures all diagnostic messages are created at diagnostic emission time, making them translatable.
2024-05-21Port DeprecatedMacro to diag structsXiretza-5/+3
2024-05-21Generate lint diagnostic message from BuiltinLintDiagXiretza-48/+15
Translation of the lint message happens when the actual diagnostic is created, not when the lint is buffered. Generating the message from BuiltinLintDiag ensures that all required data to construct the message is preserved in the LintBuffer, eventually allowing the messages to be moved to fluent. Remove the `msg` field from BufferedEarlyLint, it is either generated from the data in the BuiltinLintDiag or stored inside BuiltinLintDiag::Normal.
2024-05-21Move `#[do_not_recommend]` to the `#[diagnostic]` namespaceGeorg Semmler-1/+3
This commit moves the `#[do_not_recommend]` attribute to the `#[diagnostic]` namespace. It still requires `#![feature(do_not_recommend)]` to work.
2024-05-20Fix incorrect suggestion for undeclared hrtb lifetimes in where clauses.surechen-14/+87
fixes #122714
2024-05-19fix typoPietro Albini-6/+6
2024-05-18Auto merge of #125105 - nnethercote:rustc_resolve-cleanups, r=estebankbors-75/+23
`rustc_resolve` cleanups Some improvements I found while looking through this code. r? `@estebank`
2024-05-15Fix new for_loops_over_fallibles hits in compiler.Zachary S-4/+4
2024-05-15Auto merge of #123413 - petrochenkov:delegmulti2, r=fmeasebors-9/+20
delegation: Implement list delegation ```rust reuse prefix::{a, b, c}; ``` Using design described in https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823 (the lists are desugared at macro expansion time). List delegations are expanded eagerly when encountered, similarly to `#[cfg]`s, and not enqueued for later resolution/expansion like regular macros or glob delegation (https://github.com/rust-lang/rust/pull/124135). Part of https://github.com/rust-lang/rust/issues/118212.
2024-05-15delegation: Implement list delegationVadim Petrochenkov-9/+20
```rust reuse prefix::{a, b, c} ```
2024-05-15Add `on_unimplemented" typo suggestionsmejrs-5/+15
2024-05-10Remove `ordinalize`.Nicholas Nethercote-59/+1
Some minor (English only) heroics are performed to print error messages like "5th rule of macro `m` is never used". The form "rule #5 of macro `m` is never used" is just as good and much simpler to implement.
2024-05-10Remove unused `derive(Clone)` on `MacroData`.Nicholas Nethercote-1/+0
2024-05-10Remove `#[macro_use] extern crate tracing` from `rustc_resolve`.Nicholas Nethercote-9/+15
Explicit imports are more standard nowadays and easier to read.
2024-05-10Remove unnecessary `allow` attribute.Nicholas Nethercote-6/+7
The `#[allow(rustdoc:private_intra_doc_links)]` isn't necessary. Also sort them, as is done in other files like `compiler/rustc_errors/src/lib.rs`.
2024-05-08Rollup merge of #123344 - pietroalbini:pa-unused-imports, r=NilstriebMatthias Krüger-31/+47
Remove braces when fixing a nested use tree into a single item [Back in 2019](https://github.com/rust-lang/rust/pull/56645) I added rustfix support for the `unused_imports` lint, to automatically remove them when running `cargo fix`. For the most part this worked great, but when removing all but one childs of a nested use tree it turned `use foo::{Unused, Used}` into `use foo::{Used}`. This is slightly annoying, because it then requires you to run `rustfmt` to get `use foo::Used`. This PR automatically removes braces and the surrouding whitespace when all but one child of a nested use tree are unused. To get it done I had to add the span of the nested use tree to the AST, and refactor a bit the code I wrote back then. A thing I noticed is, there doesn't seem to be any `//@ run-rustfix` test for fixing the `unused_imports` lint. I created a test in `tests/suggestions` (is that the right directory?) that for now tests just what I added in the PR. I can followup in a separate PR to add more tests for fixing `unused_lints`. This PR is best reviewed commit-by-commit.
2024-05-04Rollup merge of #124293 - oli-obk:miri_intrinsic_fallback_body, r=RalfJungMatthias Krüger-1/+1
Let miri and const eval execute intrinsics' fallback bodies fixes https://github.com/rust-lang/miri/issues/3397 r? ``@RalfJung``
2024-05-03Rollup merge of #124510 - linyihai:raw-ident-in-typo-suggestion, r=fmeaseMatthias Krüger-1/+1
Add raw identifier in a typo suggestion Fixes #68962
2024-05-03Ensure miri only uses fallback bodies that have manually been vetted to ↵Oli Scherer-1/+1
preserve all UB that the native intrinsic would have
2024-04-29Add StaticForeignItem and use it on ForeignItemKindSantiago Pastorino-1/+1
2024-04-29Add raw identifier in a typo suggestionLin Yihai-1/+1
2024-04-28Auto merge of #124431 - chenyukang:yukang-fix-rustdoc-124363, r=Nadrierilbors-11/+14
Fix the assertion crash from rustdoc document indent widths Fixes #124363
2024-04-28Fix the assertion crash from rustdoc document indent widthsyukang-11/+14
2024-04-27Rollup merge of #124382 - petrochenkov:itemvisit, r=lcnrMatthias Krüger-7/+5
ast: Generalize item kind visiting And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign). The diff is better viewed with whitespace ignored.
2024-04-26Rollup merge of #124391 - nnethercote:builtin_macros-cleanups, r=fee1-deadJacob Pratt-10/+10
`rustc_builtin_macros` cleanups Some improvements I found while looking over this code. r? ``@fee1-dead``
2024-04-26Introduce `DeriveResolution`.Nicholas Nethercote-10/+10
Making this a proper struct, and giving its fields names, makes things easier to understand.
2024-04-25ast: Generalize item kind visitingVadim Petrochenkov-7/+5
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
2024-04-24resolve: Remove two cases of misleading macro call visitingVadim Petrochenkov-12/+3
Macro calls are ephemeral, they should not add anything to the definition tree, even if their AST could contains something with identity. Thankfully, macro call AST cannot contain anything like that, so these walks are just noops. In majority of other places in def_collector / build_reduced_graph they are already not visited. (Also, a minor match reformatting is included.)
2024-04-23delegation: Support async, const, extern "ABI" and C-variadic functionsVadim Petrochenkov-18/+19
Also allow `impl Trait` in delegated functions. The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
2024-04-23Rollup merge of #124218 - Xiretza:subsubdiagnostics, r=davidtwcoLeón Orell Valerian Liehr-8/+8
Allow nesting subdiagnostics in #[derive(Subdiagnostic)]
2024-04-23Rollup merge of #124067 - RalfJung:weak-lang-items, r=davidtwcoMatthias Krüger-1/+1
weak lang items are not allowed to be #[track_caller] For instance the panic handler will be called via this import ```rust extern "Rust" { #[lang = "panic_impl"] fn panic_impl(pi: &PanicInfo<'_>) -> !; } ``` A `#[track_caller]` would add an extra argument and thus make this the wrong signature. The 2nd commit is a consistency rename; based on the docs [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html) and [here](https://rustc-dev-guide.rust-lang.org/lang-items.html) I figured "lang item" is more widely used. (In the compiler output, "lang item" and "language item" seem to be pretty even.)
2024-04-21Move "elided lifetime in path" to subdiagnostic structXiretza-8/+8
This requires nested subdiagnostics.
2024-04-17Rename `BindingAnnotation` to `BindingMode`Jules Bertholet-3/+3
2024-04-17consistency rename: language item -> lang itemRalf Jung-1/+1
2024-04-15More polishingMichael Goulet-0/+6
2024-04-15Use a path instead of an ident (and stop manually resolving)Michael Goulet-54/+12
2024-04-15Validation and other thingsMichael Goulet-0/+35
2024-04-15Implement resolution, parse use<Self>Michael Goulet-2/+22
2024-04-15Use dedicated PreciseCapturingArg for representing what goes in use<>Michael Goulet-0/+10
2024-04-15Parsing , pre-lowering support for precise capturesMichael Goulet-2/+2
2024-04-14 remove braces when fixing a nested use tree into a single usePietro Albini-1/+26
2024-04-14store the span of the nested part of the use tree in the astPietro Albini-7/+7
2024-04-14turn all_nested_unused into used_childsPietro Albini-5/+5
2024-04-14remove redundant flat vs nested distinction to simplify enumPietro Albini-19/+10
2024-04-14add enum variant field names to make the code clearerPietro Albini-13/+13
2024-04-13Reorder error messagesJean CASPAR-14/+6
2024-04-13Migrate more diagnosticsJean CASPAR-174/+537
2024-04-13Migrate some diagnosticsJean CASPAR-70/+48
2024-04-13Port build_reduce_graphJeanCASPAR-51/+235