about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2024-10-14Move trait bound modifiers into hir::PolyTraitRefMichael Goulet-1/+2
2024-10-14Remove `Engine::new_gen_kill`.Nicholas Nethercote-7/+0
This is an alternative to `Engine::new_generic` for gen/kill analyses. It's supposed to be an optimization, but it has negligible effect. The commit merges `Engine::new_generic` into `Engine::new`. This allows the removal of various other things: `GenKillSet`, `gen_kill_statement_effects_in_block`, `is_cfg_cyclic`.
2024-10-14Rollup merge of #131473 - workingjubilee:move-that-abi-up, r=saethlinMatthias Krüger-1/+1
compiler: `{TyAnd,}Layout` comes home The `Layout` and `TyAndLayout` types are heavily abstract and have no particular target-specific qualities, though we do use them to answer questions particular to targets. We can keep it that way if we simply move them out of `rustc_target` and into `rustc_abi`. They bring a small entourage of connected types with them, but that's fine. This will allow us to strengthen a few abstraction barriers over time and thus make the notoriously gnarly layout code easier to refactor. For now, we don't need to worry about that and deliberately use reexports to minimize this particular diff.
2024-10-12Rollup merge of #131626 - matthiaskrgr:dont_string, r=lqdTrevor Gross-1/+1
remove a couple of redundant String to String conversion
2024-10-12Stabilize `const_option`Trevor Gross-1/+0
This makes the following API stable in const contexts: impl<T> Option<T> { pub const fn as_mut(&mut self) -> Option<&mut T>; pub const fn expect(self, msg: &str) -> T; pub const fn unwrap(self) -> T; pub const unsafe fn unwrap_unchecked(self) -> T; pub const fn take(&mut self) -> Option<T>; pub const fn replace(&mut self, value: T) -> Option<T>; } impl<T> Option<&T> { pub const fn copied(self) -> Option<T> where T: Copy; } impl<T> Option<&mut T> { pub const fn copied(self) -> Option<T> where T: Copy; } impl<T, E> Option<Result<T, E>> { pub const fn transpose(self) -> Result<Option<T>, E> } impl<T> Option<Option<T>> { pub const fn flatten(self) -> Option<T>; } The following functions make use of the unstable `const_precise_live_drops` feature: - `expect` - `unwrap` - `unwrap_unchecked` - `transpose` - `flatten` Fixes: <https://github.com/rust-lang/rust/issues/67441>
2024-10-12remove a couple of redundant String to String conversionMatthias Krüger-1/+1
2024-10-12Swap PredicateObligation to ThinVecGnomedDev-4/+5
2024-10-12mark InterpResult as must_useRalf Jung-0/+1
2024-10-11compiler: Wire `{TyAnd,}Layout` into `rustc_abi`Jubilee Young-1/+1
This finally unites TyAndLayout, Layout, and LayoutS into the same crate, as one might imagine they would be placed. No functional changes.
2024-10-11Auto merge of #131045 - compiler-errors:remove-unnamed_fields, r=wesleywiserbors-56/+4
Retire the `unnamed_fields` feature for now `#![feature(unnamed_fields)]` was implemented in part in #115131 and #115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature. However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly. Fixes #117942 Fixes #121161 Fixes #121263 Fixes #121299 Fixes #121722 Fixes #121799 Fixes #126969 Fixes #131041 Tracking: * https://github.com/rust-lang/rust/issues/49804 [^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields [^2]: https://github.com/rust-lang/rust/issues/49804#issuecomment-1972619108
2024-10-10Add variances to RPITITsMichael Goulet-0/+4
2024-10-10Introduce SolverRelatingMichael Goulet-0/+6
2024-10-08compiler: Factor rustc_target::abi::* out of middle::ty::layoutJubilee Young-7/+17
2024-10-08coverage. Adapt to mcdc mapping formats introduced by llvm 19zhuyunxing-31/+30
2024-10-08coverage. MCDC ConditionId start from 0 to keep with llvm 19zhuyunxing-13/+3
2024-10-08Error on resetted binding mode in edition 2024Nadrieril-7/+8
2024-10-07Auto merge of #131235 - ↵bors-3/+2
codemountains:rename-nestedmetaitem-to-metaitemlnner, r=nnethercote Rename `NestedMetaItem` to `MetaItemInner` Fixes #131087 r? `@nnethercote`
2024-10-07Auto merge of #131226 - nnethercote:rustc_infer-cleanups, r=lcnrbors-9/+1
`rustc_infer` cleanups Various small improvements I found while reading over this code. r? `@lcnr`
2024-10-07Simplify two matches.Nicholas Nethercote-9/+1
Matches involving `GenericArgKind` pairs typically use a single `_` for the impossible case. This commit shortens two verbose matches in this way.
2024-10-06various fixes for `naked_asm!` implementationFolkert de Vries-6/+37
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
2024-10-06Rename NestedMetaItem to MetaItemInnercodemountains-3/+2
2024-10-05clarify semantics of ConstantIndex MIR projectionRalf Jung-2/+4
2024-10-05Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errorsbors-39/+74
Make opaque types regular HIR nodes Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead. I haven't gone through all the test changes yet, so there may be a few surprises. Many thanks to `@camelid` for the first draft. Fixes https://github.com/rust-lang/rust/issues/129023 Fixes #129099 Fixes #125843 Fixes #119716 Fixes #121422
2024-10-04Rollup merge of #130633 - eholk:pin-reborrow-self, r=compiler-errorsJubilee-0/+10
Add support for reborrowing pinned method receivers This builds on #130526 to add pinned reborrowing for method receivers. This enables the folllowing examples to work: ```rust #![feature(pin_ergonomics)] #![allow(incomplete_features)] use std::pin::Pin; pub struct Foo; impl Foo { fn foo(self: Pin<&mut Self>) { } fn baz(self: Pin<&Self>) { } } pub fn bar(x: Pin<&mut Foo>) { x.foo(); x.foo(); x.baz(); // Pin<&mut Foo> is downgraded to Pin<&Foo> } pub fn baaz(x: Pin<&Foo>) { x.baz(); x.baz(); } ``` This PR includes the original one, which is currently in the commit queue, but the only code changes are in the latest commit (d3c53aaa5c6fcb1018c58d229bc5d92202fa6880). #130494 r? `@compiler-errors`
2024-10-04Simplify bound var resolution.Camille GILLOT-15/+12
2024-10-04WfCheck opaques.Camille GILLOT-1/+1
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-14/+52
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-04Make naming more consistent.Camille GILLOT-10/+10
2024-10-04Make query backtrace more useful.Camille GILLOT-8/+8
2024-10-04Elaborate supertrait span correctly to label the error betterMichael Goulet-0/+4
2024-10-04Rollup merge of #131202 - Urgau:wide-ptrs-compiler, r=jieyouxuGuillaume Gomez-12/+12
Use wide pointers consistenly across the compiler This PR replace every use of "fat pointer" for the more recent "wide pointer" terminology. Since some time T-lang as preferred the "wide pointer" terminology, as can be seen on [the last RFCs](https://github.com/search?q=repo%3Arust-lang%2Frfcs+%22wide+pointer%22&type=code), on some [lints](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#ambiguous-wide-pointer-comparisons), but also in [the reference](https://doc.rust-lang.org/stable/reference/expressions/operator-expr.html?highlight=wide%20pointer#pointer-to-pointer-cast). Currently we have a [mix of both](https://github.com/search?q=repo%3Arust-lang%2Frust+%22wide+pointer%22&type=code) (including in error messages), which isn't great, but with this PR no more. r? `@jieyouxu` (feel free to re-roll)
2024-10-04Use wide pointers consistenly across the compilerUrgau-12/+12
2024-10-03Auto merge of #131215 - matthiaskrgr:rollup-i021ef7, r=matthiaskrgrbors-8/+2
Rollup of 7 pull requests Successful merges: - #131024 (Don't give method suggestions when method probe fails due to bad implementation of `Deref`) - #131112 (TransmuteFrom: Gracefully handle unnormalized types and normalization errors) - #131176 (.gitignore files for nix) - #131183 (Refactoring to `OpaqueTyOrigin`) - #131187 (Avoid ICE in coverage builds with bad `#[coverage(..)]` attributes) - #131192 (Handle `rustc_query_impl` cases of `rustc::potential_query_instability` lint) - #131197 (Avoid emptiness check in `PeekMut::pop`) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-03Rollup merge of #131183 - compiler-errors:opaque-ty-origin, r=estebankMatthias Krüger-8/+2
Refactoring to `OpaqueTyOrigin` Pulled out of a larger PR that uses these changes to do cross-crate encoding of opaque origin, so we can use them for edition 2024 migrations. These changes should be self-explanatory on their own, tho 😄
2024-10-03Handle `rustc_metadata` cases of `rustc::potential_query_instability` lintismailarilik-2/+2
2024-10-02Move in_trait into OpaqueTyOriginMichael Goulet-7/+1
2024-10-02Remove redundant in_trait from hir::TyKind::OpaqueDefMichael Goulet-1/+1
2024-10-02Auto merge of #130821 - lcnr:nalgebra-hang-2, r=compiler-errorsbors-3/+25
add caching to most type folders, rm region uniquification Fixes the new minimization of the hang in nalgebra and nalgebra itself :3 this is a bit iffy, especially the cache in `TypeRelating`. I believe all the caches are correct, but it definitely adds some non-local complexity in places. The first commit removes region uniquification, reintroducing the ICE from https://github.com/rust-lang/trait-system-refactor-initiative/issues/27. This does not affect coherence and I would like to fix this by introducing OR-region constraints r? `@compiler-errors`
2024-10-02Rollup merge of #131152 - fee1-dead-contrib:fxdiag, r=compiler-errorsMatthias Krüger-13/+35
Improve const traits diagnostics for new desugaring r? project-const-traits
2024-10-02Rollup merge of #131150 - bvanjoi:issue-128327, r=chenyukangMatthias Krüger-1/+1
only query `params_in_repr` if def kind is adt Fixes #128327 `params_in_repr` was only stored in `encode_info_for_adt`, so we only query it when the def kind belongs to them. https://github.com/rust-lang/rust/blob/9e3e5174462afaf6c3b9db9b35c6d1934521848a/compiler/rustc_metadata/src/rmeta/encoder.rs#L1566-L1567
2024-10-02Rollup merge of #131140 - ↵Matthias Krüger-6/+6
ismailarilik:handle-potential-query-instability-lint-for-rustc-hir-analysis, r=compiler-errors Handle `rustc_hir_analysis` cases of `potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_hir_analysis/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_analysis/src/lib.rs#L61) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447
2024-10-02reviewlcnr-8/+9
2024-10-02Improve const traits diagnostics for new desugaringDeadbeef-13/+35
2024-10-02only query `params_in_repr` if def kind is adtbohan-1/+1
2024-10-01Rollup merge of #130885 - RalfJung:interp-error-discard, r=oli-obkJubilee-34/+223
panic when an interpreter error gets unintentionally discarded One important invariant of Miri is that when an interpreter error is raised (*in particular* a UB error), those must not be discarded: it's not okay to just check `foo().is_err()` and then continue executing. This seems to catch new contributors by surprise fairly regularly, so this PR tries to make it so that *if* this ever happens, we get a panic rather than a silent missed UB bug. The interpreter error type now contains a "guard" that panics on drop, and that is explicitly passed to `mem::forget` when an error is deliberately discarded. Fixes https://github.com/rust-lang/miri/issues/3855
2024-10-02Handle `rustc-hir-analysis` cases of `rustc::potential_query_instability` lintismailarilik-6/+6
2024-10-01make InterpResult a dedicated type to avoid accidentally discarding the errorRalf Jung-89/+223
2024-10-01Remove unnamed field featureMichael Goulet-56/+4
2024-10-01add caches to multiple type folderslcnr-2/+23
2024-10-01Replace -Z default-hidden-visibility with -Z default-visibilityDavid Lattimore-0/+11
MCP: https://github.com/rust-lang/compiler-team/issues/782 Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>