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

Commit 751e9ff

Browse files
committed
Auto merge of rust-lang#129591 - matthiaskrgr:rollup-t1y17qs, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#129207 (Lint that warns when an elided lifetime ends up being a named lifetime) - 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#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 c6db1ca + 1bac9b2 commit 751e9ff

File tree

94 files changed

+774
-188
lines changed

Some content is hidden

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

94 files changed

+774
-188
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
*~

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
838838

839839
(hir::ParamName::Fresh, hir::LifetimeParamKind::Elided(kind))
840840
}
841-
LifetimeRes::Static | LifetimeRes::Error => return None,
841+
LifetimeRes::Static { .. } | LifetimeRes::Error => return None,
842842
res => panic!(
843843
"Unexpected lifetime resolution {:?} for {:?} at {:?}",
844844
res, ident, ident.span
@@ -1657,7 +1657,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16571657
}
16581658

16591659
// Opaques do not capture `'static`
1660-
LifetimeRes::Static | LifetimeRes::Error => {
1660+
LifetimeRes::Static { .. } | LifetimeRes::Error => {
16611661
continue;
16621662
}
16631663

@@ -2070,7 +2070,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20702070
hir::LifetimeName::Param(param)
20712071
}
20722072
LifetimeRes::Infer => hir::LifetimeName::Infer,
2073-
LifetimeRes::Static => hir::LifetimeName::Static,
2073+
LifetimeRes::Static { .. } => hir::LifetimeName::Static,
20742074
LifetimeRes::Error => hir::LifetimeName::Error,
20752075
res => panic!(
20762076
"Unexpected lifetime resolution {:?} for {:?} at {:?}",

compiler/rustc_ast_lowering/src/lifetime_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<'ast> LifetimeCollectVisitor<'ast> {
2727
self.collected_lifetimes.insert(lifetime);
2828
}
2929
}
30-
LifetimeRes::Static | LifetimeRes::Error => {
30+
LifetimeRes::Static { .. } | LifetimeRes::Error => {
3131
self.collected_lifetimes.insert(lifetime);
3232
}
3333
LifetimeRes::Infer => {}

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/src/def.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,13 @@ pub enum LifetimeRes {
821821
/// This variant is used for anonymous lifetimes that we did not resolve during
822822
/// late resolution. Those lifetimes will be inferred by typechecking.
823823
Infer,
824-
/// Explicit `'static` lifetime.
825-
Static,
824+
/// `'static` lifetime.
825+
Static {
826+
/// We do not want to emit `elided_named_lifetimes`
827+
/// when we are inside of a const item or a static,
828+
/// because it would get too annoying.
829+
suppress_elision_warning: bool,
830+
},
826831
/// Resolution failure.
827832
Error,
828833
/// HACK: This is used to recover the NodeId of an elided lifetime.

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,

0 commit comments

Comments
 (0)