about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
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-77/+77
2024-05-16Uplift FnSigMichael Goulet-109/+53
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-13Remove to_termMichael Goulet-8/+0
2024-05-13Uplift AliasTyMichael Goulet-480/+139
2024-05-13Apply nitsMichael Goulet-31/+35
2024-05-13split out AliasTy -> AliasTermMichael Goulet-61/+273
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-11Also expand weak alias tys inside consts inside `expand_weak_alias_tys`León Orell Valerian Liehr-1/+1
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-29/+9
2024-05-10Rollup merge of #124957 - compiler-errors:builtin-deref, r=michaelwoeristerMatthias Krüger-7/+5
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
2024-05-10Auto merge of #124961 - matthiaskrgr:rollup-1jj65p6, r=matthiaskrgrbors-24/+3
Rollup of 7 pull requests Successful merges: - #124551 (Add benchmarks for `impl Debug for str`) - #124915 (`rustc_target` cleanups) - #124918 (Eliminate some `FIXME(lcnr)` comments) - #124927 (opt-dist: use xz2 instead of xz crate) - #124936 (analyse visitor: build proof tree in probe) - #124943 (always use `GenericArgsRef`) - #124955 (Use fewer origins when creating type variables.) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-10Rollup merge of #124943 - lcnr:generic-args-ref, r=compiler-errorsMatthias Krüger-2/+2
always use `GenericArgsRef` r? ```@compiler-errors```
2024-05-10Rollup merge of #124918 - nnethercote:FIXME-lcnr, r=lcnrMatthias Krüger-22/+1
Eliminate some `FIXME(lcnr)` comments In some cases this involved changing code. In some cases the comment was able to removed or replaced. r? ``@lcnr``
2024-05-10Auto merge of #124953 - compiler-errors:own-params, r=lcnrbors-19/+19
Rename `Generics::params` to `Generics::own_params` I hope this makes it slightly more obvious that `generics.own_params` is insufficient when considering nested items. I didn't actually audit any of the usages, for the record. r? lcnr
2024-05-09Make builtin_deref just return a TyMichael Goulet-7/+5
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-19/+19
2024-05-10Remove `TyCtxt::try_normalize_erasing_late_bound_regions`.Nicholas Nethercote-22/+1
It's unused.
2024-05-09always use `GenericArgsRef`lcnr-2/+2
2024-05-09Make `#![feature]` suggestion MaybeIncorrectAlex Macleod-1/+1
2024-05-08Handle normalization failure in `struct_tail_erasing_lifetimes`Gurinder Singh-7/+8
Fixes an ICE that occurred when the struct in question has an error
2024-05-08Rollup merge of #124548 - gurry:113272-ice-failed-to-normalize, ↵Matthias Krüger-1/+16
r=compiler-errors Handle normalization failure in `struct_tail_erasing_lifetimes` Fixes #113272 The ICE occurred because the struct being normalized had an error. This PR adds some defensive code to guard against that.
2024-05-06Refactor float `Primitive`s to a separate `Float` typebeetrees-8/+26
2024-05-03Rollup merge of #124610 - nnethercote:typenum, r=lcnrMatthias Krüger-8/+4
Tweak `consts_may_unify` r? ````@lcnr````
2024-05-03Tweak `consts_may_unify`.Nicholas Nethercote-8/+4
`ConstKind::Value` is the only variant where control flow leaves the first match on `impl_ct.kind()`, so there is no need for a second match on the same expression later on.
2024-05-02Rollup merge of #124624 - WaffleLapkin:old_unit, r=fmeaseMatthias Krüger-7/+2
Use `tcx.types.unit` instead of `Ty::new_unit(tcx)` I don't think there is any need for the function, given that we can just access the `.types`, similarly to all other primitives?
2024-05-02Inline & delete `Ty::new_unit`, since it's just a field accessWaffle Lapkin-7/+2
2024-05-01Step bootstrap cfgsMark Rousskov-2/+2
2024-05-01Handle normalization failure in `struct_tail_erasing_lifetimes`Gurinder Singh-1/+16
Fixes an ICE that occurred when the struct in question has an error
2024-04-30Give items related to issue 33140 a more meaningful nameLeón Orell Valerian Liehr-22/+21
2024-04-29Remove `extern crate smallvec` from a couple of crates.Nicholas Nethercote-2/+2
2024-04-29Remove `extern crate bitflags` from a couple of crates.Nicholas Nethercote-2/+2
2024-04-29Remove `extern crate rustc_data_structures` from numerous crates.Nicholas Nethercote-4/+4
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-14/+37
2024-04-26Auto merge of #120845 - petrochenkov:debmac, r=oli-obkbors-17/+1
debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and `#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local) - https://github.com/rust-lang/rust/issues/100758#issuecomment-1935815625 describes some debugging scenarios that motivate this default as reasonable. `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default. Stabilization report: https://github.com/rust-lang/rust/pull/120845#issuecomment-1939145242 Closes https://github.com/rust-lang/rust/issues/100758 Closes https://github.com/rust-lang/rust/issues/41743 Closes https://github.com/rust-lang/rust/issues/39153
2024-04-25Rollup merge of #124379 - compiler-errors:remove-new-solver-lookup-behavior, ↵Michael Goulet-56/+9
r=lcnr Remove special-casing for `SimplifiedType` for next solver It's unnecessary due to the way that we fully normalize the self type before assembly begins. r? lcnr
2024-04-25debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and ↵Vadim Petrochenkov-17/+1
`#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local). `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
2024-04-25Remove special-casing for SimplifiedType for next solverMichael Goulet-56/+9