Skip to content

Commit e8f57f8

Browse files
authored
Merge pull request #4736 from rust-lang/rustup-2025-11-30
Automatic Rustup
2 parents a121102 + 8eb411b commit e8f57f8

File tree

208 files changed

+10417
-5229
lines changed

Some content is hidden

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

208 files changed

+10417
-5229
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,9 @@ fn set_rvalue_location<'a, 'gcc, 'tcx>(
503503
bx: &mut Builder<'a, 'gcc, 'tcx>,
504504
rvalue: RValue<'gcc>,
505505
) -> RValue<'gcc> {
506-
if bx.location.is_some() {
506+
if let Some(location) = bx.location {
507507
#[cfg(feature = "master")]
508-
rvalue.set_location(bx.location.unwrap());
508+
rvalue.set_location(location);
509509
}
510510
rvalue
511511
}

compiler/rustc_const_eval/messages.ftl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ const_eval_validation_invalid_ref_meta = {$front_matter}: encountered invalid re
473473
const_eval_validation_invalid_ref_slice_meta = {$front_matter}: encountered invalid reference metadata: slice is bigger than largest supported object
474474
const_eval_validation_invalid_vtable_ptr = {$front_matter}: encountered {$value}, but expected a vtable pointer
475475
const_eval_validation_invalid_vtable_trait = {$front_matter}: wrong trait in wide pointer vtable: expected `{$expected_dyn_type}`, but encountered `{$vtable_dyn_type}`
476-
const_eval_validation_mutable_ref_in_const = {$front_matter}: encountered mutable reference in `const` value
477476
const_eval_validation_mutable_ref_to_immutable = {$front_matter}: encountered mutable reference or box pointing to read-only memory
478477
const_eval_validation_never_val = {$front_matter}: encountered a value of the never type `!`
479478
const_eval_validation_nonnull_ptr_out_of_range = {$front_matter}: encountered a maybe-null pointer, but expected something that is definitely non-zero

compiler/rustc_const_eval/src/errors.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,6 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
665665
PointerAsInt { .. } => const_eval_validation_pointer_as_int,
666666
PartialPointer => const_eval_validation_partial_pointer,
667667
MutableRefToImmutable => const_eval_validation_mutable_ref_to_immutable,
668-
MutableRefInConst => const_eval_validation_mutable_ref_in_const,
669668
NullFnPtr { .. } => const_eval_validation_null_fn_ptr,
670669
NeverVal => const_eval_validation_never_val,
671670
NonnullPtrMaybeNull { .. } => const_eval_validation_nonnull_ptr_out_of_range,
@@ -824,7 +823,6 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
824823
err.arg("maybe", maybe);
825824
}
826825
MutableRefToImmutable
827-
| MutableRefInConst
828826
| NonnullPtrMaybeNull
829827
| NeverVal
830828
| UnsafeCellInImmutable

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -639,12 +639,6 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
639639
// This can actually occur with transmutes.
640640
throw_validation_failure!(self.path, MutableRefToImmutable);
641641
}
642-
// In a const, any kind of mutable reference is not good.
643-
if matches!(self.ctfe_mode, Some(CtfeValidationMode::Const { .. })) {
644-
if ptr_expected_mutbl == Mutability::Mut {
645-
throw_validation_failure!(self.path, MutableRefInConst);
646-
}
647-
}
648642
}
649643
}
650644
// Potentially skip recursive check.

compiler/rustc_middle/src/mir/interpret/error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@ pub enum ValidationErrorKind<'tcx> {
496496
},
497497
MutableRefToImmutable,
498498
UnsafeCellInImmutable,
499-
MutableRefInConst,
500499
NullFnPtr {
501500
/// Records whether this pointer is definitely null or just may be null.
502501
maybe: bool,

compiler/rustc_public/src/compiler_interface.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ impl<'tcx> CompilerInterface<'tcx> {
249249
cx.def_name(did, trimmed)
250250
}
251251

252+
/// Returns the parent of the given `DefId`.
253+
pub(crate) fn def_parent(&self, def_id: DefId) -> Option<DefId> {
254+
let mut tables = self.tables.borrow_mut();
255+
let cx = &*self.cx.borrow();
256+
let did = tables[def_id];
257+
cx.def_parent(did).map(|did| tables.create_def_id(did))
258+
}
259+
252260
/// Return registered tool attributes with the given attribute name.
253261
///
254262
/// FIXME(jdonszelmann): may panic on non-tool attributes. After more attribute work, non-tool

compiler/rustc_public/src/crate_def.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ impl DefId {
2828
pub fn trimmed_name(&self) -> Symbol {
2929
with(|cx| cx.def_name(*self, true))
3030
}
31+
32+
/// Return the parent of this definition, or `None` if this is the root of a
33+
/// crate.
34+
pub fn parent(&self) -> Option<DefId> {
35+
with(|cx| cx.def_parent(*self))
36+
}
3137
}
3238

3339
/// A trait for retrieving information about a particular definition.

compiler/rustc_public_bridge/src/context/impls.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ impl<'tcx, B: Bridge> CompilerCtxt<'tcx, B> {
268268
}
269269
}
270270

271+
/// Returns the parent of the given `DefId`.
272+
pub fn def_parent(&self, def_id: DefId) -> Option<DefId> {
273+
self.tcx.opt_parent(def_id)
274+
}
275+
271276
/// Return registered tool attributes with the given attribute name.
272277
///
273278
/// FIXME(jdonszelmann): may panic on non-tool attributes. After more attribute work, non-tool

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::ops::ControlFlow;
2+
13
use itertools::Itertools as _;
24
use rustc_ast::visit::{self, Visitor};
35
use rustc_ast::{
@@ -1261,7 +1263,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
12611263
}
12621264
}
12631265

1264-
None::<()>
1266+
ControlFlow::<()>::Continue(())
12651267
});
12661268
}
12671269

0 commit comments

Comments
 (0)