about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/constant.rs
AgeCommit message (Collapse)AuthorLines
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-1/+1
2023-06-15Merge commit '8830dccd1d4c74f1f69b0d3bd982a3f1fcde5807' into ↵bjorn3-15/+15
sync_cg_clif-2023-06-15
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-4/+4
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-04-29Merge commit 'ef07e8e60f994ec014d049a95591426fb92ebb79' into ↵bjorn3-0/+2
sync_cg_clif-2023-04-29
2023-04-20Remove WithOptconstParam.Camille GILLOT-1/+1
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-03-29Support TLS access into dylibs on WindowsJohn Kåre Alsaker-6/+16
2023-03-15Merge commit 'dec0daa8f6d0a0e1c702f169abb6bf3eee198c67' into ↵bjorn3-2/+2
sync_cg_clif-2023-03-15
2023-03-09Introduce a no-op PlaceMention statement for `let _ =`.Camille GILLOT-0/+1
2023-03-07Remove DropAndReplace terminatorGiacomo Pasini-2/+1
PR 107844 made DropAndReplace unused, let's remove it completely from the codebase.
2023-01-23Update codegen cranelift for ConstEvalCounterBryan Garza-0/+1
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2022-12-14Merge commit '2bb3996244cf1b89878da9e39841e9f6bf061602' into ↵bjorn3-32/+50
sync_cg_clif-2022-12-14
2022-11-23Add `Mutability::{is_mut,is_not}`Maybe Waffle-9/+4
2022-11-19deduplicate constant evaluation in cranelift backendRalf Jung-35/+23
also sync LLVM and cranelift structure a bit
2022-11-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-1/+1
2022-11-15Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obkbors-2/+2
interpret: support for per-byte provenance Also factors the provenance map into its own module. The third commit does the same for the init mask. I can move it in a separate PR if you prefer. Fixes https://github.com/rust-lang/miri/issues/2181 r? `@oli-obk`
2022-11-13add is_sized method on Abi and Layout, and use itRalf Jung-1/+1
2022-11-06fix cranelift and gccRalf Jung-2/+2
2022-10-27Update toolingMaybe Waffle-2/+1
2022-10-23Merge commit '266e96785ab71834b917bf474f130a6d8fdecd4b' into ↵bjorn3-48/+39
sync_cg_clif-2022-10-23
2022-10-06Remove `mir::CastKind::Misc`ouz-a-1/+10
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-1/+1
2022-09-22introduce mir::Unevaluatedb-naber-11/+2
2022-09-15nitsb-naber-11/+1
2022-09-14address review againb-naber-19/+1
2022-09-13cranelift changesb-naber-49/+59
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-6/+13
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-4/+5
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-0/+1
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-1/+1
interpret: make read-pointer-as-bytes a CTFE-only error with extra information Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456. Pointer-to-int transmutation during CTFE now produces a message like this: ``` = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported ``` r? ``@oli-obk``
2022-08-27interpret: rename relocation → provenanceRalf Jung-1/+1
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-1/+1
2022-07-25Merge commit 'c19edfd71a1d0ddef86c2c67fdb40718d40a72b4' into ↵bjorn3-9/+14
sync_cg_clif-2022-07-25
2022-07-20various nits from reviewRalf Jung-1/+0
2022-07-20slightly cleaner, if more verbose, vtable handling in codegen backendsRalf Jung-6/+14
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-4/+4
2022-07-20rename get_global_alloc to try_get_global_allocRalf Jung-1/+1
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-8/+18
2022-07-09tweak names and output and blessRalf Jung-1/+1
2022-07-09review feedbackRalf Jung-1/+1
2022-07-09fix cranelift and gcc backendsRalf Jung-0/+1
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-4/+5
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-3/+3
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-2/+2
2022-04-11Add new `Deinit` statement kindJakob Degen-0/+1
2022-03-16rustc_error: make ErrorReported impossible to constructmark-2/+1
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-07Introduce `ConstAllocation`.Nicholas Nethercote-7/+12
Currently some `Allocation`s are interned, some are not, and it's very hard to tell at a use point which is which. This commit introduces `ConstAllocation` for the known-interned ones, which makes the division much clearer. `ConstAllocation::inner()` is used to get the underlying `Allocation`. In some places it's natural to use an `Allocation`, in some it's natural to use a `ConstAllocation`, and in some places there's no clear choice. I've tried to make things look as nice as possible, while generally favouring `ConstAllocation`, which is the type that embodies more information. This does require quite a few calls to `inner()`. The commit also tweaks how `PartialOrd` works for `Interned`. The previous code was too clever by half, building on `T: Ord` to make the code shorter. That caused problems with deriving `PartialOrd` and `Ord` for `ConstAllocation`, so I changed it to build on `T: PartialOrd`, which is slightly more verbose but much more standard and avoided the problems.
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-2/+2