Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d305239

Browse files
committed
Auto merge of rust-lang#129595 - matthiaskrgr:rollup-4udn7nn, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#129288 (Use subtyping for `UnsafeFnPointer` coercion, too) - rust-lang#129405 (Fixing span manipulation and indentation of the suggestion introduced by rust-lang#126187) - rust-lang#129518 (gitignore: ignore ICE reports regardless of directory) - rust-lang#129519 (Remove redundant flags from `lower_ty_common` that can be inferred from the HIR) - rust-lang#129525 (rustdoc: clean up tuple <-> primitive conversion docs) - rust-lang#129526 (Use `FxHasher` on new solver unconditionally) - rust-lang#129544 (Removes dead code from the compiler) - rust-lang#129553 (add back test for stable-const-can-only-call-stable-const) - rust-lang#129590 (Avoid taking reference of &TyKind) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3f121b9 + d6a3aa4 commit d305239

File tree

44 files changed

+283
-192
lines changed

Some content is hidden

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

44 files changed

+283
-192
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ build/
5656
/src/tools/x/target
5757
# Created by default with `src/ci/docker/run.sh`
5858
/obj/
59-
/rustc-ice*
59+
60+
## ICE reports
61+
rustc-ice-*.txt
6062

6163
## Temporary files
6264
*~

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,6 +4536,7 @@ dependencies = [
45364536
"bitflags 2.6.0",
45374537
"derive-where",
45384538
"indexmap",
4539+
"rustc-hash",
45394540
"rustc_ast_ir",
45404541
"rustc_data_structures",
45414542
"rustc_index",

compiler/rustc_borrowck/src/borrowck_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'infcx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
290290
ty: Ty<'_>,
291291
is_index: Option<bool>,
292292
) -> Diag<'infcx> {
293-
let type_name = match (&ty.kind(), is_index) {
293+
let type_name = match (ty.kind(), is_index) {
294294
(&ty::Array(_, _), Some(true)) | (&ty::Array(_, _), None) => "array",
295295
(&ty::Slice(_), _) => "slice",
296296
_ => span_bug!(move_from_span, "this path should not cause illegal move"),

compiler/rustc_borrowck/src/places_conflict.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ fn place_components_conflict<'tcx>(
201201

202202
let base_ty = base.ty(body, tcx).ty;
203203

204-
match (elem, &base_ty.kind(), access) {
204+
match (elem, base_ty.kind(), access) {
205205
(_, _, Shallow(Some(ArtificialField::ArrayLength)))
206206
| (_, _, Shallow(Some(ArtificialField::FakeBorrow))) => {
207207
// The array length is like additional fields on the

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,9 +2043,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20432043

20442044
let ty_fn_ptr_from = tcx.safe_to_unsafe_fn_ty(fn_sig);
20452045

2046-
if let Err(terr) = self.eq_types(
2047-
*ty,
2046+
if let Err(terr) = self.sub_types(
20482047
ty_fn_ptr_from,
2048+
*ty,
20492049
location.to_locations(),
20502050
ConstraintCategory::Cast { unsize_to: None },
20512051
) {

compiler/rustc_const_eval/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn
419419
const_eval_unstable_in_stable =
420420
const-stable function cannot use `#[feature({$gate})]`
421421
.unstable_sugg = if it is not part of the public API, make this function unstably const
422-
.bypass_sugg = otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
422+
.bypass_sugg = otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval)
423423
424424
const_eval_unterminated_c_string =
425425
reading a null-terminated string starting at {$pointer} with no null found before end of allocation

compiler/rustc_const_eval/src/interpret/cast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
388388
let (src_pointee_ty, dest_pointee_ty) =
389389
self.tcx.struct_lockstep_tails_for_codegen(source_ty, cast_ty, self.param_env);
390390

391-
match (&src_pointee_ty.kind(), &dest_pointee_ty.kind()) {
391+
match (src_pointee_ty.kind(), dest_pointee_ty.kind()) {
392392
(&ty::Array(_, length), &ty::Slice(_)) => {
393393
let ptr = self.read_pointer(src)?;
394394
let val = Immediate::new_slice(
@@ -478,9 +478,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
478478
dest: &PlaceTy<'tcx, M::Provenance>,
479479
) -> InterpResult<'tcx> {
480480
trace!("Unsizing {:?} of type {} into {}", *src, src.layout.ty, cast_ty.ty);
481-
match (&src.layout.ty.kind(), &cast_ty.ty.kind()) {
481+
match (src.layout.ty.kind(), cast_ty.ty.kind()) {
482482
(&ty::Ref(_, s, _), &ty::Ref(_, c, _) | &ty::RawPtr(c, _))
483-
| (&ty::RawPtr(s, _), &ty::RawPtr(c, _)) => self.unsize_into_ptr(src, dest, *s, *c),
483+
| (&ty::RawPtr(s, _), &ty::RawPtr(c, _)) => self.unsize_into_ptr(src, dest, s, c),
484484
(&ty::Adt(def_a, _), &ty::Adt(def_b, _)) => {
485485
assert_eq!(def_a, def_b); // implies same number of fields
486486

compiler/rustc_hir_analysis/src/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
392392
}
393393

394394
fn re_infer(&self, span: Span, reason: RegionInferReason<'_>) -> ty::Region<'tcx> {
395-
if let RegionInferReason::BorrowedObjectLifetimeDefault = reason {
395+
if let RegionInferReason::ObjectLifetimeDefault = reason {
396396
let e = struct_span_code_err!(
397397
self.dcx(),
398398
span,

compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
608608

609609
let mut bound_span_label = |self_ty: Ty<'_>, obligation: &str, quiet: &str| {
610610
let msg = format!("`{}`", if obligation.len() > 50 { quiet } else { obligation });
611-
match &self_ty.kind() {
611+
match self_ty.kind() {
612612
// Point at the type that couldn't satisfy the bound.
613613
ty::Adt(def, _) => {
614614
bound_spans.get_mut_or_insert_default(tcx.def_span(def.did())).push(msg)

compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1515
///
1616
/// *Bare* trait object types are ones that aren't preceded by the keyword `dyn`.
1717
/// In edition 2021 and onward we emit a hard error for them.
18-
pub(super) fn prohibit_or_lint_bare_trait_object_ty(
19-
&self,
20-
self_ty: &hir::Ty<'_>,
21-
in_path: bool,
22-
) {
18+
pub(super) fn prohibit_or_lint_bare_trait_object_ty(&self, self_ty: &hir::Ty<'_>) {
2319
let tcx = self.tcx();
2420

2521
let hir::TyKind::TraitObject([poly_trait_ref, ..], _, TraitObjectSyntax::None) =
@@ -28,6 +24,21 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2824
return;
2925
};
3026

27+
let in_path = match tcx.parent_hir_node(self_ty.hir_id) {
28+
hir::Node::Ty(hir::Ty {
29+
kind: hir::TyKind::Path(hir::QPath::TypeRelative(qself, _)),
30+
..
31+
})
32+
| hir::Node::Expr(hir::Expr {
33+
kind: hir::ExprKind::Path(hir::QPath::TypeRelative(qself, _)),
34+
..
35+
})
36+
| hir::Node::Pat(hir::Pat {
37+
kind: hir::PatKind::Path(hir::QPath::TypeRelative(qself, _)),
38+
..
39+
}) if qself.hir_id == self_ty.hir_id => true,
40+
_ => false,
41+
};
3142
let needs_bracket = in_path
3243
&& !tcx
3344
.sess

0 commit comments

Comments
 (0)