about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2024-05-18Auto merge of #125077 - spastorino:add-new-fnsafety-enum2, r=jackh726bors-46/+34
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-18(Mostly) revert "Account for type param from other item in `note_and_explain`"Michael Goulet-28/+0
This mostly reverts commit 7449478c2f6fd2d72c12a51d8562f1e6108facab. It also removes an `opt_param_at` that really is unnecessary given our ICE policy for malformed intrinsics.
2024-05-18An async closure may implement FnMut/Fn if it has no self-borrowsMichael Goulet-0/+39
2024-05-17Remove `Rvalue::CheckedBinaryOp`Scott McMurray-20/+40
2024-05-17Rename Unsafe to SafetySantiago Pastorino-46/+34
2024-05-17to_opt_poly_X_pred -> as_X_clauseMichael Goulet-2/+2
2024-05-16Uplift Goal to rustc_type_irMichael Goulet-83/+38
2024-05-16Make impls UpcastFrom, implement Upcast for UpcastFromMichael Goulet-89/+91
2024-05-16Make P parameter explicitMichael Goulet-16/+16
2024-05-16Rename ToPredicate for UpcastMichael Goulet-85/+85
2024-05-16Uplift FnSigMichael Goulet-109/+53
2024-05-15Rollup merge of #125137 - RalfJung:mir-sh, r=scottmcmLeón Orell Valerian Liehr-2/+6
MIR operators: clarify Shl/Shr handling of negative offsets "made unsigned" was not fully clear (made unsigned how? by using `abs`? no), so let's say "re-interpreted as an unsigned value of the same size" instead. r? `@scottmcm`
2024-05-15MIR operators: clarify Shl/Shr handling of negative offsetsRalf Jung-2/+6
2024-05-15Rollup merge of #125108 - Zalathar:info-bitmap-bytes, r=nnethercoteMatthias Krüger-10/+0
coverage: `CoverageIdsInfo::mcdc_bitmap_bytes` is never needed This code for recalculating `mcdc_bitmap_bytes` in a query doesn't provide any benefit, because its result won't have changed from the value in `FunctionCoverageInfo` that was computed during the MIR instrumentation pass. Extracted from #124571, to avoid having this held up by unrelated issues with condition count checks. `@rustbot` label +A-code-coverage
2024-05-15Rollup merge of #124990 - fmease:expand-weak-aliases-within-cts, ↵Matthias Krüger-1/+1
r=compiler-errors Also expand weak alias tys inside consts inside `expand_weak_alias_tys` Ever since #121344 has been merged, I couldn't let go of the fear that I might've slipped a tiny bug into rustc (:P). Checking the type flags of the `Const` is strictly more correct than only checking the ones of the `Const`'s `Ty`. I don't think it's possible to trigger an ICE rn (i.e., one of the two `bug!("unexpected weak alias type")` I added in branches where `expand_weak_alias_tys` should've expanded *all* weak alias tys) because presently const exprs aren't allowed to capture late-bound vars. To be future-proof however, we should iron this out. A possible reproducer would be the following if I'm not mistaken (currently fails to compile due to the aforementioned restriction): ```rs #![feature(lazy_type_alias, adt_const_params, generic_const_exprs)] type F = for<'a> fn(A<{ S::<Weak<'a>>(loop {}) }>) -> &'a (); type A<const N: S<Weak<'static>>> = (); #[derive(PartialEq, Eq, std::marker::ConstParamTy)] struct S<T>(T); type Weak<'a> = &'a (); ``` Whether a late-bound region should actually be considered constrained by a const expr is a separate question — one which we don't need to answer until / unless we actually allow them in such contexts (probable answer: only inside the return exprs of a block but not inside the stmts). r? oli-obk (he's not available rn but that's fine) or types or compiler
2024-05-14Rollup merge of #125088 - compiler-errors:uplift-alias-ty, r=lcnrMichael Goulet-480/+131
Uplift `AliasTy` and `AliasTerm` Follow-up from #125076. r? lcnr
2024-05-14coverage: Remove confusing comments from `CoverageKind`Zalathar-6/+0
These comments appear to be inspired by the similar comments on `CounterIncrement` and `ExpressionUsed`. But those comments refer to specific simplification steps performed during coverage codegen, and there is no corresponding step for the MC/DC coverage statements. If these statements do not survive optimization, they will simply not participate in code generation, just like any other statement.
2024-05-14coverage: `CoverageIdsInfo::mcdc_bitmap_bytes` is never neededZalathar-4/+0
This code for recalculating `mcdc_bitmap_bytes` doesn't provide any benefit, because its result won't have changed from the value in `FunctionCoverageInfo` that was computed during the MIR instrumentation pass.
2024-05-13Use a proper probe for shadowing implMichael Goulet-0/+5
2024-05-14coverage: Memoize newly-created counter expressionsZalathar-2/+2
This currently has no effect, but is expected to be useful when expanding support for branch coverage and MC/DC coverage.
2024-05-13Remove to_termMichael Goulet-8/+0
2024-05-13Uplift AliasTyMichael Goulet-480/+139
2024-05-13Auto merge of #125076 - compiler-errors:alias-term, r=lcnrbors-69/+285
Split out `ty::AliasTerm` from `ty::AliasTy` Splitting out `AliasTerm` (for use in project and normalizes goals) and `AliasTy` (for use in `ty::Alias`) r? lcnr
2024-05-13Apply nitsMichael Goulet-31/+35
2024-05-13split out AliasTy -> AliasTermMichael Goulet-61/+273
2024-05-13Add `size_of`, `size_of_val`, `align_of`, and `align_of_val` to the preludeJosh Triplett-1/+1
Many, many projects use `size_of` to get the size of a type. However, it's also often equally easy to hardcode a size (e.g. `8` instead of `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps ensure that people use it and make code more self-documenting. The name `size_of` is unambiguous: the name alone, without any prefix or path, is self-explanatory and unmistakeable for any other functionality. Adding it to the prelude cannot produce any name conflicts, as any local definition will silently shadow the one from the prelude. Thus, we don't need to wait for a new edition prelude to add it. Add `size_of_val`, `align_of`, and `align_of_val` as well, with similar justification: widely useful, self-explanatory, unmistakeable for anything else, won't produce conflicts.
2024-05-13interpret: move error macros into error.rsRalf Jung-132/+126
2024-05-13Auto merge of #124914 - nnethercote:rm-extern-crate-rustc_middle, r=saethlinbors-11/+27
Remove `#[macro_use] extern crate rustc middle` from numerous crates Because explicit importing of macros via `use` items is nicer (more standard and readable) than implicit importing via `#[macro_use]`. This PR mops up some cases I didn't get to in #124511. r? `@saethlin`
2024-05-13Remove `extern crate rustc_middle` from `rustc_const_eval`.Nicholas Nethercote-11/+27
This requires exporting the interpreter macros so they can be used with `use crate::interpret::*`.
2024-05-12Auto merge of #124639 - ↵bors-0/+19
Jules-Bertholet:match-ergonomics-2024-migration-lint, r=Nadrieril Match ergonomics 2024: migration lint Depends on #124567 r? `@Nadrieril` cc https://github.com/rust-lang/rust/issues/123076 `@rustbot` label A-edition-2024 A-patterns
2024-05-12Match ergonomics 2024: migration lintJules Bertholet-0/+19
Unfortunately, we can't always offer a machine-applicable suggestion when there are subpatterns from macro expansion. Co-Authored-By: Guillaume Boisseau <Nadrieril@users.noreply.github.com>
2024-05-11And `ImplPolarity` tooMichael Goulet-24/+0
2024-05-11Apply nits, uplift ExistentialPredicate tooMichael Goulet-78/+64
2024-05-11Uplift `NormalizesTo`, `CoercePredicate`, and `SubtypePredicate`Michael Goulet-75/+31
2024-05-11Uplift `ExistentialTraitRef`, `ExistentialProjection`, `ProjectionPredicate`Michael Goulet-169/+62
2024-05-11Uplift `TraitPredicate`Michael Goulet-77/+13
2024-05-11Consolidate obligation cause codes for where clausesMichael Goulet-16/+9
2024-05-11Also expand weak alias tys inside consts inside `expand_weak_alias_tys`León Orell Valerian Liehr-1/+1
2024-05-10Auto merge of #124982 - compiler-errors:uplift-trait-ref, r=lcnrbors-141/+90
Uplift `TraitRef` into `rustc_type_ir` Emotional rollercoaster r? lcnr
2024-05-10Apply nits, make some bounds into supertraits on inherent traitsMichael Goulet-0/+2
2024-05-10Also debugMichael Goulet-0/+4
2024-05-10Lift `TraitRef` into `rustc_type_ir`Michael Goulet-111/+74
2024-05-10Lift `Lift`Michael Goulet-30/+10
2024-05-10Auto merge of #124952 - compiler-errors:no-error, r=lcnrbors-38/+33
Rename some `FulfillmentErrorCode`/`ObligationCauseCode` variants to be less redundant 1. Rename some `FulfillmentErrorCode` variants. 2. Always use `ObligationCauseCode::` to prefix a code, rather than using a glob import and naming them through `traits::`. 3. Rename some `ObligationCauseCode` variants -- I wasn't particularly thorough with thinking of a new names for these, so could workshop them if necessary. 4. Misc stuff from renaming. r? lcnr
2024-05-10Name tweaksMichael Goulet-7/+7
2024-05-10More rename falloutMichael Goulet-18/+19
2024-05-10Rename some ObligationCauseCode variantsMichael Goulet-27/+20
2024-05-10Remove glob imports for ObligationCauseCodeMichael Goulet-11/+12
2024-05-10Rollup merge of #124957 - compiler-errors:builtin-deref, r=michaelwoeristerMatthias Krüger-14/+8
Make `Ty::builtin_deref` just return a `Ty` Nowhere in the compiler are we using the mutability part of the `TyAndMut` that we used to return.
2024-05-10Rollup merge of #124797 - beetrees:primitive-float, r=davidtwcoMatthias Krüger-8/+26
Refactor float `Primitive`s to a separate `Float` type Now there are 4 of them, it makes sense to refactor `F16`, `F32`, `F64` and `F128` out of `Primitive` and into a separate `Float` type (like integers already are). This allows patterns like `F16 | F32 | F64 | F128` to be simplified into `Float(_)`, and is consistent with `ty::FloatTy`. As a side effect, this PR also makes the `Ty::primitive_size` method work with `f16` and `f128`. Tracking issue: #116909 `@rustbot` label +F-f16_and_f128