]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agodebuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create...
Michael Woerister [Mon, 14 Mar 2022 16:18:30 +0000 (17:18 +0100)]
debuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create_vtable_metadata() to DebugInfoMethods::create_vtable_debuginfo()

2 years agoImprove `AdtDef` interning.
Nicholas Nethercote [Fri, 4 Mar 2022 20:28:41 +0000 (07:28 +1100)]
Improve `AdtDef` interning.

This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.

2 years agoAuto merge of #94690 - nnethercote:clarify-Layout-interning, r=fee1-dead
bors [Mon, 7 Mar 2022 15:25:42 +0000 (15:25 +0000)]
Auto merge of #94690 - nnethercote:clarify-Layout-interning, r=fee1-dead

Clarify `Layout` interning.

`Layout` is another type that is sometimes interned, sometimes not, and
we always use references to refer to it so we can't take any advantage
of the uniqueness properties for hashing or equality checks.

This commit renames `Layout` as `LayoutS`, and then introduces a new
`Layout` that is a newtype around an `Interned<LayoutS>`. It also
interns more layouts than before. Previously layouts within layouts
(via the `variants` field) were never interned, but now they are. Hence
the lifetime on the new `Layout` type.

Unlike other interned types, these ones are in `rustc_target` instead of
`rustc_middle`. This reflects the existing structure of the code, which
does layout-specific stuff in `rustc_target` while `TyAndLayout` is
generic over the `Ty`, allowing the type-specific stuff to occur in
`rustc_middle`.

The commit also adds a `HashStable` impl for `Interned`, which was
needed. It hashes the contents, unlike the `Hash` impl which hashes the
pointer.

r? `@fee1-dead`

2 years agoClarify `Layout` interning.
Nicholas Nethercote [Fri, 4 Mar 2022 02:46:56 +0000 (13:46 +1100)]
Clarify `Layout` interning.

`Layout` is another type that is sometimes interned, sometimes not, and
we always use references to refer to it so we can't take any advantage
of the uniqueness properties for hashing or equality checks.

This commit renames `Layout` as `LayoutS`, and then introduces a new
`Layout` that is a newtype around an `Interned<LayoutS>`. It also
interns more layouts than before. Previously layouts within layouts
(via the `variants` field) were never interned, but now they are. Hence
the lifetime on the new `Layout` type.

Unlike other interned types, these ones are in `rustc_target` instead of
`rustc_middle`. This reflects the existing structure of the code, which
does layout-specific stuff in `rustc_target` while `TyAndLayout` is
generic over the `Ty`, allowing the type-specific stuff to occur in
`rustc_middle`.

The commit also adds a `HashStable` impl for `Interned`, which was
needed. It hashes the contents, unlike the `Hash` impl which hashes the
pointer.

2 years agoAuto merge of #94638 - erikdesjardins:noextranull, r=nagisa
bors [Mon, 7 Mar 2022 02:07:36 +0000 (02:07 +0000)]
Auto merge of #94638 - erikdesjardins:noextranull, r=nagisa

cleanup: remove unused ability to have LLVM null-terminate const strings

(and the copied function in rustc_codegen_gcc)

Noticed this while writing https://github.com/rust-lang/rust/pull/94450#issuecomment-1059687348.

r? `@nagisa`

2 years agoIntroduce `ConstAllocation`.
Nicholas Nethercote [Tue, 1 Mar 2022 20:15:04 +0000 (07:15 +1100)]
Introduce `ConstAllocation`.

Currently some `Allocation`s are interned, some are not, and it's very
hard to tell at a use point which is which.

This commit introduces `ConstAllocation` for the known-interned ones,
which makes the division much clearer. `ConstAllocation::inner()` is
used to get the underlying `Allocation`.

In some places it's natural to use an `Allocation`, in some it's natural
to use a `ConstAllocation`, and in some places there's no clear choice.
I've tried to make things look as nice as possible, while generally
favouring `ConstAllocation`, which is the type that embodies more
information. This does require quite a few calls to `inner()`.

The commit also tweaks how `PartialOrd` works for `Interned`. The
previous code was too clever by half, building on `T: Ord` to make the
code shorter. That caused problems with deriving `PartialOrd` and `Ord`
for `ConstAllocation`, so I changed it to build on `T: PartialOrd`,
which is slightly more verbose but much more standard and avoided the
problems.

2 years agocleanup: remove unused ability to have LLVM null-terminate const strings
Erik Desjardins [Sat, 5 Mar 2022 04:14:38 +0000 (23:14 -0500)]
cleanup: remove unused ability to have LLVM null-terminate const strings

2 years agoall: fix some typos
cuishuang [Thu, 3 Mar 2022 11:47:23 +0000 (19:47 +0800)]
all: fix some typos

Signed-off-by: cuishuang <imcusg@gmail.com>
2 years agorename ErrorReported -> ErrorGuaranteed
mark [Sun, 23 Jan 2022 18:34:26 +0000 (12:34 -0600)]
rename ErrorReported -> ErrorGuaranteed

2 years agoAuto merge of #87402 - nagisa:nagisa/request-feature-requests-for-features, r=estebank
bors [Wed, 2 Mar 2022 03:03:22 +0000 (03:03 +0000)]
Auto merge of #87402 - nagisa:nagisa/request-feature-requests-for-features, r=estebank

Direct users towards using Rust target feature names in CLI

This PR consists of a couple of changes on how we handle target features.

In particular there is a bug-fix wherein we avoid passing through features that aren't prefixed by `+` or `-` to LLVM. These appear to be causing LLVM to assert, which is pretty poor a behaviour (and also makes it pretty clear we expect feature names to be prefixed).

The other commit, I anticipate to be somewhat more controversial is outputting a warning when users specify a LLVM-specific, or otherwise unknown, feature name on the CLI. In those situations we request users to either replace it with a known Rust feature name (e.g. `bmi` -> `bmi1`) or file a feature request. I've a couple motivations for this: first of all, if users are specifying these features on the command line, I'm pretty confident there is also a need for these features to be usable via `#[cfg(target_feature)]` machinery.  And second, we're growing a fair number of backends recently and having ability to provide some sort of unified-ish interface in this place seems pretty useful to me.

Sponsored by: standard.ai

2 years agoQuerify `global_backend_features`
Simonas Kazlauskas [Fri, 24 Sep 2021 15:02:02 +0000 (18:02 +0300)]
Querify `global_backend_features`

At the very least this serves to deduplicate the diagnostics that are
output about unknown target features provided via CLI.

2 years agoRevert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"
Erik Desjardins [Sat, 26 Feb 2022 17:52:07 +0000 (12:52 -0500)]
Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"

This reverts commit 4f49627c6fe2a32d1fed6310466bb0e1c535c0c0, reversing
changes made to 028c6f1454787c068ff5117e9000a1de4fd98374.

2 years agoAuto merge of #94123 - bjorn3:cg_ssa_singleton_builder, r=tmiasko
bors [Thu, 24 Feb 2022 12:28:19 +0000 (12:28 +0000)]
Auto merge of #94123 - bjorn3:cg_ssa_singleton_builder, r=tmiasko

Partially move cg_ssa towards using a single builder

Not all codegen backends can handle hopping between blocks well. For example Cranelift requires blocks to be terminated before switching to building a new block. Rust-gpu requires a `RefCell` to allow hopping between blocks and cg_gcc currently has a buggy implementation of hopping between blocks. This PR reduces the amount of cases where cg_ssa switches between blocks before they are finished and mostly fixes the block hopping in cg_gcc. (~~only `scalar_to_backend` doesn't handle it correctly yet in cg_gcc~~ fixed that one.)

`@antoyo` please review the cg_gcc changes.

2 years agoIntroduce Bx::switch_to_block
bjorn3 [Fri, 18 Feb 2022 14:37:31 +0000 (15:37 +0100)]
Introduce Bx::switch_to_block

2 years agoRemove build_sibling_block
bjorn3 [Fri, 18 Feb 2022 14:10:56 +0000 (15:10 +0100)]
Remove build_sibling_block

2 years agoMove ty::print methods to Drop-based scope guards
Mark Rousskov [Wed, 16 Feb 2022 18:04:48 +0000 (13:04 -0500)]
Move ty::print methods to Drop-based scope guards

2 years agoUnconditionally update symbols
bjorn3 [Thu, 10 Feb 2022 17:27:18 +0000 (18:27 +0100)]
Unconditionally update symbols

All paths to an ArchiveBuilder::build call update_symbols first.

2 years agoAuto merge of #93511 - cjgillot:query-copy, r=oli-obk
bors [Thu, 10 Feb 2022 09:37:07 +0000 (09:37 +0000)]
Auto merge of #93511 - cjgillot:query-copy, r=oli-obk

Ensure that queries only return Copy types.

This should pervent the perf footgun of returning a result with an expensive `Clone` impl (like a `Vec` of a hash map).

I went for the stupid solution of allocating on an arena everything that was not `Copy`. Some query results could be made Copy easily, but I did not really investigate.

2 years agoMake FnAbiError Copy.
Camille GILLOT [Tue, 1 Feb 2022 17:44:45 +0000 (18:44 +0100)]
Make FnAbiError Copy.

2 years agoEnsure that queries only return Copy types.
Camille GILLOT [Mon, 31 Jan 2022 18:55:34 +0000 (19:55 +0100)]
Ensure that queries only return Copy types.

2 years ago`#[used(linker)]` attribute (https://github.com/dtolnay/linkme/issues/41)
cynecx [Mon, 22 Nov 2021 12:14:54 +0000 (13:14 +0100)]
`#[used(linker)]` attribute (https://github.com/dtolnay/linkme/issues/41)

2 years agoMerge landing_pad and set_cleanup into cleanup_landing_pad
bjorn3 [Mon, 24 Jan 2022 12:57:32 +0000 (13:57 +0100)]
Merge landing_pad and set_cleanup into cleanup_landing_pad

2 years agoMerge add_handler into catch_switch
bjorn3 [Mon, 24 Jan 2022 12:50:12 +0000 (13:50 +0100)]
Merge add_handler into catch_switch

Some codegen backends may require all handlers to be immediately known

2 years agoRemove unused return values from resume and cleanup_ret
bjorn3 [Mon, 24 Jan 2022 12:48:09 +0000 (13:48 +0100)]
Remove unused return values from resume and cleanup_ret

Given that these instructions are diverging, not every codegen backend
may be able to produce a return value for them.

2 years agoReorder unwinding related builder methods to differentiate between dwarf and msvc...
bjorn3 [Mon, 24 Jan 2022 12:45:34 +0000 (13:45 +0100)]
Reorder unwinding related builder methods to differentiate between dwarf and msvc instructions

2 years agoAdd preliminary support for inline assembly for msp430.
William D. Jones [Thu, 20 Jan 2022 22:44:50 +0000 (17:44 -0500)]
Add preliminary support for inline assembly for msp430.

2 years agoUse Symbol for target features in asm handling
bjorn3 [Mon, 10 Jan 2022 14:32:45 +0000 (15:32 +0100)]
Use Symbol for target features in asm handling

This saves a couple of Symbol::intern calls

2 years agoRemove deprecated LLVM-style inline assembly
Tomasz Miąsko [Wed, 12 Jan 2022 00:00:00 +0000 (00:00 +0000)]
Remove deprecated LLVM-style inline assembly

2 years agoStore a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`
Aaron Hill [Mon, 3 Jan 2022 03:37:05 +0000 (22:37 -0500)]
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`

The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.

2 years agoUpdate references to `-Z symbol-mangling-version` to use `-C`
Josh Triplett [Thu, 21 Oct 2021 12:57:14 +0000 (14:57 +0200)]
Update references to `-Z symbol-mangling-version` to use `-C`

Replace `-Z symbol-mangling-version=v0` with `-C symbol-mangling-version=v0`.

Replace `-Z symbol-mangling-version=legacy` with
`-Z unstable-options -C symbol-mangling-version=legacy`.

2 years agoAuto merge of #92419 - erikdesjardins:coldland, r=nagisa
bors [Sat, 1 Jan 2022 13:28:13 +0000 (13:28 +0000)]
Auto merge of #92419 - erikdesjardins:coldland, r=nagisa

Mark drop calls in landing pads `cold` instead of `noinline`

Now that deferred inlining has been disabled in LLVM (#92110), this shouldn't cause catastrophic size blowup.

I confirmed that the test cases from https://github.com/rust-lang/rust/issues/41696#issuecomment-298696944 still compile quickly (<1s) after this change. ~Although note that I wasn't able to reproduce the original issue using a recent rustc/llvm with deferred inlining enabled, so those tests may no longer be representative. I was also unable to create a modified test case that reproduced the original issue.~ (edit: I reproduced it on CI by accident--the first commit timed out on the LLVM 12 builder, because I forgot to make it conditional on LLVM version)

r? `@nagisa`
cc `@arielb1` (this effectively reverts #42771 "mark calls in the unwind path as !noinline")
cc `@RalfJung` (fixes #46515)

edit: also fixes #87055

2 years agoRemove unused extern crate rustc_symbol_mangling
bjorn3 [Fri, 31 Dec 2021 15:57:33 +0000 (16:57 +0100)]
Remove unused extern crate rustc_symbol_mangling

2 years agoMerge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_clif-2021-12-31
bjorn3 [Fri, 31 Dec 2021 15:26:32 +0000 (16:26 +0100)]
Merge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_clif-2021-12-31

2 years agokeep noinline for system llvm < 14
Erik Desjardins [Thu, 30 Dec 2021 04:19:55 +0000 (23:19 -0500)]
keep noinline for system llvm < 14

2 years agoMark drop calls in landing pads cold instead of noinline
Erik Desjardins [Wed, 29 Dec 2021 20:28:31 +0000 (15:28 -0500)]
Mark drop calls in landing pads cold instead of noinline

Now that deferred inlining has been disabled in LLVM,
this shouldn't cause catastrophic size blowup.

2 years agoAuto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
bors [Sun, 19 Dec 2021 09:31:37 +0000 (09:31 +0000)]
Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk

Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`

2 years agoRemove unnecessary sigils around `Symbol::as_str()` calls.
Nicholas Nethercote [Wed, 15 Dec 2021 03:39:23 +0000 (14:39 +1100)]
Remove unnecessary sigils around `Symbol::as_str()` calls.

2 years agoRollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk
Matthias Krüger [Wed, 15 Dec 2021 00:28:06 +0000 (01:28 +0100)]
Rollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk

Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`

The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.

2 years agoUse `OutputFilenames` to generate output file for `-Zllvm-time-trace`
Tomasz Miąsko [Mon, 13 Dec 2021 00:00:00 +0000 (00:00 +0000)]
Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`

The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.

2 years agoStabilize asm! and global_asm!
Amanieu d'Antras [Fri, 10 Dec 2021 00:15:33 +0000 (00:15 +0000)]
Stabilize asm! and global_asm!

They are also removed from the prelude as per the decision in
https://github.com/rust-lang/rust/issues/87228.

stdarch and compiler-builtins are updated to work with the new, stable
asm! and global_asm! macros.

2 years agoRollup merge of #91625 - est31:remove_indexes, r=oli-obk
Matthias Krüger [Fri, 10 Dec 2021 21:40:36 +0000 (22:40 +0100)]
Rollup merge of #91625 - est31:remove_indexes, r=oli-obk

Remove redundant [..]s

2 years agoRollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett
Matthias Krüger [Thu, 9 Dec 2021 04:08:32 +0000 (05:08 +0100)]
Rollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett

Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per #90736.

cc ``@Lokathor``

r? ``@joshtriplett``

2 years agoRemove redundant [..]s
est31 [Fri, 3 Dec 2021 02:06:36 +0000 (03:06 +0100)]
Remove redundant [..]s

2 years agoAuto merge of #91604 - nikic:section-flags, r=nagisa
bors [Wed, 8 Dec 2021 14:58:48 +0000 (14:58 +0000)]
Auto merge of #91604 - nikic:section-flags, r=nagisa

Use object crate for .rustc metadata generation

We already use the object crate for generating uncompressed .rmeta
metadata object files. This switches the generation of compressed
.rustc object files to use the object crate as well. These have
slightly different requirements in that .rmeta should be completely
excluded from any final compilation artifacts, while .rustc should
be part of shared objects, but not loaded into memory.

The primary motivation for this change is #90326: In LLVM 14, the
current way of setting section flags (and in particular, preventing
the setting of SHF_ALLOC) will no longer work. There are other ways
we could work around this, but switching to the object crate seems
like the most elegant, as we already use it for .rmeta, and as it
makes this independent of the codegen backend. In particular, we
don't need separate handling in codegen_llvm and codegen_gcc.
codegen_cranelift should be able to reuse the implementation as
well, though I have omitted that here, as it is not based on
codegen_ssa.

This change mostly extracts the existing code for .rmeta handling
to allow using it for .rustc as well, and adjusts the codegen
infrastructure to handle the metadata object file separately: We
no longer create a backend-specific module for it, and directly
produce the compiled module instead.

This does not `fix` #90326 by itself yet, as .llvmbc will need to be
handled separately.

r? `@nagisa`

2 years agoRemove the reg_thumb register class for asm! on ARM
Amanieu d'Antras [Thu, 11 Nov 2021 12:42:38 +0000 (12:42 +0000)]
Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per #90736.

2 years agoUse object crate for .rustc metadata generation
Nikita Popov [Thu, 2 Dec 2021 11:24:25 +0000 (12:24 +0100)]
Use object crate for .rustc metadata generation

We already use the object crate for generating uncompressed .rmeta
metadata object files. This switches the generation of compressed
.rustc object files to use the object crate as well. These have
slightly different requirements in that .rmeta should be completely
excluded from any final compilation artifacts, while .rustc should
be part of shared objects, but not loaded into memory.

The primary motivation for this change is #90326: In LLVM 14, the
current way of setting section flags (and in particular, preventing
the setting of SHF_ALLOC) will no longer work. There are other ways
we could work around this, but switching to the object crate seems
like the most elegant, as we already use it for .rmeta, and as it
makes this independent of the codegen backend. In particular, we
don't need separate handling in codegen_llvm and codegen_gcc.
codegen_cranelift should be able to reuse the implementation as
well, though I have omitted that here, as it is not based on
codegen_ssa.

This change mostly extracts the existing code for .rmeta handling
to allow using it for .rustc as well, and adjust the codegen
infrastructure to handle the metadata object file separately: We
no longer create a backend-specific module for it, and directly
produce the compiled module instead.

This does not fix #90326 by itself yet, as .llvmbc will need to be
handled separately.

2 years agoImplement inline asm! for AVR platform
Andrew Dona-Couch [Thu, 25 Nov 2021 04:04:27 +0000 (23:04 -0500)]
Implement inline asm! for AVR platform

2 years agorustc_codegen_gcc: proper check for may_unwind
cynecx [Fri, 19 Nov 2021 22:37:09 +0000 (23:37 +0100)]
rustc_codegen_gcc: proper check for may_unwind

2 years agorustc_codegen_gcc: error on unwinding inline asm
cynecx [Fri, 12 Nov 2021 23:37:30 +0000 (00:37 +0100)]
rustc_codegen_gcc: error on unwinding inline asm

2 years agoAuto merge of #91003 - psumbera:sparc64-abi, r=nagisa
bors [Thu, 2 Dec 2021 02:59:44 +0000 (02:59 +0000)]
Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa

fix sparc64 ABI for aggregates with floating point members

Fixes #86163

2 years agofix sparc64 ABI for aggregates with floating point members
Petr Sumbera [Wed, 1 Dec 2021 09:03:45 +0000 (10:03 +0100)]
fix sparc64 ABI for aggregates with floating point members

2 years agoFeat: make cg_ssa get_param borrow the builder mutable
rdambrosio [Wed, 24 Nov 2021 03:30:20 +0000 (22:30 -0500)]
Feat: make cg_ssa get_param borrow the builder mutable

2 years agoRemove workaround for the forward progress handling in LLVM
Andreas Jonson [Sun, 14 Nov 2021 13:01:30 +0000 (14:01 +0100)]
Remove workaround for the forward progress handling in LLVM

2 years agoAuto merge of #89652 - rcvalle:rust-cfi, r=nagisa
bors [Wed, 27 Oct 2021 09:19:42 +0000 (09:19 +0000)]
Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa

Add LLVM CFI support to the Rust compiler

This PR adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments.

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) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).

Thank you, `@eddyb` and `@pcc,` for all the help!

2 years agoProperly check `target_features` not to trigger an assertion
Yuki Okushi [Wed, 20 Oct 2021 19:56:36 +0000 (04:56 +0900)]
Properly check `target_features` not to trigger an assertion

2 years agoAdd LLVM CFI support to the Rust compiler
Ramon de C Valle [Thu, 7 Oct 2021 22:33:13 +0000 (15:33 -0700)]
Add LLVM CFI support to the Rust compiler

This commit adds LLVM Control Flow Integrity (CFI) support to the Rust
compiler. It initially provides forward-edge control flow protection for
Rust-compiled code only by aggregating function pointers in groups
identified by their number of arguments.

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) will be provided in later work as
part of this project by defining and using compatible type identifiers
(see Type metadata in the design document in the tracking issue #89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e.,
-Clto).

2 years agoMake hash_result an Option.
Camille GILLOT [Sat, 16 Oct 2021 20:31:48 +0000 (22:31 +0200)]
Make hash_result an Option.

2 years agoRemove alloc::prelude
Amanieu d'Antras [Thu, 14 Oct 2021 23:41:31 +0000 (01:41 +0200)]
Remove alloc::prelude

As per the libs team decision in #58935.

Closes #58935

2 years agoAuto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser
bors [Mon, 11 Oct 2021 04:31:47 +0000 (04:31 +0000)]
Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser

Create more accurate debuginfo for vtables.

Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented.

This is only one of several possible improvements:
- This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits).
- The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object.

r? `@wesleywiser`

2 years agoCreate more accurate debuginfo for vtables.
Michael Woerister [Wed, 6 Oct 2021 12:26:50 +0000 (14:26 +0200)]
Create more accurate debuginfo for vtables.

Before this commit all vtables would have the same name "vtable" in
debuginfo. Now they get a name that identifies the implementing type
and the trait that is being implemented.

2 years agoMove rustc_middle::middle::cstore to rustc_session.
Camille GILLOT [Sat, 14 Nov 2020 02:02:03 +0000 (03:02 +0100)]
Move rustc_middle::middle::cstore to rustc_session.

2 years agoRebase fallout.
Camille GILLOT [Thu, 30 Sep 2021 18:22:42 +0000 (20:22 +0200)]
Rebase fallout.

2 years agoFix warnings (#98)
antoyo [Tue, 28 Sep 2021 13:32:54 +0000 (09:32 -0400)]
Fix warnings (#98)

2 years agoUpdate to nightly-2021-09-28 (#97)
antoyo [Tue, 28 Sep 2021 13:18:27 +0000 (09:18 -0400)]
Update to nightly-2021-09-28 (#97)

2 years agoFix/count trailing zeroes (#95)
antoyo [Tue, 28 Sep 2021 00:35:45 +0000 (20:35 -0400)]
Fix/count trailing zeroes (#95)

* Fix count trailing zeroes
* Fix pop count
* Fix bit reverse

2 years agoFix/mismatch types (#94)
antoyo [Mon, 27 Sep 2021 23:31:24 +0000 (19:31 -0400)]
Fix/mismatch types (#94)

* Refactor test.sh script

* Fix mismatched types error

2 years agoCleanup fix for global initialization (#93)
antoyo [Mon, 27 Sep 2021 13:34:06 +0000 (09:34 -0400)]
Cleanup fix for global initialization (#93)

* Cleanup fix for global initialization
* Remove linker script hack
* Use v0 symbol mangling
* Fix warnings

2 years agoFix global initialization (#91)
antoyo [Sun, 26 Sep 2021 16:20:02 +0000 (12:20 -0400)]
Fix global initialization (#91)

* Make define_global() return a RValue directly
* Return LValue in functions declaring a global variable
* Remove useless cast
* Fix bytes_in_context to use an array rvalue
* Remove global_names which is unused
* Make const_struct create a constant struct
* Correctly initialize global in static_addr_of_mut
* Fix global variable initialization
* Remove workaround for ARGV

2 years agoImpove handling of registers in inline asm (#82)
Commeownist [Sun, 26 Sep 2021 13:30:45 +0000 (16:30 +0300)]
Impove handling of registers in inline asm (#82)

* Correctly handle st(0) register in the clobbers list
* Gate the clobbers based on enabled target features

2 years agoAdd notes for cross-compilation to gcc-only targets (#68)
antoyo [Sun, 26 Sep 2021 04:06:42 +0000 (00:06 -0400)]
Add notes for cross-compilation to gcc-only targets (#68)

2 years agoUpdate to nightly-2021-09-11 (#79)
Commeownist [Fri, 17 Sep 2021 21:19:25 +0000 (00:19 +0300)]
Update to nightly-2021-09-11 (#79)

* Implement `black_box` as intrinsic

Responsibility of implementing the black box is now lies on backend

* Remove some TODOs

* Update to nightly-2021-09-17

* CI: don't fail on warnings

2 years agofix: gh origin on readme (#83)
Emerson Laurentino [Fri, 17 Sep 2021 01:47:19 +0000 (22:47 -0300)]
fix: gh origin on readme (#83)

2 years agoRemove FUNDING.yml
Antoni Boucher [Thu, 16 Sep 2021 11:37:23 +0000 (07:37 -0400)]
Remove FUNDING.yml

2 years agoImplement basic inline asm support (#72)
Commeownist [Sun, 5 Sep 2021 15:26:01 +0000 (18:26 +0300)]
Implement basic inline asm support (#72)

* Implement basic support for inline assembly

* Disable LTO

We don't support it yet at all

* Handle `inout(reg) var` correctly

Turns out that `+` readwrite output registers cannot be tied with
input variables.

* Add limited support for llvm_asm!

* Handle CHANNEL correctly

* Add support for arbitrary explicit registers

* Handle symbols properly

* Add rudimentary asm tests

* Exclude llvm_asm! tests from tests runs

* Insert `__builtin_unreachable()` after diverging asm blocks

2 years agoUpdate custom rustc instructions (#73)
antoyo [Sat, 28 Aug 2021 15:34:47 +0000 (11:34 -0400)]
Update custom rustc instructions (#73)

2 years agoEmpty gcc_path
Antoni Boucher [Sun, 15 Aug 2021 14:54:12 +0000 (10:54 -0400)]
Empty gcc_path

2 years agoCleanup (#67)
antoyo [Sun, 15 Aug 2021 12:28:46 +0000 (08:28 -0400)]
Cleanup (#67)

2 years agoUpdate to nightly-2021-08-12 (#61)
antoyo [Sat, 14 Aug 2021 14:05:49 +0000 (10:05 -0400)]
Update to nightly-2021-08-12 (#61)

2 years agoInitial commit
Antoni Boucher [Sun, 10 May 2020 14:54:30 +0000 (10:54 -0400)]
Initial commit