Skip to content

Commit

Permalink
Auto merge of rust-lang#92106 - matthiaskrgr:rollup-zw6t1mu, r=matthi…
Browse files Browse the repository at this point in the history
…askrgr

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
  • Loading branch information
bors committed Dec 19, 2021
2 parents 41c3017 + 9415c67 commit e95e084
Show file tree
Hide file tree
Showing 29 changed files with 104 additions and 66 deletions.
9 changes: 8 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,15 @@ pub fn create_compressed_metadata_file(
let section = file.add_section(
file.segment_name(StandardSegment::Data).to_vec(),
b".rustc".to_vec(),
SectionKind::Data,
SectionKind::ReadOnlyData,
);
match file.format() {
BinaryFormat::Elf => {
// Explicitly set no flags to avoid SHF_ALLOC default for data section.
file.section_mut(section).flags = SectionFlags::Elf { sh_flags: 0 };
}
_ => {}
};
let offset = file.append_section_data(section, &compressed, 1);

// For MachO and probably PE this is necessary to prevent the linker from throwing away the
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
/// response*, then we don't typically replace free regions, as they
/// must have been introduced from other parts of the system.
trait CanonicalizeRegionMode {
fn canonicalize_free_region(
fn canonicalize_free_region<'tcx>(
&self,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
Expand All @@ -146,7 +146,7 @@ trait CanonicalizeRegionMode {
struct CanonicalizeQueryResponse;

impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
fn canonicalize_free_region(
fn canonicalize_free_region<'tcx>(
&self,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
Expand Down Expand Up @@ -203,7 +203,7 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
struct CanonicalizeUserTypeAnnotation;

impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation {
fn canonicalize_free_region(
fn canonicalize_free_region<'tcx>(
&self,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
Expand All @@ -226,7 +226,7 @@ impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation {
struct CanonicalizeAllFreeRegions;

impl CanonicalizeRegionMode for CanonicalizeAllFreeRegions {
fn canonicalize_free_region(
fn canonicalize_free_region<'tcx>(
&self,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
Expand All @@ -242,7 +242,7 @@ impl CanonicalizeRegionMode for CanonicalizeAllFreeRegions {
struct CanonicalizeFreeRegionsOtherThanStatic;

impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic {
fn canonicalize_free_region(
fn canonicalize_free_region<'tcx>(
&self,
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
r: ty::Region<'tcx>,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_infer/src/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ struct Generalization<'tcx> {
needs_wf: bool,
}

impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
Expand Down Expand Up @@ -827,7 +827,7 @@ struct ConstInferUnifier<'cx, 'tcx> {
// We use `TypeRelation` here to propagate `RelateResult` upwards.
//
// Both inputs are expected to be the same.
impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/equate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Equate<'combine, 'infcx, 'tcx> {
}
}

impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
fn tag(&self) -> &'static str {
"Equate"
}
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub use need_type_info::TypeAnnotationNeeded;

pub mod nice_region_error;

pub(super) fn note_and_explain_region(
pub(super) fn note_and_explain_region<'tcx>(
tcx: TyCtxt<'tcx>,
err: &mut DiagnosticBuilder<'_>,
prefix: &str,
Expand Down Expand Up @@ -116,7 +116,7 @@ pub(super) fn note_and_explain_region(
emit_msg_span(err, prefix, description, span, suffix);
}

fn explain_free_region(
fn explain_free_region<'tcx>(
tcx: TyCtxt<'tcx>,
err: &mut DiagnosticBuilder<'_>,
prefix: &str,
Expand All @@ -128,7 +128,7 @@ fn explain_free_region(
label_msg_span(err, prefix, description, span, suffix);
}

fn msg_span_from_free_region(
fn msg_span_from_free_region<'tcx>(
tcx: TyCtxt<'tcx>,
region: ty::Region<'tcx>,
alt_span: Option<Span>,
Expand All @@ -145,7 +145,7 @@ fn msg_span_from_free_region(
}
}

fn msg_span_from_early_bound_and_free_regions(
fn msg_span_from_early_bound_and_free_regions<'tcx>(
tcx: TyCtxt<'tcx>,
region: ty::Region<'tcx>,
) -> (String, Span) {
Expand Down Expand Up @@ -226,7 +226,7 @@ fn label_msg_span(
}
}

pub fn unexpected_hidden_region_diagnostic(
pub fn unexpected_hidden_region_diagnostic<'tcx>(
tcx: TyCtxt<'tcx>,
span: Span,
hidden_ty: Ty<'tcx>,
Expand Down Expand Up @@ -316,7 +316,7 @@ pub fn unexpected_hidden_region_diagnostic(
/// with the other type. A TyVar inference type is compatible with any type, and an IntVar or
/// FloatVar inference type are compatible with themselves or their concrete types (Int and
/// Float types, respectively). When comparing two ADTs, these rules apply recursively.
pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool {
pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
match (&a.kind(), &b.kind()) {
(&ty::Adt(did_a, substs_a), &ty::Adt(did_b, substs_b)) => {
if did_a != did_b {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_middle::ty::{self, Region, TyCtxt};
/// ```
/// The function returns the nested type corresponding to the anonymous region
/// for e.g., `&u8` and `Vec<&u8>`.
pub(crate) fn find_anon_type(
pub(crate) fn find_anon_type<'tcx>(
tcx: TyCtxt<'tcx>,
region: Region<'tcx>,
br: &ty::BoundRegionKind,
Expand Down Expand Up @@ -50,7 +50,7 @@ pub(crate) fn find_anon_type(

// This method creates a FindNestedTypeVisitor which returns the type corresponding
// to the anonymous region.
fn find_component_for_bound_region(
fn find_component_for_bound_region<'tcx>(
tcx: TyCtxt<'tcx>,
arg: &'tcx hir::Ty<'tcx>,
br: &ty::BoundRegionKind,
Expand Down Expand Up @@ -83,7 +83,7 @@ struct FindNestedTypeVisitor<'tcx> {
current_index: ty::DebruijnIndex,
}

impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
type Map = Map<'tcx>;

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

impl Visitor<'tcx> for TyPathVisitor<'tcx> {
impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
type Map = Map<'tcx>;

fn nested_visit_map(&mut self) -> NestedVisitorMap<Map<'tcx>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_middle::ty::{self, TyCtxt};

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

impl NiceRegionError<'me, 'tcx> {
impl<'tcx> NiceRegionError<'_, 'tcx> {
/// When given a `ConcreteFailure` for a function with arguments containing a named region and
/// an anonymous region, emit a descriptive diagnostic error.
pub(super) fn try_report_placeholder_conflict(&self) -> Option<DiagnosticBuilder<'tcx>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
}

pub fn suggest_new_region_bound(
tcx: TyCtxt<'tcx>,
tcx: TyCtxt<'_>,
err: &mut DiagnosticBuilder<'_>,
fn_returns: Vec<&rustc_hir::Ty<'_>>,
lifetime_name: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
counter: usize,
}

impl HighlightBuilder<'tcx> {
impl<'tcx> HighlightBuilder<'tcx> {
fn build(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> RegionHighlightMode {
let mut builder =
HighlightBuilder { highlight: RegionHighlightMode::default(), counter: 1, tcx };
Expand Down Expand Up @@ -186,7 +186,7 @@ struct TypeParamSpanVisitor<'tcx> {
types: Vec<Span>,
}

impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
type Map = rustc_middle::hir::map::Map<'tcx>;

fn nested_visit_map(&mut self) -> hir::intravisit::NestedVisitorMap<Self::Map> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/glb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Glb<'combine, 'infcx, 'tcx> {
}
}

impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
fn tag(&self) -> &'static str {
"Glb"
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/lub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Lub<'combine, 'infcx, 'tcx> {
}
}

impl TypeRelation<'tcx> for Lub<'combine, 'infcx, 'tcx> {
impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
fn tag(&self) -> &'static str {
"Lub"
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ pub trait TyCtxtInferExt<'tcx> {
fn infer_ctxt(self) -> InferCtxtBuilder<'tcx>;
}

impl TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
fn infer_ctxt(self) -> InferCtxtBuilder<'tcx> {
InferCtxtBuilder {
tcx: self,
Expand Down Expand Up @@ -1718,7 +1718,7 @@ pub enum TyOrConstInferVar<'tcx> {
Const(ConstVid<'tcx>),
}

impl TyOrConstInferVar<'tcx> {
impl<'tcx> TyOrConstInferVar<'tcx> {
/// Tries to extract an inference variable from a type or a constant, returns `None`
/// for types other than `ty::Infer(_)` (or `InferTy::Fresh*`) and
/// for constants other than `ty::ConstKind::Infer(_)` (or `InferConst::Fresh`).
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_infer/src/infer/nll_relate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ trait VidValuePair<'tcx>: Debug {
/// Extract the scopes that apply to whichever side of the tuple
/// the vid was found on. See the comment where this is called
/// for more details on why we want them.
fn vid_scopes<D: TypeRelatingDelegate<'tcx>>(
fn vid_scopes<'r, D: TypeRelatingDelegate<'tcx>>(
&self,
relate: &'r mut TypeRelating<'_, 'tcx, D>,
) -> &'r mut Vec<BoundRegionScope<'tcx>>;
Expand All @@ -424,7 +424,7 @@ trait VidValuePair<'tcx>: Debug {
D: TypeRelatingDelegate<'tcx>;
}

impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
impl<'tcx> VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
fn vid(&self) -> ty::TyVid {
self.0
}
Expand All @@ -433,7 +433,7 @@ impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
self.1
}

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

// In this case, the "vid" is the "b" type.
impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
impl<'tcx> VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
fn vid(&self) -> ty::TyVid {
self.1
}
Expand All @@ -465,7 +465,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
self.0
}

fn vid_scopes<D>(
fn vid_scopes<'r, D>(
&self,
relate: &'r mut TypeRelating<'_, 'tcx, D>,
) -> &'r mut Vec<BoundRegionScope<'tcx>>
Expand All @@ -487,7 +487,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
}
}

impl<D> TypeRelation<'tcx> for TypeRelating<'me, 'tcx, D>
impl<'tcx, D> TypeRelation<'tcx> for TypeRelating<'_, 'tcx, D>
where
D: TypeRelatingDelegate<'tcx>,
{
Expand Down Expand Up @@ -841,7 +841,7 @@ where
universe: ty::UniverseIndex,
}

impl<D> TypeRelation<'tcx> for TypeGeneralizer<'me, 'tcx, D>
impl<'tcx, D> TypeRelation<'tcx> for TypeGeneralizer<'_, 'tcx, D>
where
D: TypeRelatingDelegate<'tcx>,
{
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_infer/src/infer/outlives/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub enum Component<'tcx> {

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

fn compute_components(
fn compute_components<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
out: &mut SmallVec<[Component<'tcx>; 4]>,
Expand Down Expand Up @@ -190,7 +190,7 @@ fn compute_components(
}
}

fn compute_components_recursive(
fn compute_components_recursive<'tcx>(
tcx: TyCtxt<'tcx>,
parent: GenericArg<'tcx>,
out: &mut SmallVec<[Component<'tcx>; 4]>,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_infer/src/infer/region_constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ pub struct RegionConstraintCollector<'a, 'tcx> {
undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
}

impl std::ops::Deref for RegionConstraintCollector<'_, 'tcx> {
impl<'tcx> std::ops::Deref for RegionConstraintCollector<'_, 'tcx> {
type Target = RegionConstraintStorage<'tcx>;
#[inline]
fn deref(&self) -> &RegionConstraintStorage<'tcx> {
self.storage
}
}

impl std::ops::DerefMut for RegionConstraintCollector<'_, 'tcx> {
impl<'tcx> std::ops::DerefMut for RegionConstraintCollector<'_, 'tcx> {
#[inline]
fn deref_mut(&mut self) -> &mut RegionConstraintStorage<'tcx> {
self.storage
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'combine, 'infcx, 'tcx> Sub<'combine, 'infcx, 'tcx> {
}
}

impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
fn tag(&self) -> &'static str {
"Sub"
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#![feature(extend_one)]
#![feature(let_else)]
#![feature(never_type)]
#![feature(in_band_lifetimes)]
#![feature(control_flow_enum)]
#![feature(min_specialization)]
#![feature(label_break_value)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/traits/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub trait TraitEngineExt<'tcx> {
);
}

impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
fn register_predicate_obligations(
&mut self,
infcx: &InferCtxt<'_, 'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/traits/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}
}

pub fn report_object_safety_error(
pub fn report_object_safety_error<'tcx>(
tcx: TyCtxt<'tcx>,
span: Span,
trait_def_id: DefId,
Expand Down
Loading

0 comments on commit e95e084

Please sign in to comment.