about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2024-11-25Remove span hack that doesnt do anythingMichael Goulet-34/+1
2024-11-25No need to store original_span in ClauseWithSupertraitSpanMichael Goulet-1/+1
2024-11-25Simplify object_region_boundsMichael Goulet-1/+0
2024-11-25Refactor `where` predicates, and reserve for attributes supportFrank King-23/+27
2024-11-25Rollup merge of #131664 - taiki-e:s390x-asm-vreg-inout, r=AmanieuMatthias Krüger-11/+38
Support input/output in vector registers of s390x inline assembly (under asm_experimental_reg feature) This extends currently clobber-only vector registers (`vreg`) support to allow passing `#[repr(simd)]` types, floats (f32/f64/f128), and integers (i32/i64/i128) as input/output. This is unstable and gated under new `#![feature(asm_experimental_reg)]` (tracking issue: https://github.com/rust-lang/rust/issues/133416). If the feature is not enabled, only clober is supported as before. | Architecture | Register class | Target feature | Allowed types | | ------------ | -------------- | -------------- | -------------- | | s390x | `vreg` | `vector` | `i32`, `f32`, `i64`, `f64`, `i128`, `f128`, `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` | This matches the list of types that are supported by the vector registers in LLVM: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.td#L301-L313 In addition to `core::simd` types and floats listed above, custom `#[repr(simd)]` types of the same size and type are also allowed. All allowed types other than i32/f32/i64/f64/i128, and relevant target features are currently unstable. Currently there is no SIMD type for s390x in `core::arch`, but this is tracked in https://github.com/rust-lang/rust/issues/130869. cc https://github.com/rust-lang/rust/issues/130869 about vector facility support in s390x cc https://github.com/rust-lang/rust/issues/125398 & https://github.com/rust-lang/rust/issues/116909 about f128 support in asm `@rustbot` label +O-SystemZ +A-inline-assembly
2024-11-24Actually use placeholder regions for trait method late bound regions in ↵Michael Goulet-6/+6
collect_return_position_impl_trait_in_trait_tys
2024-11-24Make s390x non-clobber-only vector register support unstableTaiki Endo-11/+38
2024-11-23Dont create trait object if it has errors in itMichael Goulet-1/+6
2024-11-23Add simd_relaxed_fma intrinsicCaleb Zulawski-1/+3
2024-11-23Dont create object type when more than one principal is presentMichael Goulet-4/+9
2024-11-23no more Reveal :(lcnr-9/+9
2024-11-23Auto merge of #132915 - veluca93:unsafe-fields, r=jswrennbors-32/+103
Implement the unsafe-fields RFC. RFC: rust-lang/rfcs#3458 Tracking: - https://github.com/rust-lang/rust/issues/132922 r? jswrenn
2024-11-22Simplify fulfill_implicationMichael Goulet-7/+2
2024-11-21Implement the unsafe-fields RFC.Luca Versari-32/+103
Co-Authored-By: Jacob Pratt <jacob@jhpratt.dev>
2024-11-21Rollup merge of #133218 - compiler-errors:const-opaque, r=fee1-deadMatthias Krüger-5/+22
Implement `~const` item bounds in RPIT an RPIT in a `const fn` is allowed to be conditionally const itself :) r? fee1-dead or reroll
2024-11-21Rollup merge of #132207 - compiler-errors:tweak-res-mod-segment, r=petrochenkovMatthias Krüger-2/+2
Store resolution for self and crate root module segments Let's make sure to record the segment resolution for `self::`, `crate::` and `$crate::`. I'm actually somewhat surprised that the only diagnostic that uses this is the one that errors on invalid generics on a module segment... but seems strictly more correct regardless, and there may be other diagnostics using these segments resolutions that just haven't been tested for `self`. Also includes a drive-by on `report_prohibit_generics_error`.
2024-11-20Auto merge of #133261 - matthiaskrgr:rollup-ekui4we, r=matthiaskrgrbors-14/+71
Rollup of 6 pull requests Successful merges: - #129838 (uefi: process: Add args support) - #130800 (Mark `get_mut` and `set_position` in `std::io::Cursor` as const.) - #132708 (Point at `const` definition when used instead of a binding in a `let` statement) - #133226 (Make `PointerLike` opt-in instead of built-in) - #133244 (Account for `wasm32v1-none` when exporting TLS symbols) - #133257 (Add `UnordMap::clear` method) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-20we should not be reporting generic error if there is not a segment to denyMichael Goulet-2/+2
2024-11-20Make PointerLike opt-in as a traitMichael Goulet-14/+71
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-2/+18
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-11-20Auto merge of #133212 - lcnr:questionable-uwu, r=compiler-errorsbors-17/+22
continue `ParamEnv` to `TypingEnv` transition cc #132279 r? `@compiler-errors`
2024-11-19additional `TypingEnv` cleanupslcnr-3/+3
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-2/+2
2024-11-19Implement ~const opaquesMichael Goulet-1/+18
2024-11-19Rename implied_const_bounds to explicit_implied_const_boundsMichael Goulet-4/+4
2024-11-19move `fn is_item_raw` to `TypingEnv`lcnr-12/+17
2024-11-19Fix broken intra-doc linkBoxy-1/+1
2024-11-19Introduce `min_generic_const_args` and directly represent pathsNoah Lev-37/+200
Co-authored-by: Boxy UwU <rust@boxyuwu.dev> Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2024-11-18reviewlcnr-1/+1
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-17/+24
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-17Rollup merge of #132795 - compiler-errors:refine-rpitit, r=lcnrJacob Pratt-1/+116
Check `use<..>` in RPITIT for refinement `#![feature(precise_capturing_in_traits)]` allows users to write `+ use<>` bounds on RPITITs to control what lifetimes are captured by the RPITIT. Since RPITITs currently also warn for refinement in implementations, this PR extends that refinement check for cases where we *undercapture* in an implementation, since that may be indirectly "promising" a more relaxed outlives bound than the impl author intended. For an opaque to be refining, we need to capture *fewer* parameters than those mentioned in the captured params of the trait. For example: ``` trait TypeParam<T> { fn test() -> impl Sized; } // Indirectly capturing a lifetime param through a type param substitution. impl<'a> TypeParam<&'a ()> for i32 { fn test() -> impl Sized + use<> {} //~^ WARN impl trait in impl method captures fewer lifetimes than in trait } ``` Since the opaque in the method (implicitly) captures `use<Self, T>`, and `Self = i32, T = &'a ()` in the impl, we must mention `'a` in our `use<..>` on the impl. Tracking: * https://github.com/rust-lang/rust/issues/130044
2024-11-18Check use<..> in RPITIT for refinementMichael Goulet-1/+116
2024-11-17Auto merge of #120370 - x17jiri:likely_unlikely_fix, r=saethlinbors-4/+2
Likely unlikely fix RFC 1131 ( https://github.com/rust-lang/rust/issues/26179 ) added likely/unlikely intrinsics, but they have been broken for a while: https://github.com/rust-lang/rust/issues/96276 , https://github.com/rust-lang/rust/issues/96275 , https://github.com/rust-lang/rust/issues/88767 . This PR tries to fix them. Changes: - added a new `cold_path()` intrinsic - `likely()` and `unlikely()` changed to regular functions implemented using `cold_path()`
2024-11-17Likely unlikely fixJiri Bobek-4/+2
2024-11-16Rollup merge of #132832 - compiler-errors:late-ty, r=cjgillotMatthias Krüger-22/+29
Deny capturing late-bound ty/const params in nested opaques First, this reverts a7f609504c92c9912b61025ae26a5404d3ee4311. I can't exactly remember why I approved this specific bit of https://github.com/rust-lang/rust/pull/132466; specifically, I don't know that the purpose of that commit is, and afaict we will never have an opaque that captures late-bound params through a const because opaques can't be used inside of anon consts. Am I missing something `@cjgillot?` Since I can't see a case where this matters, and no tests seem to fail. The second commit adds a `deny_late_regions: bool` to distinguish `Scope::LateBoundary` which should deny *any* late-bound params or just ty/consts. Then, when resolving opaques we wrap ourselves in a `Scope::LateBoundary { deny_late_regions: false }` so that we deny late-bound ty/const, which fixes a bunch of ICEs that all vaguely look like `impl for<T> Trait<Assoc = impl OtherTrait<T>>`. I guess this could be achieved other ways; for example, with a different scope kind, or maybe we could just reuse `Scope::Opaque`. But this seems a bit more verbose. I'm open to feedback anyways. Fixes #131535 Fixes #131637 Fixes #132530 I opted to remove those crashes tests ^ without adding them as regular tests, since they're basically triggering uninteresting late-bound ICEs far off in the trait solver, and the reason that existing tests such as `tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs` don't ICE are kinda just coincidental (i.e. due to a missing impl block). I don't really feel motivated to add random permutations to tests just to exercise non-lifetime binders. r? cjgillot
2024-11-11Simplify some places that deal with generic parameter defaultsLeón Orell Valerian Liehr-75/+23
2024-11-10Deny capturing late-bound ty/ct params in nested opaquesMichael Goulet-10/+27
2024-11-10Revert "Skip late-bound lifetimes when crossing an AnonConst."Michael Goulet-12/+2
This reverts commit a7f609504c92c9912b61025ae26a5404d3ee4311.
2024-11-08Rollup merge of #132757 - compiler-errors:yeet-check-wf, r=lcnrJubilee-19/+136
Get rid of `check_opaque_type_well_formed` Instead, replicate it by improving the span of the opaque in `check_opaque_meets_bounds`. This has two consequences: 1. We now prefer "concrete type differs" errors, since we'll hit those first before we check the opaque is WF. 2. Spans have gotten slightly worse. Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration. r? lcnr
2024-11-08remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic ↵Ralf Jung-5/+3
functions instead
2024-11-08Manually register some bounds for a better spanMichael Goulet-8/+37
2024-11-08Get rid of check_opaque_type_well_formedMichael Goulet-17/+105
2024-11-07Rollup merge of #132734 - RalfJung:platform-intrinsic, r=compiler-errorsMatthias Krüger-2/+1
remove 'platform-intrinsic' ABI leftovers This was removed a while ago, but some parts haven't been fully cleaned up.
2024-11-07 remove 'platform-intrinsic' ABI leftoversRalf Jung-2/+1
2024-11-07Remove unused intercrate dependenciesclubby789-1/+0
2024-11-05Remove unused errs.rs fileEric Huss-88/+0
This module was removed in #124895, but the actual file was not removed.
2024-11-05Auto merge of #132580 - compiler-errors:globs, r=Noratriebbors-31/+38
Remove unnecessary pub enum glob-imports from `rustc_middle::ty` We used to have an idiom in the compiler where we'd prefix or suffix all the variants of an enum, for example `BoundRegionKind`, with something like `Br`, and then *glob-import* that enum variant directly. `@noratrieb` brought this up, and I think that it's easier to read when we just use the normal style `EnumName::Variant`. This PR is a bit large, but it's just naming. The only somewhat opinionated change that this PR does is rename `BorrowKind::Imm` to `BorrowKind::Immutable` and same for the other variants. I think these enums are used sparingly enough that the extra length is fine. r? `@noratrieb` or reassign
2024-11-04Rollup merge of #132559 - bvanjoi:fix-132534, r=compiler-errorsMatthias Krüger-8/+2
find the generic container rather than simply looking up for the assoc with const arg Fixes #132534 This issue is caused by mismatched generic parameters. Previously, it tried to find `T` in `trait X`, but after this change, it will find `T` in `fn a`. r? `@compiler-errors` as this assertion was introduced by you.
2024-11-04Rollup merge of #132544 - dianne:unstable-library-feature-backticks, ↵Matthias Krüger-2/+2
r=compiler-errors Use backticks instead of single quotes for library feature names in diagnostics This PR changes the text of library feature errors for using unstable or body-unstable items. Displaying library feature names in backticks is consistent with other diagnostics (e.g. those from `rustc_passes`) and with the `reason`s on unstable attributes in the library. Additionally, this simplifies diagnostics when supporting multiple unstable attributes on items (see #131824) since `DiagSymbolList` also displays symbols using backticks.
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-22/+29