summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2025-02-06Add check for missing fields in enum variant patternEsteban Küber-1/+1
(cherry picked from commit d44f021904e3d5b2870e3c835cbad5e1421e83ec)
2025-02-06Ensure that we don't try to access fields on a non-struct pattern type in ↵Esteban Küber-1/+3
diagnostic Fix #135209. (cherry picked from commit 5f04f98c9aaf04e5f670e04dc12d4665489859fd)
2024-12-18Auto merge of #134243 - nnethercote:re-export-more-rustc_span, r=jieyouxubors-2/+1
Re-export more `rustc_span::symbol` things from `rustc_span`. `rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers to `rustc_span::`. This is a 300+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one. r? `@jieyouxu`
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-17Rollup merge of #133265 - the8472:extract-if-ranges, r=cuviperMatthias Krüger-1/+1
Add a range argument to vec.extract_if tracking issue: #43244 This adds the range argument requested in https://github.com/rust-lang/rust/issues/43244#issuecomment-2486160659
2024-12-16update uses of extract_if in the compilerThe 8472-1/+1
2024-12-15Use `span_label` as it looks better when we show pattern missing binding in ↵Esteban Küber-22/+5
order
2024-12-15Use `ErrorGuaranteed` moreEsteban Küber-3/+3
2024-12-13Keep track of patterns that could have introduced a binding, but didn'tEsteban Küber-0/+60
When we recover from a pattern parse error, or a pattern uses `..`, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between `..` and parse recovery. We silence resolution errors likely caused by the pattern parse error. ``` error[E0425]: cannot find value `title` in this scope --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:19:30 | LL | println!("[{}]({})", title, url); | ^^^^^ not found in this scope | note: `Website` has a field `title` which could have been included in this pattern, but it wasn't --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:17:12 | LL | / struct Website { LL | | url: String, LL | | title: Option<String> , | | ----- defined here LL | | } | |_- ... LL | if let Website { url, .. } = website { | ^^^^^^^^^^^^^^^^^^^ this pattern doesn't include `title`, which is available in `Website` ``` Fix #74863.
2024-11-28Replace `Symbol::intern` calls with preinterned symbolsclubby789-0/+1
2024-11-25Refactor `where` predicates, and reserve for attributes supportFrank King-17/+20
2024-11-23Update tests for new TRPL chapter orderChris Krycho-1/+1
2024-11-08use verbose for path separator suggestionMichael Goulet-1/+1
2024-11-05Rollup merge of #132567 - estebank:bad-suggestion, r=NadrierilMatthias Krüger-10/+36
Properly suggest `E::assoc` when we encounter `E::Variant::assoc` Use the right span when encountering an enum variant followed by an associated item so we don't lose the associated item in the resulting code. Do not suggest the thing twice, once as a removal of the associated item and a second time as a typo suggestion.
2024-11-03Properly suggest `E::assoc` when we encounter `E::Variant::assoc`Esteban Küber-10/+36
Use the right span when encountering an enum variant followed by an associated item so we don't lose the associated item in the resulting code. Do not suggest the thing twice, once as a removal of the associated item and a second time as a typo suggestion.
2024-11-02Suggest fixing typos and let bindings at the same timeuellenberg-3/+6
Fixes #132483
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-3/+3
2024-10-15Auto merge of #131723 - matthiaskrgr:rollup-krcslig, r=matthiaskrgrbors-18/+19
Rollup of 9 pull requests Successful merges: - #122670 (Fix bug where `option_env!` would return `None` when env var is present but not valid Unicode) - #131095 (Use environment variables instead of command line arguments for merged doctests) - #131339 (Expand set_ptr_value / with_metadata_of docs) - #131652 (Move polarity into `PolyTraitRef` rather than storing it on the side) - #131675 (Update lint message for ABI not supported) - #131681 (Fix up-to-date checking for run-make tests) - #131702 (Suppress import errors for traits that couldve applied for method lookup error) - #131703 (Resolved python deprecation warning in publish_toolstate.py) - #131710 (Remove `'apostrophes'` from `rustc_parse_format`) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-14Move trait bound modifiers into ast::PolyTraitRefMichael Goulet-18/+19
2024-10-07Add sugar for &pin (const|mut) typesEric Holk-1/+1
2024-10-06On function and method calls in patterns, link to the bookEsteban Küber-0/+13
``` error: expected a pattern, found an expression --> f889.rs:3:13 | 3 | let (x, y.drop()) = (1, 2); //~ ERROR | ^^^^^^^^ not a pattern | = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> error[E0532]: expected a pattern, found a function call --> f889.rs:2:13 | 2 | let (x, drop(y)) = (1, 2); //~ ERROR | ^^^^ not a tuple struct or tuple variant | = note: function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> ``` Fix #97200.
2024-09-24Separate collection of crate-local inherent impls from error reportingMichael Goulet-2/+4
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-32/+26
2024-09-16Rollup merge of #130033 - compiler-errors:foreign-fn-types, r=BoxyUwUMatthias Krüger-24/+25
Don't call `fn_arg_names` query for non-`fn` foreign items in resolver Fixes #130015
2024-09-16Do precise capturing arg validation in resolveMichael Goulet-2/+7
2024-09-12Rollup merge of #130208 - nnethercote:rslv-lifetime, r=petrochenkovMatthias Krüger-2/+2
Introduce `'ra` lifetime name. `rustc_resolve` allocates many things in `ResolverArenas`. The lifetime used for references into the arena is mostly `'a`, and sometimes `'b`. This commit changes it to `'rslv`, which is much more descriptive. The commit also changes the order of lifetimes on a couple of structs so that '`rslv` is second last, before `'tcx`, and does other minor renamings such as `'r` to `'a`. r? ``@petrochenkov`` cc ``@oli-obk``
2024-09-12Rollup merge of #130235 - compiler-errors:nested-if, r=michaelwoeristerStuart Cook-17/+16
Simplify some nested `if` statements Applies some but not all instances of `clippy::collapsible_if`. Some ended up looking worse afterwards, though, so I left those out. Also applies instances of `clippy::collapsible_else_if` Review with whitespace disabled please.
2024-09-12Introduce `'ra` lifetime name.Nicholas Nethercote-2/+2
`rustc_resolve` allocates many things in `ResolverArenas`. The lifetime used for references into the arena is mostly `'a`, and sometimes `'b`. This commit changes it to `'ra`, which is much more descriptive. The commit also changes the order of lifetimes on a couple of structs so that '`ra` is second last, before `'tcx`, and does other minor renamings such as `'r` to `'a`.
2024-09-11Simplify some nested if statementsMichael Goulet-17/+16
2024-09-09Remove needless returns detected by clippy in the compilerEduardo Sánchez Muñoz-1/+1
2024-09-07Don't call fn_arg_names for non-fn in resolverMichael Goulet-24/+25
2024-08-31Implement `elided_named_lifetimes` lintPavel Grigorenko-2/+9
2024-08-11Rollup merge of #128762 - fmease:use-more-slice-pats, r=compiler-errorsMatthias Krüger-7/+6
Use more slice patterns inside the compiler Nothing super noteworthy. Just replacing the common 'fragile' pattern of "length check followed by indexing or unwrap" with slice patterns for legibility and 'robustness'. r? ghost
2024-08-07make `import.vis` is not mutablebohan-0/+1
2024-08-07Use more slice patterns inside the compilerLeón Orell Valerian Liehr-7/+6
2024-07-29Reformat `use` declarations.Nicholas Nethercote-20/+19
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-06Use field ident spans directly instead of the full field span in diagnostics ↵Oli Scherer-25/+19
on local fields
2024-06-18Remove redundant argument from `subdiagnostic` methodOli Scherer-15/+9
2024-06-17Rework precise capturing syntaxMichael Goulet-2/+2
2024-06-15delegation: Fix hygiene for `self`Vadim Petrochenkov-9/+15
And fix diagnostics for `self` from a macro.
2024-06-10Delegation: fix ICE on late diagnosticsBryanskiy-2/+5
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-3/+3
2024-05-21Auto merge of #124417 - Xiretza:translate-early-lints, r=fmeasebors-4/+4
Make early lints translatable <del>Requires https://github.com/projectfluent/fluent-rs/pull/353.</del> https://github.com/rust-lang/rust/commit/5134a04eaa32b168cf5998a6ec13199356e2e017 r? diagnostics
2024-05-21Rename buffer_lint_with_diagnostic to buffer_lintXiretza-2/+2
2024-05-21Generate lint diagnostic message from BuiltinLintDiagXiretza-2/+2
Translation of the lint message happens when the actual diagnostic is created, not when the lint is buffered. Generating the message from BuiltinLintDiag ensures that all required data to construct the message is preserved in the LintBuffer, eventually allowing the messages to be moved to fluent. Remove the `msg` field from BufferedEarlyLint, it is either generated from the data in the BuiltinLintDiag or stored inside BuiltinLintDiag::Normal.
2024-05-20Fix incorrect suggestion for undeclared hrtb lifetimes in where clauses.surechen-14/+87
fixes #122714
2024-05-18Auto merge of #125105 - nnethercote:rustc_resolve-cleanups, r=estebankbors-0/+1
`rustc_resolve` cleanups Some improvements I found while looking through this code. r? `@estebank`
2024-05-15delegation: Implement list delegationVadim Petrochenkov-1/+3
```rust reuse prefix::{a, b, c} ```
2024-05-10Remove `#[macro_use] extern crate tracing` from `rustc_resolve`.Nicholas Nethercote-0/+1
Explicit imports are more standard nowadays and easier to read.
2024-04-23delegation: Support async, const, extern "ABI" and C-variadic functionsVadim Petrochenkov-2/+5
Also allow `impl Trait` in delegated functions. The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.