Commit Graph

1411 Commits

Author SHA1 Message Date
Michael Goulet
41b758f437 Rollup merge of #119538 - nnethercote:cleanup-errors-5, r=compiler-errors
Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to https://github.com/rust-lang/rust/pull/119171.

r? ````@compiler-errors````
2024-01-05 10:57:21 -05:00
Matthias Krüger
fe71e04f7f Rollup merge of #119431 - taiki-e:asm-s390x-reg-addr, r=Amanieu
Support reg_addr register class in s390x inline assembly

In s390x, `r0` cannot be used as an address register (it is evaluated as zero in an address context).

Therefore, currently, in assemblies involving memory accesses, `r0` must be [marked as clobbered](1a1155653a/src/arch/s390x.rs (L58)) or [explicitly used to a non-address](1a1155653a/src/arch/s390x.rs (L135)) or explicitly use an address register to prevent `r0` from being allocated to a register for the address.

This patch adds a register class for allocating general-purpose registers, except `r0`, to make it easier to use address registers. (powerpc already has a register class (reg_nonzero) for a similar purpose.)

This is identical to the `a` constraint in LLVM and GCC:

https://llvm.org/docs/LangRef.html#supported-constraint-code-list
> a: A 32, 64, or 128-bit integer address register (excludes R0, which in an address context evaluates as zero).

https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
> a
> Address register (general purpose register except r0)

cc ``@uweigand``

r? ``@Amanieu``
2024-01-04 15:33:59 +01:00
antoyo
fac7c3109d
Merge pull request #408 from GuillaumeGomez/intrinsics-conversion
Update intrinsics conversion
2024-01-03 10:00:56 -05:00
Guillaume Gomez
b5681ca4aa Update intrinsics conversion 2024-01-03 15:27:19 +01:00
Taiki Endo
f93e985664 Support reg_addr register class in s390x inline assembly 2024-01-03 18:00:37 +09:00
Nicholas Nethercote
a56eff2b41 Rename some Diagnostic setters.
`Diagnostic` has 40 methods that return `&mut Self` and could be
considered setters. Four of them have a `set_` prefix. This doesn't seem
necessary for a type that implements the builder pattern. This commit
removes the `set_` prefixes on those four methods.
2024-01-03 19:40:20 +11:00
antoyo
a91d9e1dce
Merge pull request #405 from GuillaumeGomez/rustify-cargo-sh
Rustify `cargo.sh`
2023-12-30 07:37:45 -05:00
bors
a2efaf0030 Auto merge of #118705 - WaffleLapkin:codegen-atomic-exhange-untuple, r=cjgillot
Change `rustc_codegen_ssa`'s `atomic_cmpxchg` interface to return a pair of values

Doesn't change much, but a little nicer that way.
2023-12-30 07:42:19 +00:00
Guillaume Gomez
c122376493 Don't show cargo command errors 2023-12-29 21:27:36 +01:00
Michael Goulet
eca05c6cb0 Remove movability from TyKind::Coroutine 2023-12-28 16:35:01 +00:00
Bernd Schmidt
69b5a9f2eb Change rustc_codegen_ssa's atomic_cmpxchg interface to return a pair of values 2023-12-28 09:40:47 +00:00
Nicholas Nethercote
02ed790631 Remove Session methods that duplicate DiagCtxt methods.
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
Guillaume Gomez
ec94074817 Correctly take into account potential position of cargo command in y.sh 2023-12-23 00:13:09 +01:00
Guillaume Gomez
2e52b08800 Rustify cargo.sh 2023-12-23 00:13:09 +01:00
antoyo
b2e0cc5cec
Merge pull request #399 from GuillaumeGomez/checkout
If the rustc commit cannot be retrieve, just checkout the repository
2023-12-21 16:11:03 -05:00
Antoni Boucher
a53495ab45 Add comment 2023-12-21 11:18:11 -05:00
Guillaume Gomez
6631dd9dd2 Don't stop test if llvm FileCheck cannot be found 2023-12-20 21:44:12 +01:00
Guillaume Gomez
87a704a227 If the rustc commit cannot be retrieve, just checkout the repository 2023-12-20 21:33:21 +01:00
antoyo
9131ece832
Merge pull request #397 from GuillaumeGomez/rm-rustup-sh
Remove unused `rustup.sh` script
2023-12-20 15:27:57 -05:00
Guillaume Gomez
9a8245fed8 Remove unused rustup.sh script 2023-12-20 16:19:03 +01:00
antoyo
7dad07a67c
Merge pull request #396 from GuillaumeGomez/rustify-clean-all
Rustify `clean_all.sh`
2023-12-20 10:09:16 -05:00
Guillaume Gomez
e26e074261 Rustify clean_all.sh 2023-12-20 15:47:50 +01:00
Guillaume Gomez
05ef68961b Remove unused build_sysroot.sh file 2023-12-20 14:47:42 +01:00
antoyo
e0c4d65e07
Merge pull request #384 from GuillaumeGomez/rustify-test
Rustify test.sh
2023-12-19 17:06:40 -05:00
Guillaume Gomez
8e870c75d9 Remove unused TestArgs::use_backend and display messages in case a test is not run 2023-12-19 22:25:48 +01:00
Guillaume Gomez
6e53832eda Simplify Runner type alias 2023-12-19 21:15:28 +01:00
antoyo
db494375ab
Merge pull request #382 from sadlerap/impl-generic-arithmetic-pass
simd: implement missing intrinsics from simd/generic-arithmetic-pass.rs
2023-12-19 13:00:35 -05:00
Guillaume Gomez
a46066ca23 Remove ignored commands from gcc12 CI 2023-12-19 16:55:22 +01:00
Guillaume Gomez
984e045848 Show output of --mini-tests and --std-tests commands 2023-12-19 16:54:02 +01:00
Guillaume Gomez
bb4fd2c638 Simplify code by removing unneeded pattern matching 2023-12-19 01:16:29 +01:00
Guillaume Gomez
f516c96811 Add comment about why -Cpanic=abort option is needed 2023-12-19 01:07:01 +01:00
Guillaume Gomez
a8b0e30a8b Error earlier if the rustc host cannot be found 2023-12-18 23:25:23 +01:00
Nicholas Nethercote
472ea06999 Add level arg to into_diagnostic.
And make all hand-written `IntoDiagnostic` impls generic, by using
`DiagnosticBuilder::new(dcx, level, ...)` instead of e.g.
`dcx.struct_err(...)`.

This means the `create_*` functions are the source of the error level.
This change will let us remove `struct_diagnostic`.

Note: `#[rustc_lint_diagnostics]` is added to `DiagnosticBuilder::new`,
it's necessary to pass diagnostics tests now that it's used in
`into_diagnostic` functions.
2023-12-19 09:19:25 +11:00
Nicholas Nethercote
5ea71c1150 Rename many DiagCtxt arguments. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote
a5c63ae13b Rename CodegenContext::create_diag_handler as CodegenContext::create_dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote
590e0d9573 Rename Handler as DiagCtxt. 2023-12-18 16:06:19 +11:00
bors
335e3ec566 Auto merge of #118828 - mu001999:master, r=b-naber
Remove dead codes in rustc_codegen_gcc

Detected by #118257
2023-12-17 12:15:56 +00:00
Guillaume Gomez
9882d7c511 Apply suggestions 2023-12-16 17:56:03 +01:00
Guillaume Gomez
95dfe5ec90 Simplify split_args code, add a unit test for it and run it into CI 2023-12-16 17:39:58 +01:00
Guillaume Gomez
db9b932314 Fix sysroot build 2023-12-14 17:11:35 +01:00
Urgau
b1affb9321 Move rustc_codegen_ssa target features to rustc_target 2023-12-14 14:40:55 +01:00
Lukasz Anforowicz
e1f039f562 Add unstable -Zdefault-hidden-visibility cmdline flag for rustc.
The new flag has been described in the Major Change Proposal at
https://github.com/rust-lang/compiler-team/issues/656
2023-12-13 21:14:23 +00:00
Guillaume Gomez
867ea12488 Fix non-running rustc ui tests 2023-12-13 17:49:08 +01:00
Urgau
a72e20d773 Fix rustc codegen gcc tests 2023-12-11 18:48:49 +01:00
r0cky
92de9d4210 Remove dead codes 2023-12-11 23:24:32 +08:00
bors
c578f4302c Auto merge of #117873 - quininer:android-emutls, r=Amanieu
Add emulated TLS support

This is a reopen of https://github.com/rust-lang/rust/pull/96317 . many android devices still only use 128 pthread keys, so using emutls can be helpful.

Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false.

This commit has some changes to allow users to enable emutls:

1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key.
2. when using emutls, decorate symbol names to find thread local symbol correctly.
3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.

r? `@Amanieu`
2023-12-09 05:32:35 +00:00
bors
17f0dd5898 Auto merge of #118324 - RalfJung:ctfe-read-only-pointers, r=saethlin
compile-time evaluation: detect writes through immutable pointers

This has two motivations:
- it unblocks https://github.com/rust-lang/rust/pull/116745 (and therefore takes a big step towards `const_mut_refs` stabilization), because we can now detect if the memory that we find in `const` can be interned as "immutable"
- it would detect the UB that was uncovered in https://github.com/rust-lang/rust/pull/117905, which was caused by accidental stabilization of `copy` functions in `const` that can only be called with UB

When UB is detected, we emit a future-compat warn-by-default lint. This is not a breaking change, so completely in line with [the const-UB RFC](https://rust-lang.github.io/rfcs/3016-const-ub.html), meaning we don't need t-lang FCP here. I made the lint immediately show up for dependencies since it is nearly impossible to even trigger this lint without `const_mut_refs` -- the accidentally stabilized `copy` functions are the only way this can happen, so the crates that popped up in #117905 are the only causes of such UB (in the code that crater covers), and the three cases of UB that we know about have all been fixed in their respective crates already.

The way this is implemented is by making use of the fact that our interpreter is already generic over the notion of provenance. For CTFE we now use the new `CtfeProvenance` type which is conceptually an `AllocId` plus a boolean `immutable` flag (but packed for a more efficient representation). This means we can mark a pointer as immutable when it is created as a shared reference. The flag will be propagated to all pointers derived from this one. We can then check the immutable flag on each write to reject writes through immutable pointers.

I just hope perf works out.
2023-12-07 18:11:01 +00:00
Ralf Jung
cb32ffd8da ctfe interpreter: extend provenance so that it can track whether a pointer is immutable 2023-12-07 17:46:36 +01:00
Urgau
3cfff05ac7 Allow internal_features in rustc_codegen_gcc examples 2023-12-07 15:26:18 +01:00
Urgau
19e11760ab Update rustc_codegen_gcc libc 2023-12-07 14:59:37 +01:00