about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/collect
AgeCommit message (Collapse)AuthorLines
2024-09-25Add a few more tests, commentsMichael Goulet-0/+6
2024-09-25Pull out into helper functionMichael Goulet-99/+112
2024-09-25Collect relevant item bounds from trait clauses for nested rigid ↵Michael Goulet-10/+216
projections, GATs
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-16/+16
2024-09-21Rollup merge of #130666 - compiler-errors:super-bounds, r=fee1-dead,fmeaseMichael Goulet-10/+76
Assert that `explicit_super_predicates_of` and `explicit_item_super_predicates` truly only contains bounds for the type itself We distinguish _implied_ predicates (anything that is implied from elaborating a trait bound) from _super_ predicates, which are are the subset of implied predicates that share the same self type as the trait predicate we're elaborating. This was originally done in #107614, which fixed a large class of ICEs and strange errors where the compiler expected the self type of a trait predicate not to change when elaborating super predicates. Specifically, super predicates are special for various reasons: they're the valid candidates for trait upcasting, are the only predicates we elaborate when doing closure signature inference, etc. So making sure that we get this list correct and don't accidentally "leak" any other predicates into this list is quite important. This PR adds some debug assertions that we're in fact not doing so, and it fixes an oversight in the effect desugaring rework.
2024-09-21Assert that explicit_super_predicates_of and explicit_item_bounds truly only ↵Michael Goulet-10/+76
bounds for the type itself
2024-09-21More tests and tweak commentsMichael Goulet-4/+15
2024-09-20Resolve self type alias in impl for RTNMichael Goulet-1/+25
2024-09-20Add missing diagnostics and flesh out testsMichael Goulet-4/+5
2024-09-20Flesh out some TODOsMichael Goulet-8/+40
2024-09-20Implement RTN in resolve_bound_vars and HIR ty loweringMichael Goulet-6/+116
2024-09-18Rollup merge of #130116 - veera-sivarajan:freeze-suggestions, r=chenyukangMatthias Krüger-2/+2
Implement a Method to Seal `DiagInner`'s Suggestions This PR adds a method on `DiagInner` called `.seal_suggestions()` to prevent new suggestions from being added while preserving existing suggestions. This is useful because currently there is no way to prevent new suggestions from being added to a diagnostic. `.disable_suggestions()` is the closest but it gets rid of all suggestions before and after the call. Therefore, `.seal_suggestions()` can be used when, for example, misspelled keyword is detected and reported. In such cases, we may want to prevent other suggestions from being added to the diagnostic, as they would likely be meaningless once the misspelled keyword is identified. For context: https://github.com/rust-lang/rust/pull/129899#discussion_r1741307132 To store an additional state, the type of the `suggestions` field in `DiagInner` was changed into a three variant enum. While this change affects files across different crates, care was taken to preserve the existing code's semantics. This is validated by the fact that all UI tests pass without any modifications. r? chenyukang
2024-09-16Do precise capturing arg validation in resolveMichael Goulet-6/+4
2024-09-12Implement a Method to Seal `DiagInner`'s SuggestionsVeera-2/+2
2024-09-11Also fix if in elseMichael Goulet-16/+14
2024-09-09Helper function for formatting with `LifetimeSuggestionPosition`Pavel Grigorenko-17/+1
2024-09-07Auto merge of #126161 - Bryanskiy:delegation-generics-4, r=petrochenkovbors-20/+12
Delegation: support generics in associated delegation items This is a continuation of https://github.com/rust-lang/rust/pull/125929. [design](https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md) Generic parameters inheritance was implemented in all contexts. Generic arguments are not yet supported. r? `@petrochenkov`
2024-09-05Delegation: support generics in associated delegation itemsBryanskiy-20/+12
2024-08-31Rollup merge of #129767 - nnethercote:rm-extern-crate-tracing-4, r=jieyouxuMatthias Krüger-0/+6
Remove `#[macro_use] extern crate tracing`, round 4 Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from #124511, #124914, and #125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately. r? ```@jieyouxu```
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_hir_analysis`.Nicholas Nethercote-0/+6
2024-08-29Stop using ty::GenericPredicates for non-predicates_of queriesMichael Goulet-31/+30
2024-08-28Auto merge of #129546 - compiler-errors:no-pred-on, r=fee1-deadbors-4/+21
Get rid of `predicates_defined_on` This is the uncontroversial part of #129532. This simply inlines the `predicates_defined_on` into into `predicates_of`. Nothing should change here logically.
2024-08-27Add `warn(unreachable_pub)` to `rustc_hir_analysis`.Nicholas Nethercote-2/+2
2024-08-24Get rid of predicates_defined_onMichael Goulet-4/+21
2024-08-24Fix `elided_named_lifetimes` in codePavel Grigorenko-1/+1
2024-08-22Use a LocalDefId in ResolvedArg.Camille GILLOT-14/+13
2024-08-16Use FnSig instead of raw FnDecl for ForeignItemKind::FnMichael Goulet-1/+1
2024-08-12Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxuGuillaume Gomez-5/+8
Use `assert_matches` around the compiler more It's a useful assertion, especially since it actually prints out the LHS.
2024-08-11Use assert_matches around the compilerMichael Goulet-5/+8
2024-08-06Cache supertrait outlives of impl header for soundness checkMichael Goulet-0/+21
2024-08-06Auto merge of #125558 - Amanieu:const-asm-type, r=lcnrbors-7/+59
Tweak type inference for `const` operands in inline asm Previously these would be treated like integer literals and default to `i32` if a type could not be determined. To allow for forward-compatibility with `str` constants in the future, this PR changes type inference to use an unbound type variable instead. The actual type checking is deferred until after typeck where we still ensure that the final type for the `const` operand is an integer type. <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> -->
2024-08-05Rollup merge of #127655 - RalfJung:invalid_type_param_default, r=compiler-errorsMatthias Krüger-2/+0
turn `invalid_type_param_default` into a `FutureReleaseErrorReportInDeps` `````@rust-lang/types````` I assume the plan is still to disallow this? It has been a future-compat lint for a long time, seems ripe to go for hard error. However, turns out that outright removing it right now would lead to [tons of crater regressions](https://github.com/rust-lang/rust/pull/127655#issuecomment-2228285460), so for now this PR just makes this future-compat lint show up in cargo's reports, so people are warned when they use a dependency that is affected by this. Fixes https://github.com/rust-lang/rust/issues/27336 by removing the feature gate (so there's no way to silence the lint even on nightly) CC https://github.com/rust-lang/rust/issues/36887
2024-07-31Delegation: second attempt to improve perfBryanskiy-14/+20
2024-07-29Delegation: support generics for delegation from free functionsBryanskiy-0/+16
2024-07-29Reformat `use` declarations.Nicholas Nethercote-19/+20
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-25use `ErrorGuaranteed` from emitFolkert-8/+6
2024-07-25rustfmtAmanieu d'Antras-5/+1
2024-07-25Apply suggestions from code reviewFolkert de Vries-2/+2
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2024-07-25apply fix suggested by lcnrFolkert-7/+65
2024-07-25Support ?Trait bounds in supertraits and dyn Trait under a feature gateBryanskiy-1/+1
2024-07-20Just totally fully deny late-bound constsMichael Goulet-5/+1
2024-07-16Add `ConstArgKind::Path` and make `ConstArg` its own HIR nodeNoah Lev-33/+65
This is a very large commit since a lot needs to be changed in order to make the tests pass. The salient changes are: - `ConstArgKind` gets a new `Path` variant, and all const params are now represented using it. Non-param paths still use `ConstArgKind::Anon` to prevent this change from getting too large, but they will soon use the `Path` variant too. - `ConstArg` gets a distinct `hir_id` field and its own variant in `hir::Node`. This affected many parts of the compiler that expected the parent of an `AnonConst` to be the containing context (e.g., an array repeat expression). They have been changed to check the "grandparent" where necessary. - Some `ast::AnonConst`s now have their `DefId`s created in rustc_ast_lowering rather than `DefCollector`. This is because in some cases they will end up becoming a `ConstArgKind::Path` instead, which has no `DefId`. We have to solve this in a hacky way where we guess whether the `AnonConst` could end up as a path const since we can't know for sure until after name resolution (`N` could refer to a free const or a nullary struct). If it has no chance as being a const param, then we create a `DefId` in `DefCollector` -- otherwise we decide during ast_lowering. This will have to be updated once all path consts use `ConstArgKind::Path`. - We explicitly use `ConstArgHasType` for array lengths, rather than implicitly relying on anon const type feeding -- this is due to the addition of `ConstArgKind::Path`. - Some tests have their outputs changed, but the changes are for the most part minor (including removing duplicate or almost-duplicate errors). One test now ICEs, but it is for an incomplete, unstable feature and is now tracked at #127009.
2024-07-16Use `ConstArg` for const param defaultsNoah Lev-3/+3
Now everything that actually affects the type system (i.e., excluding const blocks, enum variant discriminants, etc.) *should* be using `ConstArg`.
2024-07-16Use `ConstArg` for assoc item constraintsNoah Lev-1/+1
2024-07-16hir: Create `hir::ConstArgKind` enumNoah Lev-1/+1
This will allow lowering const params to a dedicated enum variant, rather than to an `AnonConst` that is later examined during `ty` lowering.
2024-07-15make invalid_type_param_default lint show up in cargo future-compat reportsRalf Jung-2/+0
and remove the feature gate that silenced the lint
2024-07-09Remove HirTyLowerer::set_tainted_by_errors, since it is now redundantOli Scherer-9/+18
2024-07-05Use `ControlFlow` results for visitors that are only looking for a single valueOli Scherer-42/+32
2024-06-30add `rustc_dump_def_parents` attributeBoxy-1/+49
2024-06-29Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obkbors-15/+79
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