Commit Graph

3694 Commits

Author SHA1 Message Date
Michael Goulet
4ecd45a588 Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obk
Lower `unchecked_div`/`_rem` to MIR's `BinOp::Div`/`Rem`

As described in <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.BinOp.html#variant.Div>, the ordinary `BinOp`s for these are already UB for division by zero ([or overflow](https://llvm.org/docs/LangRef.html#sdiv-instruction), [demo](https://rust.godbolt.org/z/71e7P7Exh)), as MIR building is responsible for inserting code to panic for those cases regardless of whether the overflow checks are enabled.

So we can lower these in the same arm that lowers `wrapping_add` to MIR `BinOp::Add` and such, as all these cases turn into ordinary `Rvalue::BinaryOp`s.
2023-06-02 16:02:06 -07:00
bjorn3
e369cce377 Rustup to rustc 1.72.0-nightly (d59363ad0 2023-06-01) 2023-06-02 12:51:40 +00:00
bjorn3
b1961baf43 Sync from rust d59363ad0b 2023-06-02 12:44:25 +00:00
Deadbeef
fcd93accb4 Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
Scott McMurray
919da2f16c remove unchecked_div/_rem from cg_cranelift 2023-06-01 00:05:55 -07:00
Nilstrieb
04dca8f1b2 Rollup merge of #112060 - lcnr:early-binder, r=jackh726
`EarlyBinder::new` -> `EarlyBinder::bind`

for consistency with `Binder::bind`. it may make sense to also add `EarlyBinder::dummy` in places where we know that no parameters exist, but I left that out of this PR.

r? `@jackh726` `@kylematsuda`
2023-05-30 12:57:40 +02:00
Matthias Krüger
a2a8589a8a Rollup merge of #111827 - AngelicosPhosphoros:add_docs_to_cranelift, r=bjorn3
Add build instructions for cranelift backend as part of Rust repo

All other instructions assume that user works with separate repository than Rust compiler repository. When one follows default instructions, cranelift codegen tries to use different sys-root and compiler internal crates which leads to compiler errors when building it.

I needed to do all this steps while adding new intrinsic to rustc.

r? bjorn3
2023-05-29 21:34:16 +02:00
lcnr
b488625178 EarlyBinder::new -> EarlyBinder::bind 2023-05-29 13:46:10 +02:00
Kyle Matsuda
4e87728772 Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
bjorn3
62e603527d Don't explicitly remove needs-unwind tests
Compiletest now respects panic=abort in the --print cfg output
2023-05-28 11:04:15 +00:00
bjorn3
d91fabd44f Rustup to rustc 1.71.0-nightly (cca7ee581 2023-05-27) 2023-05-28 09:55:04 +00:00
bjorn3
ba0ab0a830 Sync from rust cca7ee5811 2023-05-28 09:49:57 +00:00
bjorn3
38b4b98598 Remove -preview tag from the llvm-tools component dependency 2023-05-28 09:11:07 +00:00
Guillaume Gomez
be82095e1c Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkin
Remove DesugaringKind::Replace.

A simple boolean flag is enough.
2023-05-27 13:38:31 +02:00
bjorn3
bd45794be5 Run tests against cg_llvm too in CI
Fixes #1115
2023-05-26 11:27:29 +00:00
bjorn3
72b194cd50 Fix #[cfg(target_os)] for macOS
Fixes #1376
2023-05-26 08:44:32 +00:00
bjorn3
202b14c802 Fix rustc test suite 2023-05-26 08:40:39 +00:00
bjorn3
b3415291a6 Rustup to rustc 1.71.0-nightly (a2b1646c5 2023-05-25) 2023-05-26 08:27:47 +00:00
bjorn3
35acd910bb Sync from rust a2b1646c59 2023-05-26 08:22:10 +00:00
Michael Goulet
2f250c73ba Rollup merge of #111950 - cjgillot:expn-noinline, r=oli-obk
Remove ExpnKind::Inlined.

Suggested in https://github.com/rust-lang/rust/pull/111815#issuecomment-1561903339

r? ``@oli-obk``
2023-05-25 13:58:02 -07:00
AngelicosPhosphoros
8aa3eba564 Added build instructions for cranelift backend as part of Rust repo
All other instructions assume that user works with separate repository than Rust compiler repository. When one follows default instructions, cranelift codegen tries to use different sys-root and compiler internal crates which leads to compiler errors when building it.

I needed to do all this steps while adding new intrinsic to rustc.
2023-05-25 23:34:42 +04:00
Camille GILLOT
03f275bc5a Remove DesugaringKind::Replace. 2023-05-25 17:40:46 +00:00
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