about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2024-02-08Add a new debug_assertions instrinsic (compiler)Ben Kimock-0/+4
And in clippy
2024-02-08Auto merge of #120544 - BoxyUwU:enter_forall, r=lcnrbors-0/+1
Introduce `enter_forall` to supercede `instantiate_binder_with_placeholders` r? `@lcnr` Long term we'd like to experiment with decrementing the universe count after "exiting" binders so that we do not end up creating infer vars in non-root universes even when they logically reside in the root universe. The fact that we dont do this currently results in a number of issues in the new trait solver where we consider goals to be ambiguous because otherwise it would require lowering the universe of an infer var. i.e. the goal `?x.0 eq <T as Trait<?y.1>>::Assoc` where the alias is rigid would not be able to instantiate `?x` with the alias as there would be a universe error. This PR is the first-ish sort of step towards being able to implement this as eventually we would want to decrement the universe in `enter_forall`. Unfortunately its Difficult to actually implement decrementing universes nicely so this is a separate step which moves us closer to the long term goal :sparkles:
2024-02-08introduce `enter_forall`Boxy-0/+1
2024-02-08Step all bootstrap cfgs forwardMark Rousskov-1/+1
This also takes care of other bootstrap-related changes.
2024-02-08Rollup merge of #120739 - lukas-code:pp-dyn-assoc, r=compiler-errorsMatthias Krüger-33/+81
improve pretty printing for associated items in trait objects * Don't print a binder in front of associated items, because it's not valid syntax. * e.g. print `dyn for<'a> Trait<'a, Assoc = &'a u8>` instead of `dyn for<'a> Trait<'a, for<'a> Assoc = &'a u8>`. * Don't print associated items that are implied by a supertrait bound. * e.g. if we have `trait Sub: Super<Assoc = u8> {}`, then just print `dyn Sub` instead of `dyn Sub<Assoc = u8>`. I've added the test in the first commit, so you can see the diff of the compiler output in the second commit.
2024-02-08Rollup merge of #120206 - petrochenkov:somehir, r=compiler-errorsMatthias Krüger-79/+61
hir: Make sure all `HirId`s have corresponding HIR `Node`s And then remove `tcx.opt_hir_node(hir_id)` in favor of `tcx.hir_node(hir_id)`.
2024-02-08Auto merge of #120381 - fee1-dead-contrib:reconstify-add, r=compiler-errorsbors-0/+4
Reconstify `Add` r? project-const-traits I'm not happy with the ui test changes (or failures because I did not bless them and include the diffs in this PR). There is at least some bugs I need to look and try fix: 1. A third duplicated diagnostic when a consumer crate that does not have `effects` enabled has a trait selection error for an upstream const_trait trait. See tests/ui/ufcs/ufcs-qpath-self-mismatch.rs. 2. For some reason, making `Add` a const trait would stop us from suggesting `T: Add` when we try to add two `T`s without that bound. See tests/ui/suggestions/issue-97677.rs
2024-02-07Do not create param types that differ only by name when comparing intrinsic ↵Michael Goulet-1/+1
signatures
2024-02-07Assert that ParamTy and ParamConst have identical names for identical indicesMichael Goulet-2/+8
2024-02-07address review comments and add more testsLukas Markeffsky-10/+15
2024-02-07Rollup merge of #120746 - compiler-errors:kind-ty, r=oli-obkGuillaume Boisseau-1/+8
Record coroutine kind in coroutine generics Oops, added a new substitution (the "kind" ty) to coroutines but forgot to record it in the `generics_of`. I'm surprised I left this out of the coroutine-closure PR -- I thought I made this change; I possibly rebased it out by accident. Fixes #120732 r? oli-obk
2024-02-07Rollup merge of #120733 - klensy:trait-const-fn, r=oli-obkGuillaume Boisseau-2/+23
MirPass: make name more const Continues #120161, this time applied to `MirPass` instead of `MirLint`, locally shaves few (very few) instructions off. r? ``@cjgillot``
2024-02-07Record coroutine kind in genericsMichael Goulet-1/+8
2024-02-07improve pretty printing for trait objectsLukas Markeffsky-32/+75
2024-02-07MirPass: make name more constklensy-2/+23
2024-02-07hir: Add some FIXMEs for future workVadim Petrochenkov-0/+3
2024-02-07hir: Remove `fn opt_hir_id` and `fn opt_span`Vadim Petrochenkov-79/+54
2024-02-07hir: Make sure all `HirId`s have corresponding HIR `Node`sVadim Petrochenkov-4/+8
2024-02-06Rollup merge of #120707 - compiler-errors:suitable-region, r=nnethercoteMatthias Krüger-1/+1
Don't expect early-bound region to be local when reporting errors in RPITIT well-formedness The implicit lifetime in the example code gets replaced with `ReError`, which fails a `sub_regions` check in the lexical region solver. Error reporting ends up calling `is_suitable_region` on an early bound region in the *trait* definition. This causes an ICE because we `expect_local()`. This is kind of a bad explanation, but this code just makes diagnostics reporting a bit more gracefully fallible. If the reviewer wants a thorough investigation of exactly where we get this region outlives obligation, I can write one up. Doesn't really seem worth it, though, imo. Fixes #120638 Fixes #120648
2024-02-06Rollup merge of #120502 - clubby789:remove-ffi-returns-twice, r=compiler-errorsMatthias Krüger-13/+10
Remove `ffi_returns_twice` feature The [tracking issue](https://github.com/rust-lang/rust/issues/58314) and [RFC](https://github.com/rust-lang/rfcs/pull/2633) have been closed for a couple of years. There is also an attribute gate in R-A which should be removed if this lands.
2024-02-06Rollup merge of #120423 - RalfJung:indirect-structural-match, r=petrochenkovMatthias Krüger-2/+1
update indirect structural match lints to match RFC and to show up for dependencies This is a large step towards implementing https://github.com/rust-lang/rfcs/pull/3535. We currently have five lints related to "the structural match situation": - nontrivial_structural_match - indirect_structural_match - pointer_structural_match - const_patterns_without_partial_eq - illegal_floating_point_literal_pattern This PR concerns the first 3 of them. (The 4th already is set up to show for dependencies, and the 5th is removed by https://github.com/rust-lang/rust/pull/116284.) nontrivial_structural_match is being removed as per the RFC; the other two are enabled to show up in dependencies. Fixes https://github.com/rust-lang/rust/issues/73448 by removing the affected analysis.
2024-02-06Rollup merge of #120670 - lcnr:effect-var-storage, r=fee1-deadMatthias Krüger-19/+23
cleanup effect var handling r? types
2024-02-06Don't expect early-bound region to be local in RPITIT well-formednessMichael Goulet-1/+1
2024-02-06Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closureMichael Goulet-19/+52
2024-02-06More comments, final tweaksMichael Goulet-9/+48
2024-02-06Bless tests, add commentsMichael Goulet-8/+53
2024-02-06Construct body for by-move coroutine closure outputMichael Goulet-13/+63
2024-02-06Build a shim to call async closures with different AsyncFn trait kindsMichael Goulet-1/+25
2024-02-06Teach typeck/borrowck/solvers how to deal with async closuresMichael Goulet-6/+156
2024-02-06Add CoroutineClosure to TyKind, AggregateKind, UpvarArgsMichael Goulet-9/+232
2024-02-06Invert diagnostic lints.Nicholas Nethercote-1/+3
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-02-05get rid of nontrivial_structural_match lint and custom_eq const qualifRalf Jung-2/+1
2024-02-05old solver: improve normalization of `Pointee::Metadata`Lukas Markeffsky-16/+32
2024-02-05Rollup merge of #116284 - RalfJung:no-nan-match, r=cjgillotMatthias Krüger-29/+46
make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error. This is part of implementing https://github.com/rust-lang/rfcs/pull/3535. Closes https://github.com/rust-lang/rust/issues/41620 by removing the lint. https://github.com/rust-lang/reference/pull/1456 updates the reference to match.
2024-02-05cleanup effect var handlinglcnr-19/+23
2024-02-05Rollup merge of #119600 - aDotInTheVoid:comment-fix, r=compiler-errorsMatthias Krüger-3/+3
Remove outdated references to librustc_middle The relevant comment is now in https://github.com/rust-lang/rust/blob/791a53f380d5cf800191f25941c94ace5099876e/compiler/rustc_middle/src/tests.rs#L3-L13
2024-02-05Auto merge of #120497 - compiler-errors:modulize, r=lcnrbors-1456/+1491
Move predicate, region, and const stuff into their own modules in middle This PR mostly moves things around, and in a few cases adds some `ty::` to the beginning of names to avoid one-off imports. I don't mean this to be the most *thorough* move/refactor. I just generally wanted to begin to split up `ty/mod.rs` and `ty/sty.rs` which are huge and hard to distinguish, and have a lot of non-ty stuff in them. r? lcnr
2024-02-04make effect infer variables suggestable in diagnosticsDeadbeef-0/+4
it works when a non-const context that does not enable effects calls into a const effects-enabled trait. We'd simply suggest the non-const trait bound in this case consistent to its fallback.
2024-02-03Rollup merge of #120610 - petrochenkov:maybeownogen, r=cjgillotMatthias Krüger-7/+6
hir: Remove the generic type parameter from `MaybeOwned` It's only ever used with a reference to `OwnerInfo` as an argument. Follow up to https://github.com/rust-lang/rust/pull/120346.
2024-02-03hir: Remove the generic type parameter from `MaybeOwned`Vadim Petrochenkov-7/+6
It's only ever used with a reference to `OwnerInfo` as an argument.
2024-02-02Remove dead args from functionsMichael Goulet-2/+1
2024-02-03Use `DiagnosticArgName` in a few more places.Nicholas Nethercote-8/+11
2024-01-31Rollup merge of #120495 - clubby789:remove-amdgpu-kernel, r=oli-obkNadrieril-1/+0
Remove the `abi_amdgpu_kernel` feature The tracking issue (#51575) has been closed for 3 years, with no activity for 5.
2024-01-31Auto merge of #120346 - petrochenkov:ownodes, r=oli-obkbors-55/+55
hir: Refactor getters for owner nodes
2024-01-30Remove `ffi_returns_twice` featureclubby789-13/+10
2024-01-30Move predicate, region, and const stuff into their own modules in middleMichael Goulet-1456/+1491
2024-01-30Rollup merge of #120293 - estebank:issue-102629, r=nnethercoteGuillaume Gomez-0/+2
Deduplicate more sized errors on call exprs Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-30Remove the `abi_amdgpu_kernel` featureclubby789-1/+0
2024-01-30hir: Remove `hir::Map::{owner,expect_owner}`Vadim Petrochenkov-10/+2
2024-01-30hir: Add non-optional `hir_owner_nodes` for real `OwnerId`sVadim Petrochenkov-40/+53