about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2022-06-02Do not report mixed label/lifetime shadowing.Camille GILLOT-73/+33
2022-06-02Diagnose shadowing on AST.Camille GILLOT-299/+116
2022-05-24Rollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, ↵Yuki Okushi-7/+8
r=compiler-errors Typo suggestion for a variable with a name similar to struct fields closes #97133
2022-05-23add typo suggestions for all `AssocSuggestion` variantsTakayuki Maeda-1/+1
2022-05-21typo suggestion for a variable with a name similar to struct fieldsTakayuki Maeda-7/+8
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-24/+30
2022-05-20Lint single-use-lifetimes on the AST.Camille GILLOT-379/+78
2022-05-14Forbid nested opaque types to reference HRTB from opaque types.Camille GILLOT-0/+14
2022-05-10only_local: always check for misuselcnr-6/+1
2022-05-07Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errorsbors-2/+2
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-05Rollup merge of #96507 - TaKO8Ki:suggest-calling-associated-function, r=lcnrMatthias Krüger-34/+75
Suggest calling `Self::associated_function()` closes #96453
2022-05-05suggest calling `Self::associated_function()`Takayuki Maeda-34/+75
do not suggest when trait_ref is some Update compiler/rustc_resolve/src/late/diagnostics.rs Co-authored-by: lcnr <rust@lcnr.de> use helper struct add a test for functions with some params refactor debug log
2022-05-02fix most compiler/ doctestsElliot Roberts-2/+2
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-51/+45
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: Turn `enum Finalize` into an optional structVadim Petrochenkov-4/+4
2022-04-30Store all generic bounds as where predicates.Camille GILLOT-60/+26
2022-04-30Inline WhereClause into Generics.Camille GILLOT-2/+2
2022-04-30Box HIR Generics and Impl.Camille GILLOT-1/+1
2022-04-30Ban non-static lifetimes from AnonConst on AST.Camille GILLOT-32/+16
The extra diagnostics come from the compiler no longer aborting before typeck.
2022-04-29Ban non-static in const generics in AST.Camille GILLOT-29/+15
2022-04-28Auto merge of #96495 - Dylan-DPC:rollup-9lm4tpp, r=Dylan-DPCbors-3/+1
Rollup of 7 pull requests Successful merges: - #96377 (make `fn() -> _ { .. }` suggestion MachineApplicable) - #96397 (Make EncodeWide implement FusedIterator) - #96421 (Less `NoDelim`) - #96432 (not need `Option` for `dbg_scope`) - #96466 (Better error messages when collecting into `[T; n]`) - #96471 (replace let else with `?`) - #96483 (Add missing `target_feature` to the list of well known cfg names) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-28Rollup merge of #96471 - BoxyUwU:let_else_considered_harmful, r=lcnrDylan DPC-3/+1
replace let else with `?` r? `@oli-obk`
2022-04-27Auto merge of #91557 - cjgillot:ast-lifetimes-named, r=petrochenkovbors-1/+1
Perform lifetime resolution on the AST for lowering Lifetime resolution is currently implemented several times. Once during lowering in order to introduce in-band lifetimes, and once in the resolve_lifetimes query. However, due to the global nature of lifetime resolution and how it interferes with hygiene, it is better suited on the AST. This PR implements a first draft of lifetime resolution on the AST. For now, we specifically target named lifetimes and everything we need to remove lifetime resolution from lowering. Some diagnostics have already been ported, and sometimes made more precise using available hygiene information. Follow-up PRs will address in particular the resolution of anonymous lifetimes on the AST. We reuse the rib design of the current resolution framework. Specific `LifetimeRib` and `LifetimeRibKind` types are introduced. The most important variant is `LifetimeRibKind::Generics`, which happens each time we encounter something which may introduce generic lifetime parameters. It can be an item or a `for<...>` binder. The `LifetimeBinderKind` specifies how this rib behaves with respect to in-band lifetimes. r? `@petrochenkov`
2022-04-27Use LifetimeRes during lowering.Camille GILLOT-1/+1
2022-04-27tut tut tutEllen-3/+1
2022-04-23Stop visiting visibility.Camille GILLOT-2/+2
2022-04-19Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkovDylan DPC-6/+4
Stop using CRATE_DEF_INDEX outside of metadata encoding. `CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want. We should not manipulate raw `DefIndex` outside of metadata encoding.
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-6/+4
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-51/+9
2022-04-17Report undeclared lifetimes on AST.Camille GILLOT-71/+102
2022-04-17Remove is_in_fn_syntax.Camille GILLOT-11/+0
2022-04-12Rollup merge of #95405 - cjgillot:probe, r=petrochenkovDylan DPC-2/+1
Move name resolution logic to a dedicated file The code resolution logic from an Ident is scattered between several files. The first commits creates `rustc_resolve::probe` module to hold the different mutually recursive functions together. Just a move, no code change. The following commits attempt to make the logic a bit more readable. The two fields `last_import_segment` and `unusable_binding` are replaced by function parameters. In order to manage the fallout, `maybe_` variants of the function are added, dedicated to speculative resolution. r? `@petrochenkov`
2022-04-12Pass last_import_segment and unusable_binding as parameters.Camille GILLOT-2/+1
2022-04-11Rollup merge of #95907 - compiler-errors:diag, r=Dylan-DPCMatthias Krüger-7/+6
address fixme for diagnostic variable name quick rename
2022-04-10FIXME for diagnostic variable nameMichael Goulet-7/+6
2022-04-10Store LocalDefId in is_late_bound_map.Camille GILLOT-7/+10
This allows to avoid looking at HIR from borrowck.
2022-04-08check_doc_keyword: don't alloc string for emptiness checkklensy-1/+1
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-04-05errors: implement fallback diagnostic translationDavid Wood-1/+1
This commit updates the signatures of all diagnostic functions to accept types that can be converted into a `DiagnosticMessage`. This enables existing diagnostic calls to continue to work as before and Fluent identifiers to be provided. The `SessionDiagnostic` derive just generates normal diagnostic calls, so these APIs had to be modified to accept Fluent identifiers. In addition, loading of the "fallback" Fluent bundle, which contains the built-in English messages, has been implemented. Each diagnostic now has "arguments" which correspond to variables in the Fluent messages (necessary to render a Fluent message) but no API for adding arguments has been added yet. Therefore, diagnostics (that do not require interpolation) can be converted to use Fluent identifiers and will be output as before.
2022-04-05span: move `MultiSpan`David Wood-2/+3
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-03-30Spellchecking compiler commentsYuri Astrakhan-5/+5
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-27resolve: Simplify some diagnostic code to avoid an ICEVadim Petrochenkov-17/+4
2022-03-25resolve: Rename `CrateLint` to `Finalize`Vadim Petrochenkov-6/+6
And `crate_lint`/`record_used` to `finalize`
2022-03-25resolve: Stop passing unused spans and node ids to path resolution functionsVadim Petrochenkov-20/+14
2022-03-25resolve: Do not build expensive suggestions if they are not actually usedVadim Petrochenkov-3/+3
Also remove a redundant parameter from `fn resolve_path(_with_ribs)`, `crate_lint: CrateLint` is a more detailed version of `record_used: bool` with `CrateLint::No` meaning `false` and anything else meaning `true`.
2022-03-21Return err instead of ICEouz-a-2/+23
2022-03-17Rollup merge of #94960 - codehorseman:master, r=oli-obkDylan DPC-1/+1
Fix many spelling mistakes Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16rustc_error: make ErrorReported impossible to constructmark-6/+8
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-15Support other types of pluralization in pluralize macroest31-3/+3
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-3/+3