Auto merge of #127898 - matthiaskrgr:rollup-lkkpoui, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #127077 (Make language around `ToOwned` for `BorrowedFd` more precise)
 - #127783 (Put the dots back in RTN pretty printing)
 - #127787 (Migrate `atomic-lock-free` to `rmake`)
 - #127810 (Rename `tcx` to `cx` in `rustc_type_ir`)
 - #127878 (Fix associated item removal suggestion)
 - #127886 (Accurate `use` rename suggestion span)
 - #127888 (More accurate span for type parameter suggestion)
 - #127889 (More accurate span for anonymous argument suggestion)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-07-18 06:11:35 +00:00
commit 52f3c71c8d
80 changed files with 550 additions and 383 deletions

View file

@ -309,7 +309,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> {
} }
impl<'bccx, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'bccx, 'tcx> { impl<'bccx, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'bccx, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.type_checker.infcx.tcx self.type_checker.infcx.tcx
} }
@ -370,7 +370,7 @@ impl<'bccx, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'bccx, 'tcx
// shouldn't ever fail. Instead, it unconditionally emits an // shouldn't ever fail. Instead, it unconditionally emits an
// alias-relate goal. // alias-relate goal.
assert!(!self.type_checker.infcx.next_trait_solver()); assert!(!self.type_checker.infcx.next_trait_solver());
self.tcx().dcx().span_delayed_bug( self.cx().dcx().span_delayed_bug(
self.span(), self.span(),
"failure to relate an opaque to itself should result in an error later on", "failure to relate an opaque to itself should result in an error later on",
); );
@ -540,7 +540,7 @@ impl<'bccx, 'tcx> PredicateEmittingRelation<InferCtxt<'tcx>> for NllTypeRelating
&mut self, &mut self,
obligations: impl IntoIterator<Item: ty::Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>>, obligations: impl IntoIterator<Item: ty::Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>>,
) { ) {
let tcx = self.tcx(); let tcx = self.cx();
let param_env = self.param_env(); let param_env = self.param_env();
self.register_goals( self.register_goals(
obligations.into_iter().map(|to_pred| Goal::new(tcx, param_env, to_pred)), obligations.into_iter().map(|to_pred| Goal::new(tcx, param_env, to_pred)),
@ -559,7 +559,7 @@ impl<'bccx, 'tcx> PredicateEmittingRelation<InferCtxt<'tcx>> for NllTypeRelating
.into_iter() .into_iter()
.map(|goal| { .map(|goal| {
Obligation::new( Obligation::new(
self.tcx(), self.cx(),
ObligationCause::dummy_with_span(self.span()), ObligationCause::dummy_with_span(self.span()),
goal.param_env, goal.param_env,
goal.predicate, goal.predicate,

View file

@ -1257,14 +1257,12 @@ pub fn prohibit_assoc_item_constraint(
}; };
// Now emit the suggestion // Now emit the suggestion
if let Ok(suggestion) = tcx.sess.source_map().span_to_snippet(removal_span) { e.span_suggestion_verbose(
e.span_suggestion_verbose( removal_span,
removal_span, format!("consider removing this associated item {}", constraint.kind.descr()),
format!("consider removing this associated item {}", constraint.kind.descr()), "",
suggestion, Applicability::MaybeIncorrect,
Applicability::MaybeIncorrect, );
);
}
}; };
// Suggest replacing the associated item binding with a generic argument. // Suggest replacing the associated item binding with a generic argument.
@ -1340,11 +1338,13 @@ pub fn prohibit_assoc_item_constraint(
format!("<{lifetimes}{type_with_constraints}>"), format!("<{lifetimes}{type_with_constraints}>"),
) )
}; };
let suggestions = let suggestions = vec![
vec![param_decl, (constraint.span, format!("{}", matching_param.name))]; param_decl,
(constraint.span.with_lo(constraint.ident.span.hi()), String::new()),
];
err.multipart_suggestion_verbose( err.multipart_suggestion_verbose(
format!("declare the type parameter right after the `impl` keyword"), "declare the type parameter right after the `impl` keyword",
suggestions, suggestions,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );

View file

@ -1930,7 +1930,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
struct SameTypeModuloInfer<'a, 'tcx>(&'a InferCtxt<'tcx>); struct SameTypeModuloInfer<'a, 'tcx>(&'a InferCtxt<'tcx>);
impl<'tcx> TypeRelation<TyCtxt<'tcx>> for SameTypeModuloInfer<'_, 'tcx> { impl<'tcx> TypeRelation<TyCtxt<'tcx>> for SameTypeModuloInfer<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.0.tcx self.0.tcx
} }

View file

@ -137,7 +137,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for MatchAgainstHigherRankedOutlives<'tcx>
"MatchAgainstHigherRankedOutlives" "MatchAgainstHigherRankedOutlives"
} }
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }

View file

@ -372,7 +372,7 @@ impl<'tcx> Generalizer<'_, 'tcx> {
let is_nested_alias = mem::replace(&mut self.in_alias, true); let is_nested_alias = mem::replace(&mut self.in_alias, true);
let result = match self.relate(alias, alias) { let result = match self.relate(alias, alias) {
Ok(alias) => Ok(alias.to_ty(self.tcx())), Ok(alias) => Ok(alias.to_ty(self.cx())),
Err(e) => { Err(e) => {
if is_nested_alias { if is_nested_alias {
return Err(e); return Err(e);
@ -397,7 +397,7 @@ impl<'tcx> Generalizer<'_, 'tcx> {
} }
impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> { impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx self.infcx.tcx
} }
@ -417,7 +417,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
// (e.g., #41849). // (e.g., #41849).
relate::relate_args_invariantly(self, a_arg, b_arg) relate::relate_args_invariantly(self, a_arg, b_arg)
} else { } else {
let tcx = self.tcx(); let tcx = self.cx();
let opt_variances = tcx.variances_of(item_def_id); let opt_variances = tcx.variances_of(item_def_id);
relate::relate_args_with_variances( relate::relate_args_with_variances(
self, self,
@ -525,7 +525,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
} }
debug!("replacing original vid={:?} with new={:?}", vid, new_var_id); debug!("replacing original vid={:?} with new={:?}", vid, new_var_id);
Ok(Ty::new_var(self.tcx(), new_var_id)) Ok(Ty::new_var(self.cx(), new_var_id))
} }
} }
} }
@ -654,7 +654,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
{ {
variable_table.union(vid, new_var_id); variable_table.union(vid, new_var_id);
} }
Ok(ty::Const::new_var(self.tcx(), new_var_id)) Ok(ty::Const::new_var(self.cx(), new_var_id))
} }
} }
} }
@ -672,7 +672,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
args, args,
args, args,
)?; )?;
Ok(ty::Const::new_unevaluated(self.tcx(), ty::UnevaluatedConst { def, args })) Ok(ty::Const::new_unevaluated(self.cx(), ty::UnevaluatedConst { def, args }))
} }
ty::ConstKind::Placeholder(placeholder) => { ty::ConstKind::Placeholder(placeholder) => {
if self.for_universe.can_name(placeholder.universe) { if self.for_universe.can_name(placeholder.universe) {

View file

@ -27,7 +27,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Glb<'_, '_, 'tcx> {
"Glb" "Glb"
} }
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.fields.tcx() self.fields.tcx()
} }
@ -61,7 +61,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Glb<'_, '_, 'tcx> {
let origin = SubregionOrigin::Subtype(Box::new(self.fields.trace.clone())); let origin = SubregionOrigin::Subtype(Box::new(self.fields.trace.clone()));
// GLB(&'static u8, &'a u8) == &RegionLUB('static, 'a) u8 == &'static u8 // GLB(&'static u8, &'a u8) == &RegionLUB('static, 'a) u8 == &'static u8
Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().lub_regions( Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().lub_regions(
self.tcx(), self.cx(),
origin, origin,
a, a,
b, b,

View file

@ -27,7 +27,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Lub<'_, '_, 'tcx> {
"Lub" "Lub"
} }
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.fields.tcx() self.fields.tcx()
} }
@ -61,7 +61,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Lub<'_, '_, 'tcx> {
let origin = SubregionOrigin::Subtype(Box::new(self.fields.trace.clone())); let origin = SubregionOrigin::Subtype(Box::new(self.fields.trace.clone()));
// LUB(&'static u8, &'a u8) == &RegionGLB('static, 'a) u8 == &'a u8 // LUB(&'static u8, &'a u8) == &RegionGLB('static, 'a) u8 == &'a u8
Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().glb_regions( Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().glb_regions(
self.tcx(), self.cx(),
origin, origin,
a, a,
b, b,

View file

@ -32,7 +32,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
"TypeRelating" "TypeRelating"
} }
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.fields.infcx.tcx self.fields.infcx.tcx
} }
@ -48,7 +48,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
// (e.g., #41849). // (e.g., #41849).
relate_args_invariantly(self, a_arg, b_arg) relate_args_invariantly(self, a_arg, b_arg)
} else { } else {
let tcx = self.tcx(); let tcx = self.cx();
let opt_variances = tcx.variances_of(item_def_id); let opt_variances = tcx.variances_of(item_def_id);
relate_args_with_variances(self, item_def_id, opt_variances, a_arg, b_arg, false) relate_args_with_variances(self, item_def_id, opt_variances, a_arg, b_arg, false)
} }
@ -88,7 +88,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
// can't make progress on `A <: B` if both A and B are // can't make progress on `A <: B` if both A and B are
// type variables, so record an obligation. // type variables, so record an obligation.
self.fields.goals.push(Goal::new( self.fields.goals.push(Goal::new(
self.tcx(), self.cx(),
self.fields.param_env, self.fields.param_env,
ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate { ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
a_is_expected: true, a_is_expected: true,
@ -101,7 +101,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
// can't make progress on `B <: A` if both A and B are // can't make progress on `B <: A` if both A and B are
// type variables, so record an obligation. // type variables, so record an obligation.
self.fields.goals.push(Goal::new( self.fields.goals.push(Goal::new(
self.tcx(), self.cx(),
self.fields.param_env, self.fields.param_env,
ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate { ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
a_is_expected: false, a_is_expected: false,
@ -134,7 +134,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
(&ty::Error(e), _) | (_, &ty::Error(e)) => { (&ty::Error(e), _) | (_, &ty::Error(e)) => {
infcx.set_tainted_by_errors(e); infcx.set_tainted_by_errors(e);
return Ok(Ty::new_error(self.tcx(), e)); return Ok(Ty::new_error(self.cx(), e));
} }
( (

View file

@ -45,7 +45,7 @@ pub fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStre
quote! { quote! {
type Lifted = #lifted; type Lifted = #lifted;
fn lift_to_tcx(self, __tcx: ::rustc_middle::ty::TyCtxt<'__lifted>) -> Option<#lifted> { fn lift_to_interner(self, __tcx: ::rustc_middle::ty::TyCtxt<'__lifted>) -> Option<#lifted> {
Some(match self { #body }) Some(match self { #body })
} }
}, },

View file

@ -59,7 +59,7 @@ macro_rules! TrivialLiftImpls {
$( $(
impl<'tcx> $crate::ty::Lift<$crate::ty::TyCtxt<'tcx>> for $ty { impl<'tcx> $crate::ty::Lift<$crate::ty::TyCtxt<'tcx>> for $ty {
type Lifted = Self; type Lifted = Self;
fn lift_to_tcx(self, _: $crate::ty::TyCtxt<'tcx>) -> Option<Self> { fn lift_to_interner(self, _: $crate::ty::TyCtxt<'tcx>) -> Option<Self> {
Some(self) Some(self)
} }
} }

View file

@ -1484,7 +1484,7 @@ impl<'tcx> TyCtxt<'tcx> {
} }
pub fn lift<T: Lift<TyCtxt<'tcx>>>(self, value: T) -> Option<T::Lifted> { pub fn lift<T: Lift<TyCtxt<'tcx>>>(self, value: T) -> Option<T::Lifted> {
value.lift_to_tcx(self) value.lift_to_interner(self)
} }
/// Creates a type context. To use the context call `fn enter` which /// Creates a type context. To use the context call `fn enter` which
@ -2087,7 +2087,7 @@ macro_rules! nop_lift {
($set:ident; $ty:ty => $lifted:ty) => { ($set:ident; $ty:ty => $lifted:ty) => {
impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for $ty { impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for $ty {
type Lifted = $lifted; type Lifted = $lifted;
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> { fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
// Assert that the set has the right type. // Assert that the set has the right type.
// Given an argument that has an interned type, the return type has the type of // Given an argument that has an interned type, the return type has the type of
// the corresponding interner set. This won't actually return anything, we're // the corresponding interner set. This won't actually return anything, we're
@ -2122,7 +2122,7 @@ macro_rules! nop_list_lift {
($set:ident; $ty:ty => $lifted:ty) => { ($set:ident; $ty:ty => $lifted:ty) => {
impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a List<$ty> { impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a List<$ty> {
type Lifted = &'tcx List<$lifted>; type Lifted = &'tcx List<$lifted>;
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> { fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
// Assert that the set has the right type. // Assert that the set has the right type.
if false { if false {
let _x: &InternedSet<'tcx, List<$lifted>> = &tcx.interners.$set; let _x: &InternedSet<'tcx, List<$lifted>> = &tcx.interners.$set;
@ -2160,7 +2160,7 @@ macro_rules! nop_slice_lift {
($ty:ty => $lifted:ty) => { ($ty:ty => $lifted:ty) => {
impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a [$ty] { impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a [$ty] {
type Lifted = &'tcx [$lifted]; type Lifted = &'tcx [$lifted];
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> { fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
if self.is_empty() { if self.is_empty() {
return Some(&[]); return Some(&[]);
} }

View file

@ -308,7 +308,7 @@ impl<'tcx> GenericArg<'tcx> {
impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for GenericArg<'a> { impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for GenericArg<'a> {
type Lifted = GenericArg<'tcx>; type Lifted = GenericArg<'tcx>;
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> { fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
match self.unpack() { match self.unpack() {
GenericArgKind::Lifetime(lt) => tcx.lift(lt).map(|lt| lt.into()), GenericArgKind::Lifetime(lt) => tcx.lift(lt).map(|lt| lt.into()),
GenericArgKind::Type(ty) => tcx.lift(ty).map(|ty| ty.into()), GenericArgKind::Type(ty) => tcx.lift(ty).map(|ty| ty.into()),

View file

@ -1214,11 +1214,14 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
&& let ty::Alias(_, alias_ty) = && let ty::Alias(_, alias_ty) =
self.tcx().fn_sig(fn_def_id).skip_binder().output().skip_binder().kind() self.tcx().fn_sig(fn_def_id).skip_binder().output().skip_binder().kind()
&& alias_ty.def_id == def_id && alias_ty.def_id == def_id
&& let generics = self.tcx().generics_of(fn_def_id)
// FIXME(return_type_notation): We only support lifetime params for now.
&& generics.own_params.iter().all(|param| matches!(param.kind, ty::GenericParamDefKind::Lifetime))
{ {
let num_args = self.tcx().generics_of(fn_def_id).count(); let num_args = generics.count();
write!(self, " {{ ")?; write!(self, " {{ ")?;
self.print_def_path(fn_def_id, &args[..num_args])?; self.print_def_path(fn_def_id, &args[..num_args])?;
write!(self, "() }}")?; write!(self, "(..) }}")?;
} }
Ok(()) Ok(())

View file

@ -69,7 +69,7 @@ impl<'tcx> Relate<TyCtxt<'tcx>> for ty::Pattern<'tcx> {
if inc_a != inc_b { if inc_a != inc_b {
todo!() todo!()
} }
Ok(relation.tcx().mk_pat(ty::PatternKind::Range { start, end, include_end: inc_a })) Ok(relation.cx().mk_pat(ty::PatternKind::Range { start, end, include_end: inc_a }))
} }
} }
} }
@ -81,7 +81,7 @@ impl<'tcx> Relate<TyCtxt<'tcx>> for &'tcx ty::List<ty::PolyExistentialPredicate<
a: Self, a: Self,
b: Self, b: Self,
) -> RelateResult<'tcx, Self> { ) -> RelateResult<'tcx, Self> {
let tcx = relation.tcx(); let tcx = relation.cx();
// FIXME: this is wasteful, but want to do a perf run to see how slow it is. // FIXME: this is wasteful, but want to do a perf run to see how slow it is.
// We need to perform this deduplication as we sometimes generate duplicate projections // We need to perform this deduplication as we sometimes generate duplicate projections

View file

@ -283,7 +283,7 @@ TrivialTypeTraversalAndLiftImpls! {
impl<'tcx, T: Lift<TyCtxt<'tcx>>> Lift<TyCtxt<'tcx>> for Option<T> { impl<'tcx, T: Lift<TyCtxt<'tcx>>> Lift<TyCtxt<'tcx>> for Option<T> {
type Lifted = Option<T::Lifted>; type Lifted = Option<T::Lifted>;
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> { fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
Some(match self { Some(match self {
Some(x) => Some(tcx.lift(x)?), Some(x) => Some(tcx.lift(x)?),
None => None, None => None,
@ -293,7 +293,7 @@ impl<'tcx, T: Lift<TyCtxt<'tcx>>> Lift<TyCtxt<'tcx>> for Option<T> {
impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Term<'a> { impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Term<'a> {
type Lifted = ty::Term<'tcx>; type Lifted = ty::Term<'tcx>;
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> { fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
match self.unpack() { match self.unpack() {
TermKind::Ty(ty) => tcx.lift(ty).map(Into::into), TermKind::Ty(ty) => tcx.lift(ty).map(Into::into),
TermKind::Const(c) => tcx.lift(c).map(Into::into), TermKind::Const(c) => tcx.lift(c).map(Into::into),

View file

@ -2240,11 +2240,11 @@ impl<'a> Parser<'a> {
} }
_ => { _ => {
// Otherwise, try to get a type and emit a suggestion. // Otherwise, try to get a type and emit a suggestion.
if let Some(ty) = pat.to_ty() { if let Some(_) = pat.to_ty() {
err.span_suggestion_verbose( err.span_suggestion_verbose(
pat.span, pat.span.shrink_to_lo(),
"explicitly ignore the parameter name", "explicitly ignore the parameter name",
format!("_: {}", pprust::ty_to_string(&ty)), "_: ".to_string(),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
err.note(rfc_note); err.note(rfc_note);
@ -2256,7 +2256,7 @@ impl<'a> Parser<'a> {
// `fn foo(a, b) {}`, `fn foo(a<x>, b<y>) {}` or `fn foo(usize, usize) {}` // `fn foo(a, b) {}`, `fn foo(a<x>, b<y>) {}` or `fn foo(usize, usize) {}`
if first_param { if first_param {
err.span_suggestion( err.span_suggestion_verbose(
self_span, self_span,
"if this is a `self` type, give it a parameter name", "if this is a `self` type, give it a parameter name",
self_sugg, self_sugg,
@ -2266,14 +2266,14 @@ impl<'a> Parser<'a> {
// Avoid suggesting that `fn foo(HashMap<u32>)` is fixed with a change to // Avoid suggesting that `fn foo(HashMap<u32>)` is fixed with a change to
// `fn foo(HashMap: TypeName<u32>)`. // `fn foo(HashMap: TypeName<u32>)`.
if self.token != token::Lt { if self.token != token::Lt {
err.span_suggestion( err.span_suggestion_verbose(
param_span, param_span,
"if this is a parameter name, give it a type", "if this is a parameter name, give it a type",
param_sugg, param_sugg,
Applicability::HasPlaceholders, Applicability::HasPlaceholders,
); );
} }
err.span_suggestion( err.span_suggestion_verbose(
type_span, type_span,
"if this is a type, explicitly ignore the parameter name", "if this is a type, explicitly ignore the parameter name",
type_sugg, type_sugg,

View file

@ -371,6 +371,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}; };
let mut suggestion = None; let mut suggestion = None;
let mut span = binding_span;
match import.kind { match import.kind {
ImportKind::Single { type_ns_only: true, .. } => { ImportKind::Single { type_ns_only: true, .. } => {
suggestion = Some(format!("self as {suggested_name}")) suggestion = Some(format!("self as {suggested_name}"))
@ -381,12 +382,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
{ {
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(binding_span) { if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(binding_span) {
if pos <= snippet.len() { if pos <= snippet.len() {
suggestion = Some(format!( span = binding_span
"{} as {}{}", .with_lo(binding_span.lo() + BytePos(pos as u32))
&snippet[..pos], .with_hi(
suggested_name, binding_span.hi()
if snippet.ends_with(';') { ";" } else { "" } - BytePos(if snippet.ends_with(';') { 1 } else { 0 }),
)) );
suggestion = Some(format!(" as {suggested_name}"));
} }
} }
} }
@ -402,9 +404,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
} }
if let Some(suggestion) = suggestion { if let Some(suggestion) = suggestion {
err.subdiagnostic(ChangeImportBindingSuggestion { span: binding_span, suggestion }); err.subdiagnostic(ChangeImportBindingSuggestion { span, suggestion });
} else { } else {
err.subdiagnostic(ChangeImportBinding { span: binding_span }); err.subdiagnostic(ChangeImportBinding { span });
} }
} }

View file

@ -36,7 +36,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for MatchAgainstFreshVars<'tcx> {
"MatchAgainstFreshVars" "MatchAgainstFreshVars"
} }
fn tcx(&self) -> TyCtxt<'tcx> { fn cx(&self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }
@ -77,7 +77,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for MatchAgainstFreshVars<'tcx> {
Err(TypeError::Sorts(ExpectedFound::new(true, a, b))) Err(TypeError::Sorts(ExpectedFound::new(true, a, b)))
} }
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(Ty::new_error(self.tcx(), guar)), (&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(Ty::new_error(self.cx(), guar)),
_ => structurally_relate_tys(self, a, b), _ => structurally_relate_tys(self, a, b),
} }

View file

@ -49,10 +49,10 @@ where
{ {
type Lifted = Binder<U, T::Lifted>; type Lifted = Binder<U, T::Lifted>;
fn lift_to_tcx(self, tcx: U) -> Option<Self::Lifted> { fn lift_to_interner(self, cx: U) -> Option<Self::Lifted> {
Some(Binder { Some(Binder {
value: self.value.lift_to_tcx(tcx)?, value: self.value.lift_to_interner(cx)?,
bound_vars: self.bound_vars.lift_to_tcx(tcx)?, bound_vars: self.bound_vars.lift_to_interner(cx)?,
}) })
} }
} }
@ -439,11 +439,11 @@ impl<I: Interner, Iter: IntoIterator> EarlyBinder<I, Iter>
where where
Iter::Item: TypeFoldable<I>, Iter::Item: TypeFoldable<I>,
{ {
pub fn iter_instantiated<A>(self, tcx: I, args: A) -> IterInstantiated<I, Iter, A> pub fn iter_instantiated<A>(self, cx: I, args: A) -> IterInstantiated<I, Iter, A>
where where
A: SliceLike<Item = I::GenericArg>, A: SliceLike<Item = I::GenericArg>,
{ {
IterInstantiated { it: self.value.into_iter(), tcx, args } IterInstantiated { it: self.value.into_iter(), cx, args }
} }
/// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity), /// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity),
@ -455,7 +455,7 @@ where
pub struct IterInstantiated<I: Interner, Iter: IntoIterator, A> { pub struct IterInstantiated<I: Interner, Iter: IntoIterator, A> {
it: Iter::IntoIter, it: Iter::IntoIter,
tcx: I, cx: I,
args: A, args: A,
} }
@ -469,7 +469,7 @@ where
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
Some( Some(
EarlyBinder { value: self.it.next()?, _tcx: PhantomData } EarlyBinder { value: self.it.next()?, _tcx: PhantomData }
.instantiate(self.tcx, self.args), .instantiate(self.cx, self.args),
) )
} }
@ -487,7 +487,7 @@ where
fn next_back(&mut self) -> Option<Self::Item> { fn next_back(&mut self) -> Option<Self::Item> {
Some( Some(
EarlyBinder { value: self.it.next_back()?, _tcx: PhantomData } EarlyBinder { value: self.it.next_back()?, _tcx: PhantomData }
.instantiate(self.tcx, self.args), .instantiate(self.cx, self.args),
) )
} }
} }
@ -507,10 +507,10 @@ where
{ {
pub fn iter_instantiated_copied( pub fn iter_instantiated_copied(
self, self,
tcx: I, cx: I,
args: &'s [I::GenericArg], args: &'s [I::GenericArg],
) -> IterInstantiatedCopied<'s, I, Iter> { ) -> IterInstantiatedCopied<'s, I, Iter> {
IterInstantiatedCopied { it: self.value.into_iter(), tcx, args } IterInstantiatedCopied { it: self.value.into_iter(), cx, args }
} }
/// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity), /// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity),
@ -522,7 +522,7 @@ where
pub struct IterInstantiatedCopied<'a, I: Interner, Iter: IntoIterator> { pub struct IterInstantiatedCopied<'a, I: Interner, Iter: IntoIterator> {
it: Iter::IntoIter, it: Iter::IntoIter,
tcx: I, cx: I,
args: &'a [I::GenericArg], args: &'a [I::GenericArg],
} }
@ -535,7 +535,7 @@ where
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
self.it.next().map(|value| { self.it.next().map(|value| {
EarlyBinder { value: *value, _tcx: PhantomData }.instantiate(self.tcx, self.args) EarlyBinder { value: *value, _tcx: PhantomData }.instantiate(self.cx, self.args)
}) })
} }
@ -552,7 +552,7 @@ where
{ {
fn next_back(&mut self) -> Option<Self::Item> { fn next_back(&mut self) -> Option<Self::Item> {
self.it.next_back().map(|value| { self.it.next_back().map(|value| {
EarlyBinder { value: *value, _tcx: PhantomData }.instantiate(self.tcx, self.args) EarlyBinder { value: *value, _tcx: PhantomData }.instantiate(self.cx, self.args)
}) })
} }
} }
@ -589,11 +589,11 @@ impl<I: Interner, T: Iterator> Iterator for EarlyBinderIter<I, T> {
} }
impl<I: Interner, T: TypeFoldable<I>> ty::EarlyBinder<I, T> { impl<I: Interner, T: TypeFoldable<I>> ty::EarlyBinder<I, T> {
pub fn instantiate<A>(self, tcx: I, args: A) -> T pub fn instantiate<A>(self, cx: I, args: A) -> T
where where
A: SliceLike<Item = I::GenericArg>, A: SliceLike<Item = I::GenericArg>,
{ {
let mut folder = ArgFolder { tcx, args: args.as_slice(), binders_passed: 0 }; let mut folder = ArgFolder { cx, args: args.as_slice(), binders_passed: 0 };
self.value.fold_with(&mut folder) self.value.fold_with(&mut folder)
} }
@ -619,7 +619,7 @@ impl<I: Interner, T: TypeFoldable<I>> ty::EarlyBinder<I, T> {
// The actual instantiation engine itself is a type folder. // The actual instantiation engine itself is a type folder.
struct ArgFolder<'a, I: Interner> { struct ArgFolder<'a, I: Interner> {
tcx: I, cx: I,
args: &'a [I::GenericArg], args: &'a [I::GenericArg],
/// Number of region binders we have passed through while doing the instantiation /// Number of region binders we have passed through while doing the instantiation
@ -629,7 +629,7 @@ struct ArgFolder<'a, I: Interner> {
impl<'a, I: Interner> TypeFolder<I> for ArgFolder<'a, I> { impl<'a, I: Interner> TypeFolder<I> for ArgFolder<'a, I> {
#[inline] #[inline]
fn cx(&self) -> I { fn cx(&self) -> I {
self.tcx self.cx
} }
fn fold_binder<T: TypeFoldable<I>>(&mut self, t: ty::Binder<I, T>) -> ty::Binder<I, T> { fn fold_binder<T: TypeFoldable<I>>(&mut self, t: ty::Binder<I, T>) -> ty::Binder<I, T> {
@ -858,6 +858,6 @@ impl<'a, I: Interner> ArgFolder<'a, I> {
if self.binders_passed == 0 || !region.has_escaping_bound_vars() { if self.binders_passed == 0 || !region.has_escaping_bound_vars() {
return region; return region;
} }
ty::fold::shift_region(self.tcx, region, self.binders_passed) ty::fold::shift_region(self.cx, region, self.binders_passed)
} }
} }

View file

@ -330,25 +330,25 @@ impl<I: Interner> CanonicalVarValues<I> {
// Given a list of canonical variables, construct a set of values which are // Given a list of canonical variables, construct a set of values which are
// the identity response. // the identity response.
pub fn make_identity(tcx: I, infos: I::CanonicalVars) -> CanonicalVarValues<I> { pub fn make_identity(cx: I, infos: I::CanonicalVars) -> CanonicalVarValues<I> {
CanonicalVarValues { CanonicalVarValues {
var_values: tcx.mk_args_from_iter(infos.iter().enumerate().map( var_values: cx.mk_args_from_iter(infos.iter().enumerate().map(
|(i, info)| -> I::GenericArg { |(i, info)| -> I::GenericArg {
match info.kind { match info.kind {
CanonicalVarKind::Ty(_) | CanonicalVarKind::PlaceholderTy(_) => { CanonicalVarKind::Ty(_) | CanonicalVarKind::PlaceholderTy(_) => {
Ty::new_anon_bound(tcx, ty::INNERMOST, ty::BoundVar::from_usize(i)) Ty::new_anon_bound(cx, ty::INNERMOST, ty::BoundVar::from_usize(i))
.into() .into()
} }
CanonicalVarKind::Region(_) | CanonicalVarKind::PlaceholderRegion(_) => { CanonicalVarKind::Region(_) | CanonicalVarKind::PlaceholderRegion(_) => {
Region::new_anon_bound(tcx, ty::INNERMOST, ty::BoundVar::from_usize(i)) Region::new_anon_bound(cx, ty::INNERMOST, ty::BoundVar::from_usize(i))
.into() .into()
} }
CanonicalVarKind::Effect => { CanonicalVarKind::Effect => {
Const::new_anon_bound(tcx, ty::INNERMOST, ty::BoundVar::from_usize(i)) Const::new_anon_bound(cx, ty::INNERMOST, ty::BoundVar::from_usize(i))
.into() .into()
} }
CanonicalVarKind::Const(_) | CanonicalVarKind::PlaceholderConst(_) => { CanonicalVarKind::Const(_) | CanonicalVarKind::PlaceholderConst(_) => {
Const::new_anon_bound(tcx, ty::INNERMOST, ty::BoundVar::from_usize(i)) Const::new_anon_bound(cx, ty::INNERMOST, ty::BoundVar::from_usize(i))
.into() .into()
} }
} }

View file

@ -10,38 +10,38 @@ pub enum EffectKind {
} }
impl EffectKind { impl EffectKind {
pub fn try_from_def_id<I: Interner>(tcx: I, def_id: I::DefId) -> Option<EffectKind> { pub fn try_from_def_id<I: Interner>(cx: I, def_id: I::DefId) -> Option<EffectKind> {
if tcx.is_lang_item(def_id, EffectsMaybe) { if cx.is_lang_item(def_id, EffectsMaybe) {
Some(EffectKind::Maybe) Some(EffectKind::Maybe)
} else if tcx.is_lang_item(def_id, EffectsRuntime) { } else if cx.is_lang_item(def_id, EffectsRuntime) {
Some(EffectKind::Runtime) Some(EffectKind::Runtime)
} else if tcx.is_lang_item(def_id, EffectsNoRuntime) { } else if cx.is_lang_item(def_id, EffectsNoRuntime) {
Some(EffectKind::NoRuntime) Some(EffectKind::NoRuntime)
} else { } else {
None None
} }
} }
pub fn to_def_id<I: Interner>(self, tcx: I) -> I::DefId { pub fn to_def_id<I: Interner>(self, cx: I) -> I::DefId {
let lang_item = match self { let lang_item = match self {
EffectKind::Maybe => EffectsMaybe, EffectKind::Maybe => EffectsMaybe,
EffectKind::NoRuntime => EffectsNoRuntime, EffectKind::NoRuntime => EffectsNoRuntime,
EffectKind::Runtime => EffectsRuntime, EffectKind::Runtime => EffectsRuntime,
}; };
tcx.require_lang_item(lang_item) cx.require_lang_item(lang_item)
} }
pub fn try_from_ty<I: Interner>(tcx: I, ty: I::Ty) -> Option<EffectKind> { pub fn try_from_ty<I: Interner>(cx: I, ty: I::Ty) -> Option<EffectKind> {
if let crate::Adt(def, _) = ty.kind() { if let crate::Adt(def, _) = ty.kind() {
Self::try_from_def_id(tcx, def.def_id()) Self::try_from_def_id(cx, def.def_id())
} else { } else {
None None
} }
} }
pub fn to_ty<I: Interner>(self, tcx: I) -> I::Ty { pub fn to_ty<I: Interner>(self, cx: I) -> I::Ty {
I::Ty::new_adt(tcx, tcx.adt_def(self.to_def_id(tcx)), Default::default()) I::Ty::new_adt(cx, cx.adt_def(self.to_def_id(cx)), Default::default())
} }
/// Returns an intersection between two effect kinds. If one effect kind /// Returns an intersection between two effect kinds. If one effect kind

View file

@ -258,17 +258,17 @@ pub fn supertrait_def_ids<I: Interner>(
} }
pub fn supertraits<I: Interner>( pub fn supertraits<I: Interner>(
tcx: I, cx: I,
trait_ref: ty::Binder<I, ty::TraitRef<I>>, trait_ref: ty::Binder<I, ty::TraitRef<I>>,
) -> FilterToTraits<I, Elaborator<I, I::Clause>> { ) -> FilterToTraits<I, Elaborator<I, I::Clause>> {
elaborate(tcx, [trait_ref.upcast(tcx)]).filter_only_self().filter_to_traits() elaborate(cx, [trait_ref.upcast(cx)]).filter_only_self().filter_to_traits()
} }
pub fn transitive_bounds<I: Interner>( pub fn transitive_bounds<I: Interner>(
tcx: I, cx: I,
trait_refs: impl Iterator<Item = ty::Binder<I, ty::TraitRef<I>>>, trait_refs: impl Iterator<Item = ty::Binder<I, ty::TraitRef<I>>>,
) -> FilterToTraits<I, Elaborator<I, I::Clause>> { ) -> FilterToTraits<I, Elaborator<I, I::Clause>> {
elaborate(tcx, trait_refs.map(|trait_ref| trait_ref.upcast(tcx))) elaborate(cx, trait_refs.map(|trait_ref| trait_ref.upcast(cx)))
.filter_only_self() .filter_only_self()
.filter_to_traits() .filter_to_traits()
} }

View file

@ -105,7 +105,7 @@ pub enum TreatParams {
/// ///
/// ¹ meaning that if the outermost layers are different, then the whole types are also different. /// ¹ meaning that if the outermost layers are different, then the whole types are also different.
pub fn simplify_type<I: Interner>( pub fn simplify_type<I: Interner>(
tcx: I, cx: I,
ty: I::Ty, ty: I::Ty,
treat_params: TreatParams, treat_params: TreatParams,
) -> Option<SimplifiedType<I::DefId>> { ) -> Option<SimplifiedType<I::DefId>> {
@ -119,10 +119,10 @@ pub fn simplify_type<I: Interner>(
ty::Str => Some(SimplifiedType::Str), ty::Str => Some(SimplifiedType::Str),
ty::Array(..) => Some(SimplifiedType::Array), ty::Array(..) => Some(SimplifiedType::Array),
ty::Slice(..) => Some(SimplifiedType::Slice), ty::Slice(..) => Some(SimplifiedType::Slice),
ty::Pat(ty, ..) => simplify_type(tcx, ty, treat_params), ty::Pat(ty, ..) => simplify_type(cx, ty, treat_params),
ty::RawPtr(_, mutbl) => Some(SimplifiedType::Ptr(mutbl)), ty::RawPtr(_, mutbl) => Some(SimplifiedType::Ptr(mutbl)),
ty::Dynamic(trait_info, ..) => match trait_info.principal_def_id() { ty::Dynamic(trait_info, ..) => match trait_info.principal_def_id() {
Some(principal_def_id) if !tcx.trait_is_auto(principal_def_id) => { Some(principal_def_id) if !cx.trait_is_auto(principal_def_id) => {
Some(SimplifiedType::Trait(principal_def_id)) Some(SimplifiedType::Trait(principal_def_id))
} }
_ => Some(SimplifiedType::MarkerTraitObject), _ => Some(SimplifiedType::MarkerTraitObject),

View file

@ -345,20 +345,20 @@ impl<I: Interner, T: TypeFoldable<I>, Ix: Idx> TypeFoldable<I> for IndexVec<Ix,
// `rustc_middle/src/ty/generic_args.rs` for more details. // `rustc_middle/src/ty/generic_args.rs` for more details.
struct Shifter<I: Interner> { struct Shifter<I: Interner> {
tcx: I, cx: I,
current_index: ty::DebruijnIndex, current_index: ty::DebruijnIndex,
amount: u32, amount: u32,
} }
impl<I: Interner> Shifter<I> { impl<I: Interner> Shifter<I> {
pub fn new(tcx: I, amount: u32) -> Self { pub fn new(cx: I, amount: u32) -> Self {
Shifter { tcx, current_index: ty::INNERMOST, amount } Shifter { cx, current_index: ty::INNERMOST, amount }
} }
} }
impl<I: Interner> TypeFolder<I> for Shifter<I> { impl<I: Interner> TypeFolder<I> for Shifter<I> {
fn cx(&self) -> I { fn cx(&self) -> I {
self.tcx self.cx
} }
fn fold_binder<T: TypeFoldable<I>>(&mut self, t: ty::Binder<I, T>) -> ty::Binder<I, T> { fn fold_binder<T: TypeFoldable<I>>(&mut self, t: ty::Binder<I, T>) -> ty::Binder<I, T> {
@ -372,7 +372,7 @@ impl<I: Interner> TypeFolder<I> for Shifter<I> {
match r.kind() { match r.kind() {
ty::ReBound(debruijn, br) if debruijn >= self.current_index => { ty::ReBound(debruijn, br) if debruijn >= self.current_index => {
let debruijn = debruijn.shifted_in(self.amount); let debruijn = debruijn.shifted_in(self.amount);
Region::new_bound(self.tcx, debruijn, br) Region::new_bound(self.cx, debruijn, br)
} }
_ => r, _ => r,
} }
@ -382,7 +382,7 @@ impl<I: Interner> TypeFolder<I> for Shifter<I> {
match ty.kind() { match ty.kind() {
ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => { ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
let debruijn = debruijn.shifted_in(self.amount); let debruijn = debruijn.shifted_in(self.amount);
Ty::new_bound(self.tcx, debruijn, bound_ty) Ty::new_bound(self.cx, debruijn, bound_ty)
} }
_ if ty.has_vars_bound_at_or_above(self.current_index) => ty.super_fold_with(self), _ if ty.has_vars_bound_at_or_above(self.current_index) => ty.super_fold_with(self),
@ -394,7 +394,7 @@ impl<I: Interner> TypeFolder<I> for Shifter<I> {
match ct.kind() { match ct.kind() {
ty::ConstKind::Bound(debruijn, bound_ct) if debruijn >= self.current_index => { ty::ConstKind::Bound(debruijn, bound_ct) if debruijn >= self.current_index => {
let debruijn = debruijn.shifted_in(self.amount); let debruijn = debruijn.shifted_in(self.amount);
Const::new_bound(self.tcx, debruijn, bound_ct) Const::new_bound(self.cx, debruijn, bound_ct)
} }
_ => ct.super_fold_with(self), _ => ct.super_fold_with(self),
} }
@ -405,16 +405,16 @@ impl<I: Interner> TypeFolder<I> for Shifter<I> {
} }
} }
pub fn shift_region<I: Interner>(tcx: I, region: I::Region, amount: u32) -> I::Region { pub fn shift_region<I: Interner>(cx: I, region: I::Region, amount: u32) -> I::Region {
match region.kind() { match region.kind() {
ty::ReBound(debruijn, br) if amount > 0 => { ty::ReBound(debruijn, br) if amount > 0 => {
Region::new_bound(tcx, debruijn.shifted_in(amount), br) Region::new_bound(cx, debruijn.shifted_in(amount), br)
} }
_ => region, _ => region,
} }
} }
pub fn shift_vars<I: Interner, T>(tcx: I, value: T, amount: u32) -> T pub fn shift_vars<I: Interner, T>(cx: I, value: T, amount: u32) -> T
where where
T: TypeFoldable<I>, T: TypeFoldable<I>,
{ {
@ -424,5 +424,5 @@ where
return value; return value;
} }
value.fold_with(&mut Shifter::new(tcx, amount)) value.fold_with(&mut Shifter::new(cx, amount))
} }

View file

@ -475,7 +475,7 @@ pub trait Clause<I: Interner<Clause = Self>>:
/// poly-trait-ref to supertraits that must hold if that /// poly-trait-ref to supertraits that must hold if that
/// poly-trait-ref holds. This is slightly different from a normal /// poly-trait-ref holds. This is slightly different from a normal
/// instantiation in terms of what happens with bound regions. /// instantiation in terms of what happens with bound regions.
fn instantiate_supertrait(self, tcx: I, trait_ref: ty::Binder<I, ty::TraitRef<I>>) -> Self; fn instantiate_supertrait(self, cx: I, trait_ref: ty::Binder<I, ty::TraitRef<I>>) -> Self;
} }
/// Common capabilities of placeholder kinds /// Common capabilities of placeholder kinds

View file

@ -17,5 +17,5 @@
/// e.g., `()` or `u8`, was interned in a different context. /// e.g., `()` or `u8`, was interned in a different context.
pub trait Lift<I>: std::fmt::Debug { pub trait Lift<I>: std::fmt::Debug {
type Lifted: std::fmt::Debug; type Lifted: std::fmt::Debug;
fn lift_to_tcx(self, tcx: I) -> Option<Self::Lifted>; fn lift_to_interner(self, cx: I) -> Option<Self::Lifted>;
} }

View file

@ -22,8 +22,8 @@ pub struct OpaqueTypeKey<I: Interner> {
} }
impl<I: Interner> OpaqueTypeKey<I> { impl<I: Interner> OpaqueTypeKey<I> {
pub fn iter_captured_args(self, tcx: I) -> impl Iterator<Item = (usize, I::GenericArg)> { pub fn iter_captured_args(self, cx: I) -> impl Iterator<Item = (usize, I::GenericArg)> {
let variances = tcx.variances_of(self.def_id.into()); let variances = cx.variances_of(self.def_id.into());
std::iter::zip(self.args.iter(), variances.iter()).enumerate().filter_map( std::iter::zip(self.args.iter(), variances.iter()).enumerate().filter_map(
|(i, (arg, v))| match (arg.kind(), v) { |(i, (arg, v))| match (arg.kind(), v) {
(_, ty::Invariant) => Some((i, arg)), (_, ty::Invariant) => Some((i, arg)),
@ -35,18 +35,18 @@ impl<I: Interner> OpaqueTypeKey<I> {
pub fn fold_captured_lifetime_args( pub fn fold_captured_lifetime_args(
self, self,
tcx: I, cx: I,
mut f: impl FnMut(I::Region) -> I::Region, mut f: impl FnMut(I::Region) -> I::Region,
) -> Self { ) -> Self {
let Self { def_id, args } = self; let Self { def_id, args } = self;
let variances = tcx.variances_of(def_id.into()); let variances = cx.variances_of(def_id.into());
let args = let args =
std::iter::zip(args.iter(), variances.iter()).map(|(arg, v)| match (arg.kind(), v) { std::iter::zip(args.iter(), variances.iter()).map(|(arg, v)| match (arg.kind(), v) {
(ty::GenericArgKind::Lifetime(_), ty::Bivariant) => arg, (ty::GenericArgKind::Lifetime(_), ty::Bivariant) => arg,
(ty::GenericArgKind::Lifetime(lt), _) => f(lt).into(), (ty::GenericArgKind::Lifetime(lt), _) => f(lt).into(),
_ => arg, _ => arg,
}); });
let args = tcx.mk_args_from_iter(args); let args = cx.mk_args_from_iter(args);
Self { def_id, args } Self { def_id, args }
} }
} }

View file

@ -54,15 +54,15 @@ pub enum Component<I: Interner> {
/// Push onto `out` all the things that must outlive `'a` for the condition /// 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**. /// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**.
pub fn push_outlives_components<I: Interner>( pub fn push_outlives_components<I: Interner>(
tcx: I, cx: I,
ty: I::Ty, ty: I::Ty,
out: &mut SmallVec<[Component<I>; 4]>, out: &mut SmallVec<[Component<I>; 4]>,
) { ) {
ty.visit_with(&mut OutlivesCollector { tcx, out, visited: Default::default() }); ty.visit_with(&mut OutlivesCollector { cx, out, visited: Default::default() });
} }
struct OutlivesCollector<'a, I: Interner> { struct OutlivesCollector<'a, I: Interner> {
tcx: I, cx: I,
out: &'a mut SmallVec<[Component<I>; 4]>, out: &'a mut SmallVec<[Component<I>; 4]>,
visited: SsoHashSet<I::Ty>, visited: SsoHashSet<I::Ty>,
} }
@ -147,7 +147,7 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
// OutlivesProjectionComponents. Continue walking // OutlivesProjectionComponents. Continue walking
// through and constrain Pi. // through and constrain Pi.
let mut subcomponents = smallvec![]; let mut subcomponents = smallvec![];
compute_alias_components_recursive(self.tcx, ty, &mut subcomponents); compute_alias_components_recursive(self.cx, ty, &mut subcomponents);
self.out.push(Component::EscapingAlias(subcomponents.into_iter().collect())); self.out.push(Component::EscapingAlias(subcomponents.into_iter().collect()));
} }
} }
@ -206,7 +206,7 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
/// This should not be used to get the components of `parent` itself. /// This should not be used to get the components of `parent` itself.
/// Use [push_outlives_components] instead. /// Use [push_outlives_components] instead.
pub fn compute_alias_components_recursive<I: Interner>( pub fn compute_alias_components_recursive<I: Interner>(
tcx: I, cx: I,
alias_ty: I::Ty, alias_ty: I::Ty,
out: &mut SmallVec<[Component<I>; 4]>, out: &mut SmallVec<[Component<I>; 4]>,
) { ) {
@ -215,9 +215,9 @@ pub fn compute_alias_components_recursive<I: Interner>(
}; };
let opt_variances = let opt_variances =
if kind == ty::Opaque { Some(tcx.variances_of(alias_ty.def_id)) } else { None }; if kind == ty::Opaque { Some(cx.variances_of(alias_ty.def_id)) } else { None };
let mut visitor = OutlivesCollector { tcx, out, visited: Default::default() }; let mut visitor = OutlivesCollector { cx, out, visited: Default::default() };
for (index, child) in alias_ty.args.iter().enumerate() { for (index, child) in alias_ty.args.iter().enumerate() {
if opt_variances.and_then(|variances| variances.get(index)) == Some(ty::Bivariant) { if opt_variances.and_then(|variances| variances.get(index)) == Some(ty::Bivariant) {

View file

@ -34,8 +34,8 @@ where
{ {
type Lifted = OutlivesPredicate<U, A::Lifted>; type Lifted = OutlivesPredicate<U, A::Lifted>;
fn lift_to_tcx(self, tcx: U) -> Option<Self::Lifted> { fn lift_to_interner(self, cx: U) -> Option<Self::Lifted> {
Some(OutlivesPredicate(self.0.lift_to_tcx(tcx)?, self.1.lift_to_tcx(tcx)?)) Some(OutlivesPredicate(self.0.lift_to_interner(cx)?, self.1.lift_to_interner(cx)?))
} }
} }
@ -267,25 +267,23 @@ impl<I: Interner> ty::Binder<I, ExistentialPredicate<I>> {
/// Given an existential predicate like `?Self: PartialEq<u32>` (e.g., derived from `dyn PartialEq<u32>`), /// Given an existential predicate like `?Self: PartialEq<u32>` (e.g., derived from `dyn PartialEq<u32>`),
/// and a concrete type `self_ty`, returns a full predicate where the existentially quantified variable `?Self` /// and a concrete type `self_ty`, returns a full predicate where the existentially quantified variable `?Self`
/// has been replaced with `self_ty` (e.g., `self_ty: PartialEq<u32>`, in our example). /// has been replaced with `self_ty` (e.g., `self_ty: PartialEq<u32>`, in our example).
pub fn with_self_ty(&self, tcx: I, self_ty: I::Ty) -> I::Clause { pub fn with_self_ty(&self, cx: I, self_ty: I::Ty) -> I::Clause {
match self.skip_binder() { match self.skip_binder() {
ExistentialPredicate::Trait(tr) => { ExistentialPredicate::Trait(tr) => self.rebind(tr).with_self_ty(cx, self_ty).upcast(cx),
self.rebind(tr).with_self_ty(tcx, self_ty).upcast(tcx)
}
ExistentialPredicate::Projection(p) => { ExistentialPredicate::Projection(p) => {
self.rebind(p.with_self_ty(tcx, self_ty)).upcast(tcx) self.rebind(p.with_self_ty(cx, self_ty)).upcast(cx)
} }
ExistentialPredicate::AutoTrait(did) => { ExistentialPredicate::AutoTrait(did) => {
let generics = tcx.generics_of(did); let generics = cx.generics_of(did);
let trait_ref = if generics.count() == 1 { let trait_ref = if generics.count() == 1 {
ty::TraitRef::new(tcx, did, [self_ty]) ty::TraitRef::new(cx, did, [self_ty])
} else { } else {
// If this is an ill-formed auto trait, then synthesize // If this is an ill-formed auto trait, then synthesize
// new error args for the missing generics. // new error args for the missing generics.
let err_args = GenericArgs::extend_with_error(tcx, did, &[self_ty.into()]); let err_args = GenericArgs::extend_with_error(cx, did, &[self_ty.into()]);
ty::TraitRef::new_from_args(tcx, did, err_args) ty::TraitRef::new_from_args(cx, did, err_args)
}; };
self.rebind(trait_ref).upcast(tcx) self.rebind(trait_ref).upcast(cx)
} }
} }
} }
@ -345,8 +343,8 @@ impl<I: Interner> ty::Binder<I, ExistentialTraitRef<I>> {
/// we convert the principal trait-ref into a normal trait-ref, /// we convert the principal trait-ref into a normal trait-ref,
/// you must give *some* self type. A common choice is `mk_err()` /// you must give *some* self type. A common choice is `mk_err()`
/// or some placeholder type. /// or some placeholder type.
pub fn with_self_ty(&self, tcx: I, self_ty: I::Ty) -> ty::Binder<I, TraitRef<I>> { pub fn with_self_ty(&self, cx: I, self_ty: I::Ty) -> ty::Binder<I, TraitRef<I>> {
self.map_bound(|trait_ref| trait_ref.with_self_ty(tcx, self_ty)) self.map_bound(|trait_ref| trait_ref.with_self_ty(cx, self_ty))
} }
} }
@ -406,8 +404,8 @@ impl<I: Interner> ExistentialProjection<I> {
} }
impl<I: Interner> ty::Binder<I, ExistentialProjection<I>> { impl<I: Interner> ty::Binder<I, ExistentialProjection<I>> {
pub fn with_self_ty(&self, tcx: I, self_ty: I::Ty) -> ty::Binder<I, ProjectionPredicate<I>> { pub fn with_self_ty(&self, cx: I, self_ty: I::Ty) -> ty::Binder<I, ProjectionPredicate<I>> {
self.map_bound(|p| p.with_self_ty(tcx, self_ty)) self.map_bound(|p| p.with_self_ty(cx, self_ty))
} }
pub fn item_def_id(&self) -> I::DefId { pub fn item_def_id(&self) -> I::DefId {
@ -669,21 +667,21 @@ impl<I: Interner> ProjectionPredicate<I> {
impl<I: Interner> ty::Binder<I, ProjectionPredicate<I>> { impl<I: Interner> ty::Binder<I, ProjectionPredicate<I>> {
/// Returns the `DefId` of the trait of the associated item being projected. /// Returns the `DefId` of the trait of the associated item being projected.
#[inline] #[inline]
pub fn trait_def_id(&self, tcx: I) -> I::DefId { pub fn trait_def_id(&self, cx: I) -> I::DefId {
self.skip_binder().projection_term.trait_def_id(tcx) self.skip_binder().projection_term.trait_def_id(cx)
} }
/// Get the trait ref required for this projection to be well formed. /// Get the trait ref required for this projection to be well formed.
/// Note that for generic associated types the predicates of the associated /// Note that for generic associated types the predicates of the associated
/// type also need to be checked. /// type also need to be checked.
#[inline] #[inline]
pub fn required_poly_trait_ref(&self, tcx: I) -> ty::Binder<I, TraitRef<I>> { pub fn required_poly_trait_ref(&self, cx: I) -> ty::Binder<I, TraitRef<I>> {
// Note: unlike with `TraitRef::to_poly_trait_ref()`, // Note: unlike with `TraitRef::to_poly_trait_ref()`,
// `self.0.trait_ref` is permitted to have escaping regions. // `self.0.trait_ref` is permitted to have escaping regions.
// This is because here `self` has a `Binder` and so does our // This is because here `self` has a `Binder` and so does our
// return value, so we are preserving the number of binding // return value, so we are preserving the number of binding
// levels. // levels.
self.map_bound(|predicate| predicate.projection_term.trait_ref(tcx)) self.map_bound(|predicate| predicate.projection_term.trait_ref(cx))
} }
pub fn term(&self) -> ty::Binder<I, I::Term> { pub fn term(&self) -> ty::Binder<I, I::Term> {

View file

@ -56,7 +56,7 @@ impl<I: Interner> VarianceDiagInfo<I> {
} }
pub trait TypeRelation<I: Interner>: Sized { pub trait TypeRelation<I: Interner>: Sized {
fn tcx(&self) -> I; fn cx(&self) -> I;
/// Returns a static string we can use for printouts. /// Returns a static string we can use for printouts.
fn tag(&self) -> &'static str; fn tag(&self) -> &'static str;
@ -80,8 +80,8 @@ pub trait TypeRelation<I: Interner>: Sized {
item_def_id, a_arg, b_arg item_def_id, a_arg, b_arg
); );
let tcx = self.tcx(); let cx = self.cx();
let opt_variances = tcx.variances_of(item_def_id); let opt_variances = cx.variances_of(item_def_id);
relate_args_with_variances(self, item_def_id, opt_variances, a_arg, b_arg, true) relate_args_with_variances(self, item_def_id, opt_variances, a_arg, b_arg, true)
} }
@ -128,7 +128,7 @@ pub fn relate_args_invariantly<I: Interner, R: TypeRelation<I>>(
a_arg: I::GenericArgs, a_arg: I::GenericArgs,
b_arg: I::GenericArgs, b_arg: I::GenericArgs,
) -> RelateResult<I, I::GenericArgs> { ) -> RelateResult<I, I::GenericArgs> {
relation.tcx().mk_args_from_iter(iter::zip(a_arg.iter(), b_arg.iter()).map(|(a, b)| { relation.cx().mk_args_from_iter(iter::zip(a_arg.iter(), b_arg.iter()).map(|(a, b)| {
relation.relate_with_variance(ty::Invariant, VarianceDiagInfo::default(), a, b) relation.relate_with_variance(ty::Invariant, VarianceDiagInfo::default(), a, b)
})) }))
} }
@ -141,14 +141,13 @@ pub fn relate_args_with_variances<I: Interner, R: TypeRelation<I>>(
b_arg: I::GenericArgs, b_arg: I::GenericArgs,
fetch_ty_for_diag: bool, fetch_ty_for_diag: bool,
) -> RelateResult<I, I::GenericArgs> { ) -> RelateResult<I, I::GenericArgs> {
let tcx = relation.tcx(); let cx = relation.cx();
let mut cached_ty = None; let mut cached_ty = None;
let params = iter::zip(a_arg.iter(), b_arg.iter()).enumerate().map(|(i, (a, b))| { let params = iter::zip(a_arg.iter(), b_arg.iter()).enumerate().map(|(i, (a, b))| {
let variance = variances.get(i).unwrap(); let variance = variances.get(i).unwrap();
let variance_info = if variance == ty::Invariant && fetch_ty_for_diag { let variance_info = if variance == ty::Invariant && fetch_ty_for_diag {
let ty = let ty = *cached_ty.get_or_insert_with(|| cx.type_of(ty_def_id).instantiate(cx, a_arg));
*cached_ty.get_or_insert_with(|| tcx.type_of(ty_def_id).instantiate(tcx, a_arg));
VarianceDiagInfo::Invariant { ty, param_index: i.try_into().unwrap() } VarianceDiagInfo::Invariant { ty, param_index: i.try_into().unwrap() }
} else { } else {
VarianceDiagInfo::default() VarianceDiagInfo::default()
@ -156,7 +155,7 @@ pub fn relate_args_with_variances<I: Interner, R: TypeRelation<I>>(
relation.relate_with_variance(variance, variance_info, a, b) relation.relate_with_variance(variance, variance_info, a, b)
}); });
tcx.mk_args_from_iter(params) cx.mk_args_from_iter(params)
} }
impl<I: Interner> Relate<I> for ty::FnSig<I> { impl<I: Interner> Relate<I> for ty::FnSig<I> {
@ -165,7 +164,7 @@ impl<I: Interner> Relate<I> for ty::FnSig<I> {
a: ty::FnSig<I>, a: ty::FnSig<I>,
b: ty::FnSig<I>, b: ty::FnSig<I>,
) -> RelateResult<I, ty::FnSig<I>> { ) -> RelateResult<I, ty::FnSig<I>> {
let tcx = relation.tcx(); let cx = relation.cx();
if a.c_variadic != b.c_variadic { if a.c_variadic != b.c_variadic {
return Err(TypeError::VariadicMismatch({ return Err(TypeError::VariadicMismatch({
@ -210,7 +209,7 @@ impl<I: Interner> Relate<I> for ty::FnSig<I> {
r => r, r => r,
}); });
Ok(ty::FnSig { Ok(ty::FnSig {
inputs_and_output: tcx.mk_type_list_from_iter(inputs_and_output)?, inputs_and_output: cx.mk_type_list_from_iter(inputs_and_output)?,
c_variadic: a.c_variadic, c_variadic: a.c_variadic,
safety, safety,
abi, abi,
@ -245,11 +244,11 @@ impl<I: Interner> Relate<I> for ty::AliasTy<I> {
ExpectedFound::new(true, a, b) ExpectedFound::new(true, a, b)
})) }))
} else { } else {
let args = match a.kind(relation.tcx()) { let args = match a.kind(relation.cx()) {
ty::Opaque => relate_args_with_variances( ty::Opaque => relate_args_with_variances(
relation, relation,
a.def_id, a.def_id,
relation.tcx().variances_of(a.def_id), relation.cx().variances_of(a.def_id),
a.args, a.args,
b.args, b.args,
false, // do not fetch `type_of(a_def_id)`, as it will cause a cycle false, // do not fetch `type_of(a_def_id)`, as it will cause a cycle
@ -258,7 +257,7 @@ impl<I: Interner> Relate<I> for ty::AliasTy<I> {
relate_args_invariantly(relation, a.args, b.args)? relate_args_invariantly(relation, a.args, b.args)?
} }
}; };
Ok(ty::AliasTy::new_from_args(relation.tcx(), a.def_id, args)) Ok(ty::AliasTy::new_from_args(relation.cx(), a.def_id, args))
} }
} }
} }
@ -276,11 +275,11 @@ impl<I: Interner> Relate<I> for ty::AliasTerm<I> {
ExpectedFound::new(true, a, b) ExpectedFound::new(true, a, b)
})) }))
} else { } else {
let args = match a.kind(relation.tcx()) { let args = match a.kind(relation.cx()) {
ty::AliasTermKind::OpaqueTy => relate_args_with_variances( ty::AliasTermKind::OpaqueTy => relate_args_with_variances(
relation, relation,
a.def_id, a.def_id,
relation.tcx().variances_of(a.def_id), relation.cx().variances_of(a.def_id),
a.args, a.args,
b.args, b.args,
false, // do not fetch `type_of(a_def_id)`, as it will cause a cycle false, // do not fetch `type_of(a_def_id)`, as it will cause a cycle
@ -293,7 +292,7 @@ impl<I: Interner> Relate<I> for ty::AliasTerm<I> {
relate_args_invariantly(relation, a.args, b.args)? relate_args_invariantly(relation, a.args, b.args)?
} }
}; };
Ok(ty::AliasTerm::new_from_args(relation.tcx(), a.def_id, args)) Ok(ty::AliasTerm::new_from_args(relation.cx(), a.def_id, args))
} }
} }
} }
@ -343,7 +342,7 @@ impl<I: Interner> Relate<I> for ty::TraitRef<I> {
})) }))
} else { } else {
let args = relate_args_invariantly(relation, a.args, b.args)?; let args = relate_args_invariantly(relation, a.args, b.args)?;
Ok(ty::TraitRef::new_from_args(relation.tcx(), a.def_id, args)) Ok(ty::TraitRef::new_from_args(relation.cx(), a.def_id, args))
} }
} }
} }
@ -377,7 +376,7 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
a: I::Ty, a: I::Ty,
b: I::Ty, b: I::Ty,
) -> RelateResult<I, I::Ty> { ) -> RelateResult<I, I::Ty> {
let tcx = relation.tcx(); let cx = relation.cx();
match (a.kind(), b.kind()) { match (a.kind(), b.kind()) {
(ty::Infer(_), _) | (_, ty::Infer(_)) => { (ty::Infer(_), _) | (_, ty::Infer(_)) => {
// The caller should handle these cases! // The caller should handle these cases!
@ -388,7 +387,7 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
panic!("bound types encountered in structurally_relate_tys") panic!("bound types encountered in structurally_relate_tys")
} }
(ty::Error(guar), _) | (_, ty::Error(guar)) => Ok(Ty::new_error(tcx, guar)), (ty::Error(guar), _) | (_, ty::Error(guar)) => Ok(Ty::new_error(cx, guar)),
(ty::Never, _) (ty::Never, _)
| (ty::Char, _) | (ty::Char, _)
@ -412,16 +411,16 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
(ty::Adt(a_def, a_args), ty::Adt(b_def, b_args)) if a_def == b_def => { (ty::Adt(a_def, a_args), ty::Adt(b_def, b_args)) if a_def == b_def => {
let args = relation.relate_item_args(a_def.def_id(), a_args, b_args)?; let args = relation.relate_item_args(a_def.def_id(), a_args, b_args)?;
Ok(Ty::new_adt(tcx, a_def, args)) Ok(Ty::new_adt(cx, a_def, args))
} }
(ty::Foreign(a_id), ty::Foreign(b_id)) if a_id == b_id => Ok(Ty::new_foreign(tcx, a_id)), (ty::Foreign(a_id), ty::Foreign(b_id)) if a_id == b_id => Ok(Ty::new_foreign(cx, a_id)),
(ty::Dynamic(a_obj, a_region, a_repr), ty::Dynamic(b_obj, b_region, b_repr)) (ty::Dynamic(a_obj, a_region, a_repr), ty::Dynamic(b_obj, b_region, b_repr))
if a_repr == b_repr => if a_repr == b_repr =>
{ {
Ok(Ty::new_dynamic( Ok(Ty::new_dynamic(
tcx, cx,
relation.relate(a_obj, b_obj)?, relation.relate(a_obj, b_obj)?,
relation.relate(a_region, b_region)?, relation.relate(a_region, b_region)?,
a_repr, a_repr,
@ -433,7 +432,7 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
// the (anonymous) type of the same coroutine expression. So // the (anonymous) type of the same coroutine expression. So
// all of their regions should be equated. // all of their regions should be equated.
let args = relate_args_invariantly(relation, a_args, b_args)?; let args = relate_args_invariantly(relation, a_args, b_args)?;
Ok(Ty::new_coroutine(tcx, a_id, args)) Ok(Ty::new_coroutine(cx, a_id, args))
} }
(ty::CoroutineWitness(a_id, a_args), ty::CoroutineWitness(b_id, b_args)) (ty::CoroutineWitness(a_id, a_args), ty::CoroutineWitness(b_id, b_args))
@ -443,7 +442,7 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
// the (anonymous) type of the same coroutine expression. So // the (anonymous) type of the same coroutine expression. So
// all of their regions should be equated. // all of their regions should be equated.
let args = relate_args_invariantly(relation, a_args, b_args)?; let args = relate_args_invariantly(relation, a_args, b_args)?;
Ok(Ty::new_coroutine_witness(tcx, a_id, args)) Ok(Ty::new_coroutine_witness(cx, a_id, args))
} }
(ty::Closure(a_id, a_args), ty::Closure(b_id, b_args)) if a_id == b_id => { (ty::Closure(a_id, a_args), ty::Closure(b_id, b_args)) if a_id == b_id => {
@ -451,14 +450,14 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
// the (anonymous) type of the same closure expression. So // the (anonymous) type of the same closure expression. So
// all of their regions should be equated. // all of their regions should be equated.
let args = relate_args_invariantly(relation, a_args, b_args)?; let args = relate_args_invariantly(relation, a_args, b_args)?;
Ok(Ty::new_closure(tcx, a_id, args)) Ok(Ty::new_closure(cx, a_id, args))
} }
(ty::CoroutineClosure(a_id, a_args), ty::CoroutineClosure(b_id, b_args)) (ty::CoroutineClosure(a_id, a_args), ty::CoroutineClosure(b_id, b_args))
if a_id == b_id => if a_id == b_id =>
{ {
let args = relate_args_invariantly(relation, a_args, b_args)?; let args = relate_args_invariantly(relation, a_args, b_args)?;
Ok(Ty::new_coroutine_closure(tcx, a_id, args)) Ok(Ty::new_coroutine_closure(cx, a_id, args))
} }
(ty::RawPtr(a_ty, a_mutbl), ty::RawPtr(b_ty, b_mutbl)) => { (ty::RawPtr(a_ty, a_mutbl), ty::RawPtr(b_ty, b_mutbl)) => {
@ -475,7 +474,7 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
let ty = relation.relate_with_variance(variance, info, a_ty, b_ty)?; let ty = relation.relate_with_variance(variance, info, a_ty, b_ty)?;
Ok(Ty::new_ptr(tcx, ty, a_mutbl)) Ok(Ty::new_ptr(cx, ty, a_mutbl))
} }
(ty::Ref(a_r, a_ty, a_mutbl), ty::Ref(b_r, b_ty, b_mutbl)) => { (ty::Ref(a_r, a_ty, a_mutbl), ty::Ref(b_r, b_ty, b_mutbl)) => {
@ -493,18 +492,18 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
let r = relation.relate(a_r, b_r)?; let r = relation.relate(a_r, b_r)?;
let ty = relation.relate_with_variance(variance, info, a_ty, b_ty)?; let ty = relation.relate_with_variance(variance, info, a_ty, b_ty)?;
Ok(Ty::new_ref(tcx, r, ty, a_mutbl)) Ok(Ty::new_ref(cx, r, ty, a_mutbl))
} }
(ty::Array(a_t, sz_a), ty::Array(b_t, sz_b)) => { (ty::Array(a_t, sz_a), ty::Array(b_t, sz_b)) => {
let t = relation.relate(a_t, b_t)?; let t = relation.relate(a_t, b_t)?;
match relation.relate(sz_a, sz_b) { match relation.relate(sz_a, sz_b) {
Ok(sz) => Ok(Ty::new_array_with_const_len(tcx, t, sz)), Ok(sz) => Ok(Ty::new_array_with_const_len(cx, t, sz)),
Err(err) => { Err(err) => {
// Check whether the lengths are both concrete/known values, // Check whether the lengths are both concrete/known values,
// but are unequal, for better diagnostics. // but are unequal, for better diagnostics.
let sz_a = sz_a.try_to_target_usize(tcx); let sz_a = sz_a.try_to_target_usize(cx);
let sz_b = sz_b.try_to_target_usize(tcx); let sz_b = sz_b.try_to_target_usize(cx);
match (sz_a, sz_b) { match (sz_a, sz_b) {
(Some(sz_a_val), Some(sz_b_val)) if sz_a_val != sz_b_val => Err( (Some(sz_a_val), Some(sz_b_val)) if sz_a_val != sz_b_val => Err(
@ -518,13 +517,13 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
(ty::Slice(a_t), ty::Slice(b_t)) => { (ty::Slice(a_t), ty::Slice(b_t)) => {
let t = relation.relate(a_t, b_t)?; let t = relation.relate(a_t, b_t)?;
Ok(Ty::new_slice(tcx, t)) Ok(Ty::new_slice(cx, t))
} }
(ty::Tuple(as_), ty::Tuple(bs)) => { (ty::Tuple(as_), ty::Tuple(bs)) => {
if as_.len() == bs.len() { if as_.len() == bs.len() {
Ok(Ty::new_tup_from_iter( Ok(Ty::new_tup_from_iter(
tcx, cx,
iter::zip(as_.iter(), bs.iter()).map(|(a, b)| relation.relate(a, b)), iter::zip(as_.iter(), bs.iter()).map(|(a, b)| relation.relate(a, b)),
)?) )?)
} else if !(as_.is_empty() || bs.is_empty()) { } else if !(as_.is_empty() || bs.is_empty()) {
@ -536,25 +535,25 @@ pub fn structurally_relate_tys<I: Interner, R: TypeRelation<I>>(
(ty::FnDef(a_def_id, a_args), ty::FnDef(b_def_id, b_args)) if a_def_id == b_def_id => { (ty::FnDef(a_def_id, a_args), ty::FnDef(b_def_id, b_args)) if a_def_id == b_def_id => {
let args = relation.relate_item_args(a_def_id, a_args, b_args)?; let args = relation.relate_item_args(a_def_id, a_args, b_args)?;
Ok(Ty::new_fn_def(tcx, a_def_id, args)) Ok(Ty::new_fn_def(cx, a_def_id, args))
} }
(ty::FnPtr(a_fty), ty::FnPtr(b_fty)) => { (ty::FnPtr(a_fty), ty::FnPtr(b_fty)) => {
let fty = relation.relate(a_fty, b_fty)?; let fty = relation.relate(a_fty, b_fty)?;
Ok(Ty::new_fn_ptr(tcx, fty)) Ok(Ty::new_fn_ptr(cx, fty))
} }
// Alias tend to mostly already be handled downstream due to normalization. // Alias tend to mostly already be handled downstream due to normalization.
(ty::Alias(a_kind, a_data), ty::Alias(b_kind, b_data)) => { (ty::Alias(a_kind, a_data), ty::Alias(b_kind, b_data)) => {
let alias_ty = relation.relate(a_data, b_data)?; let alias_ty = relation.relate(a_data, b_data)?;
assert_eq!(a_kind, b_kind); assert_eq!(a_kind, b_kind);
Ok(Ty::new_alias(tcx, a_kind, alias_ty)) Ok(Ty::new_alias(cx, a_kind, alias_ty))
} }
(ty::Pat(a_ty, a_pat), ty::Pat(b_ty, b_pat)) => { (ty::Pat(a_ty, a_pat), ty::Pat(b_ty, b_pat)) => {
let ty = relation.relate(a_ty, b_ty)?; let ty = relation.relate(a_ty, b_ty)?;
let pat = relation.relate(a_pat, b_pat)?; let pat = relation.relate(a_pat, b_pat)?;
Ok(Ty::new_pat(tcx, ty, pat)) Ok(Ty::new_pat(cx, ty, pat))
} }
_ => Err(TypeError::Sorts(ExpectedFound::new(true, a, b))), _ => Err(TypeError::Sorts(ExpectedFound::new(true, a, b))),
@ -573,11 +572,11 @@ pub fn structurally_relate_consts<I: Interner, R: TypeRelation<I>>(
mut b: I::Const, mut b: I::Const,
) -> RelateResult<I, I::Const> { ) -> RelateResult<I, I::Const> {
debug!("{}.structurally_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b); debug!("{}.structurally_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b);
let tcx = relation.tcx(); let cx = relation.cx();
if tcx.features().generic_const_exprs() { if cx.features().generic_const_exprs() {
a = tcx.expand_abstract_consts(a); a = cx.expand_abstract_consts(a);
b = tcx.expand_abstract_consts(b); b = cx.expand_abstract_consts(b);
} }
debug!("{}.structurally_relate_consts(normed_a = {:?}, normed_b = {:?})", relation.tag(), a, b); debug!("{}.structurally_relate_consts(normed_a = {:?}, normed_b = {:?})", relation.tag(), a, b);
@ -607,8 +606,8 @@ pub fn structurally_relate_consts<I: Interner, R: TypeRelation<I>>(
// be stabilized. // be stabilized.
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu)) if au.def == bu.def => { (ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu)) if au.def == bu.def => {
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
let a_ty = tcx.type_of(au.def).instantiate(tcx, au.args); let a_ty = cx.type_of(au.def).instantiate(cx, au.args);
let b_ty = tcx.type_of(bu.def).instantiate(tcx, bu.args); let b_ty = cx.type_of(bu.def).instantiate(cx, bu.args);
assert_eq!(a_ty, b_ty); assert_eq!(a_ty, b_ty);
} }
@ -618,11 +617,11 @@ pub fn structurally_relate_consts<I: Interner, R: TypeRelation<I>>(
au.args, au.args,
bu.args, bu.args,
)?; )?;
return Ok(Const::new_unevaluated(tcx, ty::UnevaluatedConst { def: au.def, args })); return Ok(Const::new_unevaluated(cx, ty::UnevaluatedConst { def: au.def, args }));
} }
(ty::ConstKind::Expr(ae), ty::ConstKind::Expr(be)) => { (ty::ConstKind::Expr(ae), ty::ConstKind::Expr(be)) => {
let expr = relation.relate(ae, be)?; let expr = relation.relate(ae, be)?;
return Ok(Const::new_expr(tcx, expr)); return Ok(Const::new_expr(cx, expr));
} }
_ => false, _ => false,
}; };

View file

@ -106,13 +106,13 @@ pub struct Goal<I: Interner, P> {
} }
impl<I: Interner, P> Goal<I, P> { impl<I: Interner, P> Goal<I, P> {
pub fn new(tcx: I, param_env: I::ParamEnv, predicate: impl Upcast<I, P>) -> Goal<I, P> { pub fn new(cx: I, param_env: I::ParamEnv, predicate: impl Upcast<I, P>) -> Goal<I, P> {
Goal { param_env, predicate: predicate.upcast(tcx) } Goal { param_env, predicate: predicate.upcast(cx) }
} }
/// Updates the goal to one with a different `predicate` but the same `param_env`. /// Updates the goal to one with a different `predicate` but the same `param_env`.
pub fn with<Q>(self, tcx: I, predicate: impl Upcast<I, Q>) -> Goal<I, Q> { pub fn with<Q>(self, cx: I, predicate: impl Upcast<I, Q>) -> Goal<I, Q> {
Goal { param_env: self.param_env, predicate: predicate.upcast(tcx) } Goal { param_env: self.param_env, predicate: predicate.upcast(cx) }
} }
} }

View file

@ -136,9 +136,9 @@ pub struct ClosureArgsParts<I: Interner> {
impl<I: Interner> ClosureArgs<I> { impl<I: Interner> ClosureArgs<I> {
/// Construct `ClosureArgs` from `ClosureArgsParts`, containing `Args` /// Construct `ClosureArgs` from `ClosureArgsParts`, containing `Args`
/// for the closure parent, alongside additional closure-specific components. /// for the closure parent, alongside additional closure-specific components.
pub fn new(tcx: I, parts: ClosureArgsParts<I>) -> ClosureArgs<I> { pub fn new(cx: I, parts: ClosureArgsParts<I>) -> ClosureArgs<I> {
ClosureArgs { ClosureArgs {
args: tcx.mk_args_from_iter(parts.parent_args.iter().chain([ args: cx.mk_args_from_iter(parts.parent_args.iter().chain([
parts.closure_kind_ty.into(), parts.closure_kind_ty.into(),
parts.closure_sig_as_fn_ptr_ty.into(), parts.closure_sig_as_fn_ptr_ty.into(),
parts.tupled_upvars_ty.into(), parts.tupled_upvars_ty.into(),
@ -258,9 +258,9 @@ pub struct CoroutineClosureArgsParts<I: Interner> {
} }
impl<I: Interner> CoroutineClosureArgs<I> { impl<I: Interner> CoroutineClosureArgs<I> {
pub fn new(tcx: I, parts: CoroutineClosureArgsParts<I>) -> CoroutineClosureArgs<I> { pub fn new(cx: I, parts: CoroutineClosureArgsParts<I>) -> CoroutineClosureArgs<I> {
CoroutineClosureArgs { CoroutineClosureArgs {
args: tcx.mk_args_from_iter(parts.parent_args.iter().chain([ args: cx.mk_args_from_iter(parts.parent_args.iter().chain([
parts.closure_kind_ty.into(), parts.closure_kind_ty.into(),
parts.signature_parts_ty.into(), parts.signature_parts_ty.into(),
parts.tupled_upvars_ty.into(), parts.tupled_upvars_ty.into(),
@ -409,14 +409,14 @@ impl<I: Interner> CoroutineClosureSignature<I> {
/// When the kind and upvars are known, use the other helper functions. /// When the kind and upvars are known, use the other helper functions.
pub fn to_coroutine( pub fn to_coroutine(
self, self,
tcx: I, cx: I,
parent_args: I::GenericArgsSlice, parent_args: I::GenericArgsSlice,
coroutine_kind_ty: I::Ty, coroutine_kind_ty: I::Ty,
coroutine_def_id: I::DefId, coroutine_def_id: I::DefId,
tupled_upvars_ty: I::Ty, tupled_upvars_ty: I::Ty,
) -> I::Ty { ) -> I::Ty {
let coroutine_args = ty::CoroutineArgs::new( let coroutine_args = ty::CoroutineArgs::new(
tcx, cx,
ty::CoroutineArgsParts { ty::CoroutineArgsParts {
parent_args, parent_args,
kind_ty: coroutine_kind_ty, kind_ty: coroutine_kind_ty,
@ -428,7 +428,7 @@ impl<I: Interner> CoroutineClosureSignature<I> {
}, },
); );
Ty::new_coroutine(tcx, coroutine_def_id, coroutine_args.args) Ty::new_coroutine(cx, coroutine_def_id, coroutine_args.args)
} }
/// Given known upvars and a [`ClosureKind`](ty::ClosureKind), compute the coroutine /// Given known upvars and a [`ClosureKind`](ty::ClosureKind), compute the coroutine
@ -438,7 +438,7 @@ impl<I: Interner> CoroutineClosureSignature<I> {
/// that the `ClosureKind` is actually supported by the coroutine-closure. /// that the `ClosureKind` is actually supported by the coroutine-closure.
pub fn to_coroutine_given_kind_and_upvars( pub fn to_coroutine_given_kind_and_upvars(
self, self,
tcx: I, cx: I,
parent_args: I::GenericArgsSlice, parent_args: I::GenericArgsSlice,
coroutine_def_id: I::DefId, coroutine_def_id: I::DefId,
goal_kind: ty::ClosureKind, goal_kind: ty::ClosureKind,
@ -447,7 +447,7 @@ impl<I: Interner> CoroutineClosureSignature<I> {
coroutine_captures_by_ref_ty: I::Ty, coroutine_captures_by_ref_ty: I::Ty,
) -> I::Ty { ) -> I::Ty {
let tupled_upvars_ty = Self::tupled_upvars_by_closure_kind( let tupled_upvars_ty = Self::tupled_upvars_by_closure_kind(
tcx, cx,
goal_kind, goal_kind,
self.tupled_inputs_ty, self.tupled_inputs_ty,
closure_tupled_upvars_ty, closure_tupled_upvars_ty,
@ -456,9 +456,9 @@ impl<I: Interner> CoroutineClosureSignature<I> {
); );
self.to_coroutine( self.to_coroutine(
tcx, cx,
parent_args, parent_args,
Ty::from_coroutine_closure_kind(tcx, goal_kind), Ty::from_coroutine_closure_kind(cx, goal_kind),
coroutine_def_id, coroutine_def_id,
tupled_upvars_ty, tupled_upvars_ty,
) )
@ -474,7 +474,7 @@ impl<I: Interner> CoroutineClosureSignature<I> {
/// lifetimes are related to the lifetime of the borrow on the closure made for /// lifetimes are related to the lifetime of the borrow on the closure made for
/// the call. This allows borrowck to enforce the self-borrows correctly. /// the call. This allows borrowck to enforce the self-borrows correctly.
pub fn tupled_upvars_by_closure_kind( pub fn tupled_upvars_by_closure_kind(
tcx: I, cx: I,
kind: ty::ClosureKind, kind: ty::ClosureKind,
tupled_inputs_ty: I::Ty, tupled_inputs_ty: I::Ty,
closure_tupled_upvars_ty: I::Ty, closure_tupled_upvars_ty: I::Ty,
@ -488,12 +488,12 @@ impl<I: Interner> CoroutineClosureSignature<I> {
}; };
let coroutine_captures_by_ref_ty = let coroutine_captures_by_ref_ty =
sig.output().skip_binder().fold_with(&mut FoldEscapingRegions { sig.output().skip_binder().fold_with(&mut FoldEscapingRegions {
interner: tcx, interner: cx,
region: env_region, region: env_region,
debruijn: ty::INNERMOST, debruijn: ty::INNERMOST,
}); });
Ty::new_tup_from_iter( Ty::new_tup_from_iter(
tcx, cx,
tupled_inputs_ty tupled_inputs_ty
.tuple_fields() .tuple_fields()
.iter() .iter()
@ -501,7 +501,7 @@ impl<I: Interner> CoroutineClosureSignature<I> {
) )
} }
ty::ClosureKind::FnOnce => Ty::new_tup_from_iter( ty::ClosureKind::FnOnce => Ty::new_tup_from_iter(
tcx, cx,
tupled_inputs_ty tupled_inputs_ty
.tuple_fields() .tuple_fields()
.iter() .iter()
@ -615,9 +615,9 @@ pub struct CoroutineArgsParts<I: Interner> {
impl<I: Interner> CoroutineArgs<I> { impl<I: Interner> CoroutineArgs<I> {
/// Construct `CoroutineArgs` from `CoroutineArgsParts`, containing `Args` /// Construct `CoroutineArgs` from `CoroutineArgsParts`, containing `Args`
/// for the coroutine parent, alongside additional coroutine-specific components. /// for the coroutine parent, alongside additional coroutine-specific components.
pub fn new(tcx: I, parts: CoroutineArgsParts<I>) -> CoroutineArgs<I> { pub fn new(cx: I, parts: CoroutineArgsParts<I>) -> CoroutineArgs<I> {
CoroutineArgs { CoroutineArgs {
args: tcx.mk_args_from_iter(parts.parent_args.iter().chain([ args: cx.mk_args_from_iter(parts.parent_args.iter().chain([
parts.kind_ty.into(), parts.kind_ty.into(),
parts.resume_ty.into(), parts.resume_ty.into(),
parts.yield_ty.into(), parts.yield_ty.into(),

View file

@ -71,7 +71,7 @@ fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
wc.push(parse_quote! { #ty: ::rustc_type_ir::lift::Lift<J, Lifted = #lifted_ty> }); wc.push(parse_quote! { #ty: ::rustc_type_ir::lift::Lift<J, Lifted = #lifted_ty> });
let bind = &bindings[index]; let bind = &bindings[index];
quote! { quote! {
#bind.lift_to_tcx(interner)? #bind.lift_to_interner(interner)?
} }
}) })
}); });
@ -89,7 +89,7 @@ fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
quote! { quote! {
type Lifted = #lifted_ty; type Lifted = #lifted_ty;
fn lift_to_tcx( fn lift_to_interner(
self, self,
interner: J, interner: J,
) -> Option<Self::Lifted> { ) -> Option<Self::Lifted> {

View file

@ -24,9 +24,14 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
/// passed as an argument, it is not captured or consumed, and it never has the /// passed as an argument, it is not captured or consumed, and it never has the
/// value `-1`. /// value `-1`.
/// ///
/// This type's `.to_owned()` implementation returns another `BorrowedFd` /// This type does not have a [`ToOwned`][crate::borrow::ToOwned]
/// rather than an `OwnedFd`. It just makes a trivial copy of the raw file /// implementation. Calling `.to_owned()` on a variable of this type will call
/// descriptor, which is then borrowed under the same lifetime. /// it on `&BorrowedFd` and use `Clone::clone()` like `ToOwned` does for all
/// types implementing `Clone`. The result will be descriptor borrowed under
/// the same lifetime.
///
/// To obtain an [`OwnedFd`], you can use [`BorrowedFd::try_clone_to_owned`]
/// instead, but this is not supported on all platforms.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(0)] #[rustc_layout_scalar_valid_range_start(0)]
@ -50,6 +55,8 @@ pub struct BorrowedFd<'fd> {
/// descriptor, so it can be used in FFI in places where a file descriptor is /// descriptor, so it can be used in FFI in places where a file descriptor is
/// passed as a consumed argument or returned as an owned value, and it never /// passed as a consumed argument or returned as an owned value, and it never
/// has the value `-1`. /// has the value `-1`.
///
/// You can use [`AsFd::as_fd`] to obtain a [`BorrowedFd`].
#[repr(transparent)] #[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(0)] #[rustc_layout_scalar_valid_range_start(0)]
// libstd/os/raw/mod.rs assures me that every libstd-supported platform has a // libstd/os/raw/mod.rs assures me that every libstd-supported platform has a

View file

@ -61,7 +61,7 @@ pub use env::{env_var, env_var_os};
pub use run::{cmd, run, run_fail, run_with_args}; pub use run::{cmd, run, run_fail, run_with_args};
/// Helpers for checking target information. /// Helpers for checking target information.
pub use targets::{is_darwin, is_msvc, is_windows, target, uname}; pub use targets::{is_darwin, is_msvc, is_windows, llvm_components_contain, target, uname};
/// Helpers for building names of output artifacts that are potentially target-specific. /// Helpers for building names of output artifacts that are potentially target-specific.
pub use artifact_names::{ pub use artifact_names::{

View file

@ -28,6 +28,13 @@ pub fn is_darwin() -> bool {
target().contains("darwin") target().contains("darwin")
} }
/// Check if `component` is within `LLVM_COMPONENTS`
#[must_use]
pub fn llvm_components_contain(component: &str) -> bool {
// `LLVM_COMPONENTS` is a space-separated list of words
env_var("LLVM_COMPONENTS").split_whitespace().find(|s| s == &component).is_some()
}
/// Run `uname`. This assumes that `uname` is available on the platform! /// Run `uname`. This assumes that `uname` is available on the platform!
#[track_caller] #[track_caller]
#[must_use] #[must_use]

View file

@ -1,5 +1,4 @@
run-make/archive-duplicate-names/Makefile run-make/archive-duplicate-names/Makefile
run-make/atomic-lock-free/Makefile
run-make/branch-protection-check-IBT/Makefile run-make/branch-protection-check-IBT/Makefile
run-make/c-dynamic-dylib/Makefile run-make/c-dynamic-dylib/Makefile
run-make/c-dynamic-rlib/Makefile run-make/c-dynamic-rlib/Makefile

View file

@ -1,48 +0,0 @@
include ../tools.mk
# This tests ensure that atomic types are never lowered into runtime library calls that are not
# guaranteed to be lock-free.
all:
ifeq ($(UNAME),Linux)
ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86)
$(RUSTC) --target=i686-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=x86_64-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
endif
ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm)
$(RUSTC) --target=arm-unknown-linux-gnueabi atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=arm-unknown-linux-gnueabihf atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
endif
ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64)
$(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
endif
ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips)
$(RUSTC) --target=mips-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=mipsel-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
endif
ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc)
$(RUSTC) --target=powerpc-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=powerpc-unknown-linux-gnuspe atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
endif
ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz)
$(RUSTC) --target=s390x-unknown-linux-gnu atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
endif
endif

View file

@ -0,0 +1,52 @@
// This tests ensure that atomic types are never lowered into runtime library calls that are not
// guaranteed to be lock-free.
//@ only-linux
use run_make_support::{llvm_components_contain, llvm_readobj, rustc};
fn compile(target: &str) {
rustc().input("atomic_lock_free.rs").target(target).run();
}
fn check() {
llvm_readobj()
.symbols()
.input("libatomic_lock_free.rlib")
.run()
.assert_stdout_not_contains("__atomic_fetch_add");
}
fn compile_and_check(target: &str) {
compile(target);
check();
}
fn main() {
if llvm_components_contain("x86") {
compile_and_check("i686-unknown-linux-gnu");
compile_and_check("x86_64-unknown-linux-gnu");
}
if llvm_components_contain("arm") {
compile_and_check("arm-unknown-linux-gnueabi");
compile_and_check("arm-unknown-linux-gnueabihf");
compile_and_check("armv7-unknown-linux-gnueabihf");
compile_and_check("thumbv7neon-unknown-linux-gnueabihf");
}
if llvm_components_contain("aarch64") {
compile_and_check("aarch64-unknown-linux-gnu");
}
if llvm_components_contain("mips") {
compile_and_check("mips-unknown-linux-gnu");
compile_and_check("mipsel-unknown-linux-gnu");
}
if llvm_components_contain("powerpc") {
compile_and_check("powerpc-unknown-linux-gnu");
compile_and_check("powerpc-unknown-linux-gnuspe");
compile_and_check("powerpc64-unknown-linux-gnu");
compile_and_check("powerpc64le-unknown-linux-gnu");
}
if llvm_components_contain("systemz") {
compile_and_check("s390x-unknown-linux-gnu");
}
}

View file

@ -0,0 +1,11 @@
error[E0432]: unresolved import `inner`
--> $DIR/ice-unresolved-import-100241.rs:9:13
|
LL | pub use inner::S;
| ^^^^^ maybe a missing crate `inner`?
|
= help: consider adding `extern crate inner` to use the `inner` crate
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0432`.

View file

@ -6,8 +6,9 @@ LL | type A: S<C<X = 0i32> = 34>;
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<X = 0i32> = 34>; LL - type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~ LL + type A: S<C = 34>;
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/invalid_associated_const.rs:4:17 --> $DIR/invalid_associated_const.rs:4:17
@ -18,8 +19,9 @@ LL | type A: S<C<X = 0i32> = 34>;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<X = 0i32> = 34>; LL - type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~ LL + type A: S<C = 34>;
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -6,8 +6,9 @@ LL | type A: S<C<X = 0i32> = 34>;
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<X = 0i32> = 34>; LL - type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~ LL + type A: S<C = 34>;
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/issue-102467.rs:7:17 --> $DIR/issue-102467.rs:7:17
@ -18,8 +19,9 @@ LL | type A: S<C<X = 0i32> = 34>;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<X = 0i32> = 34>; LL - type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~ LL + type A: S<C = 34>;
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -48,7 +48,7 @@ LL | fn foo_with_qualified_path(<Bar as T>::Baz);
help: explicitly ignore the parameter name help: explicitly ignore the parameter name
| |
LL | fn foo_with_qualified_path(_: <Bar as T>::Baz); LL | fn foo_with_qualified_path(_: <Bar as T>::Baz);
| ~~~~~~~~~~~~~~~~~~ | ++
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)` error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:15:56 --> $DIR/anon-params-denied-2018.rs:15:56
@ -60,7 +60,7 @@ LL | fn foo_with_qualified_path_and_ref(&<Bar as T>::Baz);
help: explicitly ignore the parameter name help: explicitly ignore the parameter name
| |
LL | fn foo_with_qualified_path_and_ref(_: &<Bar as T>::Baz); LL | fn foo_with_qualified_path_and_ref(_: &<Bar as T>::Baz);
| ~~~~~~~~~~~~~~~~~~~ | ++
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `,` error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `,`
--> $DIR/anon-params-denied-2018.rs:18:57 --> $DIR/anon-params-denied-2018.rs:18:57
@ -72,7 +72,7 @@ LL | fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, <Bar as T>::Baz);
help: explicitly ignore the parameter name help: explicitly ignore the parameter name
| |
LL | fn foo_with_multiple_qualified_paths(_: <Bar as T>::Baz, <Bar as T>::Baz); LL | fn foo_with_multiple_qualified_paths(_: <Bar as T>::Baz, <Bar as T>::Baz);
| ~~~~~~~~~~~~~~~~~~ | ++
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)` error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:18:74 --> $DIR/anon-params-denied-2018.rs:18:74
@ -84,7 +84,7 @@ LL | fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, <Bar as T>::Baz);
help: explicitly ignore the parameter name help: explicitly ignore the parameter name
| |
LL | fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, _: <Bar as T>::Baz); LL | fn foo_with_multiple_qualified_paths(<Bar as T>::Baz, _: <Bar as T>::Baz);
| ~~~~~~~~~~~~~~~~~~ | ++
error: expected one of `:`, `@`, or `|`, found `,` error: expected one of `:`, `@`, or `|`, found `,`
--> $DIR/anon-params-denied-2018.rs:22:36 --> $DIR/anon-params-denied-2018.rs:22:36

View file

@ -6,8 +6,9 @@ LL | type A: S<C<X = 0i32> = 34>;
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<X = 0i32> = 34>; LL - type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~ LL + type A: S<C = 34>;
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/issue-102335-const.rs:4:17 --> $DIR/issue-102335-const.rs:4:17
@ -18,8 +19,9 @@ LL | type A: S<C<X = 0i32> = 34>;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<X = 0i32> = 34>; LL - type A: S<C<X = 0i32> = 34>;
| ~~~~~~~~~~ LL + type A: S<C = 34>;
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -6,8 +6,9 @@ LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint LL - type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint
| ~~~~~~~~~~~ LL + type A: S<C = ()>; // Just one erroneous equality constraint
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/issue-102335-ty.rs:2:17 --> $DIR/issue-102335-ty.rs:2:17
@ -18,8 +19,9 @@ LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint LL - type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint
| ~~~~~~~~~~~ LL + type A: S<C = ()>; // Just one erroneous equality constraint
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/issue-102335-ty.rs:8:17 --> $DIR/issue-102335-ty.rs:8:17
@ -29,8 +31,9 @@ LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equal
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints LL - type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints
| ~~~~~~~~~~ LL + type A: S<C<X = i32> = ()>; // More than one erroneous equality constraints
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/issue-102335-ty.rs:8:17 --> $DIR/issue-102335-ty.rs:8:17
@ -41,8 +44,9 @@ LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equal
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints LL - type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints
| ~~~~~~~~~~ LL + type A: S<C<X = i32> = ()>; // More than one erroneous equality constraints
|
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -6,8 +6,9 @@ LL | fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>;
| |
help: consider removing this associated item constraint help: consider removing this associated item constraint
| |
LL | fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>; LL - fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>;
| ~~~~~~~~~~~ LL + fn next<'a>(&'a mut self) -> Option<Self::Item<'a>>;
|
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -13,12 +13,12 @@ error: future cannot be sent between threads safely
LL | is_send(foo::<T>()); LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send` | ^^^^^^^^^^ future returned by `foo` is not `Send`
| |
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is required by `impl Future<Output = Result<(), ()>>: Send` = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }`, which is required by `impl Future<Output = Result<(), ()>>: Send`
note: future is not `Send` as it awaits another future which is not `Send` note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:13:5 --> $DIR/basic.rs:13:5
| |
LL | T::method().await?; LL | T::method().await?;
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is not `Send` | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }`, which is not `Send`
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/basic.rs:17:20 --> $DIR/basic.rs:17:20
| |

View file

@ -0,0 +1,25 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {}
fn needs_trait(_: impl Trait) {}
trait Assoc {
fn method() -> impl Sized;
fn method_with_lt() -> impl Sized;
fn method_with_ty<T>() -> impl Sized;
fn method_with_ct<const N: usize>() -> impl Sized;
}
fn foo<T: Assoc>(t: T) {
needs_trait(T::method());
//~^ ERROR the trait bound
needs_trait(T::method_with_lt());
//~^ ERROR the trait bound
needs_trait(T::method_with_ty());
//~^ ERROR the trait bound
needs_trait(T::method_with_ct());
//~^ ERROR the trait bound
}
fn main() {}

View file

@ -0,0 +1,78 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/display.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `impl Sized { <T as Assoc>::method(..) }: Trait` is not satisfied
--> $DIR/display.rs:15:17
|
LL | needs_trait(T::method());
| ----------- ^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method(..) }`
| |
| required by a bound introduced by this call
|
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error[E0277]: the trait bound `impl Sized { <T as Assoc>::method_with_lt(..) }: Trait` is not satisfied
--> $DIR/display.rs:17:17
|
LL | needs_trait(T::method_with_lt());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method_with_lt(..) }`
| |
| required by a bound introduced by this call
|
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error[E0277]: the trait bound `impl Sized: Trait` is not satisfied
--> $DIR/display.rs:19:17
|
LL | needs_trait(T::method_with_ty());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/display.rs:4:1
|
LL | trait Trait {}
| ^^^^^^^^^^^
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error[E0277]: the trait bound `impl Sized: Trait` is not satisfied
--> $DIR/display.rs:21:17
|
LL | needs_trait(T::method_with_ct());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/display.rs:4:1
|
LL | trait Trait {}
| ^^^^^^^^^^^
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error: aborting due to 4 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View file

@ -50,8 +50,9 @@ LL | impl Tr1<A = usize> for usize {
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | impl Tr1<A = usize> for usize { LL - impl Tr1<A = usize> for usize {
| ~~~~~~~~~~~ LL + impl Tr1 for usize {
|
error[E0046]: not all trait items implemented, missing: `A` error[E0046]: not all trait items implemented, missing: `A`
--> $DIR/associated-types-eq-2.rs:20:1 --> $DIR/associated-types-eq-2.rs:20:1
@ -70,8 +71,9 @@ LL | fn baz<I: Tr1>(_x: &<I as Tr1<A=Bar>>::A) {}
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | fn baz<I: Tr1>(_x: &<I as Tr1<A=Bar>>::A) {} LL - fn baz<I: Tr1>(_x: &<I as Tr1<A=Bar>>::A) {}
| ~~~~~~~ LL + fn baz<I: Tr1>(_x: &<I as Tr1>::A) {}
|
error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied
--> $DIR/associated-types-eq-2.rs:40:6 --> $DIR/associated-types-eq-2.rs:40:6
@ -128,8 +130,9 @@ LL | impl Tr2<i32, t2 = Qux, T3 = usize> for Qux {
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | impl Tr2<i32, t2 = Qux, T3 = usize> for Qux { LL - impl Tr2<i32, t2 = Qux, T3 = usize> for Qux {
| ~~~~~~~~~~ LL + impl Tr2<i32, T3 = usize> for Qux {
|
error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied
--> $DIR/associated-types-eq-2.rs:54:6 --> $DIR/associated-types-eq-2.rs:54:6
@ -157,8 +160,9 @@ LL | impl Tr2<i32, X = Qux, Y = usize> for Bar {
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | impl Tr2<i32, X = Qux, Y = usize> for Bar { LL - impl Tr2<i32, X = Qux, Y = usize> for Bar {
| ~~~~~~~~~ LL + impl Tr2<i32, Y = usize> for Bar {
|
error[E0107]: trait takes 3 generic arguments but 2 generic arguments were supplied error[E0107]: trait takes 3 generic arguments but 2 generic arguments were supplied
--> $DIR/associated-types-eq-2.rs:61:6 --> $DIR/associated-types-eq-2.rs:61:6
@ -228,8 +232,9 @@ LL | impl Tr3<n = 42, T2 = Qux, T3 = usize> for Qux {
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | impl Tr3<n = 42, T2 = Qux, T3 = usize> for Qux { LL - impl Tr3<n = 42, T2 = Qux, T3 = usize> for Qux {
| ~~~~~~~ LL + impl Tr3<T2 = Qux, T3 = usize> for Qux {
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/associated-types-eq-2.rs:92:10 --> $DIR/associated-types-eq-2.rs:92:10
@ -239,8 +244,9 @@ LL | impl Tr3<N = u32, T2 = Qux, T3 = usize> for Bar {
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | impl Tr3<N = u32, T2 = Qux, T3 = usize> for Bar { LL - impl Tr3<N = u32, T2 = Qux, T3 = usize> for Bar {
| ~~~~~~~~ LL + impl Tr3<T2 = Qux, T3 = usize> for Bar {
|
error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied
--> $DIR/associated-types-eq-2.rs:98:6 --> $DIR/associated-types-eq-2.rs:98:6
@ -268,8 +274,9 @@ LL | impl Tr3<42, T2 = 42, T3 = usize> for Bar {
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | impl Tr3<42, T2 = 42, T3 = usize> for Bar { LL - impl Tr3<42, T2 = 42, T3 = usize> for Bar {
| ~~~~~~~~~ LL + impl Tr3<42, T3 = usize> for Bar {
|
error[E0107]: trait takes 3 generic arguments but 0 generic arguments were supplied error[E0107]: trait takes 3 generic arguments but 0 generic arguments were supplied
--> $DIR/associated-types-eq-2.rs:106:6 --> $DIR/associated-types-eq-2.rs:106:6
@ -295,8 +302,9 @@ LL | impl Tr3<X = 42, Y = Qux, Z = usize> for Bar {
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | impl Tr3<X = 42, Y = Qux, Z = usize> for Bar { LL - impl Tr3<X = 42, Y = Qux, Z = usize> for Bar {
| ~~~~~~~ LL + impl Tr3<Y = Qux, Z = usize> for Bar {
|
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/associated-types-eq-2.rs:117:13 --> $DIR/associated-types-eq-2.rs:117:13

View file

@ -18,8 +18,8 @@ LL | | }
LL | | }); LL | | });
| |______^ implementation of `Send` is not general enough | |______^ implementation of `Send` is not general enough
| |
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>() }`, for any two lifetimes `'0` and `'1`... = note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>(..) }`, for any two lifetimes `'0` and `'1`...
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>() }`, for some specific lifetime `'2` = note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>(..) }`, for some specific lifetime `'2`
error: implementation of `Send` is not general enough error: implementation of `Send` is not general enough
--> $DIR/issue-110963-early.rs:14:5 --> $DIR/issue-110963-early.rs:14:5
@ -32,8 +32,8 @@ LL | | }
LL | | }); LL | | });
| |______^ implementation of `Send` is not general enough | |______^ implementation of `Send` is not general enough
| |
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>() }`, for any two lifetimes `'0` and `'1`... = note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>(..) }`, for any two lifetimes `'0` and `'1`...
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>() }`, for some specific lifetime `'2` = note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>(..) }`, for some specific lifetime `'2`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors; 1 warning emitted error: aborting due to 2 previous errors; 1 warning emitted

View file

@ -15,8 +15,9 @@ LL | impl Super1<'_, bar(..): Send> for () {}
| |
help: consider removing this associated item constraint help: consider removing this associated item constraint
| |
LL | impl Super1<'_, bar(..): Send> for () {} LL - impl Super1<'_, bar(..): Send> for () {}
| ~~~~~~~~~~~~~~~ LL + impl Super1<'_> for () {}
|
error[E0046]: not all trait items implemented, missing: `bar` error[E0046]: not all trait items implemented, missing: `bar`
--> $DIR/rtn-in-impl-signature.rs:10:1 --> $DIR/rtn-in-impl-signature.rs:10:1

View file

@ -10,7 +10,7 @@ LL | use foo::Bar;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use foo::Bar as OtherBar; LL | use foo::Bar as OtherBar;
| ~~~~~~~~~~~~~~~~~~~~ | +++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ LL | use foo::foo;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use foo::foo as other_foo; LL | use foo::foo as other_foo;
| ~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ LL | macro_rules! panic { () => {} }
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | pub use std::panic as other_panic; LL | pub use std::panic as other_panic;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,9 @@ LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
| ~~~~~~~~~ LL + fn baz<I>(x: &<I as Foo>::A) {}
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/E0229.rs:13:25 --> $DIR/E0229.rs:13:25
@ -18,8 +19,9 @@ LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
| ~~~~~~~~~ LL + fn baz<I>(x: &<I as Foo>::A) {}
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/E0229.rs:13:25 --> $DIR/E0229.rs:13:25
@ -30,8 +32,9 @@ LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
| ~~~~~~~~~ LL + fn baz<I>(x: &<I as Foo>::A) {}
|
error[E0277]: the trait bound `I: Foo` is not satisfied error[E0277]: the trait bound `I: Foo` is not satisfied
--> $DIR/E0229.rs:13:15 --> $DIR/E0229.rs:13:15

View file

@ -10,7 +10,7 @@ LL | use bar::baz;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use bar::baz as other_baz; LL | use bar::baz as other_baz;
| ~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ LL | use foo::alloc;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use foo::alloc as other_alloc; LL | use foo::alloc as other_alloc;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ LL | fn foo() {}
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use bar::foo as other_foo; LL | use bar::foo as other_foo;
| ~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,9 @@ LL | type A: S<C<(), i32 = ()> = ()>;
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<(), i32 = ()> = ()>; LL - type A: S<C<(), i32 = ()> = ()>;
| ~~~~~~~~~~ LL + type A: S<C<()> = ()>;
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/issue-102335-gat.rs:2:21 --> $DIR/issue-102335-gat.rs:2:21
@ -18,8 +19,9 @@ LL | type A: S<C<(), i32 = ()> = ()>;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type A: S<C<(), i32 = ()> = ()>; LL - type A: S<C<(), i32 = ()> = ()>;
| ~~~~~~~~~~ LL + type A: S<C<()> = ()>;
|
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -14,8 +14,9 @@ LL | impl Foo<T: Default> for String {}
| |
help: declare the type parameter right after the `impl` keyword help: declare the type parameter right after the `impl` keyword
| |
LL | impl<T: Default> Foo<T> for String {} LL - impl Foo<T: Default> for String {}
| ++++++++++++ ~ LL + impl<T: Default> Foo<T> for String {}
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:7:10 --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:7:10
@ -25,8 +26,9 @@ LL | impl Foo<T: 'a + Default> for u8 {}
| |
help: declare the type parameter right after the `impl` keyword help: declare the type parameter right after the `impl` keyword
| |
LL | impl<'a, T: 'a + Default> Foo<T> for u8 {} LL - impl Foo<T: 'a + Default> for u8 {}
| +++++++++++++++++++++ ~ LL + impl<'a, T: 'a + Default> Foo<T> for u8 {}
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:13:13 --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:13:13
@ -36,8 +38,9 @@ LL | impl<T> Foo<T: Default> for u16 {}
| |
help: declare the type parameter right after the `impl` keyword help: declare the type parameter right after the `impl` keyword
| |
LL | impl<T, T: Default> Foo<T> for u16 {} LL - impl<T> Foo<T: Default> for u16 {}
| ++++++++++++ ~ LL + impl<T, T: Default> Foo<T> for u16 {}
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:17:14 --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:17:14
@ -47,8 +50,9 @@ LL | impl<'a> Foo<T: 'a + Default> for u32 {}
| |
help: declare the type parameter right after the `impl` keyword help: declare the type parameter right after the `impl` keyword
| |
LL | impl<'a, 'a, T: 'a + Default> Foo<T> for u32 {} LL - impl<'a> Foo<T: 'a + Default> for u32 {}
| +++++++++++++++++++++ ~ LL + impl<'a, 'a, T: 'a + Default> Foo<T> for u32 {}
|
error[E0229]: associated item constraints are not allowed here error[E0229]: associated item constraints are not allowed here
--> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:23:10 --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:23:10
@ -58,8 +62,9 @@ LL | impl Bar<T: Default, K: Default> for String {}
| |
help: declare the type parameter right after the `impl` keyword help: declare the type parameter right after the `impl` keyword
| |
LL | impl<T: Default> Bar<T, K: Default> for String {} LL - impl Bar<T: Default, K: Default> for String {}
| ++++++++++++ ~ LL + impl<T: Default> Bar<T, K: Default> for String {}
|
error[E0107]: trait takes 2 generic arguments but 1 generic argument was supplied error[E0107]: trait takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:27:9 --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:27:9
@ -87,8 +92,9 @@ LL | impl<T> Bar<T, K: Default> for u8 {}
| |
help: declare the type parameter right after the `impl` keyword help: declare the type parameter right after the `impl` keyword
| |
LL | impl<T, K: Default> Bar<T, K> for u8 {} LL - impl<T> Bar<T, K: Default> for u8 {}
| ++++++++++++ ~ LL + impl<T, K: Default> Bar<T, K> for u8 {}
|
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View file

@ -10,7 +10,7 @@ LL | use sub2::foo;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use sub2::foo as other_foo; LL | use sub2::foo as other_foo;
| ~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ LL | mod A {}
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use self::A as OtherA; LL | use self::A as OtherA;
| ~~~~~~~~~~~~~~~~~ | +++++++++
error[E0255]: the name `B` is defined multiple times error[E0255]: the name `B` is defined multiple times
--> $DIR/issue-19498.rs:5:1 --> $DIR/issue-19498.rs:5:1
@ -26,7 +26,7 @@ LL | pub mod B {}
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use self::B as OtherB; LL | use self::B as OtherB;
| ~~~~~~~~~~~~~~~~~ | +++++++++
error[E0255]: the name `D` is defined multiple times error[E0255]: the name `D` is defined multiple times
--> $DIR/issue-19498.rs:9:5 --> $DIR/issue-19498.rs:9:5
@ -40,7 +40,7 @@ LL | mod D {}
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use C::D as OtherD; LL | use C::D as OtherD;
| ~~~~~~~~~~~~~~ | +++++++++
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -11,7 +11,7 @@ LL | type Add = bool;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::ops::Add as OtherAdd; LL | use std::ops::Add as OtherAdd;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | +++++++++++
error[E0255]: the name `Sub` is defined multiple times error[E0255]: the name `Sub` is defined multiple times
--> $DIR/issue-24081.rs:9:1 --> $DIR/issue-24081.rs:9:1
@ -26,7 +26,7 @@ LL | struct Sub { x: f32 }
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::ops::Sub as OtherSub; LL | use std::ops::Sub as OtherSub;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | +++++++++++
error[E0255]: the name `Mul` is defined multiple times error[E0255]: the name `Mul` is defined multiple times
--> $DIR/issue-24081.rs:11:1 --> $DIR/issue-24081.rs:11:1
@ -41,7 +41,7 @@ LL | enum Mul { A, B }
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::ops::Mul as OtherMul; LL | use std::ops::Mul as OtherMul;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | +++++++++++
error[E0255]: the name `Div` is defined multiple times error[E0255]: the name `Div` is defined multiple times
--> $DIR/issue-24081.rs:13:1 --> $DIR/issue-24081.rs:13:1
@ -56,7 +56,7 @@ LL | mod Div { }
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::ops::Div as OtherDiv; LL | use std::ops::Div as OtherDiv;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | +++++++++++
error[E0255]: the name `Rem` is defined multiple times error[E0255]: the name `Rem` is defined multiple times
--> $DIR/issue-24081.rs:15:1 --> $DIR/issue-24081.rs:15:1
@ -71,7 +71,7 @@ LL | trait Rem { }
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::ops::Rem as OtherRem; LL | use std::ops::Rem as OtherRem;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | +++++++++++
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -10,7 +10,7 @@ LL | use bar::baz;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use bar::baz as other_baz; LL | use bar::baz as other_baz;
| ~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error[E0252]: the name `Quux` is defined multiple times error[E0252]: the name `Quux` is defined multiple times
--> $DIR/issue-25396.rs:7:5 --> $DIR/issue-25396.rs:7:5
@ -24,7 +24,7 @@ LL | use bar::Quux;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use bar::Quux as OtherQuux; LL | use bar::Quux as OtherQuux;
| ~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error[E0252]: the name `blah` is defined multiple times error[E0252]: the name `blah` is defined multiple times
--> $DIR/issue-25396.rs:10:5 --> $DIR/issue-25396.rs:10:5
@ -38,7 +38,7 @@ LL | use bar::blah;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use bar::blah as other_blah; LL | use bar::blah as other_blah;
| ~~~~~~~~~~~~~~~~~~~~~~~ | +++++++++++++
error[E0252]: the name `WOMP` is defined multiple times error[E0252]: the name `WOMP` is defined multiple times
--> $DIR/issue-25396.rs:13:5 --> $DIR/issue-25396.rs:13:5
@ -52,7 +52,7 @@ LL | use bar::WOMP;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use bar::WOMP as OtherWOMP; LL | use bar::WOMP as OtherWOMP;
| ~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -10,7 +10,7 @@ LL | use extension2::ConstructorExtension;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use extension2::ConstructorExtension as OtherConstructorExtension; LL | use extension2::ConstructorExtension as OtherConstructorExtension;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++++++++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -48,7 +48,7 @@ LL | use foo::self;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use foo as other_foo; LL | use foo as other_foo;
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~
error[E0252]: the name `A` is defined multiple times error[E0252]: the name `A` is defined multiple times
--> $DIR/import-self.rs:16:11 --> $DIR/import-self.rs:16:11

View file

@ -10,7 +10,7 @@ LL | use foo::{A, B as A};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use foo::{A, B as OtherA}; LL | use foo::{A, B as OtherA};
| ~~~~~~~~~~~ | ~~~~~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -10,7 +10,7 @@ LL | use std as issue_45829_b;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std as other_issue_45829_b; LL | use std as other_issue_45829_b;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -10,7 +10,7 @@ LL | use foo::{A, bar::B as A};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use foo::{A, bar::B as OtherA}; LL | use foo::{A, bar::B as OtherA};
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -10,7 +10,7 @@ LL | use std::{collections::HashMap as A, sync::Arc as A};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::{collections::HashMap as A, sync::Arc as OtherA}; LL | use std::{collections::HashMap as A, sync::Arc as OtherA};
| ~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -10,7 +10,7 @@ LL | use std as core;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std as other_core; LL | use std as other_core;
| ~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -98,7 +98,7 @@ LL | use issue_52891::b::inner;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use issue_52891::b::inner as other_inner; LL | use issue_52891::b::inner as other_inner;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++++
error[E0254]: the name `issue_52891` is defined multiple times error[E0254]: the name `issue_52891` is defined multiple times
--> $DIR/issue-52891.rs:31:19 --> $DIR/issue-52891.rs:31:19

View file

@ -10,7 +10,7 @@ LL | mod bar {}
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use baz::bar as other_bar; LL | use baz::bar as other_bar;
| ~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -6,8 +6,9 @@ LL | fn bar(foo: Foo<Target = usize>) {}
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | fn bar(foo: Foo<Target = usize>) {} LL - fn bar(foo: Foo<Target = usize>) {}
| ~~~~~~~~~~~~~~~~ LL + fn bar(foo: Foo) {}
|
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -8,7 +8,7 @@ LL | use std::slice as std;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::slice as other_std; LL | use std::slice as other_std;
| ~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ LL | fn transmute() {}
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::mem::transmute as other_transmute; LL | use std::mem::transmute as other_transmute;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ LL | struct Iter;
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | use std::slice::Iter as OtherIter; LL | use std::slice::Iter as OtherIter;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -22,8 +22,9 @@ LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;
| |
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; LL - type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;
| ~~~~~~~~~~~~~~~ LL + type Bar<'a>: Deref<Target = <Self>::Bar>;
|
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/issue-85347.rs:3:42 --> $DIR/issue-85347.rs:3:42
@ -51,8 +52,9 @@ LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider removing this associated item binding help: consider removing this associated item binding
| |
LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; LL - type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;
| ~~~~~~~~~~~~~~~ LL + type Bar<'a>: Deref<Target = <Self>::Bar>;
|
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -11,7 +11,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | pub use variant_namespacing::XE::{XStruct as OtherXStruct, XTuple, XUnit}; LL | pub use variant_namespacing::XE::{XStruct as OtherXStruct, XTuple, XUnit};
| ~~~~~~~~~~~~~~~~~~~~~~~ | +++++++++++++++
error[E0255]: the name `XTuple` is defined multiple times error[E0255]: the name `XTuple` is defined multiple times
--> $DIR/variant-namespacing.rs:24:44 --> $DIR/variant-namespacing.rs:24:44
@ -26,7 +26,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | pub use variant_namespacing::XE::{XStruct, XTuple as OtherXTuple, XUnit}; LL | pub use variant_namespacing::XE::{XStruct, XTuple as OtherXTuple, XUnit};
| ~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++++
error[E0255]: the name `XUnit` is defined multiple times error[E0255]: the name `XUnit` is defined multiple times
--> $DIR/variant-namespacing.rs:24:52 --> $DIR/variant-namespacing.rs:24:52
@ -41,7 +41,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit as OtherXUnit}; LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit as OtherXUnit};
| ~~~~~~~~~~~~~~~~~~~ | +++++++++++++
error[E0255]: the name `Struct` is defined multiple times error[E0255]: the name `Struct` is defined multiple times
--> $DIR/variant-namespacing.rs:28:13 --> $DIR/variant-namespacing.rs:28:13
@ -56,7 +56,7 @@ LL | pub use E::{Struct, Tuple, Unit};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | pub use E::{Struct as OtherStruct, Tuple, Unit}; LL | pub use E::{Struct as OtherStruct, Tuple, Unit};
| ~~~~~~~~~~~~~~~~~~~~~ | ++++++++++++++
error[E0255]: the name `Tuple` is defined multiple times error[E0255]: the name `Tuple` is defined multiple times
--> $DIR/variant-namespacing.rs:28:21 --> $DIR/variant-namespacing.rs:28:21
@ -71,7 +71,7 @@ LL | pub use E::{Struct, Tuple, Unit};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | pub use E::{Struct, Tuple as OtherTuple, Unit}; LL | pub use E::{Struct, Tuple as OtherTuple, Unit};
| ~~~~~~~~~~~~~~~~~~~ | +++++++++++++
error[E0255]: the name `Unit` is defined multiple times error[E0255]: the name `Unit` is defined multiple times
--> $DIR/variant-namespacing.rs:28:28 --> $DIR/variant-namespacing.rs:28:28
@ -86,7 +86,7 @@ LL | pub use E::{Struct, Tuple, Unit};
help: you can use `as` to change the binding name of the import help: you can use `as` to change the binding name of the import
| |
LL | pub use E::{Struct, Tuple, Unit as OtherUnit}; LL | pub use E::{Struct, Tuple, Unit as OtherUnit};
| ~~~~~~~~~~~~~~~~~ | ++++++++++++
error: aborting due to 6 previous errors error: aborting due to 6 previous errors