29 Commits

Author SHA1 Message Date
David Wood
e9d795d717 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
Ralf Jung
f5c62888b8 intrinsics: rename min_align_of to align_of 2025-06-12 17:50:25 +02:00
Guillaume Gomez
d52b5e6df5 Merge commit '6ba33f5e1189a5ae58fb96ce3546e76b13d090f5' into subtree-update_cg_gcc_2025-05-14 2025-05-14 13:51:02 +02:00
Guillaume Gomez
8f9a32aaf8 Merge commit 'db1a31c243a649e1fe20f5466ba181da5be35c14' into subtree-update_cg_gcc_2025-04-18 2025-04-18 21:20:11 +02:00
Ralf Jung
7989568b8e intrinsics: remove unnecessary leading underscore from argument names 2025-03-12 08:04:09 +01:00
Ralf Jung
15f0dca531 remove support for rustc_intrinsic_must_be_overridden from the compiler 2025-02-24 07:53:59 +01:00
Michael Goulet
feb78f904e Implement and use BikeshedGuaranteedNoDrop for union/unsafe field validity 2025-02-13 03:45:04 +00:00
Jacob Pratt
daeeffa830 Rollup merge of #132397 - m-ou-se:warn-missing-abi, r=Nadrieril
Make missing_abi lint warn-by-default.

This makes the missing_abi lint warn-by-default, as suggested here: https://github.com/rust-lang/rfcs/pull/3722#issuecomment-2447719047

This needs a lang FCP.
2025-01-15 04:08:10 -05:00
Antoni Boucher
43b7e28601 Merge commit '59a81c2ca1edc88ad3ac4b27a8e03977ffb8e73a' into subtree-update_cg_gcc_2025_01_12 2025-01-13 10:53:58 -05:00
Mara Bos
60ee6fbaa4 Update tests. 2025-01-07 16:04:14 +01:00
Jack Wrenn
691aec2ef3 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
Ralf Jung
f0368983da remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
Adrian Taylor
c12fdd2c65 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
Michael Goulet
9a9d5ec6b6 Remove lang feature for type ascription 2024-07-11 20:40:38 -04:00
Mark Rousskov
2b875f0927 Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
Maybe Waffle
dd50f454c8 Fixup rustc_codegen_gcc test signature 2024-04-20 12:18:21 +00:00
Mark Rousskov
c8cb091e1e 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
Jacob Pratt
a6202e2a77 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
0975461837 only set noalias on Box with the global allocator 2024-03-05 15:03:33 +01:00
Oli Scherer
3ca0c5913e Forbid implementing Freeze even if the trait is stabilized 2024-02-29 14:10:29 +00:00
Ralf Jung
215284a490 remove StructuralEq trait 2024-01-24 07:56:23 +01:00
Urgau
a72e20d773 Fix rustc codegen gcc tests 2023-12-11 18:48:49 +01:00
Antoni Boucher
242a482c88 Merge commit '11a0cceab966e5ff1058ddbcab5977e8a1d6d290' into subtree-update_cg_gcc_2023-10-09 2023-10-09 15:53:34 -04:00
Antoni Boucher
38c16e9862 Merge commit '1bbee3e217d75e7bc3bfe5d8c1b35e776fce96e6' into sync-cg_gcc-2023-06-19 2023-06-19 18:51:02 -04:00
DrMeepster
ec100514f8 remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
Antoni Boucher
d725cfb6ab Merge commit '08a6d6e16b5efe217123e780398969946266268f' into sync-cg_gcc-2023-03-04 2023-03-05 12:03:19 -05:00
Nikolai Vazquez
be34cb35c7 Make std::mem::needs_drop accept ?Sized 2022-06-03 03:28:19 -04:00
bjorn3
3888aafe3a Merge commit '39683d8eb7a32a74bea96ecbf1e87675d3338506' into sync_cg_gcc-2022-03-26 2022-03-26 18:29:37 +01:00
Antoni Boucher
afae271d5d Initial commit 2021-08-12 21:46:50 -04:00