rust/library/core/src
bors 6650252439 Auto merge of #128440 - oli-obk:defines, r=lcnr
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type

Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed.

A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table.

Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable.

Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature.

One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now.

fixes #131298
2025-03-11 18:13:31 +00:00
..
alloc library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
array Rollup merge of #135489 - RalfJung:TryFromSliceError, r=tgross35 2025-01-24 08:08:06 +01:00
ascii Add more precondition check tests 2024-10-09 19:34:27 -04:00
async_iter Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
cell OnceCell & OnceLock docs: Using (un)initialized consistently 2025-02-03 17:48:39 +05:30
char Auto merge of #138155 - matthiaskrgr:rollup-xq5buio, r=matthiaskrgr 2025-03-07 13:47:27 +00:00
clone CloneToUninit: use a private specialization trait 2024-07-29 20:44:43 +03:00
cmp Use generic NonZero everywhere in core. 2024-02-22 15:17:33 +01:00
convert Ensure that negative auto impls are always applicable 2025-03-04 17:45:18 +00:00
ffi Target definition for wasm32-wali-linux-musl to support the Wasm Linux 2025-03-10 21:26:45 -04:00
fmt Add #[track_caller] to from_usize. 2025-03-10 12:20:06 +01:00
future tidying up tidy 2025-02-15 13:34:01 +06:00
hash library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
intrinsics Rollup merge of #138034 - thaliaarchi:use-prelude-size-of, r=tgross35 2025-03-07 10:12:44 +01:00
io Add inherent versions of MaybeUninit methods for slices 2025-01-11 23:57:00 -05:00
iter Rollup merge of #135987 - hkBst:patch-20, r=joboet 2025-03-11 13:30:49 +01:00
macros Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
marker Make phantom variance markers transparent 2025-02-15 00:47:49 +00:00
mem library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
net stabilize const_sockaddr_setters 2025-03-06 22:29:07 +01:00
num Use disjoint_bitor inside borrowing_sub 2025-03-08 15:45:03 +01:00
ops fix order on shl impl 2025-03-03 09:51:51 +01:00
panic replace placeholder version 2024-11-27 12:10:21 +00:00
prelude Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
ptr Use turbofish for size_of<T> and align_of<T> in docs 2025-03-06 20:20:38 -08:00
range Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
slice Rollup merge of #138034 - thaliaarchi:use-prelude-size-of, r=tgross35 2025-03-07 10:12:44 +01:00
str library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
sync Rollup merge of #137585 - xizheyin:issue-135801, r=workingjubilee 2025-03-10 09:32:11 +01:00
task docs: fix broken intra-doc links that never worked 2025-02-15 12:21:38 -07:00
unicode core: add #![warn(unreachable_pub)] 2025-01-20 18:35:32 +01:00
any.rs Rollup merge of #136148 - kpreid:type-str, r=joboet 2025-02-21 19:01:12 +01:00
arch.rs core: #[allow(unreachable_pub)] on unreachable pub use 2025-01-20 18:35:32 +01:00
ascii.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
asserting.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
bool.rs Rollup merge of #133964 - joboet:select_unpredictable, r=tgross35 2025-01-04 09:54:36 +01:00
borrow.rs Suggest borrowing on fn argument that is impl AsRef 2024-05-09 23:25:31 +00:00
bstr.rs Fix char count in Display for ByteStr 2025-02-27 19:06:06 -08:00
cell.rs Rustfmt 2025-02-08 22:12:13 +00:00
clone.rs Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=nikomatsakis 2025-03-07 19:15:33 +01:00
cmp.rs Make is_le and friends work like clang's 2025-03-05 21:58:46 -08:00
contracts.rs update cfg(bootstrap) 2025-02-18 09:32:44 -08:00
default.rs update cfgs 2024-09-05 17:24:01 +01:00
error.md Mention core's PanicInfo in error.md. 2024-06-11 15:47:00 +02:00
error.rs update version placeholders 2025-02-18 08:50:21 -08:00
escape.rs core: add #![warn(unreachable_pub)] 2025-01-20 18:35:32 +01:00
hint.rs update version placeholders 2025-02-18 08:50:21 -08:00
internal_macros.rs Fix doc nits 2024-07-26 13:26:33 +01:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Update stdarch 2025-03-06 11:11:55 -08:00
marker.rs Rollup merge of #138034 - thaliaarchi:use-prelude-size-of, r=tgross35 2025-03-07 10:12:44 +01:00
option.rs Add UseCloned trait related code 2025-03-06 17:58:32 -03:00
panic.rs update cfgs 2024-11-27 15:14:54 +00:00
panicking.rs update cfg(bootstrap) 2025-02-18 09:32:44 -08:00
pat.rs Remove the Option part of range ends in the HIR 2025-03-06 10:47:40 +00:00
pin.rs fix doc in library/core/src/pin.rs 2025-02-25 21:21:00 +08:00
primitive.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
primitive_docs.rs library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
random.rs random: add tracking issue, address other comments 2024-09-23 10:36:16 +02:00
range.rs update cfg(bootstrap) 2025-02-18 09:32:44 -08:00
result.rs Add UseCloned trait related code 2025-03-06 17:58:32 -03:00
time.rs Limit formatting width and precision to 16 bits. 2025-03-10 12:20:05 +01:00
tuple.rs update cfgs 2024-09-05 17:24:01 +01:00
ub_checks.rs Make ub_check message clear that it's not an assert 2025-02-16 00:56:09 +00:00
unit.rs Import the 2021 prelude in the core crate 2024-03-25 13:12:06 -07:00
unsafe_binder.rs Add unwrap_unsafe_binder and wrap_unsafe_binder macro operators 2024-12-12 16:29:40 +00:00