Skip to content

Commit e95e084

Browse files
committed
Auto merge of rust-lang#92106 - matthiaskrgr:rollup-zw6t1mu, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#91791 (Fix an ICE when lowering a float with missing exponent magnitude) - rust-lang#91878 (Remove `in_band_lifetimes` from `rustc_infer`) - rust-lang#91895 (Remove `in_band_lifetimes` for `rustc_monomorphize`) - rust-lang#92029 (Explicitly set no ELF flags for .rustc section) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 41c3017 + 9415c67 commit e95e084

File tree

29 files changed

+104
-66
lines changed

29 files changed

+104
-66
lines changed

compiler/rustc_codegen_ssa/src/back/metadata.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,15 @@ pub fn create_compressed_metadata_file(
259259
let section = file.add_section(
260260
file.segment_name(StandardSegment::Data).to_vec(),
261261
b".rustc".to_vec(),
262-
SectionKind::Data,
262+
SectionKind::ReadOnlyData,
263263
);
264+
match file.format() {
265+
BinaryFormat::Elf => {
266+
// Explicitly set no flags to avoid SHF_ALLOC default for data section.
267+
file.section_mut(section).flags = SectionFlags::Elf { sh_flags: 0 };
268+
}
269+
_ => {}
270+
};
264271
let offset = file.append_section_data(section, &compressed, 1);
265272

266273
// For MachO and probably PE this is necessary to prevent the linker from throwing away the

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
134134
/// response*, then we don't typically replace free regions, as they
135135
/// must have been introduced from other parts of the system.
136136
trait CanonicalizeRegionMode {
137-
fn canonicalize_free_region(
137+
fn canonicalize_free_region<'tcx>(
138138
&self,
139139
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
140140
r: ty::Region<'tcx>,
@@ -146,7 +146,7 @@ trait CanonicalizeRegionMode {
146146
struct CanonicalizeQueryResponse;
147147

148148
impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
149-
fn canonicalize_free_region(
149+
fn canonicalize_free_region<'tcx>(
150150
&self,
151151
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
152152
r: ty::Region<'tcx>,
@@ -203,7 +203,7 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
203203
struct CanonicalizeUserTypeAnnotation;
204204

205205
impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation {
206-
fn canonicalize_free_region(
206+
fn canonicalize_free_region<'tcx>(
207207
&self,
208208
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
209209
r: ty::Region<'tcx>,
@@ -226,7 +226,7 @@ impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation {
226226
struct CanonicalizeAllFreeRegions;
227227

228228
impl CanonicalizeRegionMode for CanonicalizeAllFreeRegions {
229-
fn canonicalize_free_region(
229+
fn canonicalize_free_region<'tcx>(
230230
&self,
231231
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
232232
r: ty::Region<'tcx>,
@@ -242,7 +242,7 @@ impl CanonicalizeRegionMode for CanonicalizeAllFreeRegions {
242242
struct CanonicalizeFreeRegionsOtherThanStatic;
243243

244244
impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic {
245-
fn canonicalize_free_region(
245+
fn canonicalize_free_region<'tcx>(
246246
&self,
247247
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
248248
r: ty::Region<'tcx>,

compiler/rustc_infer/src/infer/combine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ struct Generalization<'tcx> {
533533
needs_wf: bool,
534534
}
535535

536-
impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
536+
impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
537537
fn tcx(&self) -> TyCtxt<'tcx> {
538538
self.infcx.tcx
539539
}
@@ -827,7 +827,7 @@ struct ConstInferUnifier<'cx, 'tcx> {
827827
// We use `TypeRelation` here to propagate `RelateResult` upwards.
828828
//
829829
// Both inputs are expected to be the same.
830-
impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
830+
impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
831831
fn tcx(&self) -> TyCtxt<'tcx> {
832832
self.infcx.tcx
833833
}

compiler/rustc_infer/src/infer/equate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Equate<'combine, 'infcx, 'tcx> {
2323
}
2424
}
2525

26-
impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
26+
impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
2727
fn tag(&self) -> &'static str {
2828
"Equate"
2929
}

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub use need_type_info::TypeAnnotationNeeded;
8383

8484
pub mod nice_region_error;
8585

86-
pub(super) fn note_and_explain_region(
86+
pub(super) fn note_and_explain_region<'tcx>(
8787
tcx: TyCtxt<'tcx>,
8888
err: &mut DiagnosticBuilder<'_>,
8989
prefix: &str,
@@ -116,7 +116,7 @@ pub(super) fn note_and_explain_region(
116116
emit_msg_span(err, prefix, description, span, suffix);
117117
}
118118

119-
fn explain_free_region(
119+
fn explain_free_region<'tcx>(
120120
tcx: TyCtxt<'tcx>,
121121
err: &mut DiagnosticBuilder<'_>,
122122
prefix: &str,
@@ -128,7 +128,7 @@ fn explain_free_region(
128128
label_msg_span(err, prefix, description, span, suffix);
129129
}
130130

131-
fn msg_span_from_free_region(
131+
fn msg_span_from_free_region<'tcx>(
132132
tcx: TyCtxt<'tcx>,
133133
region: ty::Region<'tcx>,
134134
alt_span: Option<Span>,
@@ -145,7 +145,7 @@ fn msg_span_from_free_region(
145145
}
146146
}
147147

148-
fn msg_span_from_early_bound_and_free_regions(
148+
fn msg_span_from_early_bound_and_free_regions<'tcx>(
149149
tcx: TyCtxt<'tcx>,
150150
region: ty::Region<'tcx>,
151151
) -> (String, Span) {
@@ -226,7 +226,7 @@ fn label_msg_span(
226226
}
227227
}
228228

229-
pub fn unexpected_hidden_region_diagnostic(
229+
pub fn unexpected_hidden_region_diagnostic<'tcx>(
230230
tcx: TyCtxt<'tcx>,
231231
span: Span,
232232
hidden_ty: Ty<'tcx>,
@@ -316,7 +316,7 @@ pub fn unexpected_hidden_region_diagnostic(
316316
/// with the other type. A TyVar inference type is compatible with any type, and an IntVar or
317317
/// FloatVar inference type are compatible with themselves or their concrete types (Int and
318318
/// Float types, respectively). When comparing two ADTs, these rules apply recursively.
319-
pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool {
319+
pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
320320
match (&a.kind(), &b.kind()) {
321321
(&ty::Adt(did_a, substs_a), &ty::Adt(did_b, substs_b)) => {
322322
if did_a != did_b {

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_middle::ty::{self, Region, TyCtxt};
2020
/// ```
2121
/// The function returns the nested type corresponding to the anonymous region
2222
/// for e.g., `&u8` and `Vec<&u8>`.
23-
pub(crate) fn find_anon_type(
23+
pub(crate) fn find_anon_type<'tcx>(
2424
tcx: TyCtxt<'tcx>,
2525
region: Region<'tcx>,
2626
br: &ty::BoundRegionKind,
@@ -50,7 +50,7 @@ pub(crate) fn find_anon_type(
5050

5151
// This method creates a FindNestedTypeVisitor which returns the type corresponding
5252
// to the anonymous region.
53-
fn find_component_for_bound_region(
53+
fn find_component_for_bound_region<'tcx>(
5454
tcx: TyCtxt<'tcx>,
5555
arg: &'tcx hir::Ty<'tcx>,
5656
br: &ty::BoundRegionKind,
@@ -83,7 +83,7 @@ struct FindNestedTypeVisitor<'tcx> {
8383
current_index: ty::DebruijnIndex,
8484
}
8585

86-
impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
86+
impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
8787
type Map = Map<'tcx>;
8888

8989
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
@@ -207,7 +207,7 @@ struct TyPathVisitor<'tcx> {
207207
current_index: ty::DebruijnIndex,
208208
}
209209

210-
impl Visitor<'tcx> for TyPathVisitor<'tcx> {
210+
impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
211211
type Map = Map<'tcx>;
212212

213213
fn nested_visit_map(&mut self) -> NestedVisitorMap<Map<'tcx>> {

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_middle::ty::{self, TyCtxt};
1313

1414
use std::fmt::{self, Write};
1515

16-
impl NiceRegionError<'me, 'tcx> {
16+
impl<'tcx> NiceRegionError<'_, 'tcx> {
1717
/// When given a `ConcreteFailure` for a function with arguments containing a named region and
1818
/// an anonymous region, emit a descriptive diagnostic error.
1919
pub(super) fn try_report_placeholder_conflict(&self) -> Option<DiagnosticBuilder<'tcx>> {

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
287287
}
288288

289289
pub fn suggest_new_region_bound(
290-
tcx: TyCtxt<'tcx>,
290+
tcx: TyCtxt<'_>,
291291
err: &mut DiagnosticBuilder<'_>,
292292
fn_returns: Vec<&rustc_hir::Ty<'_>>,
293293
lifetime_name: String,

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
8686
counter: usize,
8787
}
8888

89-
impl HighlightBuilder<'tcx> {
89+
impl<'tcx> HighlightBuilder<'tcx> {
9090
fn build(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> RegionHighlightMode {
9191
let mut builder =
9292
HighlightBuilder { highlight: RegionHighlightMode::default(), counter: 1, tcx };
@@ -186,7 +186,7 @@ struct TypeParamSpanVisitor<'tcx> {
186186
types: Vec<Span>,
187187
}
188188

189-
impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
189+
impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
190190
type Map = rustc_middle::hir::map::Map<'tcx>;
191191

192192
fn nested_visit_map(&mut self) -> hir::intravisit::NestedVisitorMap<Self::Map> {

compiler/rustc_infer/src/infer/glb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Glb<'combine, 'infcx, 'tcx> {
2323
}
2424
}
2525

26-
impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
26+
impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
2727
fn tag(&self) -> &'static str {
2828
"Glb"
2929
}

compiler/rustc_infer/src/infer/lub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Lub<'combine, 'infcx, 'tcx> {
2323
}
2424
}
2525

26-
impl TypeRelation<'tcx> for Lub<'combine, 'infcx, 'tcx> {
26+
impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
2727
fn tag(&self) -> &'static str {
2828
"Lub"
2929
}

compiler/rustc_infer/src/infer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ pub trait TyCtxtInferExt<'tcx> {
554554
fn infer_ctxt(self) -> InferCtxtBuilder<'tcx>;
555555
}
556556

557-
impl TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
557+
impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
558558
fn infer_ctxt(self) -> InferCtxtBuilder<'tcx> {
559559
InferCtxtBuilder {
560560
tcx: self,
@@ -1718,7 +1718,7 @@ pub enum TyOrConstInferVar<'tcx> {
17181718
Const(ConstVid<'tcx>),
17191719
}
17201720

1721-
impl TyOrConstInferVar<'tcx> {
1721+
impl<'tcx> TyOrConstInferVar<'tcx> {
17221722
/// Tries to extract an inference variable from a type or a constant, returns `None`
17231723
/// for types other than `ty::Infer(_)` (or `InferTy::Fresh*`) and
17241724
/// for constants other than `ty::ConstKind::Infer(_)` (or `InferConst::Fresh`).

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ trait VidValuePair<'tcx>: Debug {
407407
/// Extract the scopes that apply to whichever side of the tuple
408408
/// the vid was found on. See the comment where this is called
409409
/// for more details on why we want them.
410-
fn vid_scopes<D: TypeRelatingDelegate<'tcx>>(
410+
fn vid_scopes<'r, D: TypeRelatingDelegate<'tcx>>(
411411
&self,
412412
relate: &'r mut TypeRelating<'_, 'tcx, D>,
413413
) -> &'r mut Vec<BoundRegionScope<'tcx>>;
@@ -424,7 +424,7 @@ trait VidValuePair<'tcx>: Debug {
424424
D: TypeRelatingDelegate<'tcx>;
425425
}
426426

427-
impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
427+
impl<'tcx> VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
428428
fn vid(&self) -> ty::TyVid {
429429
self.0
430430
}
@@ -433,7 +433,7 @@ impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
433433
self.1
434434
}
435435

436-
fn vid_scopes<D>(
436+
fn vid_scopes<'r, D>(
437437
&self,
438438
relate: &'r mut TypeRelating<'_, 'tcx, D>,
439439
) -> &'r mut Vec<BoundRegionScope<'tcx>>
@@ -456,7 +456,7 @@ impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
456456
}
457457

458458
// In this case, the "vid" is the "b" type.
459-
impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
459+
impl<'tcx> VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
460460
fn vid(&self) -> ty::TyVid {
461461
self.1
462462
}
@@ -465,7 +465,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
465465
self.0
466466
}
467467

468-
fn vid_scopes<D>(
468+
fn vid_scopes<'r, D>(
469469
&self,
470470
relate: &'r mut TypeRelating<'_, 'tcx, D>,
471471
) -> &'r mut Vec<BoundRegionScope<'tcx>>
@@ -487,7 +487,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
487487
}
488488
}
489489

490-
impl<D> TypeRelation<'tcx> for TypeRelating<'me, 'tcx, D>
490+
impl<'tcx, D> TypeRelation<'tcx> for TypeRelating<'_, 'tcx, D>
491491
where
492492
D: TypeRelatingDelegate<'tcx>,
493493
{
@@ -841,7 +841,7 @@ where
841841
universe: ty::UniverseIndex,
842842
}
843843

844-
impl<D> TypeRelation<'tcx> for TypeGeneralizer<'me, 'tcx, D>
844+
impl<'tcx, D> TypeRelation<'tcx> for TypeGeneralizer<'_, 'tcx, D>
845845
where
846846
D: TypeRelatingDelegate<'tcx>,
847847
{

compiler/rustc_infer/src/infer/outlives/components.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub enum Component<'tcx> {
4949

5050
/// Push onto `out` all the things that must outlive `'a` for the condition
5151
/// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**.
52-
pub fn push_outlives_components(
52+
pub fn push_outlives_components<'tcx>(
5353
tcx: TyCtxt<'tcx>,
5454
ty0: Ty<'tcx>,
5555
out: &mut SmallVec<[Component<'tcx>; 4]>,
@@ -59,7 +59,7 @@ pub fn push_outlives_components(
5959
debug!("components({:?}) = {:?}", ty0, out);
6060
}
6161

62-
fn compute_components(
62+
fn compute_components<'tcx>(
6363
tcx: TyCtxt<'tcx>,
6464
ty: Ty<'tcx>,
6565
out: &mut SmallVec<[Component<'tcx>; 4]>,
@@ -190,7 +190,7 @@ fn compute_components(
190190
}
191191
}
192192

193-
fn compute_components_recursive(
193+
fn compute_components_recursive<'tcx>(
194194
tcx: TyCtxt<'tcx>,
195195
parent: GenericArg<'tcx>,
196196
out: &mut SmallVec<[Component<'tcx>; 4]>,

compiler/rustc_infer/src/infer/region_constraints/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ pub struct RegionConstraintCollector<'a, 'tcx> {
6565
undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
6666
}
6767

68-
impl std::ops::Deref for RegionConstraintCollector<'_, 'tcx> {
68+
impl<'tcx> std::ops::Deref for RegionConstraintCollector<'_, 'tcx> {
6969
type Target = RegionConstraintStorage<'tcx>;
7070
#[inline]
7171
fn deref(&self) -> &RegionConstraintStorage<'tcx> {
7272
self.storage
7373
}
7474
}
7575

76-
impl std::ops::DerefMut for RegionConstraintCollector<'_, 'tcx> {
76+
impl<'tcx> std::ops::DerefMut for RegionConstraintCollector<'_, 'tcx> {
7777
#[inline]
7878
fn deref_mut(&mut self) -> &mut RegionConstraintStorage<'tcx> {
7979
self.storage

compiler/rustc_infer/src/infer/sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'combine, 'infcx, 'tcx> Sub<'combine, 'infcx, 'tcx> {
3131
}
3232
}
3333

34-
impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
34+
impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
3535
fn tag(&self) -> &'static str {
3636
"Sub"
3737
}

compiler/rustc_infer/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#![feature(extend_one)]
2020
#![feature(let_else)]
2121
#![feature(never_type)]
22-
#![feature(in_band_lifetimes)]
2322
#![feature(control_flow_enum)]
2423
#![feature(min_specialization)]
2524
#![feature(label_break_value)]

compiler/rustc_infer/src/traits/engine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub trait TraitEngineExt<'tcx> {
6363
);
6464
}
6565

66-
impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
66+
impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
6767
fn register_predicate_obligations(
6868
&mut self,
6969
infcx: &InferCtxt<'_, 'tcx>,

compiler/rustc_infer/src/traits/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
3535
}
3636
}
3737

38-
pub fn report_object_safety_error(
38+
pub fn report_object_safety_error<'tcx>(
3939
tcx: TyCtxt<'tcx>,
4040
span: Span,
4141
trait_def_id: DefId,

0 commit comments

Comments
 (0)