summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late.rs
AgeCommit message (Collapse)AuthorLines
2023-07-05resolve: Use `Interned` for `Module`Vadim Petrochenkov-1/+1
2023-07-05resolve: Use `Interned` for `NameBinding`Vadim Petrochenkov-1/+1
2023-07-04Auto merge of #112917 - chenyukang:yukang-fix-112590, r=estebankbors-3/+8
Suggest importing for partial mod path matching in name resolving Fixes #112590
2023-07-02add testcase for 112590yukang-7/+8
2023-06-30Use structured suggestion when telling user about `for<'a>`Esteban Küber-3/+7
``` error[E0637]: `&` without an explicit lifetime name cannot be used here --> $DIR/E0637.rs:13:13 | LL | T: Into<&u32>, | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | LL | T: for<'a> Into<&'a u32>, | +++++++ ++ ```
2023-06-22suggest importing for partial mod path in name resolvingyukang-1/+5
2023-06-19ReformattingTom Martin-3/+5
2023-06-18Add translatable diagnostic for invalid importsTom Martin-5/+5
2023-06-01Remember names of `cfg`-ed out items to mention them in diagnosticsNilstrieb-4/+20
`#[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-23Ignore "non-real" type Res in rustdoc intra doc link resolutionGuillaume Gomez-7/+8
2023-05-18fix(resolve): only disambiguate binding key during definebohan-2/+3
2023-05-16Rollup merge of #111428 - bvanjoi:fix-109250, r=NilstriebNilstrieb-4/+0
refactor(resolve): clean up the early error return caused by non-call closes https://github.com/rust-lang/rust/issues/109250 It seems no bad happened, r? ``@Nilstrieb``
2023-05-11Rollup merge of #111460 - clubby789:lowercase-box-self, r=compiler-errorsMichael Goulet-0/+9
Improve suggestion for `self: Box<self>` Fixes #110642
2023-05-11Improve error for `self: Box<self>`clubby789-0/+9
2023-05-10Only warn single-use lifetime when the binders match.Camille GILLOT-5/+11
2023-05-10refactor(resolve): clean up the early error return caused by non-callbohan-4/+0
2023-05-05improve diagnostics and bless testsBoxy-2/+2
2023-05-05misc nameres changes for anon constsBoxy-101/+161
2023-05-04Rollup merge of #110982 - cjgillot:elided-self-const, r=petrochenkovMatthias Krüger-0/+4
Do not recurse into const generic args when resolving self lifetime elision. Fixes https://github.com/rust-lang/rust/issues/110899 r? `@petrochenkov`
2023-05-04Rollup merge of #111070 - WaffleLapkin:break_ribs, r=lcnrMatthias Krüger-80/+78
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-03Do not recurse into const generic args when resolving self lifetime elision.Camille GILLOT-0/+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-80/+74
2023-05-01Don't `use RibKind::*`Maybe Waffle-71/+75
2023-05-01fix testsyukang-3/+7
2023-05-01clean up debug codeyukang-1/+4
2023-05-01remove current_type_ascription from DiagnosticMetadatayukang-13/+1
2023-05-01Rip it outNilstrieb-11/+4
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-30Rollup merge of #110984 - cjgillot:const-infer-lifetime, r=compiler-errorsMatthias Krüger-2/+2
Do not resolve anonymous lifetimes in consts to be static. Fixes https://github.com/rust-lang/rust/issues/110931
2023-04-29Do not force anonymous lifetimes in consts to be static.Camille GILLOT-2/+2
2023-04-28Don't duplicate anonymous lifetimes for async fn in traitsMichael Goulet-5/+1
2023-04-17Spelling - compilerJosh Soref-2/+2
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-12Rollup merge of #110203 - compiler-errors:rtn-dots, r=eholkMatthias Krüger-1/+0
Remove `..` from return type notation `@nikomatsakis` and I decided that using `..` in the return-type notation syntax is probably overkill. r? `@eholk` since you reviewed the last one Since this is piggybacking now totally off of a pre-existing syntax (parenthesized generics), let me know if you need any explanation of the logic here, since it's a bit more complicated now.
2023-04-10Remove `..` from return type notationMichael Goulet-1/+0
2023-04-10Fix typos in compilerDaniPopes-1/+1
2023-04-09Remove turbofishNilstrieb-1/+1
2023-04-09Some simple `clippy::perf` fixesNilstrieb-1/+1
2023-04-09Auto merge of #110041 - fmease:diag-sugg-adding-const-param, r=compiler-errorsbors-2/+2
Suggest defining const parameter when appropriate Helps a bit with #91119. Following #105523's lead, I use placeholder `/* Type */` instead of `_` in the suggestion. It should be easier for newcomers to parse. `@rustbot` label A-diagnostics r? diagnostics
2023-04-07suggest adding const paramLeón Orell Valerian Liehr-2/+2
2023-04-07Use smart-resolve when checking for trait in RHS of UFCSMichael Goulet-2/+30
2023-04-04Rename `ast::Static` to `ast::StaticItem` to match `ast::ConstItem`Oli Scherer-1/+1
2023-04-04box a bunch of large typesOli Scherer-4/+4
2023-04-04Split out ast::ItemKind::Const into its own structOli Scherer-5/+5
2023-04-04rust-analyzer guided tuple field to named fieldOli Scherer-1/+2
2023-04-04rust-analyzer guided enum variant structificationOli Scherer-1/+1
2023-04-01fix clippy::iter_kv_mapMatthias Krüger-2/+1
2023-03-28Add `(..)` syntax for RTNMichael Goulet-0/+1
2023-03-23rustdoc: Skip doc link resolution for non-exported itemsVadim Petrochenkov-1/+4
2023-03-22Remove comment about re-using Rib allocationsLukas Wirth-1/+0
2023-03-17Do not ICE for unexpected lifetime with ConstGeneric ribyukang-2/+3