about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/consts.rs
AgeCommit message (Collapse)AuthorLines
2025-06-30Introduce `ByteSymbol`.Nicholas Nethercote-1/+1
It's like `Symbol` but for byte strings. The interner is now used for both `Symbol` and `ByteSymbol`. E.g. if you intern `"dog"` and `b"dog"` you'll get a `Symbol` and a `ByteSymbol` with the same index and the characters will only be stored once. The motivation for this is to eliminate the `Arc`s in `ast::LitKind`, to make `ast::LitKind` impl `Copy`, and to avoid the need to arena-allocate `ast::LitKind` in HIR. The latter change reduces peak memory by a non-trivial amount on literal-heavy benchmarks such as `deep-vector` and `tuple-stress`. `Encoder`, `Decoder`, `SpanEncoder`, and `SpanDecoder` all get some changes so that they can handle normal strings and byte strings. This change does slow down compilation of programs that use `include_bytes!` on large files, because the contents of those files are now interned (hashed). This makes `include_bytes!` more similar to `include_str!`, though `include_bytes!` contents still aren't escaped, and hashing is still much cheaper than escaping.
2025-06-23Add `#[loop_match]` for improved DFA codegenbjorn3-1/+7
Co-authored-by: Folkert de Vries <folkert@folkertdev.nl>
2025-03-06Implement .use keyword as an alias of cloneSantiago Pastorino-1/+4
2025-02-13intern valtreesLukas Markeffsky-9/+3
2025-02-03Remove `'pat` lifetime from some match-lowering data structuresZalathar-1/+2
By storing `PatRange` in an Arc, and copying a few fields out of `Pat`, we can greatly simplify the lifetimes involved in match lowering.
2025-01-31Implement MIR, CTFE, and codegen for unsafe bindersMichael Goulet-0/+8
2025-01-30introduce `ty::Value`Lukas Markeffsky-3/+3
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-01-09Remove the now-useless `Result` from `lit_to_const`Oli Scherer-7/+2
2025-01-09Use error constant instead of explicit error handlingOli Scherer-1/+0
2024-11-03compiler: Directly use rustc_abi in ty_utilsJubilee Young-1/+1
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-08-21Use bool in favor of Option<()> for diagnosticsMichael Goulet-2/+2
2024-08-18rename AddressOf -> RawBorrow inside the compilerRalf Jung-3/+3
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-10ScalarInt: size mismatches are a bug, do not delay the panicRalf Jung-1/+1
2024-06-05ty::Expr reviewsBoxy-1/+1
2024-06-05Add `Ty` to `ConstKind::Value`Boxy-4/+1
2024-06-05Basic removal of `Ty` from places (boring)Boxy-25/+16
2024-06-04Downsize `ty::Expr`Boxy-8/+25
2024-05-28Add an intrinsic for `ptr::metadata`Scott McMurray-1/+1
2024-05-26Give EarlyBinder a tcx parameterMichael Goulet-3/+3
We are gonna need it to uplift EarlyBinder
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_ty_utils`.Nicholas Nethercote-0/+1
2024-05-17Remove `Rvalue::CheckedBinaryOp`Scott McMurray-3/+3
2024-05-13Remove `extern crate rustc_middle` from `rustc_ty_utils`.Nicholas Nethercote-0/+1
2024-03-23Add+Use `mir::BinOp::Cmp`Scott McMurray-1/+1
2023-12-26Rollup merge of #119307 - compiler-errors:pat-lifetimes, r=NadrierilMichael Goulet-2/+2
Clean up some lifetimes in `rustc_pattern_analysis` This PR removes some redundant lifetimes. I figured out that we were shortening the lifetime of an arena-allocated `&'p DeconstructedPat<'p>` to `'a DeconstructedPat<'p>`, which forced us to carry both lifetimes when we could otherwise carry just one. This PR also removes and elides some unnecessary lifetimes. I also cherry-picked 0292eb9bb9b897f5c0926c6a8530877f67e7cc9b, and then simplified more lifetimes in `MatchVisitor`, which should make #119233 a very simple PR! r? Nadrieril
2023-12-26`thir::Visitor` only needs to visit `&'thir` dataNadrieril-2/+2
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-2/+2
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`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-20Reduce exposure of some items.Nicholas Nethercote-3/+3
2023-10-03Optimize some `alloc_from_iter` call sites.Nicholas Nethercote-1/+1
There's no need to collect an iterator into a `Vec`, or to call `into_iter` at the call sites.
2023-07-17Rollup merge of #113539 - agnarrarendelle:master, r=workingjubileeMatthias Krüger-1/+1
fixed typo Hi, I have fixed a few typos in commands. Please review my pr.
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-6/+7
2023-07-12fixed typosagnarrarendelle-1/+1
2023-07-07Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`Nilstrieb-2/+2
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-04Replace `const_error` methods with `Const::new_error`Boxy-1/+1
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-13/+15
2023-06-27`thir`: Add `Become` expression kindMaybe Waffle-1/+3
2023-06-19Promote unchecked_add/sub/mul/shl/shr to mir::BinOpScott McMurray-2/+3
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-1/+1
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-1/+1
2023-05-15Rollup merge of #111578 - Zoxc:query-macro-move, r=cjgillotMatthias Krüger-2/+3
Move expansion of query macros in rustc_middle to rustc_middle::query This moves the expansion of `define_callbacks!` and `define_feedable!` from `rustc_middle::ty::query` to `rustc_middle::query`. This means that types used in queries are both imported and used in `rustc_middle::query` instead of being split between these modules. It also decouples `rustc_middle::ty::query` further from `rustc_middle` which is helpful since we want to move `rustc_middle::ty::query` to the query system crates.
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-2/+3
2023-05-14Rename const error methods for consistencyMichael Goulet-3/+1
2023-05-09add EarlyBinder to thir_abstract_const; remove tcx.bound_abstract_constKyle Matsuda-2/+2
2023-04-22Auto merge of #106934 - DrMeepster:offset_of, r=WaffleLapkinbors-0/+2
Add offset_of! macro (RFC 3308) Implements https://github.com/rust-lang/rfcs/pull/3308 (tracking issue #106655) by adding the built in macro `core::mem::offset_of`. Two of the future possibilities are also implemented: * Nested field accesses (without array indexing) * DST support (for `Sized` fields) I wrote this a few months ago, before the RFC merged. Now that it's merged, I decided to rebase and finish it. cc `@thomcc` (RFC author)
2023-04-21offset_ofDrMeepster-0/+2
2023-04-20Remove WithOptconstParam.Camille GILLOT-41/+25
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-2/+2
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.