summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2023-05-24Use `is_some_and`/`is_ok_and` in less obvious spotsMaybe Waffle-2/+1
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-7/+6
2023-05-05improve diagnostics and bless testsBoxy-25/+45
2023-05-04Rollup merge of #111070 - WaffleLapkin:break_ribs, r=lcnrMatthias Krüger-2/+2
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-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-26/+29
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-2/+2
2023-05-01clean up debug codeyukang-1/+0
2023-05-01remove type_ascription_path_suggestions in parseryukang-38/+0
2023-05-01Remove more diagnostics for ascription in resolveyukang-80/+8
2023-05-01Rip it outNilstrieb-8/+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-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-07suggest adding const paramLeón Orell Valerian Liehr-5/+10
2023-03-15error-msg: impl better suggestion for `E0532`Ezra Shaw-16/+32
2023-03-13resolve: Remove `struct_field_names_untracked`Vadim Petrochenkov-17/+27
2023-03-13resolve: Centralize retrieval of items span and item nameVadim Petrochenkov-31/+16
2023-03-13resolve: Remove `fn_has_self_parameter_untracked`Vadim Petrochenkov-1/+11
2023-03-13resolve: Remove `struct_field_visibilities_untracked`Vadim Petrochenkov-12/+31
2023-03-07Simplify `sort_by` callsMaybe Waffle-1/+1
2023-03-05Auto merge of #108351 - petrochenkov:rmdit, r=cjgillotbors-3/+2
rustc_middle: Remove trait `DefIdTree` This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-03Match unmatched backticks in comments in compiler/est31-1/+1
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-3/+2
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-21Auto merge of #105462 - oli-obk:feeding_full, r=cjgillot,petrochenkovbors-30/+41
give the resolver access to TyCtxt The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR. Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes. ### PRs split out of this one and leading up to it: * https://github.com/rust-lang/rust/pull/105423 * https://github.com/rust-lang/rust/pull/105357 * https://github.com/rust-lang/rust/pull/105603 * https://github.com/rust-lang/rust/pull/106776 * https://github.com/rust-lang/rust/pull/106810 * https://github.com/rust-lang/rust/pull/106812 * https://github.com/rust-lang/rust/pull/108032
2023-02-20Prepare crate loader for LockGuardOli Scherer-2/+1
2023-02-20Prepare for adding a `TyCtxt` to `Resolver`Oli Scherer-28/+40
2023-02-19Make public API, docs algorithm-agnosticJacob Pratt-3/+3
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-5/+3
2023-02-14Separate the lifetime of the session and the arena in the resolverOli Scherer-2/+2
2023-02-13rustdoc: Eliminate remaining uses of resolverVadim Petrochenkov-2/+2
2023-02-03unused-lifetimes: don't warn about lifetimes originating from expanded codeMatthias Krüger-12/+16
previously, we would warn like this: ```` warning: lifetime parameter `'s` never used --> /tmp/unusedlif/code.rs:6:62 | 5 | #[derive(Clone)] | - help: elide the unused lifetime 6 | struct ShimMethod4<T: Trait2 + 'static>(pub &'static dyn for<'s> Fn(&'s mut T::As)); | ^^ | = note: requested on the command line with `-W unused-lifetimes` ```` Fixes #104432
2023-02-02Rename `rust_2015` => `is_rust_2015`Maybe Waffle-1/+1
2023-01-25suggest qualifying bare associated constantsAndy Russell-5/+12
2023-01-16fix #104440Takayuki Maeda-3/+19
2023-01-12Don't suggest dyn as parameter to addMichael Goulet-1/+5
2023-01-11review comments: Tweak outputEsteban Küber-12/+3
* Account for `struct S(pub(super)Ty);` in suggestion * Suggest changing field visibility in E0603 too
2023-01-11review commentEsteban Küber-1/+1
2023-01-11Suggest making private tuple struct field publicEsteban Küber-0/+20
Fix #52144.
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-2/+2
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-18use &str / String literals instead of format!()Matthias Krüger-6/+2
2022-12-13Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebankMatthias Krüger-0/+16
Account for item-local in inner scope for E0425 Fixes #104700
2022-12-09Generate crate loaders on the flyOli Scherer-4/+5
2022-11-29clean up pr 104954Rageking8-1/+1
2022-11-27make simple check of prinf function.Vincenzo Palazzo-0/+8
With this commit we start to make some simple check when the name resolution fails, and we generate some helper message in case the name is a C name like in the case of the `printf` and suggest the correct rust method. Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-11-25fix the crossing function issueyukang-1/+1
2022-11-25fix #104700, account for item-local in inner scope for E0425yukang-0/+16
2022-11-23resolve: Don't use constructor def ids in the map for field namesVadim Petrochenkov-2/+5
Also do some minor cleanup to insertion of those field names
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-10/+2
2022-11-17Use `ThinVec` in `ast::Path`.Nicholas Nethercote-2/+4
2022-11-17Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and ↵Nicholas Nethercote-10/+8
patterns.
2022-11-12Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebankDylan DPC-8/+10
Unhide unknown spans r? ```@estebank```
2022-11-11Rollup merge of #103531 - chenyukang:yukang/fix-103474, r=estebankManish Goregaokar-12/+12
Suggest calling the instance method of the same name when method not found Fixes #103474