Commit Graph

4118 Commits

Author SHA1 Message Date
bjorn3
c53025b45d Add needs-unwind annotations to a couple of tests 2024-03-25 14:19:07 +00:00
bjorn3
0231d65cec Rustup to rustc 1.79.0-nightly (0824b300e 2024-03-24) 2024-03-25 14:05:11 +00:00
bjorn3
28d480b881 Sync from rust 0824b300eb 2024-03-25 13:59:27 +00:00
Michael Goulet
4609a48d6a Add async-closures/once.rs back to cranelift tests 2024-03-24 21:42:32 -04:00
Scott McMurray
629a772585 Add+Use mir::BinOp::Cmp 2024-03-23 23:23:41 -07:00
Ralf Jung
905550149f also rename the SIMD intrinsic 2024-03-23 23:03:37 +01:00
Ralf Jung
a517adc66e move assert_unsafe_preconditions to its own file
These macros and functions are not intrinsics, after all.
2024-03-23 18:44:17 +01:00
Ralf Jung
c7ab6b5030 rename MIR int2ptr casts to match library name 2024-03-23 13:18:33 +01:00
bors
7f0f9f6580 Auto merge of #122852 - compiler-errors:raw-ptr, r=lcnr
Remove `TypeAndMut` from `ty::RawPtr` variant, make it take `Ty` and `Mutability`

Pretty much mechanically converting `ty::RawPtr(ty::TypeAndMut { ty, mutbl })` to `ty::RawPtr(ty, mutbl)` and its fallout.

r? lcnr

cc rust-lang/types-team#124
2024-03-22 20:34:14 +00:00
bjorn3
593228373d Remove workaround for UB in cranelift-jit that has been fixed 2024-03-22 18:58:36 +00:00
bjorn3
e2cc8ebd87 Rustup to rustc 1.79.0-nightly (0ad927c0c 2024-03-21) 2024-03-22 18:51:59 +00:00
bjorn3
087385a1e7 Sync from rust 0ad927c0c0 2024-03-22 18:44:52 +00:00
bjorn3
ae0e6e22f0 Update to Cranelift 0.106 2024-03-22 18:34:00 +00:00
bors
9057355f50 Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix
"Handle" calls to upstream monomorphizations in compiler_builtins

This is pretty cooked, but I think it works.

compiler-builtins has a long-standing problem that at link time, its rlib cannot contain any calls to `core`. And yet, in codegen we _love_ inserting calls to symbols in `core`, generally from various panic entrypoints.

I intend this PR to attack that problem as completely as possible. When we generate a function call, we now check if we are generating a function call from `compiler_builtins` and whether the callee is a function which was not lowered in the current crate, meaning we will have to link to it.

If those conditions are met, actually generating the call is asking for a linker error. So we don't. If the callee diverges, we lower to an abort with the same behavior as `core::intrinsics::abort`. If the callee does not diverge, we produce an error. This means that compiler-builtins can contain panics, but they'll SIGILL instead of panicking. I made non-diverging calls a compile error because I'm guessing that they'd mostly get into compiler-builtins by someone making a mistake while working on the crate, and compile errors are better than linker errors. We could turn such calls into aborts as well if that's preferred.
2024-03-22 16:55:11 +00:00
Michael Goulet
155b46aeb2 Programmatically convert some of the pat ctors 2024-03-22 11:13:29 -04:00
Michael Goulet
dfc1bd7516 Eagerly convert some ctors to use their specialized ctors 2024-03-22 11:12:01 -04:00
Mark Rousskov
05783c8ed6 Codegen const panic messages as function calls
This skips emitting extra arguments at every callsite (of which there
can be many). For a librustc_driver build with overflow checks enabled,
this cuts 0.7MB from the resulting binary.
2024-03-22 09:55:50 -04:00
bjorn3
9ddba16363
Merge pull request #1467 from BeetleFunk/global-asm-ice
Avoid ICE when global_asm const operand fails to evaluate
2024-03-21 23:06:33 +01:00
BeetleFunk
eb752bc6a7 Avoid ICE when global_asm const operand fails to evaluate 2024-03-21 11:59:03 -04:00
Oli Scherer
06ef32c862 Make ptr_guaranteed_cmp a rustc_intrinsic and favor its body over backends implementing it 2024-03-19 09:17:40 +00:00
bjorn3
c49f608062 Several refactorings to constant.rs
* Move the done hash set from ConstantCx to define_all_allocs.
* Move check if alloc has already been defined to the start of the loop.
* Extract helper function for vtables.
2024-03-18 15:10:23 +00:00
bjorn3
b64079d631 Re-enable rmake.rs tests as a compiletest bug has been fixed 2024-03-18 14:08:59 +00:00
bjorn3
1aac27e6b6 Rustup to rustc 1.79.0-nightly (eb45c8444 2024-03-17) 2024-03-18 13:59:53 +00:00
Oli Scherer
eeca87b8c7 Avoid various uses of Option<Span> in favor of using DUMMY_SP in the few cases that used None 2024-03-18 09:34:08 +00:00
Ben Kimock
e46114fdc8 Handle calls to upstream monomorphizations in compiler_builtins 2024-03-16 15:22:05 -04:00
bjorn3
db15302b5d Merge branch 'sync_from_rust' 2024-03-16 17:25:11 +00:00
bjorn3
4b61629951 Merge commit '4cf4ffc6ba514f171b3f52d1c731063e4fc45be3' into sync_cg_clif-2024-03-16 2024-03-16 17:23:11 +00:00
bjorn3
4cf4ffc6ba Fix rustc test suite 2024-03-16 16:30:08 +00:00
bjorn3
e775fdc9e9 Don't try to get a ty for a nested allocation
Fixes rust-lang/rustc_codegen_cranelift#1464
2024-03-16 16:17:58 +00:00
bjorn3
9f162c49cb Rustup to rustc 1.78.0-nightly (c67326b06 2024-03-15) 2024-03-16 16:17:16 +00:00
bjorn3
0000db58c6 Sync from rust c67326b063 2024-03-16 13:25:40 +00:00
Matthias Krüger
47abd3a486 Rollup merge of #122287 - RalfJung:simd-static-assert, r=pnkfelix
add test ensuring simd codegen checks don't run when a static assertion failed

stdarch relies on this to ensure that SIMD indices are in bounds.

I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. `@oli-obk` `@bjorn3` do you have any idea?
2024-03-14 15:44:33 +01:00
Jacob Pratt
221402e863 Rollup merge of #121840 - oli-obk:freeze, r=dtolnay
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of https://github.com/rust-lang/rust/pull/121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: https://github.com/google/zerocopy/issues/941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: https://github.com/rust-lang/rust/pull/121501#issuecomment-1969827742
2024-03-11 03:47:19 -04:00
Ralf Jung
fe7be63dae add comments explaining where post-mono const eval errors abort compilation 2024-03-10 14:39:26 +01:00
Ralf Jung
01affeb53a use Instance::expect_resolve() instead of unwraping Instance::resolve() 2024-03-10 11:49:33 +01:00
bors
ef862a707b Auto merge of #121662 - saethlin:precondition-unification, r=RalfJung
Distinguish between library and lang UB in assert_unsafe_precondition

As described in https://github.com/rust-lang/rust/pull/121583#issuecomment-1963168186, `assert_unsafe_precondition` now explicitly distinguishes between language UB (conditions we explicitly optimize on) and library UB (things we document you shouldn't do, and maybe some library internals assume you don't do).

`debug_assert_nounwind` was originally added to avoid the "only at runtime" aspect of `assert_unsafe_precondition`. Since then the difference between the macros has gotten muddied. This totally revamps the situation.

Now _all_ preconditions shall be checked with `assert_unsafe_precondition`. If you have a precondition that's only checkable at runtime, do a `const_eval_select` hack, as done in this PR.

r? RalfJung
2024-03-10 01:23:54 +00:00
bjorn3
07633821ed Add bcryptprimitives.dll shim for wine 2024-03-09 19:51:11 +00:00
bjorn3
e18201deca Fix rustc test suite 2024-03-09 17:35:49 +00:00
bjorn3
f5a192b736 Rustup to rustc 1.78.0-nightly (46b180ec2 2024-03-08) 2024-03-09 16:20:13 +00:00
Ben Kimock
127c232050 Distinguish between library and lang UB in assert_unsafe_precondition 2024-03-08 18:53:58 -05:00
bjorn3
77dae8c881 Merge branch 'sync_from_rust' 2024-03-08 20:43:24 +00:00
bjorn3
5ec45d3d7a Merge commit '54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba' into sync_cg_clif-2024-03-08 2024-03-08 20:41:29 +00:00
bjorn3
54cbb6e753 Use sqrt clif instruction for sqrt rust intrinsics 2024-03-08 20:20:45 +00:00
bjorn3
b0809eadef Cleanup .gitignore 2024-03-08 19:52:57 +00:00
bjorn3
da083a8fc2 Remove configuration section from readme
None of these options are available in the rustup version, so it only
has the potential for confusion.
2024-03-08 19:52:51 +00:00
bjorn3
436fce0747 Remove y.rs
It has been deprecated for over a year now.
2024-03-08 19:37:23 +00:00
bjorn3
2b0f51b0b8 Disable Linux MinGW cross-compilation testing for now 2024-03-08 19:02:56 +00:00
bjorn3
6b220e5a2e Disable portable-simd sqrt test on MinGW 2024-03-08 19:02:56 +00:00
bjorn3
4976aa5216 Workaround a couple of bugs in rustc's test suite 2024-03-08 19:02:56 +00:00
bjorn3
5320a800e3 Rustup to rustc 1.78.0-nightly (9c3ad802d 2024-03-07) 2024-03-08 10:22:03 +00:00