Skip to content

Commit 56e112a

Browse files
committed
Auto merge of #126374 - workingjubilee:rollup-tz0utfr, r=workingjubilee
Rollup of 10 pull requests Successful merges: - #125674 (Rewrite `symlinked-extern`, `symlinked-rlib` and `symlinked-libraries` `run-make` tests in `rmake.rs` format) - #125688 (Walk into alias-eq nested goals even if normalization fails) - #126142 (Harmonize using root or leaf obligation in trait error reporting) - #126303 (Urls to docs in rust_hir) - #126328 (Add Option::is_none_or) - #126337 (Add test for walking order dependent opaque type behaviour) - #126353 (Move `MatchAgainstFreshVars` to old solver) - #126356 (docs(rustc): Improve discoverable of Cargo docs) - #126358 (safe transmute: support `Single` enums) - #126362 (Make `try_from_target_usize` method public) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f6b4b71 + 3b10998 commit 56e112a

File tree

80 files changed

+557
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+557
-275
lines changed

compiler/rustc_const_eval/src/interpret/discriminant.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
241241
variant_index: VariantIdx,
242242
) -> InterpResult<'tcx, Option<(ScalarInt, usize)>> {
243243
match self.layout_of(ty)?.variants {
244-
abi::Variants::Single { index } => {
245-
assert_eq!(index, variant_index);
246-
Ok(None)
247-
}
244+
abi::Variants::Single { .. } => Ok(None),
248245

249246
abi::Variants::Multiple {
250247
tag_encoding: TagEncoding::Direct,

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10571057

10581058
ty::Str | ty::Slice(_) | ty::Dynamic(_, _, ty::Dyn) | ty::Foreign(..) => false,
10591059

1060-
ty::Tuple(tys) => tys.last().iter().all(|ty| is_very_trivially_sized(**ty)),
1060+
ty::Tuple(tys) => tys.last().is_none_or(|ty| is_very_trivially_sized(*ty)),
10611061

10621062
ty::Pat(ty, ..) => is_very_trivially_sized(*ty),
10631063

compiler/rustc_const_eval/src/interpret/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
446446
let (alloc_size, _alloc_align, ret_val) = alloc_size(alloc_id, offset, prov)?;
447447
// Test bounds.
448448
// It is sufficient to check this for the end pointer. Also check for overflow!
449-
if offset.checked_add(size, &self.tcx).map_or(true, |end| end > alloc_size) {
449+
if offset.checked_add(size, &self.tcx).is_none_or(|end| end > alloc_size) {
450450
throw_ub!(PointerOutOfBounds {
451451
alloc_id,
452452
alloc_size,

compiler/rustc_const_eval/src/interpret/projection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ where
300300
) -> InterpResult<'tcx, P> {
301301
let len = base.len(self)?; // also asserts that we have a type where this makes sense
302302
let actual_to = if from_end {
303-
if from.checked_add(to).map_or(true, |to| to > len) {
303+
if from.checked_add(to).is_none_or(|to| to > len) {
304304
// This can only be reached in ConstProp and non-rustc-MIR.
305305
throw_ub!(BoundsCheckFailed { len: len, index: from.saturating_add(to) });
306306
}

compiler/rustc_const_eval/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![feature(box_patterns)]
77
#![feature(decl_macro)]
88
#![feature(if_let_guard)]
9+
#![feature(is_none_or)]
910
#![feature(let_chains)]
1011
#![feature(never_type)]
1112
#![feature(rustdoc_internals)]

compiler/rustc_hir/src/hir.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,13 @@ pub struct ConstBlock {
16331633
}
16341634

16351635
/// An expression.
1636+
///
1637+
/// For more details, see the [rust lang reference].
1638+
/// Note that the reference does not document nightly-only features.
1639+
/// There may be also slight differences in the names and representation of AST nodes between
1640+
/// the compiler and the reference.
1641+
///
1642+
/// [rust lang reference]: https://doc.rust-lang.org/reference/expressions.html
16361643
#[derive(Debug, Clone, Copy, HashStable_Generic)]
16371644
pub struct Expr<'hir> {
16381645
pub hir_id: HirId,
@@ -3147,6 +3154,13 @@ impl ItemId {
31473154
/// An item
31483155
///
31493156
/// The name might be a dummy name in case of anonymous items
3157+
///
3158+
/// For more details, see the [rust lang reference].
3159+
/// Note that the reference does not document nightly-only features.
3160+
/// There may be also slight differences in the names and representation of AST nodes between
3161+
/// the compiler and the reference.
3162+
///
3163+
/// [rust lang reference]: https://doc.rust-lang.org/reference/items.html
31503164
#[derive(Debug, Clone, Copy, HashStable_Generic)]
31513165
pub struct Item<'hir> {
31523166
pub ident: Ident,

compiler/rustc_hir_typeck/src/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
234234
let ret_ty = ret_coercion.borrow().expected_ty();
235235
let ret_ty = self.infcx.shallow_resolve(ret_ty);
236236
self.can_coerce(arm_ty, ret_ty)
237-
&& prior_arm.map_or(true, |(_, ty, _)| self.can_coerce(ty, ret_ty))
237+
&& prior_arm.is_none_or(|(_, ty, _)| self.can_coerce(ty, ret_ty))
238238
// The match arms need to unify for the case of `impl Trait`.
239239
&& !matches!(ret_ty.kind(), ty::Alias(ty::Opaque, ..))
240240
}

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
913913
if self
914914
.tcx
915915
.upvars_mentioned(closure_def_id_a.expect_local())
916-
.map_or(true, |u| u.is_empty()) =>
916+
.is_none_or(|u| u.is_empty()) =>
917917
{
918918
// We coerce the closure, which has fn type
919919
// `extern "rust-call" fn((arg0,arg1,...)) -> _`

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15571557

15581558
// If the length is 0, we don't create any elements, so we don't copy any. If the length is 1, we
15591559
// don't copy that one element, we move it. Only check for Copy if the length is larger.
1560-
if count.try_eval_target_usize(tcx, self.param_env).map_or(true, |len| len > 1) {
1560+
if count.try_eval_target_usize(tcx, self.param_env).is_none_or(|len| len > 1) {
15611561
let lang_item = self.tcx.require_lang_item(LangItem::Copy, None);
15621562
let code = traits::ObligationCauseCode::RepeatElementCopy {
15631563
is_constable,

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2240,7 +2240,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22402240
for (idx, (generic_param, param)) in
22412241
params_with_generics.iter().enumerate().filter(|(idx, _)| {
22422242
check_for_matched_generics
2243-
|| expected_idx.map_or(true, |expected_idx| expected_idx == *idx)
2243+
|| expected_idx.is_none_or(|expected_idx| expected_idx == *idx)
22442244
})
22452245
{
22462246
let Some(generic_param) = generic_param else {

0 commit comments

Comments
 (0)