summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/diagnostics.rs
AgeCommit message (Collapse)AuthorLines
2022-09-03more clippy::perf fixesMatthias Krüger-1/+1
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-28Remove `register_attr` featureYuki Okushi-10/+0
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-23Mark suggestion as MaybeIncorrect.Camille GILLOT-1/+1
2022-08-23Improve local generic parameter suggestions.Camille GILLOT-18/+15
2022-08-23Create specific ConstantHasGenerics for ConstantItemRibKind.Camille GILLOT-1/+1
2022-08-07Don't ICE while suggesting updating item path.Luqman Aden-6/+9
When an item isn't found, we may suggest an appropriate import to `use`. Along with that, we also suggest updating the path to work with the `use`. Unfortunately, if the code in question originates from a macro, the span used to indicate which part of the path needs updating may not be suitable and cause an ICE. Since, such code is not adjustable directly by the user without modifying the macro, just skip the suggestion in such cases.
2022-07-28Remove guess_head_span.Camille GILLOT-5/+1
2022-07-28change the type of `note` field to `Option<String>`Takayuki Maeda-17/+14
2022-07-26Rollup merge of #99729 - cjgillot:rm-unused-tuple, r=michaelwoeristerMatthias Krüger-1/+1
Remove unused tuple fields Found by https://github.com/rust-lang/rust/pull/95977
2022-07-25Unused tuple fields in rustc_resolve.Camille GILLOT-1/+1
2022-07-25avoid `&str`/`Symbol` to `String` conversionsTakayuki Maeda-2/+1
2022-07-21Rollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebankMatthias Krüger-1/+1
couple of clippy::perf fixes
2022-07-20clippy::perf fixesMatthias Krüger-1/+1
2022-07-20avoid `&str` to String conversionsTakayuki Maeda-2/+2
2022-07-19Rollup merge of #99401 - TaKO8Ki:avoid-symbol-to-&str-conversions, r=nnethercoteMatthias Krüger-1/+1
Avoid `Symbol` to `&str` conversions `Symbol::as_str` is a slowish operation, so this patch removes some usages of it.
2022-07-18avoid `Symbol` to `&str` conversionsTakayuki Maeda-1/+1
2022-07-13avoid `&str` to `String` conversionsTakayuki Maeda-2/+2
2022-07-11Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-deadDylan DPC-1/+1
Implement `SourceMap::is_span_accessible` This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.
2022-07-11rename a methodTakayuki Maeda-1/+1
2022-07-11implement `is_accessible_span`Takayuki Maeda-1/+1
2022-07-10Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obkMatthias Krüger-4/+1
Avoid some `&str` to `String` conversions This patch removes some `&str` to `String` conversions.
2022-07-10avoid some `&str` to `String` conversionsTakayuki Maeda-4/+1
2022-07-09Rollup merge of #99008 - obeis:issue-98974, r=compiler-errorsDylan DPC-4/+19
Adding suggestion for E0530 Closes #98974
2022-07-08Update ui test for the new E0530 suggestionObei Sideg-2/+1
2022-07-08Check if E0530 is `rustc_resolve::late::PatternSource::Match` to emit suggestionObei Sideg-5/+8
2022-07-08Check if E0530 is `tuple variant` or `tuple struct` to emit suggestionObei Sideg-8/+14
2022-07-07Adding suggestion for E0530Obei Sideg-0/+7
2022-07-07suggest adding a derive for #[default] applied to variantsDeadbeef-4/+10
2022-07-05fix typo in note about multiple inaccessible type aliasesClementTsang-1/+3
Mainly intended as a small typo fix ("aliass" -> "aliases") for the case where a type cannot be found in scope, and there are multiple inaccessible type aliases that match the missing type. In general this change would use the correct plural form in this scenario for words that end with 's'.
2022-07-04suggest `#[derive(Default)]` to enums with `#[default]`Takayuki Maeda-0/+9
2022-06-29avoid many `&str` to `String` conversions with `MultiSpan::push_span_label`Takayuki Maeda-1/+1
2022-06-19Mention what item is using an invalid `Self` typeMichael Goulet-0/+2
2022-06-14Separate `source_span` and `expn_that_defined` from `Definitions`.Camille GILLOT-10/+11
2022-06-13remove unnecessary `to_string` and `String::new` for `tool_only_span_suggestion`Takayuki Maeda-7/+2
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-12/+7
2022-06-01Rollup merge of #97264 - ↵Matthias Krüger-3/+12
TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank Suggest `extern crate foo` when failing to resolve `use foo` closes #97095 r? ``@estebank``
2022-05-25suggest `extern crate foo` when failing to resolve `use foo`Takayuki Maeda-3/+12
fix ci error
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-20/+20
2022-05-12Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkovbors-0/+14
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2022-05-07Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errorsbors-13/+13
Begin fixing all the broken doctests in `compiler/` Begins to fix #95994. All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are. There are also a few that I marked `ignore` that could maybe be made to work but seem less important. Each `ignore` has a rough "reason" for ignoring after it parentheses, with - `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax" - `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy. - `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR. - `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup. Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful. I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
2022-05-05Implement the unused_macro_rules lintest31-0/+14
2022-05-03Tweak wordingEsteban Kuber-5/+4
2022-05-03When suggesting to import an item, also suggest changing the path if appropriateEsteban Küber-4/+17
When we don't find an item we search all of them for an appropriate import and suggest `use`ing it. This is sometimes done for expressions that have paths with more than one segment. We now also suggest changing that path to work with the `use`. Fix #95413
2022-05-02fix most compiler/ doctestsElliot Roberts-13/+13
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-2/+2
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-05-01resolve: Rename `unusable_binding` to `ignore_binding`Vadim Petrochenkov-5/+5
2022-05-01resolve: Merge `last_import_segment` into `Finalize`Vadim Petrochenkov-3/+0
2022-05-01resolve: Turn `enum Finalize` into an optional structVadim Petrochenkov-11/+8
2022-04-30Use newtype `enum`s instead of `bool`Esteban Kuber-21/+43