rust/library/core/src
Matthias Krüger 9adf2189f5
Rollup merge of #137449 - compiler-errors:control-flow, r=Amanieu,lnicola
Denote `ControlFlow` as `#[must_use]`

I've repeatedly hit bugs in the compiler due to `ControlFlow` not being marked `#[must_use]`. There seems to be an accepted ACP to make the type `#[must_use]` (https://github.com/rust-lang/libs-team/issues/444), so this PR implements that part of it.

Most of the usages in the compiler that trigger this new warning are "root" usages (calling into an API that uses control-flow internally, but for which the callee doesn't really care) and have been suppressed by `let _ = ...`, but I did legitimately find one instance of a missing `?` and one for a never-used `ControlFlow` value in #137448.

Presumably this needs an FCP too, so I'm opening this and nominating it for T-libs-api.

This PR also touches the tools (incl. rust-analyzer), but if this went into FCP, I'd split those out into separate PRs which can land before this one does.

r? libs-api
`@rustbot` label: T-libs-api I-libs-api-nominated
2025-03-17 16:34:47 +01:00
..
alloc library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
array Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08: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 Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08: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 Auto merge of #138363 - beetrees:f16-f128-integer-convert, r=Amanieu 2025-03-17 00:33:36 +00:00
ffi intrinsics: remove unnecessary leading underscore from argument names 2025-03-12 08:04:09 +01:00
fmt Rollup merge of #135080 - Enselic:debug-ptr-metadata, r=thomcc 2025-03-16 13:19:51 +08: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 #136359 - hkBst:ptr_copy_docs, r=Amanieu 2025-03-16 21:47:42 -04:00
io Add inherent versions of MaybeUninit methods for slices 2025-01-11 23:57:00 -05:00
iter Rollup merge of #138329 - scottmcm:assert-hint, r=Mark-Simulacrum 2025-03-16 09:40:07 +08:00
macros Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
marker Make phantom variance markers transparent 2025-02-15 00:47:49 +00:00
mem Rollup merge of #138323 - kpreid:offset-of-doc, r=Mark-Simulacrum 2025-03-16 09:40:07 +08:00
net Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
num Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
ops Make ControlFlow must_use 2025-03-16 17:47:56 +00:00
panic Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
prelude Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
ptr Rollup merge of #135080 - Enselic:debug-ptr-metadata, r=thomcc 2025-03-16 13:19:51 +08:00
range Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
slice Auto merge of #138537 - yotamofek:pr/lib/multi-char-pattern, r=jhpratt 2025-03-16 14:23:18 +00:00
str Auto merge of #138537 - yotamofek:pr/lib/multi-char-pattern, r=jhpratt 2025-03-16 14:23:18 +00:00
sync Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
task Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
unicode core: add #![warn(unreachable_pub)] 2025-01-20 18:35:32 +01:00
any.rs Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08: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 Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08: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 Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
clone.rs Rewrite example to not deal with Copy at all. 2025-03-10 15:03:36 -07:00
cmp.rs Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
contracts.rs update cfg(bootstrap) 2025-02-18 09:32:44 -08:00
default.rs Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
error.md Mention core's PanicInfo in error.md. 2024-06-11 15:47:00 +02:00
error.rs Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -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 Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
marker.rs Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
option.rs Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08: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 Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08:00
time.rs Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc 2025-03-16 09:40:05 +08: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 core: Make Debug impl of raw pointers print metadata if present 2025-02-15 17:27:55 +01:00
unsafe_binder.rs Add unwrap_unsafe_binder and wrap_unsafe_binder macro operators 2024-12-12 16:29:40 +00:00