about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-27/+27
rustc: Remove needless lifetimes
2022-12-22Rollup merge of #106010 - oli-obk:tait_coherence_diagnostic, r=compiler-errorsMatthias Krüger-8/+15
Give opaque types a better coherence error
2022-12-21Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJungbors-4/+4
Rename `assert_uninit_valid` intrinsic It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that. This is actually not fully correct though, as it does still panic for all uninit with `-Zstrict-init-checks`. I'm not sure what the best way is to deal with that not causing confusion. I guess we could just remove the flag? I don't think having it makes a lot of sense anymore with the direction that we have chose to go. It could be relevant again if #100423 lands so removing it may be a bit over eager. r? `@RalfJung`
2022-12-21Give opaque types a better coherence errorOli Scherer-8/+15
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-27/+27
2022-12-20Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obkbors-3/+3
Improve syntax of `newtype_index` This makes it more like proper Rust and also makes the implementation a lot simpler. Mostly just turns weird flags in the body into proper attributes. It should probably also be converted to an attribute macro instead of function-like, but that can be done in a future PR.
2022-12-20Auto merge of #105575 - compiler-errors:impl-wf-lint, r=oli-obkbors-12/+98
Add `IMPLIED_BOUNDS_ENTAILMENT` lint Implements a lint (#105572) version of the hard-error introduced in #105483. Context is in that PR. r? `@lcnr` cc `@oli-obk` who had asked for this to be a lint first Not sure if this needs to be an FCP, since it's a lint for now.
2022-12-19Auto merge of #103600 - compiler-errors:early-binder-nits, r=spastorinobors-9/+5
Address some `EarlyBinder` nits
2022-12-19Make fast-path for implied wf lint betterMichael Goulet-71/+92
2022-12-19Add IMPLIED_BOUNDS_ENTAILMENT lintMichael Goulet-5/+70
2022-12-18Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=NilstriebMatthias Krüger-1/+1
use &str / String literals instead of format!()
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-2/+2
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Make `#[custom_encodable]` an attribute for `newtype_index`Nilstrieb-1/+1
Makes the syntax a little more rusty.
2022-12-18use &str / String literals instead of format!()Matthias Krüger-1/+1
2022-12-18remove redundant fn params that were only "used" in recursionMatthias Krüger-4/+3
2022-12-17Rollup merge of #105711 - compiler-errors:rpitit-references-errors, r=eholkMatthias Krüger-0/+2
bail in `collect_trait_impl_trait_tys` if signatures reference errors Fixes #105290
2022-12-16Auto merge of #105717 - compiler-errors:anonymize, r=jackh726bors-1/+1
always use `anonymize_bound_vars` Unless this is perf-sensitive, it's probably best to always use one anonymize function that does the right thing for all bound vars. r? types
2022-12-15Rollup merge of #104592 - ComputerDruid:async_check, r=compiler-errorsMatthias Krüger-0/+43
Ensure async trait impls are async (or otherwise return an opaque type) As a workaround for the full `#[refine]` semantics not being implemented yet, forbit returning a concrete future type like `Box<dyn Future>` or a manually implemented Future. `-> impl Future` is still permitted; while that can also cause accidental refinement, that's behind a different feature gate (`return_position_impl_trait_in_trait`) and that problem exists regardless of whether the trait method is async, so will have to be solved more generally. Fixes https://github.com/rust-lang/rust/issues/102745
2022-12-14Ensure async trait impls are async (or otherwise return an opaque type)Dan Johnson-0/+43
As a workaround for the full `#[refine]` semantics not being implemented yet, forbit returning a concrete future type like `Box<dyn Future>` or a manually implemented Future. `-> impl Future` is still permitted; while that can also cause accidental refinement, that's behind a different feature gate (`return_position_impl_trait_in_trait`) and that problem exists regardless of whether the trait method is async, so will have to be solved more generally. Fixes #102745
2022-12-14always use anonymize_bound_varsMichael Goulet-1/+1
2022-12-14bail in collect_trait_impl_trait_tys if signatures reference errorsMichael Goulet-0/+2
2022-12-14Remove TraitRef::newOli Scherer-2/+2
2022-12-14Prevent the creation of `TraitRef` without dedicated methodsOli Scherer-2/+2
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-3/+3
2022-12-14Guard `AliasTy` creation against passing the wrong number of substsOli Scherer-5/+2
2022-12-14Auto merge of #104986 - compiler-errors:opaques, r=oli-obkbors-51/+42
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias` Implements https://github.com/rust-lang/types-team/issues/79. This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so: ``` enum AliasKind { Projection, Opaque, } struct AliasTy<'tcx> { def_id: DefId, substs: SubstsRef<'tcx>, } ``` Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example: ```diff match ty.kind() { - ty::Opaque(..) => + ty::Alias(ty::Opaque, ..) => {} _ => {} } ``` This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically. r? `@ghost`
2022-12-13Rollup merge of #105628 - spastorino:small-doc-fixes, r=compiler-errorsMatthias Krüger-9/+6
Small doc fixes r? `@compiler-errors`
2022-12-13Address a few more nitsMichael Goulet-5/+6
2022-12-13Address nitsMichael Goulet-1/+1
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-12-13Combine identical alias armsMichael Goulet-6/+2
2022-12-13Combine projection and opaque into aliasMichael Goulet-17/+17
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-8/+8
2022-12-13ProjectionTy.item_def_id -> ProjectionTy.def_idMichael Goulet-31/+25
2022-12-13Use ty::OpaqueTy everywhereMichael Goulet-4/+4
2022-12-13Rename `assert_uninit_valid` intrinsicNilstrieb-4/+4
It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that.
2022-12-13Clarify explicit_predicates_of is_assoc_item_ty commentSantiago Pastorino-3/+4
2022-12-13Move some codegen-y methods from rustc_hir_analysis::collect -> ↵Michael Goulet-816/+4
rustc_codegen_ssa
2022-12-13EarlyBinder nitsMichael Goulet-9/+5
2022-12-12Join match arms since they do the same thingSantiago Pastorino-5/+1
2022-12-12Fix typoSantiago Pastorino-1/+1
2022-12-11Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-deadMatthias Krüger-1/+0
compiler: remove unnecessary imports and qualified paths Some of these imports were necessary before Edition 2021, others were already in the prelude. I hope it's fine that this PR is so spread-out across files :/
2022-12-11Add `round_ties_even` to `f32` and `f64`Jules Bertholet-0/+2
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-12-10Rollup merge of #105410 - TaKO8Ki:fix-105257, r=BoxyUwUMatthias Krüger-1/+1
Consider `parent_count` for const param defaults Fixes #105257
2022-12-10Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3Matthias Krüger-1/+3
Add LLVM KCFI support to the Rust compiler This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) 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) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-09Tweak `rustc_must_implement_one_of` diagnostic outputEsteban Küber-11/+8
2022-12-08Add LLVM KCFI support to the Rust compilerRamon de C Valle-1/+3
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) 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) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-12-08Rollup merge of #105255 - cjgillot:issue-105197, r=compiler-errorsMatthias Krüger-15/+1
Make nested RPIT inherit the parent opaque's generics. Fixes https://github.com/rust-lang/rust/issues/105197 r? ```@compiler-errors```
2022-12-08add a test case for `generic_const_exprs` in trait itemsTakayuki Maeda-1/+1
2022-12-07Auto merge of #104799 - pcc:linkage-fn, r=tmiaskobors-2/+47
Support Option and similar enums as type of static variable with linkage attribute Compiler MCP: rust-lang/compiler-team#565