summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/base.rs
AgeCommit message (Collapse)AuthorLines
2024-03-08Distinguish between library and lang UB in assert_unsafe_preconditionBen Kimock-1/+1
2024-02-24Change InlineAsm to allow multiple targets insteadGary Guo-2/+14
2024-02-08Add a new debug_assertions instrinsic (compiler)Ben Kimock-0/+9
And in clippy
2024-01-22Do not normalize closure signature when building FnOnce shimMichael Goulet-1/+0
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-4/+4
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-23Rename `EarlyDiagCtxt` methods to match `DiagCtxt`.Nicholas Nethercote-1/+1
- `early_error_no_abort` -> `early_err` - `early_error` -> `early_fatal` - `early_struct_error` -> `early_struct_fatal`
2023-12-19Merge commit '3a9bf729322fb5035518f99b9d76a742bf7c124e' into ↵bjorn3-8/+8
sync_cg_clif-2023-12-19
2023-12-18Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.Nicholas Nethercote-2/+2
2023-12-18Rename `EarlyErrorHandler` as `EarlyDiagCtxt`.Nicholas Nethercote-1/+1
2023-11-16Merge commit 'def04540a4e2541b995195c752c751295606a388' into ↵bjorn3-1/+1
sync_cg_clif-2023-11-16
2023-10-31Support enum variants in offset_of!George Bateman-1/+1
2023-10-20s/Generator/Coroutine/Oli Scherer-1/+1
2023-10-09Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into ↵bjorn3-4/+3
sync_cg_clif-2023-10-09
2023-10-06Rollup merge of #116277 - RalfJung:post-mono, r=oli-obkJubilee-11/+0
dont call mir.post_mono_checks in codegen It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-02change is_subtype to relate_typesouz-a-1/+1
2023-10-02Add docs, remove code, change subtyper codeouz-a-3/+1
2023-10-02subtyping_projectionsouz-a-0/+3
2023-09-30dont call mir.post_mono_checks in codegenRalf Jung-11/+0
2023-09-28Strip `OpaqueCast` during `RevealAll`.Oli Scherer-1/+1
2023-09-14don't point at const usage site for resolution-time errorsRalf Jung-16/+9
also share the code that emits the actual error
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-6/+16
2023-09-13make the eval() functions on our const types return the resulting valueRalf Jung-5/+2
2023-08-24when terminating during unwinding, show the reason whyRalf Jung-4/+5
2023-08-20give some unwind-related terminators a more clear nameRalf Jung-2/+2
2023-07-22Merge commit '1eded3619d0e55d57521a259bf27a03906fdfad0' into ↵bjorn3-2/+18
sync_cg_clif-2023-07-22
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-5/+5
2023-07-07Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`Nilstrieb-7/+11
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-2/+2
2023-07-05Deal with falloutBoxy-1/+0
2023-06-18Better error for non const `PartialEq` call generated by `match`Deadbeef-1/+1
2023-06-15Merge commit '8830dccd1d4c74f1f69b0d3bd982a3f1fcde5807' into ↵bjorn3-0/+1
sync_cg_clif-2023-06-15
2023-05-25Remove DesugaringKind::Replace.Camille GILLOT-1/+1
2023-05-24Use `is_some_and`/`is_ok_and` in less obvious spotsMaybe Waffle-4/+4
2023-05-16Remove `LangItems::require`Nilstrieb-5/+1
It's just a short wrapper used by `tcx.require_lang_item`. Deleting it gives us a negative diff.
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-2/+2
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-05-01Box AssertKindBen Kimock-1/+1
2023-04-29Merge commit 'ef07e8e60f994ec014d049a95591426fb92ebb79' into ↵bjorn3-42/+12
sync_cg_clif-2023-04-29
2023-04-27rename `needs_infer` to `has_infer`Boxy-1/+1
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-21offset_ofDrMeepster-1/+4
2023-04-06Rename `Abort` terminator to `Terminate`Gary Guo-1/+1
Unify terminology used in unwind action and terminator, and reflect the fact that a nounwind panic is triggered instead of an immediate abort is triggered for this terminator.
2023-04-06Refactor unwind from Option to a new enumGary Guo-3/+3
2023-04-01Use `FieldIdx` in various things related to aggregatesScott McMurray-3/+4
Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.
2023-03-31Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obkbors-0/+12
Insert alignment checks for pointer dereferences when debug assertions are enabled Closes https://github.com/rust-lang/rust/issues/54915 - [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit) - [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue! - [x] Implement a more helpful panic message like slice bounds checking. r? `@oli-obk`
2023-03-28Move `mir::Field` → `abi::FieldIdx`Scott McMurray-1/+1
The first PR for https://github.com/rust-lang/compiler-team/issues/606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-1/+1
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
2023-03-23A MIR transform that checks pointers are alignedBen Kimock-0/+12
2023-03-22Add `CastKind::Transmute` to MIRScott McMurray-0/+4
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
2023-03-16Tweak implementation of overflow checking assertionsTomasz Miąsko-11/+4
Extract and reuse logic controlling behaviour of overflow checking assertions instead of duplicating it three times.
2023-03-15Merge commit 'dec0daa8f6d0a0e1c702f169abb6bf3eee198c67' into ↵bjorn3-11/+7
sync_cg_clif-2023-03-15