summary refs log tree commit diff
path: root/compiler/rustc_symbol_mangling/src
AgeCommit message (Collapse)AuthorLines
2023-09-24Remove span from BrAnon.Camille GILLOT-1/+1
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-4/+1
2023-09-23Enable drop_tracking_mir by default.Camille GILLOT-6/+2
2023-09-20the Const::eval_bits methods don't need to be given the TyRalf Jung-3/+3
2023-09-14Auto merge of #115817 - fee1-dead-contrib:fix-codegen, r=oli-obkbors-5/+4
treat host effect params as erased in codegen This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`. r? `@oli-obk`
2023-09-14treat host effect params as erased generics in codegenDeadbeef-5/+4
This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`.
2023-09-13make the set of methods between our two Const types more consistentRalf Jung-1/+1
2023-09-13make the eval() functions on our const types return the resulting valueRalf Jung-1/+1
2023-08-24Fix CFI: f32 and f64 are encoded incorrectly for cRamon de C Valle-4/+13
Fix #115150 by encoding f32 and f64 correctly for cross-language CFI. I missed changing the encoding for f32 and f64 when I introduced the integer normalization option in #105452 as integer normalization does not include floating point. `f32` and `f64` should be always encoded as `f` and `d` since they are both FFI safe when their representation are the same (i.e., IEEE 754) for both the Rust compiler and Clang.
2023-08-11Auto merge of #114672 - lenawanel:master, r=compiler-errorsbors-5/+2
make `typeid::typeid_itanium_cxx_abi::transform_ty` evaluate length in array types the ICE in https://github.com/rust-lang/rust/issues/114275 was caused by `transform_ty` in compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs encountering an unevaluated const, while expecting it to already be evaluated.
2023-08-10fix #114275lena-5/+2
this ICE was caused by `transform_ty` in compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs encountering an unevaluated const, while expecting it to already be evaluated. add a regression test Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs Co-authored-by: Michael Goulet <michael@errs.io> Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs Co-authored-by: Michael Goulet <michael@errs.io> fix test compiling for targets with -crt-static and failing this was causign https://github.com/rust-lang/rust/pull/114686 to fail
2023-08-09rustc: Move `stable_crate_id` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes a piece of mutable state. Follow up to #114578.
2023-08-02avoid 'miri' when refering to the shared interpreterRalf Jung-1/+2
2023-07-27Auto merge of #113708 - rcvalle:rust-cfi-fix-100778, r=compiler-errorsbors-34/+45
CFI: Fix ICE: encode_const: unexpected type [usize Fixes #100778 and #113366, and complements #106547 by adding support for encoding const parameters.
2023-07-23more clippy::style fixes:Matthias Krüger-1/+1
get_first single_char_add_str unnecessary_mut_passed manual_map manual_is_ascii_check
2023-07-17CFI: Fix ICE: encode_const: unexpected type [usizeRamon de C Valle-34/+45
Fixes #100778 and #113366, and complements #106547 by adding support for encoding const parameters.
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-83/+78
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-36/+47
2023-07-05Deal with falloutBoxy-6/+4
2023-07-04nitBoxy-0/+1
Co-authored-by: lcnr <rust@lcnr.de>
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-1/+1
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-0/+1
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-02Rollup merge of #112182 - rcvalle:rust-cfi-fix-111185, r=compiler-errorsMatthias Krüger-3/+10
CFI: Fix cfi with repr(transparent): transform_ty: unexpected Alias(Proj Fixes https://github.com/rust-lang/rust/issues/111185 by normalizing ty::Alias before encoding.
2023-06-02Auto merge of #112198 - compiler-errors:rollup-o2xe4of, r=compiler-errorsbors-5/+24
Rollup of 7 pull requests Successful merges: - #111670 (Require that const param tys implement `ConstParamTy`) - #111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - #112030 (Migrate `item_trait_alias` to Askama) - #112150 (Support 128-bit atomics on all x86_64 Apple targets) - #112174 (Fix broken link) - #112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - #112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - #112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-01Rollup merge of #111914 - rcvalle:rust-cfi-fix-111184, r=compiler-errorsMichael Goulet-5/+24
CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi… Fixes https://github.com/rust-lang/rust/issues/111184 by encoding ty::Generator parent substs only.
2023-06-01CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(BindeRamon de C Valle-5/+24
Fixes #111184 by encoding ty::Generator parent substs only.
2023-06-01CFI: Fix cfi with repr(transparent): transform_ty: unexpected Alias(ProjRamon de C Valle-3/+10
Fixes #111185 by normalizing ty::Alias before encoding.
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-2/+15
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-1/+1
2023-05-29Use `Cow` in `{D,Subd}iagnosticMessage`.Nicholas Nethercote-9/+2
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile.
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-1/+1
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-1/+1
2023-05-23Rollup merge of #111851 - rcvalle:rust-cfi-fix-111515, r=bjorn3Matthias Krüger-7/+7
CFI: Fix encode_region: unexpected ReEarlyBound(0, 'a) Fixes #111515 and complements #106547 by adding support for encoding early bound regions and also excluding projections when transforming trait objects' traits into their identities before emitting type checks.
2023-05-23Rollup merge of #111486 - fmease:pp-inh-proj, r=petrochenkovMatthias Krüger-2/+5
Pretty-print inherent projections correctly Previously, we were trying to pretty-print inherent projections with `Printer::print_def_path` which is incorrect since it expects the substitutions to be of a certain format (parents substs followed by own substs) which doesn't hold for inherent projections (self type subst followed by own substs). Now we print inherent projections manually. Fixes #111390. Fixes #111397. Lacking tests! Is there a test suite / compiletest flags for the pretty-printer? In most if not all cases, inherent projections are normalized away before they get the chance to appear in diagnostics. If I were to create regression tests for linked issues, they would need to be `mir-opt` tests to exercise `-Zdump-mir=all` (right?) which doesn't feel quite adequate to me. `@rustbot` label F-inherent_associated_types
2023-05-23CFI: Fix encode_region: unexpected ReEarlyBound(0, 'a)Ramon de C Valle-7/+7
Fixes #111515 and complements #106547 by adding support for encoding early bound regions and also excluding projections when transforming trait objects' traits into their identities before emitting type checks.
2023-05-22properly pretty-print inherent projectionsLeón Orell Valerian Liehr-2/+5
2023-05-21Auto merge of #111697 - rcvalle:rust-cfi-fix-111510, r=bjorn3bors-16/+52
CFI: Fix encode_ty: unexpected Param(B/#1) Fixes #111510 and complements #106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
2023-05-17CFI: Fix encode_ty: unexpected Param(B/#1)Ramon de C Valle-16/+52
Fixes #111510 and complements #106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-1/+1
2023-05-09CFI: Fix SIGILL reached via trait objectsRamon de C Valle-3/+78
Fix #106547 by transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods.
2023-05-03Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3Manish Goregaokar-75/+193
Add cross-language LLVM CFI support to the Rust compiler This PR adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto). Thank you again, ``@bjorn3,`` ``@nikic,`` ``@samitolvanen,`` and the Rust community for all the help!
2023-05-03Add cross-language LLVM CFI support to the Rust compilerRamon de C Valle-75/+193
This commit adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).
2023-04-27rename `needs_subst` to `has_param`Boxy-1/+1
2023-04-21Allow `LocalDefId` as the argument to `def_path_str`Oli Scherer-1/+1
2023-04-19Add `GenericArgKind::as_{type,const,region}`Maybe Waffle-10/+4
2023-04-19Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwcobors-1/+1
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros` Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+1
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-6/+6
2023-04-06Remove index from BrAnonJack Huey-21/+12
2023-03-29Support TLS access into dylibs on WindowsJohn Kåre Alsaker-0/+5