summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/sty.rs
AgeCommit message (Collapse)AuthorLines
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-5/+393
2023-07-05move `ConstKind` to typeir and move inherent impls to `Const`Boxy-0/+2
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-1/+1
2023-06-21Print def_id on EarlyBoundRegion debugSantiago Pastorino-1/+1
2023-06-19change binders from tuple structs to named fieldslcnr-30/+32
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-0/+1
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-05-30Rollup merge of #112060 - lcnr:early-binder, r=jackh726Nilstrieb-1/+1
`EarlyBinder::new` -> `EarlyBinder::bind` for consistency with `Binder::bind`. it may make sense to also add `EarlyBinder::dummy` in places where we know that no parameters exist, but I left that out of this PR. r? `@jackh726` `@kylematsuda`
2023-05-30Auto merge of #112075 - WaffleLapkin:unmkII, r=lcnrbors-2/+99
Replace `tcx.mk_re_*` with `Region::new_*` Second step in implementing https://github.com/rust-lang/compiler-team/issues/616 r? `@lcnr`
2023-05-29Rollup merge of #111988 - BoxyUwU:make_tykind_debug_good, r=compiler-errorsMatthias Krüger-1/+2
Make `TyKind: Debug` have less verbose output Current `TyKind: Debug` impl is basically unusable for debugging, its too verbose even for verbose debugging :rofl: This PR replaces the debug logic for `TyKind` with a more manual debug impl instead of a hand expanded derived impl. This should help make #107084 more reasonable to land since the output of `Ty: Debug` will be better. This isn't a fully completed change to the `Debug` impl of `TyKind` as there's still logic from the derive macro for some variants. Some of the variants are also not consisten with the `-Zverbose` printing of `Ty`, ideally `-Zverbose` printing of `Ty` would also just defer to the debug impl instead of having lots of checks in pretty printing. I plan on fixing this in follow up PRs since it seems tricky to do in this one and its already a large PR :sweat_smile:
2023-05-29Rename `tcx.mk_re_*` => `Region::new_*`Maybe Waffle-2/+99
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-1/+1
2023-05-28Make EarlyBinder's inner value private; and fix all of the resulting errorsKyle Matsuda-1/+1
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-1/+1
2023-05-26better `TyKind::Debug`Boxy-1/+2
2023-05-14Erase ReError properlyMichael Goulet-1/+3
2023-05-13Rollup merge of #110454 - oli-obk:limited_impl_trait_in_assoc_type, ↵Dylan DPC-1/+1
r=compiler-errors Require impl Trait in associated types to appear in method signatures This implements the limited version of TAIT that was proposed in https://github.com/rust-lang/rust/issues/107645#issuecomment-1477899536 Similar to `impl Trait` in return types, `impl Trait` in associated types may only be used within the impl block which it is a part of. To make everything simpler and forward compatible to getting desugared to a plain type alias impl trait in the future, we're requiring that any associated functions or constants that want to register hidden types must be using the associated type in their signature (type of the constant or argument/return type of the associated method. Where bounds mentioning the associated type are ignored). We have preexisting tests checking that this works transitively across multiple associated types in situations like ```rust impl Foo for Bar { type A = impl Trait; type B = impl Iterator<Item = Self::A>; fn foo() -> Self::B { ...... } } ```
2023-05-12Use the opaque_types_defined_by query to cheaply check for whether a hidden ↵Oli Scherer-1/+1
type may be registered for an opaque type
2023-05-12Don't ICE in layout computation for placeholder typesMichael Goulet-4/+2
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-10/+41
2023-05-04Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnrbors-21/+53
Replace `tcx.mk_trait_ref` with `TraitRef::new` First step in implementing https://github.com/rust-lang/compiler-team/issues/616 r? `@lcnr`
2023-05-03Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3Manish Goregaokar-0/+7
Add cross-language LLVM CFI support to the Rust compiler This PR adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto). Thank you again, ``@bjorn3,`` ``@nikic,`` ``@samitolvanen,`` and the Rust community for all the help!
2023-05-03Add cross-language LLVM CFI support to the Rust compilerRamon de C Valle-0/+7
This commit adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).
2023-04-27Rollup merge of #110838 - nnethercote:more-Folder-Visitable-cleanups, r=lcnrMatthias Krüger-1/+1
More `Typefoldable`/`TypeVisitable` cleanups r? ``@lcnr``
2023-04-26Don't return a `Binder` from `TraitRef::identity`Maybe Waffle-6/+2
2023-04-26Add new `ToPredicate` impls and `TraitRef` methods to remove some ↵Maybe Waffle-0/+12
`ty::Binber::dummy` calls
2023-04-26Switch `ty::TraitRef::from_lang_item` from using `TyCtxtAt` to `TyCtxt` and ↵Maybe Waffle-4/+4
a `Span`
2023-04-26Remove unused `TypeFoldable`/`TypeVisitable` impls.Nicholas Nethercote-1/+1
2023-04-25vars are ?Michael Goulet-1/+1
2023-04-25Rename `TraitRef::{_use_mk_trait_ref_instead => _use_trait_ref_new_instead}`Maybe Waffle-3/+3
2023-04-25Replace `tcx.mk_trait_ref` with `ty::TraitRef::new`Maybe Waffle-8/+13
2023-04-25Move `TraitRef` constructors to the topMaybe Waffle-14/+14
In rust `new`-ish functions are usually the first ones in an `impl` block
2023-04-25Add `ty::TraitRef::{new, from_lang_item}`Maybe Waffle-0/+19
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-13Remove some unused type folders.Nicholas Nethercote-77/+2
I'm surprised the compiler doesn't warn about these. It appears having an `impl` on a struct is enough to avoid a warning about it never being constructed.
2023-04-13Make `Region::as_var` infallible.Nicholas Nethercote-3/+3
It's what all the call sites require.
2023-04-11Add `sym::anon`.Nicholas Nethercote-1/+1
2023-04-11Introduce `Region::get_name_or_anon`.Nicholas Nethercote-5/+10
For a common pattern.
2023-04-10Auto merge of #108698 - IntQuant:issue-100717-infer-6, r=davidtwcobors-8/+24
Migrating rustc_infer to session diagnostics (part 5) `@rustbot` label +A-translation cc https://github.com/rust-lang/rust/issues/100717
2023-04-10Call `into_diagnostic_arg` on Binder's contained value directly.IQuant-3/+21
2023-04-09Remove identity castsNilstrieb-1/+1
2023-04-07Add a size assertion for `RegionKind`.Nicholas Nethercote-4/+11
2023-04-06Remove u32 on BoundTyKind::AnonJack Huey-2/+2
2023-04-06Remove index from BrAnonJack Huey-1/+1
2023-04-06Remove expect_anon and expect_anon_placeholder in favor of varJack Huey-18/+0
2023-04-06Use BoundTy and BoundRegion instead of kind of PlaceholderTy and ↵Jack Huey-2/+2
PlaceholderRegion
2023-04-04A more general implementation of `IntoDiagnosticArg` for `Binder` (Also ↵IQuant-13/+11
removes `DiagArg`, as it's no longer necessary)
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-2/+2
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-3/+2
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
2023-03-22Rollup merge of #109378 - MU001999:master, r=scottmcmMatthias Krüger-6/+1
Remove Ty::is_region_ptr Fixes #109372
2023-03-21Deduplicate fn trait compatibility checksOli Scherer-1/+13