summary refs log tree commit diff
path: root/compiler/rustc_smir/src/rustc_internal
AgeCommit message (Collapse)AuthorLines
2024-12-17Auto merge of #134302 - bjorn3:remove_driver_queries, r=oli-obk,jieyouxubors-1/+1
Remove queries from the driver interface All uses of driver queries in the public api of rustc_driver have been removed in https://github.com/rust-lang/rust/pull/134130 already. This removes driver queries from rustc_interface and does a couple of cleanups around TyCtxt construction and entering enabled by this removal. Finishes the removal of driver queries started with https://github.com/rust-lang/rust/pull/126834.
2024-12-14Fix testsbjorn3-1/+1
2024-12-14Encode coroutine-closures in SMIRMichael Goulet-0/+8
2024-12-06Fix ui-fulldep testsbjorn3-2/+3
2024-11-09Pass TyCtxt instead of Queries to the after_analysis callbacksbjorn3-14/+13
There is no other query that may need to be called at that point anyway.
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-3/+3
2024-11-03compiler: Directly use rustc_abi in smir againJubilee Young-29/+29
2024-10-28stable_mir: Directly use types from rustc_abiJubilee Young-1/+1
2024-09-30Validate ExistentialPredicate argsMichael Goulet-9/+11
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-09-21add `C-cmse-nonsecure-entry` ABIFolkert de Vries-0/+1
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-1/+4
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8/+11
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-17Avoid comments that describe multiple `use` items.Nicholas Nethercote-0/+1
There are some comments describing multiple subsequent `use` items. When the big `use` reformatting happens some of these `use` items will be reordered, possibly moving them away from the comment. With this additional level of formatting it's not really feasible to have comments of this type. This commit removes them in various ways: - merging separate `use` items when appropriate; - inserting blank lines between the comment and the first `use` item; - outright deletion (for comments that are relatively low-value); - adding a separate "top-level" comment. We also entirely skip formatting for four library files that contain nothing but `pub use` re-exports, where reordering would be painful.
2024-07-11Remove extern "wasm" ABINikita Popov-1/+0
Remove the unstable `extern "wasm"` ABI (`wasm_abi` feature tracked in #83788). As discussed in https://github.com/rust-lang/rust/pull/127513#issuecomment-2220410679 and following, this ABI is a failed experiment that did not end up being used for anything. Keeping support for this ABI in LLVM 19 would require us to switch wasm targets to the `experimental-mv` ABI, which we do not want to do. It should be noted that `Abi::Wasm` was internally used for two things: The `-Z wasm-c-abi=legacy` ABI that is still used by default on some wasm targets, and the `extern "wasm"` ABI. Despite both being `Abi::Wasm` internally, they were not the same. An explicit `extern "wasm"` additionally enabled the `+multivalue` feature. I've opted to remove `Abi::Wasm` in this patch entirely, instead of keeping it as an ABI with only internal usage. Both `-Z wasm-c-abi` variants are now treated as part of the normal C ABI, just with different different treatment in adjust_for_foreign_abi.
2024-06-26Remove `f16` and `f128` ICE paths from smirTrevor Gross-0/+2
2024-06-24Split out IntoIterator and non-Iterator constructors for ↵Michael Goulet-1/+1
AliasTy/AliasTerm/TraitRef/projection
2024-06-05Add `Ty` to `mir::Const::Ty`Boxy-1/+3
2024-06-04Split smir `Const` into `TyConst` and `MirConst`Boxy-26/+21
2024-05-28Add an intrinsic for `ptr::metadata`Scott McMurray-1/+13
2024-05-17Rename Unsafe to SafetySantiago Pastorino-5/+4
2024-04-09Rollup merge of #123655 - celinval:smir-fix-binop-ty, r=compiler-errorsMatthias Krüger-1/+33
Remove unimplemented!() from BinOp::ty() function To reduce redundancy, we now internalize the BinOp instead of duplicating the `ty()` function body.
2024-04-08Remove unimplemented!() from BinOp::ty() functionCelina G. Val-1/+33
To reduce redundancy, we now internalize the BinOp instead of duplicating the `ty()` function body.
2024-04-08Actually create ranged int types in the type system.Oli Scherer-2/+18
2024-03-22Make RawPtr take Ty and Mutbl separatelyMichael Goulet-4/+3
2024-03-20Improve emit stable mir bodyCelina G. Val-2/+46
2024-02-25remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsicsRalf Jung-1/+0
2024-02-17Merge `CompilerError::CompilationFailed` and `CompilerError::ICE`.Nicholas Nethercote-2/+8
`CompilerError` has `CompilationFailed` and `ICE` variants, which seems reasonable at first. But the way it identifies them is flawed: - If compilation errors out, i.e. `RunCompiler::run` returns an `Err`, it uses `CompilationFailed`, which is reasonable. - If compilation panics with `FatalError`, it catches the panic and uses `ICE`. This is sometimes right, because ICEs do cause `FatalError` panics, but sometimes wrong, because certain compiler errors also cause `FatalError` panics. (The compiler/rustdoc/clippy/whatever just catches the `FatalError` with `catch_with_exit_code` in `main`.) In other words, certain non-ICE compilation failures get miscategorized as ICEs. It's not possible to reliably distinguish the two cases, so this commit merges them. It also renames the combined variant as just `Failed`, to better match the existing `Interrupted` and `Skipped` variants. Here is an example of a non-ICE failure that causes a `FatalError` panic, from `tests/ui/recursion_limit/issue-105700.rs`: ``` #![recursion_limit="4"] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] //~^ERROR recursion limit reached while expanding fn main() {{}} ```
2024-02-12Add APIs for fetching foreign items including foreign modules, their ABIs, ↵Mohammad Omidvar-0/+4
and their items
2024-01-30Remove the `abi_amdgpu_kernel` featureclubby789-1/+0
2024-01-19Use the new `with_tables` everywhereOli Scherer-145/+127
2024-01-19Ensure internal function is safeCelina G. Val-154/+218
The internal function was unsound, it could cause UB in rare cases where the user inadvertly stored the returned object in a location that could outlive the TyCtxt. In order to make it safe, we now take a type context as an argument to the internal fn, and we ensure that interned items are lifted using the provided context. Thus, this change ensures that the compiler can properly enforce that the object does not outlive the type context it was lifted to.
2024-01-19Fix a soundness bug in `with_tables`.Oli Scherer-2/+2
We were able to uplift any value from `Tables` to `'static`, which is unsound.
2024-01-17Revert changes to internal method for nowCelina G. Val-26/+2
- Move fix to a separate PR
2024-01-16Remove tcx function and make `internal` fn saferCelina G. Val-26/+52
I added `tcx` argument to `internal` to force 'tcx to be the same lifetime as TyCtxt. The only other solution I could think is to change this function to be `unsafe`.
2024-01-16Remove tcx from SMIR run macro and accept closuresCelina G. Val-17/+105
Simplify the `run` macro to avoid sometimes unnecessary dependency on `TyCtxt`. Instead, users can use the new internal method `tcx()`. Additionally, extend the macro to accept closures that may capture variables. These are non-backward compatible changes, but they only affect internal APIs which are provided today as helper functions until we have a stable API to start the compiler.
2024-01-09Fix all_trait* methods to return all trait availableCelina G. Val-1/+8
Also provide a mechanism to retrieve traits and implementations for a given crate.
2023-12-28Restore movability to SMIRMichael Goulet-1/+1
2023-12-28Remove movability from TyKind::CoroutineMichael Goulet-5/+3
2023-12-18Add function ABI and type layout to StableMIRCelina G. Val-0/+15
This change introduces a new module to StableMIR named `abi` with information from `rustc_target::abi` and `rustc_abi`, that allow users to retrieve more low level information required to perform bit-precise analysis. The layout of a type can be retrieved via `Ty::layout`, and the instance ABI can be retrieved via `Instance::fn_abi()`. To properly handle errors while retrieve layout information, we had to implement a few layout related traits.
2023-12-04Finish implementing `RustcInternal` for `TyKind`Celina G. Val-12/+185
This will allow us to provide methods to create `Ty` inside the stable MIR, which can be helpful while handling pointers and other stuff.
2023-12-04Add Variant and a few more APIs to stable_mirCelina G. Val-5/+17
2023-11-24Move the compiler interface defs to its own moduleCelina G. Val-1/+1
Separate items that are exposed in the `stable_mir` crate to be used by the compiler from items that we expect to be used by tool developers.
2023-11-24Break down `rustc_smir/mod.rs` fileCelina G. Val-1/+1
This file was getting too big and causing a lot of merge conflicts. All these changes shouldn't be visible to users since this module is private.
2023-11-22Provide conversion of stable span to internal spanCelina G. Val-2/+10
This will allow users to use rustc span messages to display user friendly messages.
2023-11-21Add support to get virtual table allocationCelina G. Val-3/+25
2023-11-21Add support to global allocation to stable-mirCelina G. Val-2/+3
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-20Improve code per PR commentsCelina G. Val-5/+1
- Simplified DefTy::internal - Break down place::ty() method