Commit Graph

3622 Commits

Author SHA1 Message Date
bors
e6d1a0ed95 Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix
Support #[global_allocator] without the allocator shim

This makes it possible to use liballoc/libstd in combination with `--emit obj` if you use `#[global_allocator]`. This is what rust-for-linux uses right now and systemd may use in the future. Currently they have to depend on the exact implementation of the allocator shim to create one themself as `--emit obj` doesn't create an allocator shim.

Note that currently the allocator shim also defines the oom error handler, which is normally required too. Once `#![feature(default_alloc_error_handler)]` becomes the only option, this can be avoided. In addition when using only fallible allocator methods and either `--cfg no_global_oom_handling` for liballoc (like rust-for-linux) or `--gc-sections` no references to the oom error handler will exist.

To avoid this feature being insta-stable, you will have to define `__rust_no_alloc_shim_is_unstable` to avoid linker errors.

(Labeling this with both T-compiler and T-lang as it originally involved both an implementation detail and had an insta-stable user facing change. As noted above, the `__rust_no_alloc_shim_is_unstable` symbol requirement should prevent unintended dependence on this unstable feature.)
2023-05-25 16:59:57 +00:00
Camille GILLOT
f9dabd8b88 Remove ExpnKind::Inlined. 2023-05-25 16:43:14 +00:00
bjorn3
134dc33485 Fix testing with unstable features disabled 2023-05-24 17:31:25 +00:00
bjorn3
72e67c862f Fix compiling all tests with LLVM 2023-05-24 17:27:32 +00:00
bjorn3
5b3bc29008 Allow testing a cranelift backend built into rustc itself
This avoids building cranelift twice in rust's CI and is a lot easier
than trying to make building of codegen backends work from within a
cargo invocation done by rust's build system.
2023-05-24 17:27:28 +00:00
Maybe Waffle
a3b816be53 Use is_some_and/is_ok_and in less obvious spots 2023-05-24 14:33:43 +00:00
bjorn3
c87dfd9c9d Update Cranelift to 0.96.1
There was a minor bug in Wasmtime that needed a new release. Nothing
changed in Cranelift.
2023-05-23 11:55:07 +00:00
bjorn3
031bfa659f Print symbol name in PrintOnPanic for define_function 2023-05-23 11:48:34 +00:00
bjorn3
a684753a68
Merge pull request #1374 from bjorn3/non_rustup_build3
Allow building and testing without rustup
2023-05-22 20:58:07 +02:00
bjorn3
24f1569c85 Enable overflow-checks on CI
Unlike rustc with cargo debug-assertions = true doesn't imply overflow-checks = true
2023-05-22 18:35:56 +00:00
bjorn3
a555b8ab7e Add fixme 2023-05-22 17:17:50 +00:00
bjorn3
a2f720d9fe Allow building and testing without rustup
This can be done by installing the nightly specified in
rust-toolchain.toml and then pointing the CARGO, RUSTC and RUSTDOC env
vars to the right executables.
2023-05-22 17:17:05 +00:00
bjorn3
22befab611 Avoid hard-coding rustc path in prepare.rs 2023-05-22 17:17:05 +00:00
bjorn3
b1d8b7186c Only pass --frozen to cargo when it is passed to y.rs 2023-05-22 17:17:05 +00:00
bjorn3
2155c03500 Inline Compiler::bootstrap_with_triple 2023-05-22 17:10:55 +00:00
bjorn3
de8a4d5d46 Remove all implicit "rustc" from rustc_info.rs 2023-05-22 17:10:55 +00:00
bjorn3
6900c9943d Update Cranelift to 0.96.0 2023-05-22 16:06:01 +00:00
Dylan DPC
84644eb9c6 Rollup merge of #111633 - nnethercote:avoid-ref-format, r=WaffleLapkin
Avoid `&format("...")` calls in error message code.

Some error message cleanups. Best reviewed one commit at a time.

r? `@davidtwco`
2023-05-18 10:52:35 +05:30
Nilstrieb
74ab27c269 Remove LangItems::require
It's just a short wrapper used by `tcx.require_lang_item`. Deleting it
gives us a negative diff.
2023-05-16 19:53:38 +02:00
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