summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2022-07-09Return a FxIndexSet in is_late_bound query.Camille GILLOT-2/+2
This return value is iterated upon by borrowck, hence the need to preserve a deterministic iteration order.
2022-06-22Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkovbors-41/+47
Create elided lifetime parameters for function-like types Split from https://github.com/rust-lang/rust/pull/97720 This PR refactor lifetime generic parameters in bare function types and parenthesized traits to introduce the additional required lifetimes as fresh parameters in a `for<>` bound. This PR does the same to lifetimes appearing in closure signatures, and as-if introducing `for<>` bounds on closures (without the associated change in semantics). r? `@petrochenkov`
2022-06-21Use CreateParameter mode for closures too.Camille GILLOT-37/+32
2022-06-21Always create parameters for functions-like types.Camille GILLOT-4/+15
2022-06-21This comment is out dated and misleadingSantiago Pastorino-3/+0
Arms are about TAIT and RPIT, as the variants clearly show.
2022-06-20Rollup merge of #98267 - compiler-errors:suggest-wildcard-arm, r=oli-obkMatthias Krüger-1/+1
Don't omit comma when suggesting wildcard arm after macro expr * Also adds `Span::eq_ctxt` to consolidate the various usages of `span.ctxt() == other.ctxt()` * Also fixes an unhygenic usage of spans which caused the suggestion to render weirdly when we had one arm match in a macro * Also always suggests a comma (i.e. even after a block) if we're rendering a wildcard arm in a single-line match (looks prettier :rose:) Fixes #94866
2022-06-19Don't suggest adding Self as a type parameterMichael Goulet-1/+1
2022-06-19Mention what item is using an invalid `Self` typeMichael Goulet-0/+19
2022-06-19Use `Span::eq_ctxt` method instead of `.ctxt() == .ctxt()`Michael Goulet-1/+1
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-1/+0
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-15Rollup merge of #97822 - compiler-errors:hesitate-to-suggest-intrinsics, ↵Yuki Okushi-1/+13
r=oli-obk Filter out intrinsics if we have other import candidates to suggest Fixes #97618 Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-1/+0
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-12/+12
2022-06-11Rollup merge of #97812 - TaKO8Ki:suggest-to-swap-struct-and-trait, r=estebankDylan DPC-0/+33
Suggest to swap a struct and a trait in trait impls closes #89590
2022-06-09move suggestions to its own methodTakayuki Maeda-19/+31
2022-06-07Don't suggest adding let in certain if conditionsMichael Goulet-7/+15
2022-06-07Filter out intrinsics if we have other import candidates to suggestMichael Goulet-1/+13
2022-06-07suggest swapping a struct and a traitTakayuki Maeda-0/+21
fmt
2022-06-06Rollup merge of #97312 - cjgillot:no-path-in-scope, r=compiler-errorsDylan DPC-97/+8
Compute lifetimes in scope at diagnostic time The set of available lifetimes is currently computed during lifetime resolution on HIR. It is only used for one diagnostic. In this PR, HIR lifetime resolution just reports whether elided lifetimes are well-defined at the place of use. The diagnostic code is responsible for building a list of lifetime names if elision is not allowed. This will allow to remove lifetime resolution on HIR eventually.
2022-06-04Completely remove LifetimeScopeForPath.Camille GILLOT-83/+5
2022-06-04Compute lifetimes in scope at diagnostic time.Camille GILLOT-22/+11
2022-06-03Fail gracefully when encountering an HRTB in APIT.Camille GILLOT-7/+64
2022-06-03Compute `is_late_bound` in a separate query.Camille GILLOT-68/+24
The computation is actually much simpler, and can be done by directly fetching the HIR for the `FnDecl` and its generics.
2022-06-03Manipulate lifetimes by LocalDefId for region resolution.Camille GILLOT-89/+87
2022-06-03Use the same message as type & const generics.Camille GILLOT-23/+8
2022-06-03Reuse resolve_label to check lifetime shadowing.Camille GILLOT-7/+9
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