Skip to content

Commit

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

Rollup of 6 pull requests

Successful merges:

 - rust-lang#91901 (Remove `in_band_lifetimes` from `rustc_symbol_mangling`)
 - rust-lang#91904 (Remove `in_band_lifetimes` from `rustc_trait_selection`)
 - rust-lang#91951 (update stdarch)
 - rust-lang#91958 (Apply rust-logo class only on default logo)
 - rust-lang#91972 (link to pref_align_of tracking issue)
 - rust-lang#91986 (Bump compiler-builtins to 0.1.66)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Dec 16, 2021
2 parents a090c86 + 7391962 commit f840216
Show file tree
Hide file tree
Showing 29 changed files with 110 additions and 91 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ dependencies = [

[[package]]
name = "compiler_builtins"
version = "0.1.65"
version = "0.1.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed37ea958309f2451e1cea7fd2b37aa56b1894c9a9fbdbbe6a194f7b78f0362d"
checksum = "191424db7756bbed2c4996959a0fbda94388abcf4f5a2728a8af17481ad9c4f7"
dependencies = [
"cc",
"rustc-std-workspace-core",
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_symbol_mangling/src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tracing::debug;
use std::fmt::{self, Write};
use std::mem::{self, discriminant};

pub(super) fn mangle(
pub(super) fn mangle<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
instantiating_crate: Option<CrateNum>,
Expand Down Expand Up @@ -199,7 +199,7 @@ struct SymbolPrinter<'tcx> {
// `PrettyPrinter` aka pretty printing of e.g. types in paths,
// symbol names should have their own printing machinery.

impl Printer<'tcx> for &mut SymbolPrinter<'tcx> {
impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
type Error = fmt::Error;

type Path = Self;
Expand Down Expand Up @@ -345,7 +345,7 @@ impl Printer<'tcx> for &mut SymbolPrinter<'tcx> {
}
}

impl PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx> {
impl<'tcx> PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx> {
fn region_should_not_be_omitted(&self, _region: ty::Region<'_>) -> bool {
false
}
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_symbol_mangling/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(never_type)]
#![feature(nll)]
#![feature(in_band_lifetimes)]
#![recursion_limit = "256"]

#[macro_use]
Expand All @@ -116,7 +115,7 @@ pub mod test;
/// This function computes the symbol name for the given `instance` and the
/// given instantiating crate. That is, if you know that instance X is
/// instantiated in crate Y, this is the symbol name this instance would have.
pub fn symbol_name_for_instance_in_crate(
pub fn symbol_name_for_instance_in_crate<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
instantiating_crate: CrateNum,
Expand All @@ -131,7 +130,7 @@ pub fn provide(providers: &mut Providers) {
// The `symbol_name` query provides the symbol name for calling a given
// instance from the local crate. In particular, it will also look up the
// correct symbol name of instances from upstream crates.
fn symbol_name_provider(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> ty::SymbolName<'tcx> {
fn symbol_name_provider<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> ty::SymbolName<'tcx> {
let symbol_name = compute_symbol_name(tcx, instance, || {
// This closure determines the instantiating crate for instances that
// need an instantiating-crate-suffix for their symbol name, in order
Expand All @@ -151,14 +150,14 @@ fn symbol_name_provider(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> ty::Symb
}

/// This function computes the typeid for the given function ABI.
pub fn typeid_for_fnabi(tcx: TyCtxt<'tcx>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> String {
pub fn typeid_for_fnabi<'tcx>(tcx: TyCtxt<'tcx>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> String {
v0::mangle_typeid_for_fnabi(tcx, fn_abi)
}

/// Computes the symbol name for the given instance. This function will call
/// `compute_instantiating_crate` if it needs to factor the instantiating crate
/// into the symbol name.
fn compute_symbol_name(
fn compute_symbol_name<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
compute_instantiating_crate: impl FnOnce() -> CrateNum,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_symbol_mangling/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct SymbolNamesTest<'tcx> {
tcx: TyCtxt<'tcx>,
}

impl SymbolNamesTest<'tcx> {
impl SymbolNamesTest<'_> {
fn process_attrs(&mut self, def_id: LocalDefId) {
let tcx = self.tcx;
for attr in tcx.get_attrs(def_id.to_def_id()).iter() {
Expand Down Expand Up @@ -59,7 +59,7 @@ impl SymbolNamesTest<'tcx> {
}
}

impl hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'tcx> {
impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
self.process_attrs(item.def_id);
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::fmt::Write;
use std::iter;
use std::ops::Range;

pub(super) fn mangle(
pub(super) fn mangle<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
instantiating_crate: Option<CrateNum>,
Expand Down Expand Up @@ -56,7 +56,7 @@ pub(super) fn mangle(
std::mem::take(&mut cx.out)
}

pub(super) fn mangle_typeid_for_fnabi(
pub(super) fn mangle_typeid_for_fnabi<'tcx>(
_tcx: TyCtxt<'tcx>,
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
) -> String {
Expand Down Expand Up @@ -118,7 +118,7 @@ struct SymbolMangler<'tcx> {
consts: FxHashMap<&'tcx ty::Const<'tcx>, usize>,
}

impl SymbolMangler<'tcx> {
impl<'tcx> SymbolMangler<'tcx> {
fn push(&mut self, s: &str) {
self.out.push_str(s);
}
Expand Down Expand Up @@ -250,7 +250,7 @@ impl SymbolMangler<'tcx> {
}
}

impl Printer<'tcx> for &mut SymbolMangler<'tcx> {
impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
type Error = !;

type Path = Self;
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#![feature(drain_filter)]
#![feature(derive_default_enum)]
#![feature(hash_drain_filter)]
#![feature(in_band_lifetimes)]
#![feature(let_else)]
#![feature(never_type)]
#![feature(crate_visibility_modifier)]
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_trait_selection/src/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct ReverseMapper<'tcx> {
span: Span,
}

impl ReverseMapper<'tcx> {
impl<'tcx> ReverseMapper<'tcx> {
fn new(
tcx: TyCtxt<'tcx>,
tainted_by_errors: bool,
Expand Down Expand Up @@ -134,7 +134,7 @@ impl ReverseMapper<'tcx> {
}
}

impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}
Expand Down Expand Up @@ -338,7 +338,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
/// Requires that trait definitions have been processed so that we can
/// elaborate predicates and walk supertraits.
#[instrument(skip(tcx, predicates), level = "debug")]
crate fn required_region_bounds(
crate fn required_region_bounds<'tcx>(
tcx: TyCtxt<'tcx>,
erased_self_ty: Ty<'tcx>,
predicates: impl Iterator<Item = ty::Predicate<'tcx>>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
}
}

impl AutoTraitFinder<'tcx> {
impl<'tcx> AutoTraitFinder<'tcx> {
/// The core logic responsible for computing the bounds for our synthesized impl.
///
/// To calculate the bounds, we call `SelectionContext.select` in a loop. Like
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/chalk_fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct FulfillmentContext<'tcx> {
relationships: FxHashMap<ty::TyVid, ty::FoundRelationships>,
}

impl FulfillmentContext<'tcx> {
impl FulfillmentContext<'_> {
crate fn new() -> Self {
FulfillmentContext {
obligations: FxIndexSet::default(),
Expand All @@ -25,7 +25,7 @@ impl FulfillmentContext<'tcx> {
}
}

impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
fn normalize_projection_type(
&mut self,
infcx: &InferCtxt<'_, 'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
/// type inference variables that appear in `result` to be
/// unified, and hence we need to process those obligations to get
/// the complete picture of the type.
fn drain_fulfillment_cx_or_panic<T>(
fn drain_fulfillment_cx_or_panic<'tcx, T>(
infcx: &InferCtxt<'_, 'tcx>,
fulfill_cx: &mut FulfillmentContext<'tcx>,
result: T,
Expand Down
20 changes: 15 additions & 5 deletions compiler/rustc_trait_selection/src/traits/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,24 @@ fn overlap<'cx, 'tcx>(
})
}

fn overlap_within_probe(
fn overlap_within_probe<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
skip_leak_check: SkipLeakCheck,
a_def_id: DefId,
b_def_id: DefId,
snapshot: &CombinedSnapshot<'_, 'tcx>,
) -> Option<OverlapResult<'tcx>> {
fn loose_check(selcx: &mut SelectionContext<'cx, 'tcx>, o: &PredicateObligation<'tcx>) -> bool {
fn loose_check<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
o: &PredicateObligation<'tcx>,
) -> bool {
!selcx.predicate_may_hold_fatal(o)
}

fn strict_check(selcx: &SelectionContext<'cx, 'tcx>, o: &PredicateObligation<'tcx>) -> bool {
fn strict_check<'cx, 'tcx>(
selcx: &SelectionContext<'cx, 'tcx>,
o: &PredicateObligation<'tcx>,
) -> bool {
let infcx = selcx.infcx();
let tcx = infcx.tcx;
o.flip_polarity(tcx)
Expand Down Expand Up @@ -518,7 +524,11 @@ fn orphan_check_trait_ref<'tcx>(
/// - for `Foo<u32>`, where `Foo` is a local type, this returns `[]`.
/// - `&mut u32` returns `[u32]`, as `&mut` is a fundamental type, similar to `Box`.
/// - `Box<Foo<u32>>` returns `[]`, as `Box` is a fundamental type and `Foo` is local.
fn contained_non_local_types(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> {
fn contained_non_local_types<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
in_crate: InCrate,
) -> Vec<Ty<'tcx>> {
if ty_is_local_constructor(ty, in_crate) {
Vec::new()
} else {
Expand All @@ -534,7 +544,7 @@ fn contained_non_local_types(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, in_crate: InCrate)
/// For `#[fundamental]` ADTs and `&T` / `&mut T`, returns `Some` with the
/// type parameters of the ADT, or `T`, respectively. For non-fundamental
/// types, returns `None`.
fn fundamental_ty_inner_tys(
fn fundamental_ty_inner_tys<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
) -> Option<impl Iterator<Item = Ty<'tcx>>> {
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
}

trait InferCtxtPrivExt<'tcx> {
trait InferCtxtPrivExt<'hir, 'tcx> {
// returns if `cond` not occurring implies that `error` does not occur - i.e., that
// `error` occurring implies that `cond` occurs.
fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -> bool;
Expand Down Expand Up @@ -1174,7 +1174,7 @@ trait InferCtxtPrivExt<'tcx> {
) -> bool;
}

impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
// returns if `cond` not occurring implies that `error` does not occur - i.e., that
// `error` occurring implies that `cond` occurs.
fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -> bool {
Expand Down Expand Up @@ -2042,7 +2042,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
self.maybe_suggest_unsized_generics(err, span, node);
}

fn maybe_suggest_unsized_generics(
fn maybe_suggest_unsized_generics<'hir>(
&self,
err: &mut DiagnosticBuilder<'tcx>,
span: Span,
Expand Down Expand Up @@ -2109,7 +2109,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
);
}

fn maybe_indirection_for_unsized(
fn maybe_indirection_for_unsized<'hir>(
&self,
err: &mut DiagnosticBuilder<'tcx>,
item: &'hir Item<'hir>,
Expand Down Expand Up @@ -2223,7 +2223,7 @@ impl<'v> Visitor<'v> for FindTypeParam {
}

pub fn recursive_type_with_infinite_size_error(
tcx: TyCtxt<'tcx>,
tcx: TyCtxt<'_>,
type_def_id: DefId,
spans: Vec<Span>,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn predicate_constraint(generics: &hir::Generics<'_>, pred: String) -> (Span, St
/// Type parameter needs more bounds. The trivial case is `T` `where T: Bound`, but
/// it can also be an `impl Trait` param that needs to be decomposed to a type
/// param for cleaner code.
fn suggest_restriction(
fn suggest_restriction<'tcx>(
tcx: TyCtxt<'tcx>,
generics: &hir::Generics<'tcx>,
msg: &str,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct FulfillProcessor<'a, 'b, 'tcx> {
register_region_obligations: bool,
}

fn mk_pending(os: Vec<PredicateObligation<'tcx>>) -> Vec<PendingPredicateObligation<'tcx>> {
fn mk_pending(os: Vec<PredicateObligation<'_>>) -> Vec<PendingPredicateObligation<'_>> {
os.into_iter()
.map(|o| PendingPredicateObligation { obligation: o, stalled_on: vec![] })
.collect()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum CopyImplementationError<'tcx> {
HasDestructor,
}

pub fn can_type_implement_copy(
pub fn can_type_implement_copy<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
self_type: Ty<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ fn vtable_trait_first_method_offset<'tcx>(
}

/// Find slot offset for trait vptr within vtable entries of another trait
pub fn vtable_trait_upcasting_coercion_new_vptr_slot(
pub fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
tcx: TyCtxt<'tcx>,
key: (
Ty<'tcx>, // trait object type whose trait owning vtable
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_trait_selection/src/traits/object_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ pub fn astconv_object_safety_violations(
violations
}

fn object_safety_violations(
tcx: TyCtxt<'tcx>,
trait_def_id: DefId,
) -> &'tcx [ObjectSafetyViolation] {
fn object_safety_violations(tcx: TyCtxt<'_>, trait_def_id: DefId) -> &'_ [ObjectSafetyViolation] {
debug_assert!(tcx.generics_of(trait_def_id).has_self);
debug!("object_safety_violations: {:?}", trait_def_id);

Expand Down Expand Up @@ -272,7 +269,7 @@ fn bounds_reference_self(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SmallVec<[Span
.collect()
}

fn predicate_references_self(
fn predicate_references_self<'tcx>(
tcx: TyCtxt<'tcx>,
(predicate, sp): (ty::Predicate<'tcx>, Span),
) -> Option<Span> {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
}
}

impl TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
Expand Down Expand Up @@ -678,7 +678,7 @@ impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
}
}

impl TypeFolder<'tcx> for PlaceholderReplacer<'_, 'tcx> {
impl<'tcx> TypeFolder<'tcx> for PlaceholderReplacer<'_, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
Expand Down Expand Up @@ -1937,14 +1937,14 @@ fn assoc_ty_def(
}
}

crate trait ProjectionCacheKeyExt<'tcx>: Sized {
crate trait ProjectionCacheKeyExt<'cx, 'tcx>: Sized {
fn from_poly_projection_predicate(
selcx: &mut SelectionContext<'cx, 'tcx>,
predicate: ty::PolyProjectionPredicate<'tcx>,
) -> Option<Self>;
}

impl<'tcx> ProjectionCacheKeyExt<'tcx> for ProjectionCacheKey<'tcx> {
impl<'cx, 'tcx> ProjectionCacheKeyExt<'cx, 'tcx> for ProjectionCacheKey<'tcx> {
fn from_poly_projection_predicate(
selcx: &mut SelectionContext<'cx, 'tcx>,
predicate: ty::PolyProjectionPredicate<'tcx>,
Expand Down
Loading

0 comments on commit f840216

Please sign in to comment.