Commit Graph

3853 Commits

Author SHA1 Message Date
Nicholas Nethercote
8a9b38fd3b Avoid &format("...") calls in error message code.
Error message all end up passing into a function as an `impl
Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as
`&format("...")` that means we allocate a string (in the `format!`
call), then take a reference, and then clone (allocating again) the
reference to produce the `{D,Subd}iagnosticMessage`, which is silly.

This commit removes the leading `&` from a lot of these cases. This
means the original `String` is moved into the
`{D,Subd}iagnosticMessage`, avoiding the double allocations. This
requires changing some function argument types from `&str` to `String`
(when all arguments are `String`) or `impl
Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and
some are `&str`).
2023-05-16 17:59:56 +10:00
bjorn3
b773282309 Use --sysroot ... instead of --sysroot=...
Rust's build system doesn't handle --sysroot=... correctly
2023-05-14 13:00:00 +00:00
bjorn3
521d937116 Pass --cap-lints=allow to tests 2023-05-14 12:53:00 +00:00
bjorn3
d16ba45fe4
Merge pull request #1373 from bjorn3/more_bench
Benchmark clif release builds with ./y.rs bench
2023-05-14 14:49:55 +02:00
bjorn3
a43f08363e Benchmark clif release builds with ./y.rs bench 2023-05-14 12:19:11 +00:00
bjorn3
88ae8fc9c8 Allow passing more than two commands to benchmark to hyperfine_command 2023-05-14 12:04:55 +00:00
bjorn3
d2a8023948 Fix CirrusCI 2023-05-14 10:17:12 +00:00
bjorn3
e39191594f Support _mm_movemask_ps 2023-05-12 17:07:38 +00:00
bjorn3
899d193c9d Implement a couple more platform intrinsics 2023-05-12 17:07:31 +00:00
bjorn3
ecbb33a71b Implement and fix a couple more simd intrinsics 2023-05-12 13:25:58 +00:00
bjorn3
f6ba10dead Fix rustc test suite 2023-05-12 12:58:56 +00:00
bjorn3
9b2a0984e9 Rustup to rustc 1.71.0-nightly (2a8221dbd 2023-05-11) 2023-05-12 12:50:44 +00:00
bjorn3
d6656403a3 Sync from rust 2a8221dbdf 2023-05-12 12:45:38 +00:00
bjorn3
2253e866a9 Prevent insta-stable no alloc shim support
You will need to add the following as replacement for the old __rust_*
definitions when not using the alloc shim.

    #[no_mangle]
    static __rust_no_alloc_shim_is_unstable: u8 = 0;
2023-05-11 14:35:09 +00:00
bjorn3
a1d0a902c3 Use global_fn_name instead of format! 2023-05-11 14:35:09 +00:00
bjorn3
5930509272 Split AllocatorKind::fn_name in global_fn_name and default_fn_name 2023-05-11 14:35:08 +00:00
bjorn3
002aa8ed90 Don't use an allocator shim for #[global_allocator]
This makes it possible to use liballoc/libstd in combination with
`--emit obj` if you use `#[global_allocator]`. Making it work for the
default libstd allocator would require weak functions, which are not
well supported on all systems.
2023-05-11 14:23:31 +00:00
Kyle Matsuda
db3faa78d0 use EarlyBinder in tcx.(try_)subst_mir_and_normalize_erasing_regions 2023-05-06 22:32:39 -06:00
bjorn3
dfb11195da Replace once_cell with the newly stabilized std::sync::OnceLock 2023-05-05 18:55:34 +00:00
bjorn3
4ef286c038 Fix rustc test suite 2023-05-05 12:46:12 +00:00
bjorn3
332b54a6d3 Rustup to rustc 1.71.0-nightly (74c482104 2023-05-04) 2023-05-05 12:45:06 +00:00
bjorn3
7905fa92ce Fix rustc test suite 2023-05-04 11:24:58 +00:00
bjorn3
edd0e5df3b Rustup to rustc 1.71.0-nightly (473f916d8 2023-05-03) 2023-05-04 10:21:07 +00:00
bjorn3
b7decf2899 Sync from rust 473f916d83 2023-05-04 10:14:36 +00:00
Nicholas Nethercote
a4c49374cb Restrict From<S> for {D,Subd}iagnosticMessage.
Currently a `{D,Subd}iagnosticMessage` can be created from any type that
impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static,
str>`, which are reasonable. It also includes `&String`, which is pretty
weird, and results in many places making unnecessary allocations for
patterns like this:
```
self.fatal(&format!(...))
```
This creates a string with `format!`, takes a reference, passes the
reference to `fatal`, which does an `into()`, which clones the
reference, doing a second allocation. Two allocations for a single
string, bleh.

This commit changes the `From` impls so that you can only create a
`{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static,
str>`. This requires changing all the places that currently create one
from a `&String`. Most of these are of the `&format!(...)` form
described above; each one removes an unnecessary static `&`, plus an
allocation when executed. There are also a few places where the existing
use of `&String` was more reasonable; these now just use `clone()` at
the call site.

As well as making the code nicer and more efficient, this is a step
towards possibly using `Cow<'static, str>` in
`{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing
the `From<&'a str>` impls to `From<&'static str>`, which is doable, but
I'm not yet sure if it's worthwhile.
2023-05-03 08:44:39 +10:00
Ben Kimock
249a6f8fe1 Box AssertKind 2023-05-01 23:12:41 -04:00
Ralf Jung
d530c043f7 Merge from rustc 2023-04-30 22:35:29 +02:00
bjorn3
215dd7aa0d Add some extra instructions for using the precompiled builds 2023-04-29 13:31:06 +00:00
bjorn3
456ef8b39f Merge branch 'sync_from_rust' 2023-04-29 12:05:00 +00:00
bjorn3
8bf550e616 Merge commit 'ef07e8e60f994ec014d049a95591426fb92ebb79' into sync_cg_clif-2023-04-29 2023-04-29 12:00:43 +00:00
bjorn3
ef07e8e60f Integrate better with Cranelift's profiling infrastructure 2023-04-29 11:27:28 +00:00
bjorn3
517b5c1f1b Update Cranelift to 0.95.1
This version was released as part of a security fix for Wasmtime. The
fix didn't change Cranelift though, so this commit is not strictly
necessary, but also doesn't hurt.
2023-04-29 11:24:05 +00:00
bjorn3
ee3721eec6 Rustup to rustc 1.71.0-nightly (f49560538 2023-04-28) 2023-04-29 11:16:48 +00:00
bjorn3
72022bb24d Sync from rust f495605381 2023-04-29 11:10:56 +00:00
Ralf Jung
7a77541c06 Merge from rustc 2023-04-28 15:49:39 +02:00
Boxy
2f624db5ea rename needs_infer to has_infer 2023-04-27 08:35:19 +01:00
Ralf Jung
20571f60bb Merge from rustc 2023-04-26 09:51:54 +02:00
Scott McMurray
065d81ac6f Lower intrinsics::offset to mir::BinOp::Offset
They're semantically the same, so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-04-25 19:23:45 -07:00
bjorn3
0c79ce3bac Add two fixmes 2023-04-25 17:40:12 +00:00
bjorn3
c5be67ba36 Pass all extra args in rustc-clif before user supplied args
This allows the user to overwrite them and prevents confusing error
messages if the last argument supplied expects a value.
2023-04-25 17:39:20 +00:00
bjorn3
a7c797909c Make rustdoc using run-make tests work 2023-04-25 13:43:27 +00:00
bjorn3
b56d4ab66b Update portable-simd test 2023-04-25 12:32:24 +00:00
bjorn3
669b1e367c Rustup to rustc 1.71.0-nightly (f5559e338 2023-04-24) 2023-04-25 11:37:18 +00:00
bjorn3
1c978ee516 Sync from rust f5559e3382 2023-04-25 11:32:28 +00:00
Matthias Krüger
b908472a93 Revert "Remove #[alloc_error_handler] from the compiler and library"
This reverts commit abc0660118.
2023-04-25 00:08:35 +02:00
Maybe Waffle
106db3ef59 Fix rustc_index imports outside the compiler 2023-04-24 13:53:37 +00:00
Maybe Waffle
dd172d08d4 Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
Ralf Jung
fc7b3ebfe9 Merge from rustc 2023-04-24 11:59:11 +02:00
bors
c7155f2a78 Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwco
Report allocation errors as panics

OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`.

This should be review one commit at a time:
- The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics.
- The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API.

ACP: https://github.com/rust-lang/libs-team/issues/192

Closes #51540
Closes #51245
2023-04-22 12:27:45 +00:00
Ralf Jung
b05a03b4c5 Merge from rustc 2023-04-22 10:35:35 +02:00