about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/ident.rs
AgeCommit message (Collapse)AuthorLines
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.
2023-05-11Improve error for `self: Box<self>`clubby789-24/+20
2023-05-05improve diagnostics and bless testsBoxy-19/+51
2023-05-05misc nameres changes for anon constsBoxy-10/+2
2023-05-04Rollup merge of #111070 - WaffleLapkin:break_ribs, r=lcnrMatthias Krüger-34/+33
Don't suffix `RibKind` variants This PR - Removes `use RibKind::*` - Renames `RibKind::{SomethingRibKind => Something}` It seems unnecessary to have "RibKind" in the end of all variants, if we can just use it as a normal enum. Additionally previously it was weird that `MacroDefinition` is the only unsuffixed variant.
2023-05-04Rollup merge of #111020 - cjgillot:validate-self-ctor, r=petrochenkovMatthias Krüger-1/+4
Validate resolution for SelfCtor too. Fixes https://github.com/rust-lang/rust/issues/89868 r? `@petrochenkov`
2023-05-03Validate resolution for SelfCtor too.Camille GILLOT-1/+4
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-1/+1
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-05-01Remove "RibKind" suffix from `RibKind` variantsMaybe Waffle-28/+28
2023-05-01Don't `use RibKind::*`Maybe Waffle-34/+33
2023-05-01Rip it outNilstrieb-1/+7
My type ascription Oh rip it out Ah If you think we live too much then You can sacrifice diagnostics Don't mix your garbage Into my syntax So many weird hacks keep diagnostics alive Yet I don't even step outside So many bad diagnostics keep tyasc alive Yet tyasc doesn't even bother to survive!
2023-04-06Rollup merge of #109909 - clubby789:import-tool-mod, r=petrochenkovYuki Okushi-11/+7
Deny `use`ing tool paths Fixes #109853 Fixes #109147
2023-04-04Deny `use`ing tool pathsclubby789-11/+7
2023-04-04Auto merge of #109599 - notriddle:notriddle/use-redundant-glob, r=petrochenkovbors-14/+21
diagnostics: account for glob shadowing when linting redundant imports Fixes #92904
2023-04-01slighty simplify a few boolean expressions (clippy::nonminimal_bool)Matthias Krüger-1/+1
2023-04-01diagnostics: account for glob shadowing when linting redundant importsMichael Howell-14/+21
Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2023-03-03Match unmatched backticks in compiler/ that are part of rustdocest31-1/+1
2023-02-20Prepare for adding a `TyCtxt` to `Resolver`Oli Scherer-6/+9
2023-02-14Separate the lifetime of the session and the arena in the resolverOli Scherer-1/+1
2023-02-02Rename `rust_2015` => `is_rust_2015`Maybe Waffle-2/+3
2023-01-31Use `Edition` methods a bit moreMaybe Waffle-2/+1
2023-01-20Revert "Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error"Felix S. Klock II-10/+65
This reverts commit 7d82cadd97acc66993b69304c5a1a04ef7d1fa36. I am doing this to buy us some time with respect to issue #106337 w.r.t. the 1.67 release.
2023-01-04Simplify some iterator combinatorsMichael Goulet-5/+4
2022-11-01Rollup merge of #103760 - petrochenkov:macimp, r=cjgillotDylan DPC-2/+6
resolve: Turn the binding from `#[macro_export]` into a proper `Import` Continuation of https://github.com/rust-lang/rust/pull/91795. ```rust #[macro_export] macro_rules! m { /*...*/ } ``` is desugared to something like ```rust macro_rules! m { /*...*/ } // Non-modularized macro_rules item pub use m; // It's modularized reexport ``` This PR adjusts the internal representation to better match this model.
2022-10-31resolve: Turn the binding from `#[macro_export]` into a proper `Import`Vadim Petrochenkov-2/+6
2022-10-24Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard errorAaron Hill-65/+10
2022-09-29Shrink `hir::def::Res`.Nicholas Nethercote-6/+16
`Res::SelfTy` currently has two `Option`s. When the second one is `Some` the first one is never consulted. So we can split it into two variants, `Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res` from 24 bytes to 12. This then shrinks `hir::Path` and `hir::PathSegment`, which are the HIR types that take up the most space.