Commit graph

233 commits

Author SHA1 Message Date
bjorn3
45671b42e6 Merge commit '8de4afd39b' into sync_cg_clif-2025-12-18 2025-12-18 11:50:08 +00:00
bjorn3
c90a9d836b Merge commit 'a0b865dc87' into sync_cg_clif-2025-11-08 2025-11-08 14:18:53 +00:00
Camille Gillot
cc27b04473 Replace NullOp::SizeOf and NullOp::AlignOf by lang items. 2025-10-23 00:38:28 +00:00
Scott McMurray
7fa842965e Update cranelift tests 2025-07-20 10:15:14 -07:00
Oli Scherer
95281ed1c1 Stop backends from needing to support nullary intrinsics 2025-06-30 08:04:19 +00:00
David Wood
cfa4c8f473 cranelift/gcc: {Meta,Pointee,}Sized in minicore
As in many previous commits, adding the new traits to minicore, but this
time for cranelift and gcc.
2025-06-16 23:04:37 +00:00
Matthias Krüger
8b24077171 Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errors
Unimplement unsized_locals

Implements https://github.com/rust-lang/compiler-team/issues/630

Tracking issue here: https://github.com/rust-lang/rust/issues/111942

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``

``@rustbot`` label F-unsized_locals

Fixes rust-lang/rust#79409
2025-06-14 11:27:10 +02:00
mejrs
a6ecde32b9 Unimplement unsized_locals 2025-06-13 01:16:36 +02:00
Ralf Jung
a9fd42e536 intrinsics: rename min_align_of to align_of 2025-06-12 17:50:25 +02:00
sayantn
b97136c817 Add impl for llvm.roundeven in cg_clif
- remove unused `llvm.aarch64.neon.frintn` from cg_clif
2025-06-03 20:37:10 +05:30
bjorn3
4f24d142d9 Merge commit '979dcf8e2f' into sync_cg_clif-2025-05-25 2025-05-25 18:51:16 +00:00
bendn
00417de6b8 Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etc 2025-04-24 13:14:36 +07:00
bors
d9dac3cb38 Auto merge of #139309 - RalfJung:abi_unsupported_vector_types, r=fee1-dead,traviscross
make abi_unsupported_vector_types a hard error

Fixes https://github.com/rust-lang/rust/issues/116558 by completing the transition; see that issue for context. The lint was introduced with Rust 1.84 and this has been shown in cargo's future breakage reports since Rust 1.85, released 6 weeks ago, and so far we got 0 complaints by users. There's not even a backlink on the tracking issue. We did a [crater run](https://github.com/rust-lang/rust/pull/127731#issuecomment-2286736295) when the lint was originally added and found no breakage. So I don't think we need another crater run now, but I can do one if the team prefers that.

https://github.com/rust-lang/rust/issues/131800 is done, so for most current targets (in particular, all tier 1 and tier 2 targets) we have the information to implement this check (modulo the targets where we don't properly support SIMD vectors yet, see the sub-issues of https://github.com/rust-lang/rust/issues/116558). If a new target gets added in the future, it will default to reject all SIMD vector types until proper information is added, which is the default we want.

This will need approval by for `@rust-lang/lang.` Cc `@workingjubilee` `@veluca93`

try-job: test-various
try-job: armhf-gnu
try-job: dist-i586-gnu-i586-i686-musl
2025-04-24 00:44:40 +00:00
Ralf Jung
d50c76974f make abi_unsupported_vector_types a hard error 2025-04-20 11:34:56 +02:00
Folkert de Vries
88ddf9e203 stabilize naked_functions 2025-04-20 11:18:38 +02:00
Folkert de Vries
59c5ed0ba8 Make #[naked] an unsafe attribute 2025-04-19 00:03:35 +02:00
bjorn3
625b8000f7 Allow formatting example/gen_block_iterate.rs 2025-04-01 14:49:15 +00:00
Ralf Jung
56715d9864 intrinsics: remove unnecessary leading underscore from argument names 2025-03-12 08:04:09 +01:00
Oli Scherer
d9de94001a Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
Ralf Jung
957389c196 remove support for rustc_intrinsic_must_be_overridden from the compiler 2025-02-24 07:53:59 +01:00
Michael Goulet
c6ddd335a8 Implement and use BikeshedGuaranteedNoDrop for union/unsafe field validity 2025-02-13 03:45:04 +00:00
bjorn3
6bd92ef9cb Rustfmt 2025-02-08 22:12:13 +00:00
bjorn3
04e580fcc5 Merge commit '8332329f83' into sync_cg_clif-2025-02-07 2025-02-07 20:58:27 +00:00
bjorn3
2c2d2a7e0d Merge commit 'e39eacd2d4' into sync_cg_clif-2025-01-10 2025-01-10 09:02:07 +00:00
Jack Wrenn
03746a5511 Make Copy unsafe to implement for ADTs with unsafe fields
As a rule, the application of `unsafe` to a declaration requires that use-sites
of that declaration also require `unsafe`. For example, a field declared
`unsafe` may only be read in the lexical context of an `unsafe` block.

For nearly all safe traits, the safety obligations of fields are explicitly
discharged when they are mentioned in method definitions. For example,
idiomatically implementing `Clone` (a safe trait) for a type with unsafe fields
will require `unsafe` to clone those fields.

Prior to this commit, `Copy` violated this rule. The trait is marked safe, and
although it has no explicit methods, its implementation permits reads of `Self`.

This commit resolves this by making `Copy` conditionally safe to implement. It
remains safe to implement for ADTs without unsafe fields, but unsafe to
implement for ADTs with unsafe fields.

Tracking: #132922
2024-12-07 20:50:00 +00:00
Ben Kimock
4d01ca8ae9 Remove polymorphization 2024-12-06 16:42:09 -05:00
bjorn3
e8ad19987d Merge commit '57845a397e' into sync_cg_clif-2024-12-06 2024-12-06 12:10:30 +00:00
Ralf Jung
00354ddaa6 remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
Adrian Taylor
c5a5e86baa Rename Receiver -> LegacyReceiver
As part of the "arbitrary self types v2" project, we are going to
replace the current `Receiver` trait with a new mechanism based on a
new, different `Receiver` trait.

This PR renames the old trait to get it out the way. Naming is hard.
Options considered included:
* HardCodedReceiver (because it should only be used for things in the
  standard library, and hence is sort-of hard coded)
* LegacyReceiver
* TargetLessReceiver
* OldReceiver

These are all bad names, but fortunately this will be temporary.
Assuming the new mechanism proceeds to stabilization as intended, the
legacy trait will be removed altogether.

Although we expect this trait to be used only in the standard library,
we suspect it may be in use elsehwere, so we're landing this change
separately to identify any surprising breakages.

It's known that this trait is used within the Rust for Linux project; a
patch is in progress to remove their dependency.

This is a part of the arbitrary self types v2 project,
https://github.com/rust-lang/rfcs/pull/3519
https://github.com/rust-lang/rust/issues/44874

r? @wesleywiser
2024-10-22 12:55:16 +00:00
Folkert de Vries
2811ce715d various fixes for naked_asm! implementation
- fix for divergence
- fix error message
- fix another cranelift test
- fix some cranelift things
- don't set the NORETURN option for naked asm
- fix use of naked_asm! in doc comment
- fix use of naked_asm! in run-make test
- use `span_bug` in unreachable branch
2024-10-06 19:00:09 +02:00
Urgau
0bd0b99729 Use wide pointers consistenly across the compiler 2024-10-04 14:06:48 +02:00
bjorn3
32b608a439 Merge commit '6d35b4c9a0' into sync_cg_clif-2024-09-22 2024-09-23 11:20:46 +00:00
Michael Goulet
02b0f3b5ab Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
Scott McMurray
fe5183e627 Fix the examples in cg_clif 2024-09-09 19:39:43 -07:00
Ralf Jung
f1fadb8ba2 stabilize raw_ref_op 2024-08-18 19:46:53 +02:00
Nadrieril
3de829e4e5 Fixes in various places 2024-08-10 12:08:46 +02:00
bjorn3
3ea9313de3 Merge commit '69b3f5a426' into sync_cg_clif-2024-08-09 2024-08-09 17:18:46 +00:00
Nicholas Nethercote
ea9f491696 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Slanterns
62a0c22ca9 stabilize is_sorted 2024-07-28 03:11:54 +08:00
bjorn3
5adaed06a0 Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
Oli Scherer
4e0af7cc61 Require any function with a tait in its signature to actually constrain a hidden type 2024-06-12 08:53:59 +00:00
bjorn3
ed7d97e4c8 Merge commit '3270432f4b' into sync_cg_clif-2024-05-13 2024-05-13 13:26:33 +00:00
Oli Scherer
dda4709b1c Error on using yield without also using #[coroutine] on the closure
And suggest adding the `#[coroutine]` to the closure
2024-04-24 08:05:29 +00:00
Matthias Krüger
36449f8cd6 Rollup merge of #124286 - bjorn3:sync_cg_clif-2024-04-23, r=bjorn3
Subtree sync for rustc_codegen_cranelift

This fixes a crash when compiling the standard library. In addition the Cranelift update fixes all the 128bit int abi incompatibility between cg_clif and cg_llvm.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2024-04-23 20:17:52 +02:00
Matthias Krüger
6a2ad55108 Rollup merge of #124003 - WaffleLapkin:dellvmization, r=scottmcm,RalfJung,antoyo
Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics)

This implements https://github.com/rust-lang/compiler-team/issues/693 minus what was implemented in #123226.

Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it.

r? ``@scottmcm``
2024-04-23 20:17:51 +02:00
bjorn3
4ad6c6c581 Merge commit 'de5d652373' into sync_cg_clif-2024-04-23 2024-04-23 09:37:28 +00:00
Maybe Waffle
d5273fff48 Do intrinsic changes in rustc_codegen_cranelift 2024-04-19 18:45:25 +00:00
Ralf Jung
9e4e444a47 static_mut_refs: use raw pointers to remove the remaining FIXME 2024-04-15 18:45:56 +02:00
bjorn3
f91bd7882f Merge commit 'fbda869b4e' into sync_cg_clif-2024-04-05 2024-04-05 16:20:23 +00: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