Commit Graph

2619 Commits

Author SHA1 Message Date
bors
86daae2e6b Auto merge of #88098 - Amanieu:oom_panic, r=nagisa
Implement -Z oom=panic

This PR removes the `#[rustc_allocator_nounwind]` attribute on `alloc_error_handler` which allows it to unwind with a panic instead of always aborting. This is then used to implement `-Z oom=panic` as per RFC 2116 (tracking issue #43596).

Perf and binary size tests show negligible impact.
2022-03-18 03:01:46 +00:00
bjorn3
ce577f7f12 Fix and re-enable some rustc tests
* Set `config.opts.trimmed_def_paths` to `GoodPath` to trim def paths in
  error messages as expected by the rustc test suite
* Fix `$SRC_DIR` normalization for out of tree compiled standard library
2022-03-17 20:59:39 +01:00
bjorn3
9a8da8c64a Slightly speed up building of y.rs 2022-03-16 19:21:24 +01:00
mark
c56a10ca3b rustc_error: make ErrorReported impossible to construct
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-16 10:35:24 -05:00
bjorn3
64bc2352ee Silence warning 2022-03-16 12:05:02 +01:00
bjorn3
d08d32fa5d Trim down alloc_system.rs
It is used only by a single test. Also remove the dependency on the libc
crate.
2022-03-15 19:25:42 +01:00
bjorn3
5c666ea7ec Remove some unused feature gates 2022-03-15 19:25:33 +01:00
bjorn3
88c3719c68 Avoid once_cell unstable feature in cg_clif.rs 2022-03-15 19:25:33 +01:00
bjorn3
a900a5229a Download tarballs from github instead of cloning full repos
This saves 40-50s on CI as the repo history can be skipped
2022-03-15 12:44:06 +01:00
bjorn3
af008bdc66 Rustup to rustc 1.61.0-nightly (285fa7ecd 2022-03-14) 2022-03-15 11:21:42 +01:00
bjorn3
4ba83cbfca
Merge pull request #1220 from bjorn3/dont_print_on_trap
Replace a lot of print+trap with plain trap
2022-03-14 12:51:47 +01:00
bjorn3
d8e7501584 Replace a lot of print+trap with plain trap
This reduces binary sizes by a decent amount:

libstd.so: 17% reduction
mini_core_hello_world: 27% reduction
simple-raytracer: 27% reduction

This also improves compile time of simple-raytracer by 0.5s (4% +- 2%)
In addition it is also a pre-requisite for building standalone binaries.
2022-03-14 12:02:36 +01:00
bjorn3
90f8aefe71 Mark cold blocks 2022-03-13 19:36:40 +01:00
bjorn3
7eb454124f Update list of ignores rustc tests 2022-03-13 19:24:57 +01:00
bjorn3
a48fea6dda Add and remove some fixmes 2022-03-13 17:58:02 +01:00
bjorn3
fef517eae7 Remove almost all remaining feature gates
Only rustc_private is still enabled as cg_clif by definition needs to
use internal rustc api's.
2022-03-13 17:55:55 +01:00
bjorn3
cfc1a2cd68 Remove decl_macro usage
This reduces the amount of unstable features used by cg_clif
2022-03-13 15:19:48 +01:00
bjorn3
e937265673 Rustup to rustc 1.61.0-nightly (f103b2969 2022-03-12) 2022-03-13 15:04:33 +01:00
bjorn3
6e42ca187f Sync from rust 4800c7816e 2022-03-13 14:39:10 +01:00
Nicholas Nethercote
e439761b8f 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`.
2022-03-11 13:31:24 +11:00
bjorn3
d2026d679e Update Cranelift to 0.82.1
This fixes a miscompilation
2022-03-10 14:50:09 +01:00
bjorn3
54920ff25e Add missing clif ir comment 2022-03-09 19:33:55 +01:00
bjorn3
01ffb98db5 Update dependencies 2022-03-08 20:08:50 +01:00
bjorn3
3ccf12acdd Update Cranelift to 0.82.0 2022-03-08 20:01:48 +01:00
bjorn3
401b03443b Fix Box deref for non-ZST allocators 2022-03-08 20:00:11 +01:00
bjorn3
5841caa6ef Fix compiletest compilation 2022-03-08 12:13:33 +01:00
bjorn3
1b75d1146f Rustup to rustc 1.61.0-nightly (03918badd 2022-03-07) 2022-03-08 11:29:17 +01:00
bjorn3
2577efb434 Sync from rust 67b3e81838 2022-03-08 11:11:51 +01:00
Nicholas Nethercote
8723fe0b6b 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.
2022-03-07 13:41:47 +11:00
Nicholas Nethercote
7c1a318c7b 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.
2022-03-07 08:25:50 +11:00
bjorn3
c5ec4d353c Fix typo 2022-03-04 20:45:04 +01:00
Amanieu d'Antras
e29149552e Add -Z oom={panic,abort} command-line option 2022-03-03 12:58:38 +00:00
mark
346108202d rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
Tomasz Miąsko
69bd5324ca Normalize main return type during mono item collection & codegen 2022-02-23 22:33:50 +01:00
bjorn3
057de8f12e Merge branch 'sync_from_rust' 2022-02-23 11:51:21 +01:00
bjorn3
b5cbb87e62 Merge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into sync_cg_clif-2022-02-23 2022-02-23 11:49:34 +01:00
bjorn3
35d9c6bf25 Rustup to rustc 1.61.0-nightly (68369a041 2022-02-22) 2022-02-23 11:45:41 +01:00
bjorn3
ca1f3e752e Sync from rust bafe8d06e0 2022-02-23 11:38:28 +01:00
bjorn3
dc973aef2a Rustup to rustc 1.61.0-nightly (03a8cc7df 2022-02-21) 2022-02-22 20:37:22 +01:00
bjorn3
33cf8fafd8 Sync from rust 03a8cc7df1 2022-02-22 19:55:24 +01:00
Matthias Krüger
a063e138b6 Rollup merge of #94169 - Amanieu:asm_stuff, r=nagisa
Fix several asm! related issues

This is a combination of several fixes, each split into a separate commit. Splitting these into PRs is not practical since they conflict with each other.

Fixes #92378
Fixes #85247

r? ``@nagisa``
2022-02-22 12:16:28 +01:00
Amanieu d'Antras
73cf3aaa78 Take CodegenFnAttrs into account when validating asm! register operands
Checking of asm! register operands now properly takes function
attributes such as #[target_feature] and #[instruction_set] into
account.
2022-02-21 18:28:22 +00:00
Amanieu d'Antras
e62c26e39d On ARM, use relocation_model to detect whether r9 should be reserved
The previous approach of checking for the reserve-r9 target feature
didn't actually work because LLVM only sets this feature very late when
initializing the per-function subtarget.
2022-02-21 18:28:22 +00:00
lcnr
d34bcdd49c use List<Ty<'tcx>> for tuples 2022-02-21 07:09:11 +01:00
bjorn3
2aad0066ba Update ignored rustc tests list 2022-02-20 17:11:59 +01:00
bjorn3
4a5b069558 Rustup to rustc 1.61.0-nightly (3b348d932 2022-02-19) 2022-02-20 16:28:22 +01:00
Mark Rousskov
7e80bc3c8d Move ty::print methods to Drop-based scope guards 2022-02-16 17:24:23 -05:00
bjorn3
f606a5807c Rustup to rustc 1.60.0-nightly (09cb29c64 2022-02-15) 2022-02-16 12:43:07 +01:00
bjorn3
4563abd4f1 Sync from rust a240ccd81c 2022-02-16 12:14:53 +01:00
Nicholas Nethercote
06bc64df92 Overhaul Const.
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as
this:
```
pub struct Const<'tcx>(&'tcx Interned<ConstS>);
```
This now matches `Ty` and `Predicate` more closely, including using
pointer-based `eq` and `hash`.

Notable changes:
- `mk_const` now takes a `ConstS`.
- `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a
  we need separate arena for it, because we can't use the `Dropless` one any
  more.
- Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes
- Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes.
- Lots of tedious sigil fiddling.
2022-02-15 16:19:59 +11:00