about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2022-04-18ssa: don't pack debuginfo on windows not only msvcDavid Wood-1/+1
Small fix that prevents `thorin` from running on platforms where it definitely shouldn't be running. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-15/+2
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-17Auto merge of #96010 - eduardosm:Unique-on-top-of-NonNull, r=m-ou-se,tmiaskobors-2/+6
Implement `core::ptr::Unique` on top of `NonNull` Removes the use `rustc_layout_scalar_valid_range_start` and some `unsafe` blocks.
2022-04-15Add codegen for global_asm! sym operandsAmanieu d'Antras-6/+30
2022-04-14Add additional `extract_field` / `project_field` to take into account extra ↵Eduardo Sánchez Muñoz-2/+6
level of struct nesting.
2022-04-13Auto merge of #95968 - davidtwco:translation-lazy-fallback, r=oli-obkbors-1/+1
errors: lazily load fallback fluent bundle Addresses (hopefully) https://github.com/rust-lang/rust/pull/95667#issuecomment-1094794087. Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. r? `@ghost` (just for perf initially)
2022-04-13Auto merge of #95656 - cjgillot:no-id-hashing-mode, r=Aaron1011bors-6/+1
Remove NodeIdHashingMode. r? `@ghost`
2022-04-13errors: lazily load fallback fluent bundleDavid Wood-1/+1
Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-12Remove NodeIdHashingMode.Camille GILLOT-6/+1
2022-04-11Add new `MutatatingUseContext`s for deinit and `SetDiscriminant`Jakob Degen-0/+2
2022-04-11Add new `Deinit` statement kindJakob Degen-0/+6
2022-04-08check_doc_keyword: don't alloc string for emptiness checkklensy-4/+4
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-04-05Auto merge of #94527 - oli-obk:undef_scalars, r=nagisa,erikdesjardinbors-18/+23
Let CTFE to handle partially uninitialized unions without marking the entire value as uninitialized. follow up to #94411 To fix https://github.com/rust-lang/rust/issues/69488 and by extension fix https://github.com/rust-lang/rust/issues/94371, we should stop treating types like `MaybeUninit<usize>` as something that the `Scalar` type in the interpreter engine can represent. So we add a new field to `abi::Primitive` that records whether the primitive is nested in a union cc `@RalfJung` r? `@ghost`
2022-04-05Mark scalar layout unions so that backends that do not support partially ↵Oli Scherer-18/+23
initialized scalars can special case them.
2022-04-05errors: implement fallback diagnostic translationDavid Wood-5/+15
This commit updates the signatures of all diagnostic functions to accept types that can be converted into a `DiagnosticMessage`. This enables existing diagnostic calls to continue to work as before and Fluent identifiers to be provided. The `SessionDiagnostic` derive just generates normal diagnostic calls, so these APIs had to be modified to accept Fluent identifiers. In addition, loading of the "fallback" Fluent bundle, which contains the built-in English messages, has been implemented. Each diagnostic now has "arguments" which correspond to variables in the Fluent messages (necessary to render a Fluent message) but no API for adding arguments has been added yet. Therefore, diagnostics (that do not require interpolation) can be converted to use Fluent identifiers and will be output as before.
2022-04-05errors: introduce `DiagnosticMessage`David Wood-2/+2
Introduce a `DiagnosticMessage` type that will enable diagnostic messages to be simple strings or Fluent identifiers. `DiagnosticMessage` is now used in the implementation of the standard `DiagnosticBuilder` APIs. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-04Auto merge of #95606 - petrochenkov:linkregr, r=wesleywiserbors-1/+6
linker: Implicitly link native libs as whole-archive in some more cases Partially revert changes from https://github.com/rust-lang/rust/pull/93901 to address regressions like https://github.com/rust-lang/rust/issues/95561. Fixes https://github.com/rust-lang/rust/issues/95561 r? `@wesleywiser`
2022-04-03Cleanup after some refactoring in rustc_targetLoïc BRANSTETT-3/+3
2022-04-03Replace LinkArgs with Cow<'static, str>Loïc BRANSTETT-5/+6
2022-04-03Replace every Vec in Target(Options) with it's Cow equivalentLoïc BRANSTETT-2/+2
2022-04-03Replace every `String` in Target(Options) with `Cow<'static, str>`Loïc BRANSTETT-12/+12
2022-04-03Auto merge of #90791 - drmorr0:drmorr-memcmp-cint-cfg, r=petrochenkovbors-0/+1
make memcmp return a value of c_int_width instead of i32 This is an attempt to fix #32610 and #78022, namely, that `memcmp` always returns an `i32` regardless of the platform. I'm running into some issues and was hoping I could get some help. Here's what I've been attempting so far: 1. Build the stage0 compiler with all the changes _expect_ for the changes in `library/core/src/slice/cmp.rs` and `compiler/rustc_codegen_llvm/src/context.rs`; this is because `target_c_int_width` isn't passed through and recognized as a valid config option yet. I'm building with `./x.py build --stage 0 library/core library/proc_macro compiler/rustc` 2. Next I add in the `#[cfg(c_int_width = ...)]` params to `cmp.rs` and `context.rs` and build the stage 1 compiler by running `./x.py build --keep-stage 0 --stage 1 library/core library/proc_macro compiler/rustc`. This step now runs successfully. 3. Lastly, I try to build the test program for AVR mentioned in #78022 with `RUSTFLAGS="--emit llvm-ir" cargo build --release`, and look at the resulting llvm IR, which still shows: ``` ... %11 = call addrspace(1) i32 `@memcmp(i8*` nonnull %5, i8* nonnull %10, i16 5) #7, !dbg !1191 %.not = icmp eq i32 %11, 0, !dbg !1191 ... ; Function Attrs: nounwind optsize declare i32 `@memcmp(i8*,` i8*, i16) local_unnamed_addr addrspace(1) #4 ``` Any ideas what I'm missing here? Alternately, if this is totally the wrong approach I'm open to other suggestions. cc `@Rahix`
2022-04-02make memcmp return a value of c_int_width instead of i32David Morrison-0/+1
2022-04-03linker: Implicitly link native libs as whole-archive in some more casesVadim Petrochenkov-1/+6
2022-04-02Address review comments and add a testJakub Beránek-4/+24
2022-04-02Include a header in .rlink files to provide nicer error messages when a ↵Jakub Beránek-0/+31
wrong file is parsed as .rlink
2022-03-31Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errorsDylan DPC-1/+1
Spellchecking compiler comments This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30Stabilize native library modifier syntax and the `whole-archive` modifier ↵Vadim Petrochenkov-41/+73
specifically
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30Auto merge of #95241 - Gankra:cleaned-provenance, r=workingjubileebors-1/+2
Strict Provenance MVP This patch series examines the question: how bad would it be if we adopted an extremely strict pointer provenance model that completely banished all int<->ptr casts. The key insight to making this approach even *vaguely* pallatable is the ptr.with_addr(addr) -> ptr function, which takes a pointer and an address and creates a new pointer with that address and the provenance of the input pointer. In this way the "chain of custody" is completely and dynamically restored, making the model suitable even for dynamic checkers like CHERI and Miri. This is not a formal model, but lots of the docs discussing the model have been updated to try to the *concept* of this design in the hopes that it can be iterated on. See #95228
2022-03-30Rollup merge of #95461 - nyurik:spelling, r=lcnrDylan DPC-4/+4
Spellchecking some comments This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30Spellchecking some commentsYuri Astrakhan-4/+4
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-29Make some rustc code conform to strict provenance.Aria Beingessner-1/+2
There's some really bad stuff around `ty` and pointer tagging stuff that was too much work to handle here.
2022-03-28Rollup merge of #95328 - DrMeepster:box_gep_err, r=oli-obkDylan DPC-7/+13
Fix yet another Box<T, A> ICE Fixes #95036. This widens the special case from #94414 to make sure that boxes with a custom allocator are never directly dereferenced.
2022-03-28use cfg attribute instead of macroklensy-25/+27
2022-03-27fix other source of box derefDrMeepster-3/+11
2022-03-26check the the right fieldDrMeepster-1/+1
2022-03-25widen special case on deref to all non-zst allocatorsDrMeepster-4/+2
2022-03-26Auto merge of #95149 - cjgillot:once-diag, r=estebankbors-1/+1
Remove `Session::one_time_diagnostic` This is untracked mutable state, which modified the behaviour of queries. It was used for 2 things: some full-blown errors, but mostly for lint declaration notes ("the lint level is defined here" notes). It is replaced by the diagnostic deduplication infra which already exists in the diagnostic emitter. A new diagnostic level `OnceNote` is introduced specifically for lint notes, to deduplicate subdiagnostics. As a drive-by, diagnostic emission takes a `&mut` to allow dropping the `SubDiagnostic`s.
2022-03-23Rollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,AmanieuDylan DPC-4/+1
Fold aarch64 feature +fp into +neon Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64: The Neon unit, which handles both floating point and SIMD instructions. Moreover, a configuration for AArch64 must include both or neither. Arm says "entirely proprietary" toolchains may omit floating point: https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point In the Programmer's Guide for Armv8-A, Arm says AArch64 can have both FP and Neon or neither in custom implementations: https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON In "Bare metal boot code for Armv8-A", enabling Neon and FP is just disabling the same trap flag: https://developer.arm.com/documentation/dai0527/a In an unlikely future where "Neon and FP" become unrelated, we can add "[+-]fp" as its own feature flag. Until then, we can simplify programming with Rust on AArch64 by folding both into "[+-]neon", which is valid as it supersets both. "[+-]neon" is retained for niche uses such as firmware, kernels, "I just hate floats", and so on. I am... pretty sure no one is relying on this. An argument could be made that, as we are not an "entirely proprietary" toolchain, we should not support AArch64 without floats at all. I think that's a bit excessive. However, I want to recognize the intent: programming for AArch64 should be simplified where possible. For x86-64, programmers regularly set up illegal feature configurations because it's hard to understand them, see https://github.com/rust-lang/rust/issues/89586. And per the above notes, plus the discussion in https://github.com/rust-lang/rust/issues/86941, there should be no real use cases for leaving these features split: the two should in fact always go together. - Fixes rust-lang/rust#95002. - Fixes rust-lang/rust#95064. - Fixes rust-lang/rust#95122.
2022-03-22Fold aarch64 feature +fp into +neonJubilee Young-4/+1
Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64: The Neon unit, which handles both floating point and SIMD instructions. Moreover, a configuration for AArch64 must include both or neither. Arm says "entirely proprietary" toolchains may omit floating point: https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point In the Programmer's Guide for Armv8-A, Arm says AArch64 can have both FP and Neon or neither in custom implementations: https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON In "Bare metal boot code for Armv8-A", enabling Neon and FP is just disabling the same trap flag: https://developer.arm.com/documentation/dai0527/a In an unlikely future where "Neon and FP" become unrelated, we can add "[+-]fp" as its own feature flag. Until then, we can simplify programming with Rust on AArch64 by folding both into "[+-]neon", which is valid as it supersets both. "[+-]neon" is retained for niche uses such as firmware, kernels, "I just hate floats", and so on.
2022-03-20Take &mut Diagnostic in emit_diagnostic.Camille GILLOT-1/+1
Taking a Diagnostic by move would break the usual pattern `diag.label(..).emit()`.
2022-03-18Auto merge of #95056 - Dylan-DPC:rollup-swtuw2n, r=Dylan-DPCbors-5/+25
Rollup of 10 pull requests Successful merges: - #91133 (Improve `unsafe` diagnostic) - #93222 (Make ErrorReported impossible to construct outside `rustc_errors`) - #93745 (Stabilize ADX target feature) - #94309 ([generator_interior] Be more precise with scopes of borrowed places) - #94698 (Remove redundant code from copy-suggestions) - #94731 (Suggest adding `{ .. }` around a const function call with arguments) - #94960 (Fix many spelling mistakes) - #94982 (Add deprecated_safe feature gate and attribute, cc #94978) - #94997 (debuginfo: Fix ICE when generating name for type that produces a layout error.) - #95000 (Fixed wrong type name in comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-17Rollup merge of #94997 - michaelwoerister:fix-enum-type-name-layout-error, ↵Dylan DPC-2/+23
r=wesleywiser debuginfo: Fix ICE when generating name for type that produces a layout error. Fixes https://github.com/rust-lang/rust/issues/94961.
2022-03-17Rollup merge of #93745 - tarcieri:stabilize-adx, r=cjgillotDylan DPC-1/+1
Stabilize ADX target feature This is a continuation of #60109, which noted that while the ADX intrinsics were stabilized, the corresponding target feature never was. This PR follows the same general structure and stabilizes the ADX target feature. See also https://github.com/rust-lang/rust/issues/44839 - tracking issue for target feature
2022-03-16erase late-bound regions in dyn projection types for debuginfoMichael Goulet-1/+2
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-16debuginfo: Fix ICE when generating name for type that produces a layout error.Michael Woerister-2/+23
2022-03-16feat: more RISC-V featuresluojia65-0/+20
These features include: - V for vector extension - Zfinx, Zdinx, Zhinx and Zhinxmin float in integer register extensions - Zfh, Zfhmin 16-bit float pointer extensions - Zbkb, Zkbc, Zbkc, Zk* cryptography extensions It matches name in LLVM feature and is_riscv_feature_detected!.
2022-03-15Rollup merge of #94810 - michaelwoerister:fix-trait-pointer-debuginfo-names, ↵Matthias Krüger-3/+10
r=wesleywiser debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments. For types like `&dyn Future<Output=bool>` the compiler currently emits invalid types names in debuginfo. This PR fixes this. Before: ```txt // DWARF &dyn core::future::future::Future, Output=bool> // CodeView ref$<dyn$<core::future::future::Future,assoc$<Output,bool> > > > ``` After: ```txt // DWARF &dyn core::future::future::Future<Output=bool> // CodeView ref$<dyn$<core::future::future::Future<assoc$<Output,bool> > > > ``` These syntactically incorrect type names can cause downstream tools (e.g. debugger extensions) crash when trying to parse them. r? `@wesleywiser`