about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-5/+105
Initial implementation of dyn* This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things: * Introduce `dyn_star` feature flag * Adds parsing for `dyn* Trait` types * Defines `dyn* Trait` as a sized type * Adds support for explicit casts, like `42usize as dyn* Debug` * Including const evaluation of such casts * Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope * Adds codegen for method calls, at least for methods that take `&self` Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits. Joint work with `@nikomatsakis` and `@compiler-errors.` r? `@bjorn3`
2022-09-14Auto merge of #99443 - jam1garner:mips-virt-feature, r=nagisabors-2/+5
Add support for MIPS VZ ISA extension [Link to relevant LLVM line where virt extension is specified](https://github.com/llvm/llvm-project/blob/83fab8cee9d6b9fa911195c20325b4512a7a22ef/llvm/lib/Target/Mips/Mips.td#L172-L173) This has been tested on mips-unknown-linux-musl with a target-cpu that is >= MIPS32 5 and `target-features=+virt`. The example was checked in a disassembler to ensure the correct assembly sequence was being generated using the virtualization instructions. Needed additional work: * MIPS is missing from [the Rust reference CPU feature lists](https://doc.rust-lang.org/reference/attributes/codegen.html#available-features) Example docs for later: ```md #### `mips` or `mips64` This platform requires that `#[target_feature]` is only applied to [`unsafe` functions][unsafe function]. This target's feature support is currently unstable and must be enabled by `#![feature(mips_target_feature)]` ([Issue #44839]) [Issue #44839]: https://github.com/rust-lang/rust/issues/44839 Further documentation on these features can be found in the [MIPS Instruction Set Reference Manual], or elsewhere on [mips.com]. [MIPS Instruction Set Reference Manual]: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-6.06.pdf [developer.arm.com]: https://www.mips.com/products/architectures/ase/ Feature | Implicitly Enables | Description ---------------|--------------------|------------------- `fp64` | | 64-bit Floating Point `msa` | | "MIPS SIMD Architecture" `virt` | | Virtualization instructions (VZ ASE) ``` If the above is good I can also submit a PR for that if there's interest in documenting it while it's still unstable. Otherwise that can be dropped, I just wrote it before realizing it was possibly not a good idea. Relevant to #44839
2022-09-13Address code review commentsEric Holk-1/+1
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-18/+18
2022-09-13Auto merge of #100101 - BelovDV:issue-99429, r=petrochenkovbors-46/+130
change rlib format to distinguish native dependencies Another one method to solve problem mentioned in #99429. Changed .rlib format, it contains all bundled native libraries as archieves. At link time rlib is unpacked and native dependencies linked separately. New behavior hidden under separate_native_rlib_dependencies flag.
2022-09-13Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiserbors-4/+4
ssa: implement `#[collapse_debuginfo]` cc #39153 rust-lang/compiler-team#386 Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. r? rust-lang/wg-debugging
2022-09-12Make dyn-trait-method workMichael Goulet-1/+24
2022-09-12Rename some variantsMichael Goulet-4/+4
2022-09-12Construct dyn* during const interpMichael Goulet-1/+1
2022-09-12Use principal of cast target as dyn-star trait ref in codegenMichael Goulet-7/+6
2022-09-12Call destructors when dyn* object goes out of scopeEric Holk-7/+33
2022-09-12dyn* through more typechecking and MIREric Holk-2/+54
2022-09-12Plumb dyn trait representation through ty::DynamicEric Holk-1/+1
2022-09-12change rlib format to discern native dependenciesDaniil Belov-46/+130
2022-09-12Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726Dylan DPC-17/+8
Remove manual <[u8]>::escape_ascii `@rustbot` label: +C-cleanup
2022-09-10Auto merge of #101647 - crlf0710:test_for_99551, r=bjorn3bors-1/+6
Fix LLVM IR type mismatch reported in #99551 Closes #99551 .
2022-09-10Fix pointer value punning.Charles Lew-1/+6
Seems this doesn't trigger error on LLVM 15, but let's fix it for better compatibility.
2022-09-10Auto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-deadbors-6/+2
The `<*const T>::guaranteed_*` methods now return an option for the unknown case cc https://github.com/rust-lang/rust/issues/53020#issuecomment-1236932443 I chose `0` for "not equal" and `1` for "equal" and left `2` for the unknown case so backends can just forward to raw pointer equality and it works ✨ r? `@fee1-dead` or `@lcnr` cc `@rust-lang/wg-const-eval`
2022-09-09The `<*const T>::guaranteed_*` methods now return an option for the unknown caseOli Scherer-6/+2
2022-09-09Use memset when repeating 128bit zero valueTomasz Miąsko-1/+1
2022-09-07Change name of "dataful" variant to "untagged"Michael Benfield-4/+4
This is in anticipation of a new enum layout, in which the niche optimization may be applied even when multiple variants have data.
2022-09-07ssa: implement `#[collapse_debuginfo]`David Wood-4/+4
Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-07Auto merge of #98332 - oli-obk:assume, r=wesleywiserbors-9/+9
Lower the assume intrinsic to a MIR statement This makes https://github.com/rust-lang/rust/pull/96862#issuecomment-1153739068 easier and will generally allow us to cheaply insert assume intrinsic calls in mir building. r? rust-lang/wg-mir-opt
2022-09-07Auto merge of #101508 - JohnTitor:rollup-i5i2vqc, r=JohnTitorbors-9/+1
Rollup of 8 pull requests Successful merges: - #101451 (Add incremental test for changing struct name in assoc type.) - #101468 (fix RPIT ICE for implicit HRTB when missing dyn) - #101481 (Fix compile errors for uwp-windows-msvc targets) - #101484 (Remove dead broken code from const zst handling in backends) - #101486 (Add list of recognized repr attributes to the unrecognized repr error) - #101488 (rustdoc: remove unused CSS `#results > table`) - #101491 (rustdoc: remove outdated CSS `.sub-variant > div > .item-info`) - #101497 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-10/+9
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-4/+5
2022-09-06Remove dead broken code from const zst handling in backendsOli Scherer-9/+1
2022-09-06Fix CI failures on windows and aarch64-linuxVadim Petrochenkov-20/+36
2022-09-06change stdlib circular dependencies handlingDaniil Belov-122/+35
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-2/+1
2022-09-02Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplettbors-6/+10
Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE` When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program ```rust fn main() { loop { println!("hello world"); } } ``` will print an error if used with a short-lived pipe, e.g. % ./main | head -n 1 hello world thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace by enabling `#[unix_sigpipe = "sig_dfl"]` like this ```rust #![feature(unix_sigpipe)] #[unix_sigpipe = "sig_dfl"] fn main() { loop { println!("hello world"); } } ``` there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately: % ./main | head -n 1 hello world The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`. With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`. See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2022-09-02Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-SimulacrumMatthias Krüger-14/+18
Change implementation of `-Z gcc-ld` and `lld-wrapper` again This PR partially reverts https://github.com/rust-lang/rust/pull/97375 and uses the strategy described in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520 instead, thus fixes https://github.com/rust-lang/rust/issues/97755.
2022-09-01rustc_target: Refactor internal linker flavors slightlyVadim Petrochenkov-26/+22
Remove one unstable user-facing linker flavor (l4-bender)
2022-09-01rustc_target: Add a compatibility layer to separate internal and user-facing ↵Vadim Petrochenkov-1/+2
linker flavors
2022-09-01Auto merge of #100958 - mikebenfield:workaround, r=nikicbors-11/+0
compiler/rustc_codegen_ssa/src/mir/place.rs: Remove LLVM bug workaround This memset was inserted as a workaround to Rust issue #34427, which was an LLVM bug that apparently no longer manifests.
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-2/+2
Fix a bunch of typo 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-31Rollup merge of #100753 - LuisCardosoOliveira:translation-migrate-session, ↵Ralf Jung-1/+1
r=davidtwco translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1 ## Description This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883). The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.
2022-08-31Fix a bunch of typoDezhi Wu-2/+2
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 #100653 - cuviper:fptoint_sat, r=michaelwoerister,antoyoDylan DPC-155/+3
Move the cast_float_to_int fallback code to GCC Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-29Rollup merge of #101141 - ↵Matthias Krüger-11/+7
compiler-errors:get-trait-ref-is-a-misleading-name, r=oli-obk Simplify `get_trait_ref` fn used for `virtual_function_elimination` 1. The name `get_trait_ref` is misleading, so I renamed it to something more like `expect_...` because it ICEs if used incorrectly. 2. No need to manually go through the existential trait refs, we already have `.principal()` for that.
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-7/+7
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-29Simplify get_trait_ref a bitMichael Goulet-11/+7
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-6/+10
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
2022-08-28Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrumbors-11/+7
Move EH personality functions to std These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame. Fixes #41004
2022-08-28Fix handling of rust_eh_personality in reachable_non_genericsAmanieu d'Antras-11/+7
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-27/+23
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-26translations(rustc_session): migrate check_expected_reuseLuis Cardoso-1/+1
This commit migrates the errors in the function check_expected_reuse to use the new SessionDiagnostic. It also does some small refactor for the IncorrectCguReuseType to include the 'at least' word in the fluent translation file
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-7/+7
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-22/+18
Because it's only needed for that variant. This shrinks the types and clarifies the logic.