about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/consts
AgeCommit message (Collapse)AuthorLines
2025-08-14Apply suggestions from code reviewRalf Jung-1/+1
Co-authored-by: Boxy <rust@boxyuwu.dev>
2025-08-14avoid unnecessary type sanity checksRalf Jung-8/+4
2025-08-14use ty::Value instead of manual pairs of types and valtreesRalf Jung-4/+10
2025-08-14pattern testing: store constants as valtreesRalf Jung-0/+13
2025-07-07compiler: Parse `p-` specs in datalayout string, allow definition of custom ↵Edoardo Marangoni-3/+3
default data address space
2025-06-26const-eval: allow constants to refer to mutable/external memory, but reject ↵Ralf Jung-1/+7
such constants as patterns
2025-05-28get rid of rustc_codegen_ssa::common::AtomicOrderingRalf Jung-1/+1
2025-05-28atomic_load intrinsic: use const generic parameter for orderingRalf Jung-1/+33
2025-05-24ScalarInt: support conversion with signed int types and cmp::OrderingRalf Jung-2/+45
2025-04-01Improve docs of ValTreeKindbjorn3-1/+1
2025-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-2/+2
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-02-25Teach structured errors to display short `Ty`Esteban Küber-1/+1
Make it so that every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to. ``` error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)`` --> long.rs:7:5 | 6 | fn foo(x: D) { //~ `x` has type `(... | - `x` has type `((..., ..., ..., ...), ..., ..., ...)` 7 | x(); //~ ERROR expected function, found `(... | ^-- | | | call expression requires function | = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt' = note: consider using `--verbose` to print the full type name to the console ```
2025-02-13intern valtreesLukas Markeffsky-27/+71
2025-02-03Move `try_to_raw_bytes` from `ty::Valtree` to `ty::Value`FedericoBruzzone-24/+23
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-01-30check the types in `ty::Value` to value conversionLukas Markeffsky-1/+11
and remove `ty::Const::try_to_scalar` because it becomes redundant
2025-01-30introduce `ty::Value`Lukas Markeffsky-7/+44
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2024-11-12Consolidate type system const evaluation under `traits::evaluate_const`Boxy-35/+1
mew
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-1/+1
Stop reexporting ReprOptions from middle::ty
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-9/+6
2024-08-11Use assert_matches around the compilerMichael Goulet-4/+6
2024-08-01interpret: simplify pointer arithmetic logicRalf Jung-2/+2
2024-07-29Reformat `use` declarations.Nicholas Nethercote-5/+9
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-06Uplift push_outlives_componentsMichael Goulet-0/+7
2024-06-11interpret: ensure we check bool/char for validity when they are used in a castRalf Jung-10/+5
2024-06-10ScalarInt: size mismatches are a bug, do not delay the panicRalf Jung-125/+106
2024-06-05ty::Expr reviewsBoxy-3/+5
2024-06-04Downsize `ty::Expr`Boxy-7/+118
2024-05-13Uplift AliasTyMichael Goulet-26/+4
2024-04-29Remove `extern crate rustc_data_structures` from numerous crates.Nicholas Nethercote-1/+1
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-1/+1
2024-04-19Auto merge of #124113 - RalfJung:interpret-scalar-ops, r=oli-obkbors-37/+63
interpret: use ScalarInt for bin-ops; avoid PartialOrd for ScalarInt Best reviewed commit-by-commit r? `@oli-obk`
2024-04-19avoid PartialOrd on ScalarIntRalf Jung-2/+2
we don't know their sign so we cannot, in general, order them properly
2024-04-19ScalarInt: add methods to assert being a (u)int of given sizeRalf Jung-28/+39
2024-04-18interpret/binary_int_op: avoid dropping to raw ints until we determined the signRalf Jung-8/+23
2024-04-18Simplify `static_assert_size`s.Nicholas Nethercote-4/+1
We want to run them on all 64-bit platforms.
2024-04-03Check `x86_64` size assertions on `aarch64`, tooZalathar-2/+2
This makes it easier for contributors on aarch64 workstations (e.g. Macs) to notice when these assertions have been violated.
2024-03-27Remove `Ord` from `Ty`, `Const`, and `Region`Oli Scherer-2/+2
2024-03-14Add compiler support for parsing `f16` and `f128`Trevor Gross-1/+43
2024-03-11Rename `IntoDiagnosticArg` as `IntoDiagArg`.Nicholas Nethercote-6/+6
Also rename `into_diagnostic_arg` as `into_diag_arg`, and `NotIntoDiagnosticArg` as `NotInotDiagArg`.
2024-02-28Rename `DiagnosticArg{,Map,Name,Value}` as `DiagArg{,Map,Name,Value}`.Nicholas Nethercote-4/+4
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-13/+10
2024-02-15Use generic `NonZero` internally.Markus Reiter-12/+15
2024-02-05Rollup merge of #116284 - RalfJung:no-nan-match, r=cjgillotMatthias Krüger-27/+44
make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error. This is part of implementing https://github.com/rust-lang/rfcs/pull/3535. Closes https://github.com/rust-lang/rust/issues/41620 by removing the lint. https://github.com/rust-lang/reference/pull/1456 updates the reference to match.
2024-01-30Remove the lifetime from `DiagnosticArgValue`.Nicholas Nethercote-2/+2
Because it's almost always static. This makes `impl IntoDiagnosticArg for DiagnosticArgValue` trivial, which is nice. There are a few diagnostics constructed in `compiler/rustc_mir_build/src/check_unsafety.rs` and `compiler/rustc_mir_transform/src/errors.rs` that now need symbols converted to `String` with `to_string` instead of `&str` with `as_str`, but that' no big deal, and worth it for the simplifications elsewhere.
2024-01-26make matching on NaN a hard errorRalf Jung-27/+44
2023-12-15Annotate some more bugsMichael Goulet-2/+2
2023-12-07ctfe interpreter: extend provenance so that it can track whether a pointer ↵Ralf Jung-2/+2
is immutable
2023-11-20Uplift InferConst to rustc_type_irMichael Goulet-26/+0
2023-10-24Get rid of 'tcx on ConstVid, EffectVidMichael Goulet-4/+4
2023-09-18Remove unused `Lift` derives.Nicholas Nethercote-1/+1
I found these by commenting out all `Lift` derives and then adding back the ones that were necessary to successfully compile.