about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/collect.rs
AgeCommit message (Collapse)AuthorLines
2024-06-30Auto merge of #127133 - matthiaskrgr:rollup-jxkp3yf, r=matthiaskrgrbors-1/+18
Rollup of 9 pull requests Successful merges: - #123237 (Various rustc_codegen_ssa cleanups) - #126960 (Improve error message in tidy) - #127002 (Implement `x perf` as a separate tool) - #127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel) - #127106 (Improve unsafe extern blocks diagnostics) - #127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.) - #127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer) - #127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.) - #127122 (Remove uneccessary condition in `div_ceil`) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-29Rollup merge of #127110 - surechen:fix_125488_06, r=compiler-errorsMatthias Krüger-1/+18
Fix a error suggestion for E0121 when using placeholder _ as return types on function signature. Recommit after refactoring based on comment: https://github.com/rust-lang/rust/pull/126017#issuecomment-2189149361 But when changing return type's lifetime to `ReError` will affect the subsequent borrow check process and cause test11 in typeck_type_placeholder_item.rs to lost E0515 message. ```rust fn test11(x: &usize) -> &_ { //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types &x //~ ERROR cannot return reference to function parameter(this E0515 msg will disappear) } ``` fixes #125488 r? ``@pnkfelix``
2024-06-29Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obkbors-37/+12
Implement new effects desugaring cc `@rust-lang/project-const-traits.` Will write down notes once I have finished. * [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>` * [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>` * [ ] add types and traits to minicore test * [ ] update rustc-dev-guide Fixes #119717 Fixes #123664 Fixes #124857 Fixes #126148
2024-06-29Fix a error suggestion for E0121 when using placeholder _ as return types on ↵surechen-1/+18
function signature. Recommit after refactoring based on comment: https://github.com/rust-lang/rust/pull/126017#issuecomment-2189149361 But when changing return type's lifetime to `ReError` will affect the subsequent borrow check process and cause test11 in typeck_type_placeholder_item.rs to lost E0515 message. ```rust fn test11(x: &usize) -> &_ { //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types &x //~ ERROR cannot return reference to function parameter(this E0515 msg will disappear) } ```
2024-06-28implement new effects desugaringDeadbeef-37/+12
2024-06-27Make queries more explicitMichael Goulet-7/+7
2024-06-24Split out IntoIterator and non-Iterator constructors for ↵Michael Goulet-2/+2
AliasTy/AliasTerm/TraitRef/projection
2024-06-20Slightly refactor the dumping of HIR analysis dataLeón Orell Valerian Liehr-1/+1
2024-06-06Auto merge of #124482 - spastorino:unsafe-extern-blocks, r=oli-obkbors-3/+6
Unsafe extern blocks This implements RFC 3484. Tracking issue #123743 and RFC https://github.com/rust-lang/rfcs/pull/3484 This is better reviewed commit by commit.
2024-06-05Basic removal of `Ty` from places (boring)Boxy-10/+2
2024-06-05Unify optional param info with object lifetime default boolean into an enum ↵Oli Scherer-8/+3
that exhaustively supports all call sites
2024-06-05Remove `allows_infer` now that every use of it is delegated to `HirTyLowerer`Oli Scherer-4/+0
2024-06-05Only collect infer vars to error about in case infer vars are actually forbiddenOli Scherer-2/+85
2024-06-05Remove an `Option` and instead eagerly create error lifetimesOli Scherer-3/+22
2024-06-05Use a `LocalDefId` for `HirTyLowerer::item_def_id`, since we only ever (can) ↵Oli Scherer-2/+2
use it for local items
2024-06-04Handle safety keyword for extern block inner itemsSantiago Pastorino-3/+6
2024-05-29Add lang item for Future::OutputMichael Goulet-1/+1
2024-05-27Rollup merge of #125597 - compiler-errors:early-binder, r=jackh726Guillaume Gomez-1/+1
Uplift `EarlyBinder` into `rustc_type_ir` We also need to give `EarlyBinder` a `'tcx` param, so that we can carry the `Interner` in the `EarlyBinder` too. This is necessary because otherwise we have an unconstrained `I: Interner` parameter in many of the `EarlyBinder`'s inherent impls. I also generally think that this is desirable to have, in case we later want to track some state in the `EarlyBinder`. r? lcnr
2024-05-26Give EarlyBinder a tcx parameterMichael Goulet-1/+1
We are gonna need it to uplift EarlyBinder
2024-05-24Remove `DefId` from `EarlyParamRegion` (tedium/diagnostics)Boxy-1/+0
2024-05-20Implement BOXED_SLICE_INTO_ITERMichael Goulet-2/+19
2024-05-18Auto merge of #125077 - spastorino:add-new-fnsafety-enum2, r=jackh726bors-22/+17
Rename Unsafe to Safety Alternative to #124455, which is to just have one Safety enum to use everywhere, this opens the posibility of adding `ast::Safety::Safe` that's useful for unsafe extern blocks. This leaves us today with: ```rust enum ast::Safety { Unsafe(Span), Default, // Safe (going to be added for unsafe extern blocks) } enum hir::Safety { Unsafe, Safe, } ``` We would convert from `ast::Safety::Default` into the right Safety level according the context.
2024-05-17Rename Unsafe to SafetySantiago Pastorino-22/+17
2024-05-16Rename ToPredicate for UpcastMichael Goulet-2/+2
2024-05-13Remove `extern crate rustc_middle` from `rustc_hir_analysis`.Nicholas Nethercote-0/+1
2024-05-09Add `ErrorGuaranteed` to `Recovered::Yes` and use it more.Nicholas Nethercote-4/+2
The starting point for this was identical comments on two different fields, in `ast::VariantData::Struct` and `hir::VariantData::Struct`: ``` // FIXME: investigate making this a `Option<ErrorGuaranteed>` recovered: bool ``` I tried that, and then found that I needed to add an `ErrorGuaranteed` to `Recovered::Yes`. Then I ended up using `Recovered` instead of `Option<ErrorGuaranteed>` for these two places and elsewhere, which required moving `ErrorGuaranteed` from `rustc_parse` to `rustc_ast`. This makes things more consistent, because `Recovered` is used in more places, and there are fewer uses of `bool` and `Option<ErrorGuaranteed>`. And safer, because it's difficult/impossible to set `recovered` to `Recovered::Yes` without having emitted an error.
2024-05-04Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillotbors-1/+1
Some hir cleanups It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field. r? compiler
2024-04-27Fix ICE on invalid const param typesGurinder Singh-0/+2
2024-04-26put `hir::AnonConst` on the hir arenaOli Scherer-1/+1
2024-04-25Fix some typos in commentsTechVest-1/+1
Signed-off-by: TechVest <techdashen@qq.com>
2024-04-14Don't leak unnameable types in -> _ recoverMichael Goulet-16/+11
2024-04-10Use suggest_impl_trait in return type suggestionMichael Goulet-42/+56
2024-03-22Arrange methods on HirTyLowerer more logicallyLeón Orell Valerian Liehr-15/+15
This makes it easier to read the trait definition for newcomers: Sorted from least “complex” to most “complex” followed by trivial “plumbing” and grouped by area. * Move `allow_infer` above all `*_infer` methods * It's the least complex method of those * Allows the `*_infer` to be placed right next to each other * Move `probe_ty_param_bounds` further down right next to `lower_assoc_ty` and `probe_adt` * It's more complex than the `infer` methods, it should come “later” * Now all required lowering functions are grouped together * Move the “plumbing” function `set_tainted_by_errors` further down below any actual lowering methods. * Provided method should come last
2024-03-22Rename module astconv to hir_ty_loweringLeón Orell Valerian Liehr-1/+1
Split from the main renaming commit to make git generate a proper diff for ease of reviewing.
2024-03-22Update local variables and tracing callsLeón Orell Valerian Liehr-19/+20
Most of the tracing calls didn't fully leverage the power of `tracing`. For example, several of them used to hard-code method names / tracing spans as well as variable names. Use `#[instrument]` and `?var` / `%var` (etc.) instead. In my opinion, this is the proper way to migrate them from the old AstConv nomenclature to the new HIR ty lowering one.
2024-03-22Update (doc) commentsLeón Orell Valerian Liehr-9/+7
Several (doc) comments were super outdated or didn't provide enough context. Some doc comments shoved everything in a single paragraph without respecting the fact that the first paragraph should be a single sentence because rustdoc treats these as item descriptions / synopses on module pages.
2024-03-22Rename AstConv to HIR ty loweringLeón Orell Valerian Liehr-30/+35
This includes updating astconv-related items and a few local variables.
2024-03-21Rollup merge of #122799 - estebank:issue-122569, r=fee1-deadMatthias Krüger-3/+3
Replace closures with `_` when suggesting fully qualified path for method call ``` error[E0283]: type annotations needed --> $DIR/into-inference-needs-type.rs:12:10 | LL | .into()?; | ^^^^ | = note: cannot satisfy `_: From<...>` = note: required for `FilterMap<...>` to implement `Into<_>` help: try using a fully qualified path to specify the expected types | LL ~ let list = <FilterMap<Map<std::slice::Iter<'_, &str>, _>, _> as Into<T>>::into(vec LL | .iter() LL | .map(|s| s.strip_prefix("t")) LL ~ .filter_map(Option::Some))?; | ``` Fix #122569.
2024-03-21Replace closures with `_` when suggesting fully qualified path for method callEsteban Küber-3/+3
``` error[E0283]: type annotations needed --> $DIR/into-inference-needs-type.rs:12:10 | LL | .into()?; | ^^^^ | = note: cannot satisfy `_: From<...>` = note: required for `FilterMap<...>` to implement `Into<_>` help: try using a fully qualified path to specify the expected types | LL ~ let list = <FilterMap<Map<std::slice::Iter<'_, &str>, _>, _> as Into<T>>::into(vec LL | .iter() LL | .map(|s| s.strip_prefix("t")) LL ~ .filter_map(Option::Some))?; | ``` Fix #122569.
2024-03-20Split item bounds and item super predicatesMichael Goulet-0/+7
2024-03-14Ensure RPITITs are created before def-id freezingMichael Goulet-0/+2
2024-03-08Auto merge of #121500 - oli-obk:track_errors12, r=petrochenkovbors-9/+3
Merge `collect_mod_item_types` query into `check_well_formed` follow-up to https://github.com/rust-lang/rust/pull/121154 this removes more potential parallel-compiler bottlenecks and moves diagnostics for the same items next to each other, instead of grouping diagnostics by analysis kind
2024-03-07Merge collect_mod_item_types query into check_well_formedOli Scherer-20/+3
2024-03-07Use the same collection order as check_mod_type_wfOli Scherer-3/+3
2024-03-07Apply `EarlyBinder` only to `TraitRef` in `ImplTraitHeader`Yoshitomo Nakanishi-7/+4
2024-03-07Collect mod item types in parallel, just like wfcheckOli Scherer-1/+12
2024-03-04hir_analysis: enums return `None` in `find_field`David Wood-1/+6
Unnamed union fields with enums are checked for, but if `find_field` causes an ICE then the compiler won't get to that point. Signed-off-by: David Wood <david@davidtw.co>
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-3/+3
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-27Auto merge of #121285 - nnethercote:delayed_bug-audit, r=lcnrbors-1/+1
Delayed bug audit I went through all the calls to `delayed_bug` and `span_delayed_bug` and found a few places where they could be avoided. r? `@compiler-errors`
2024-02-27Avoid `span_delayed_bug` on one path in `AdtDef::eval_explicit_discr`.Nicholas Nethercote-1/+1
Also change its return type to `Result`.