about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
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
2024-01-30hir: Simplify `hir_owner_nodes` queryVadim Petrochenkov-13/+8
The query accept arbitrary DefIds, not just owner DefIds. The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom. Also rename the query to `opt_hir_owner_nodes`.
2024-01-30Rollup merge of #120488 - nnethercote:diag-lifetimes, r=oli-obkGuillaume Gomez-27/+21
Diagnostic lifetimes cleanups Some diagnostic simplifications. r? `@oli-obk`
2024-01-30Rollup merge of #120425 - DaniPopes:query-default-return, r=NilstriebGuillaume Gomez-14/+14
Remove unnecessary unit returns in query declarations For consistency with normal functions.
2024-01-30Remove the lifetime from `DiagnosticArgValue`.Nicholas Nethercote-27/+21
Because it's almost always static. This makes `impl IntoDiagnosticArg for DiagnosticArgValue` trivial, which is nice. There are a few diagnostics constructed in `compiler/rustc_mir_build/src/check_unsafety.rs` and `compiler/rustc_mir_transform/src/errors.rs` that now need symbols converted to `String` with `to_string` instead of `&str` with `as_str`, but that' no big deal, and worth it for the simplifications elsewhere.
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-3/+3
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
2024-01-27Remove unnecessary unit returns in query declarationsDaniPopes-14/+14
For consistency with normal functions.
2024-01-27Rollup merge of #120386 - klensy:destruction_scopes, r=compiler-errorsMatthias Krüger-8/+0
ScopeTree: remove destruction_scopes as unused last usages removed by https://github.com/rust-lang/rust/pull/116170 Unused, but still presented in memory at `t-gmax` (in DHAT termonology)
2024-01-26ScopeTree: remove destruction_scopes as unusedklensy-8/+0
last usages removed by https://github.com/rust-lang/rust/pull/116170
2024-01-26make matching on NaN a hard errorRalf Jung-29/+46
2024-01-26interpret: project_downcast: do not ICE for uninhabited variantsRalf Jung-0/+2
2024-01-26Auto merge of #119968 - clubby789:unused-feature, r=compiler-errorsbors-6/+0
Remove unused/unnecessary features ~~The bulk of the actual code changes here is replacing try blocks with equivalent closures. I'm not entirely sure that's a good idea since it may have perf impact, happy to revert if that's the case/the change is unwanted.~~ I also removed a lot of `recursion_limit = "256"` since everything seems to build fine without that and most don't have any comment justifying it.
2024-01-26Auto merge of #116167 - RalfJung:structural-eq, r=lcnrbors-7/+6
remove StructuralEq trait The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more. One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust https://github.com/rust-lang/rust/pull/115893 to check for `Eq`, and rule out float matching for good. Fixes https://github.com/rust-lang/rust/issues/115881
2024-01-25Rollup merge of #120330 - ↵Matthias Krüger-4/+15
compiler-errors:no-coroutine-info-in-coroutine-drop-body, r=nnethercote Remove coroutine info when building coroutine drop body Coroutine drop shims are not themselves coroutines, so erase the "`coroutine`" field from the body so that helper fns like `yield_ty` and `coroutine_kind` properly return `None` for the drop shim.
2024-01-25Remove unused featuresclubby789-6/+0
2024-01-25Auto merge of #120335 - matthiaskrgr:rollup-2a0y3rd, r=matthiaskrgrbors-3/+12
Rollup of 10 pull requests Successful merges: - #119305 (Add `AsyncFn` family of traits) - #119389 (Provide more context on recursive `impl` evaluation overflow) - #119895 (Remove `track_errors` entirely) - #120230 (Assert that a single scope is passed to `for_scope`) - #120278 (Remove --fatal-warnings on wasm targets) - #120292 (coverage: Dismantle `Instrumentor` and flatten span refinement) - #120315 (On E0308 involving `dyn Trait`, mention trait objects) - #120317 (pattern_analysis: Let `ctor_sub_tys` return any Iterator they want) - #120318 (pattern_analysis: Reuse most of the `DeconstructedPat` `Debug` impl) - #120325 (rustc_data_structures: use either instead of itertools) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-25Rollup merge of #119895 - oli-obk:track_errors_3, r=matthewjasperMatthias Krüger-3/+12
Remove `track_errors` entirely follow up to https://github.com/rust-lang/rust/pull/119869 r? `@matthewjasper` There are some diagnostic changes adding new diagnostics or not emitting some anymore. We can improve upon that in follow-up work imo.
2024-01-25Auto merge of #119955 - kamalesh0406:master, r=WaffleLapkinbors-18/+56
Modify GenericArg and Term structs to use strict provenance rules This is the first PR to solve issue #119217 . In this PR, I have modified the GenericArg struct to use the `NonNull` struct as the pointer instead of `NonZeroUsize`. The change were tested by running `./x test compiler/rustc_middle`. Resolves https://github.com/rust-lang/rust/issues/119217 r? `@WaffleLapkin`
2024-01-25What even is CoroutineInfoMichael Goulet-4/+15
2024-01-25Auto merge of #119627 - oli-obk:const_prop_lint_n̵o̵n̵sense, r=cjgillotbors-2/+0
Remove all ConstPropNonsense We track all locals and projections on them ourselves within the const propagator and only use the InterpCx to actually do some low level operations or read from constants (via `OpTy` we get for said constants). This helps moving the const prop lint out from the normal pipeline and running it just based on borrowck information. This in turn allows us to make progress on https://github.com/rust-lang/rust/pull/108730#issuecomment-1875557745 there are various follow up cleanups that can be done after this PR (e.g. not matching on Rvalue twice and doing binop checks twice), but lets try landing this one first. r? `@RalfJung`
2024-01-24remove StructuralEq traitRalf Jung-7/+6
2024-01-24Deduplicate more sized errors on call exprsEsteban Küber-0/+2
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-23Auto merge of #120283 - fmease:rollup-rk0f6r5, r=fmeasebors-10/+17
Rollup of 9 pull requests Successful merges: - #112806 (Small code improvements in `collect_intra_doc_links.rs`) - #119766 (Split tait and impl trait in assoc items logic) - #120139 (Do not normalize closure signature when building `FnOnce` shim) - #120160 (Manually implement derived `NonZero` traits.) - #120171 (Fix assume and assert in jump threading) - #120183 (Add `#[coverage(off)]` to closures introduced by `#[test]` and `#[bench]`) - #120195 (add several resolution test cases) - #120259 (Split Diagnostics for Uncommon Codepoints: Add List to Display Characters Involved) - #120261 (Provide structured suggestion to use trait objects in some cases of `if` arm type divergence) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-23Rollup merge of #120139 - compiler-errors:fnonce-shim, r=BoxyUwULeón Orell Valerian Liehr-10/+8
Do not normalize closure signature when building `FnOnce` shim It is not necessary to normalize the closure signature when building an `FnOnce` shim for an `Fn`/`FnMut` closure. That closure shim is just calling `FnMut::call_mut(&mut self)` anyways. It's also somewhat sketchy that we were ever doing this to begin with, since we're normalizing with a `ParamEnv::reveal_all()` param-env, which is definitely not right with possibly polymorphic substs. This cuts out a tiny bit of unnecessary work in `Instance::resolve` and simplifies the signature because now we can unconditionally return an `Instance`.