summary refs log tree commit diff
path: root/compiler/rustc_smir/src/rustc_internal
AgeCommit message (Collapse)AuthorLines
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
2023-11-20Add place.ty() and Ty build from a kind to smirCelina G. Val-2/+89
2023-11-17use new apis and add new functionouz-a-1/+1
2023-11-17move pretty into stable_mirOğuz Ağcayazı-299/+11
2023-11-17change smir to StableMirOğuz Ağcayazı-15/+27
2023-11-17remove unwrapOğuz Ağcayazı-10/+15
2023-11-17better formatting for statementsOğuz Ağcayazı-23/+46
2023-11-17cover statementsOğuz Ağcayazı-26/+155
2023-11-17emit basic smirOğuz Ağcayazı-0/+140
2023-11-16Add more SMIR internal impl and callback return valueCelina G. Val-13/+147
In cases like Kani, we will invoke the rustc_internal run command directly for now. It would be handly to be able to have a callback that can return a value. We also need extra methods to convert stable constructs into internal ones, so we can break down the transition into finer grain commits.
2023-11-10add CoroutineWitness to covered typesOğuz Ağcayazı-0/+4
2023-11-09Fix typo in internal.rsIkko Eltociear Ashimine-1/+1
covert -> convert
2023-10-24Use IndexMap for handling stable TyCelina G. Val-2/+2
2023-10-24Remove fold code and add Const::internal()Celina G. Val-8/+15
We are not planning to support user generated constant in the foreseeable future, so we are removing the Fold logic for now in favor of the Instance::resolve logic. The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that. I decided to keep the Const fields private in case we decide to translate them lazily.
2023-10-23Add test and remove double refCelina G. Val-3/+3
2023-10-23Remove unsafe and `Rc`Celina G. Val-13/+9
2023-10-23Add `internal()` method counterpart to `stable()`Celina G. Val-1/+5
Note: We do not expect to provide internalizing methods for all StableMIR constructs. They exist only to help migrating efforts to allow users to mix StableMIR and internal constructs.
2023-10-23Add method to convert internal to stable constructsCelina G. Val-12/+46
2023-10-23Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`Oli Scherer-58/+72
2023-10-21Rollup merge of #116964 - celinval:smir-mono-body, r=oli-obkMatthias Krüger-0/+71
Add stable Instance::body() and RustcInternal trait The `Instance::body()` returns a monomorphized body. For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal. Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed. The tests here are very simple, and I'm planning on creating more exhaustive tests in the project-mir repo. But I was hoping to get some feedback here first. r? ```@oli-obk```
2023-10-20s/generator/coroutine/Oli Scherer-1/+1
2023-10-20s/Generator/Coroutine/Oli Scherer-2/+2
2023-10-19Add stable Instance::body() and RustcInternal traitCelina G. Val-0/+71
The `Instance::body()` returns a monomorphized body. For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal. Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed.
2023-10-16Add MonoItems and Instance to stable_mirCelina G. Val-4/+24
Also add a few methods to instantiate instances and get an instance definition. We're still missing support to actually monomorphize the instance body.
2023-10-10add new wrapper for FxIndexMapOğuz Ağcayazı-28/+38
2023-10-09spans are now indexmappedOğuz Ağcayazı-10/+8
2023-10-09alloc id is indexmappedOğuz Ağcayazı-7/+8
2023-10-09defids are indexmappedOğuz Ağcayazı-10/+15
2023-10-06Remove unnecessary `pub`.Nicholas Nethercote-1/+1
2023-09-28add RegionDefouz-a-0/+4
2023-09-25Split out the stable part of smir into its own crate to prevent accidental ↵Oli Scherer-3/+3
usage of forever unstable things