summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/ident.rs
AgeCommit message (Collapse)AuthorLines
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-43/+30
2024-09-12Rollup merge of #130208 - nnethercote:rslv-lifetime, r=petrochenkovMatthias Krüger-53/+53
Introduce `'ra` lifetime name. `rustc_resolve` allocates many things in `ResolverArenas`. The lifetime used for references into the arena is mostly `'a`, and sometimes `'b`. This commit changes it to `'rslv`, which is much more descriptive. The commit also changes the order of lifetimes on a couple of structs so that '`rslv` is second last, before `'tcx`, and does other minor renamings such as `'r` to `'a`. r? ``@petrochenkov`` cc ``@oli-obk``
2024-09-12Introduce `'ra` lifetime name.Nicholas Nethercote-53/+53
`rustc_resolve` allocates many things in `ResolverArenas`. The lifetime used for references into the arena is mostly `'a`, and sometimes `'b`. This commit changes it to `'ra`, which is much more descriptive. The commit also changes the order of lifetimes on a couple of structs so that '`ra` is second last, before `'tcx`, and does other minor renamings such as `'r` to `'a`.
2024-09-11Simplify some nested if statementsMichael Goulet-6/+6
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1
2024-08-07make `import.vis` is not mutablebohan-15/+55
2024-07-29Reformat `use` declarations.Nicholas Nethercote-12/+10
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-11Account for `let foo = expr`; to suggest `const foo: Ty = expr;`Esteban Küber-12/+32
2024-06-17mark undetermined if target binding in current ns is not gotbohan-9/+16
2024-06-07mark binding undetermined if target name exist and not obtainedbohan-5/+5
2024-06-04resolve: mark it undetermined if single import is not has any bindingsbohan-2/+27
2024-05-21Rename buffer_lint_with_diagnostic to buffer_lintXiretza-1/+1
2024-05-21Generate lint diagnostic message from BuiltinLintDiagXiretza-8/+5
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-10Remove `#[macro_use] extern crate tracing` from `rustc_resolve`.Nicholas Nethercote-0/+1
Explicit imports are more standard nowadays and easier to read.
2024-04-03Fix f16 and f128 feature gates in editions other than 2015Trevor Gross-0/+2
Fixes https://github.com/rust-lang/rust/issues/123282 Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2024-03-14Add feature gates for `f16` and `f128`Trevor Gross-1/+31
Includes related tests and documentation pages. Michael Goulet: Don't issue feature error in resolver for f16/f128 unless finalize Co-authored-by: Michael Goulet <michael@errs.io>
2024-03-06avoid overlapping privacy suggestion for single nested importsbohan-1/+2
2024-03-05Rename `BuiltinLintDiagnostics` as `BuiltinLintDiag`.Nicholas Nethercote-2/+2
Not the dropping of the trailing `s` -- this type describes a single diagnostic and its name should be singular.
2024-02-27Remove an unnecessary `span_delayed_bug` in `Resolver::valid_res_from_ribs`.Nicholas Nethercote-3/+2
`Resolver::report_error` always emits (this commit makes that clearer), so the `span_delayed_bug` is unnecessary.
2024-02-20Add newtype for using the prelude in resolutionclubby789-7/+17
2024-02-18By tracking import use types to check whether it is scope uses or the other ↵surechen-5/+5
situations like module-relative uses, we can do more accurate redundant import checking. fixes #117448 For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-06Rollup merge of #119939 - clubby789:static-const-generic-note, r=compiler-errorsMatthias Krüger-10/+20
Improve 'generic param from outer item' error for `Self` and inside `static`/`const` items Fixes #109596 Fixes #119936
2024-01-14Add note to resolve error about generics from inside static/constclubby789-10/+20
2024-01-13store the segment name when resolution failsbohan-27/+17
2023-12-30Update to bitflags 2 in the compilerNilstrieb-0/+1
This involves lots of breaking changes. There are two big changes that force changes. The first is that the bitflag types now don't automatically implement normal derive traits, so we need to derive them manually. Additionally, bitflags now have a hidden inner type by default, which breaks our custom derives. The bitflags docs recommend using the impl form in these cases, which I did.
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-2/+2
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-1/+1
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-25resolve: Avoid clones of `MacroData`Vadim Petrochenkov-1/+1
And move declarative macro compilation to an earlier point in def collector, which is required for #118188.
2023-10-27Rename `RibKind::ClosureOrAsync` to reflect how it is actually usedOli Scherer-3/+3
2023-10-13Format all the let chains in compilerMichael Goulet-5/+9
2023-09-13resolve: determined binding after parent module macro expandbohan-3/+2
2023-09-10Generalize E0401León Orell Valerian Liehr-8/+2
2023-08-24resolve: Leave a comment about name bindings for legacy derive helpersVadim Petrochenkov-0/+5
2023-08-24resolve: Make bindings for derive helper attributes uniqueVadim Petrochenkov-21/+9
instead of creating them every time such attribute is used
2023-08-24resolve: Make bindings for crate roots uniqueVadim Petrochenkov-3/+1
instead of creating a new every time `crate` or `$crate` is used
2023-08-24resolve: Pre-intern tool module bindingsVadim Petrochenkov-2/+2
2023-08-24resolve: Pre-intern builtin name bindingsVadim Petrochenkov-16/+7
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-3/+3
2023-07-29fix(resolve): update the ambiguity glob binding as warning recursivelybohan-0/+2
2023-07-19Make it clearer that edition functions are >=, not ==Michael Goulet-2/+2
2023-07-05resolve: Use `Interned` for `Module`Vadim Petrochenkov-3/+1
2023-07-05resolve: Use `Interned` for `Import`Vadim Petrochenkov-7/+4
2023-07-05resolve: Use `Interned` for `NameBinding`Vadim Petrochenkov-23/+19
2023-07-01fix(resolve): skip assertion judgment when `NonModule` is dummybohan-1/+1
2023-06-29resolve: Remove artificial import ambiguity errorsVadim Petrochenkov-12/+11
2023-06-22Tweak privacy errors to account for reachable itemsEsteban Küber-0/+13
Suggest publicly accessible paths for items in private mod: When encountering a path in non-import situations that are not reachable due to privacy constraints, search for any public re-exports that the user could use instead. Track whether an import suggestion is offering a re-export. When encountering a path with private segments, mention if the item at the final path segment is not publicly accessible at all. Add item visibility metadata to privacy errors from imports: On unreachable imports, record the item that was being imported in order to suggest publicly available re-exports or to be explicit that the item is not available publicly from any path. In order to allow this, we add a mode to `resolve_path` that will not add new privacy errors, nor return early if it encounters one. This way we can get the `Res` corresponding to the final item in the import, which is used in the privacy error machinery.
2023-06-21resolve: Minor cleanup to `fn resolve_path_with_ribs`Vadim Petrochenkov-51/+38
A single-use closure is inlined and one unnecessary enum is removed.
2023-06-01Remember names of `cfg`-ed out items to mention them in diagnosticsNilstrieb-42/+50
`#[cfg]`s are frequently used to gate crate content behind cargo features. This can lead to very confusing errors when features are missing. For example, `serde` doesn't have the `derive` feature by default. Therefore, `serde::Serialize` fails to resolve with a generic error, even though the macro is present in the docs. This commit adds a list of all stripped item names to metadata. This is filled during macro expansion and then, through a fed query, persisted in metadata. The downstream resolver can then access the metadata to look at possible candidates for mentioning in the errors. This slightly increases metadata (800k->809k for the feature-heavy windows crate), but not enough to really matter.
2023-05-18fix(resolve): only disambiguate binding key during definebohan-1/+2
2023-05-14Revert "Validate resolution for SelfCtor too."Camille GILLOT-4/+1
This reverts commit 83453408a0ce91b9e3d3ae6e7f117b1fd28b487d.