Auto merge of #87141 - spastorino:remove_impl_trait_in_bindings, r=oli-obk

Remove impl trait in bindings

Closes #86729

r? `@oli-obk`
This commit is contained in:
bors 2021-07-20 05:34:22 +00:00
commit a72c360a30
113 changed files with 540 additions and 1954 deletions

View File

@ -343,9 +343,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
// opaque type Foo1: Trait
let ty = self.lower_ty(
ty,
ImplTraitContext::OtherOpaqueTy {
ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut FxHashSet::default(),
origin: hir::OpaqueTyOrigin::TyAlias,
},
);
let generics = self.lower_generics(gen, ImplTraitContext::disallowed());
@ -484,17 +483,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
span: Span,
body: Option<&Expr>,
) -> (&'hir hir::Ty<'hir>, hir::BodyId) {
let mut capturable_lifetimes;
let itctx = if self.sess.features_untracked().impl_trait_in_bindings {
capturable_lifetimes = FxHashSet::default();
ImplTraitContext::OtherOpaqueTy {
capturable_lifetimes: &mut capturable_lifetimes,
origin: hir::OpaqueTyOrigin::Misc,
}
} else {
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
};
let ty = self.lower_ty(ty, itctx);
let ty = self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::Binding));
(ty, self.lower_const_body(span, body))
}
@ -926,9 +915,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
Some(ty) => {
let ty = self.lower_ty(
ty,
ImplTraitContext::OtherOpaqueTy {
ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut FxHashSet::default(),
origin: hir::OpaqueTyOrigin::TyAlias,
},
);
hir::ImplItemKind::TyAlias(ty)

View File

@ -264,8 +264,8 @@ enum ImplTraitContext<'b, 'a> {
/// Origin: Either OpaqueTyOrigin::FnReturn or OpaqueTyOrigin::AsyncFn,
origin: hir::OpaqueTyOrigin,
},
/// Impl trait in type aliases, consts and statics.
OtherOpaqueTy {
/// Impl trait in type aliases.
TypeAliasesOpaqueTy {
/// Set of lifetimes that this opaque type can capture, if it uses
/// them. This includes lifetimes bound since we entered this context.
/// For example:
@ -280,8 +280,6 @@ enum ImplTraitContext<'b, 'a> {
// FIXME(impl_trait): but `required_region_bounds` will ICE later
// anyway.
capturable_lifetimes: &'b mut FxHashSet<hir::LifetimeName>,
/// Origin: Either OpaqueTyOrigin::Misc or OpaqueTyOrigin::Binding,
origin: hir::OpaqueTyOrigin,
},
/// `impl Trait` is not accepted in this position.
Disallowed(ImplTraitPosition),
@ -310,8 +308,8 @@ impl<'a> ImplTraitContext<'_, 'a> {
ReturnPositionOpaqueTy { fn_def_id, origin } => {
ReturnPositionOpaqueTy { fn_def_id: *fn_def_id, origin: *origin }
}
OtherOpaqueTy { capturable_lifetimes, origin } => {
OtherOpaqueTy { capturable_lifetimes, origin: *origin }
TypeAliasesOpaqueTy { capturable_lifetimes } => {
TypeAliasesOpaqueTy { capturable_lifetimes }
}
Disallowed(pos) => Disallowed(*pos),
}
@ -1126,7 +1124,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
//
// fn foo() -> impl Iterator<Item = impl Debug>
ImplTraitContext::ReturnPositionOpaqueTy { .. }
| ImplTraitContext::OtherOpaqueTy { .. } => (true, itctx),
| ImplTraitContext::TypeAliasesOpaqueTy { .. } => (true, itctx),
// We are in the argument position, but within a dyn type:
//
@ -1150,9 +1148,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
capturable_lifetimes = FxHashSet::default();
(
true,
ImplTraitContext::OtherOpaqueTy {
ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut capturable_lifetimes,
origin: hir::OpaqueTyOrigin::Misc,
},
)
}
@ -1416,18 +1413,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
None,
|this| this.lower_param_bounds(bounds, itctx),
),
ImplTraitContext::OtherOpaqueTy { ref capturable_lifetimes, origin } => {
ImplTraitContext::TypeAliasesOpaqueTy { ref capturable_lifetimes } => {
// Reset capturable lifetimes, any nested impl trait
// types will inherit lifetimes from this opaque type,
// so don't need to capture them again.
let nested_itctx = ImplTraitContext::OtherOpaqueTy {
let nested_itctx = ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut FxHashSet::default(),
origin,
};
self.lower_opaque_impl_trait(
span,
None,
origin,
hir::OpaqueTyOrigin::TyAlias,
def_node_id,
Some(capturable_lifetimes),
|this| this.lower_param_bounds(bounds, nested_itctx),
@ -1464,25 +1460,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}),
))
}
ImplTraitContext::Disallowed(pos) => {
let allowed_in = if self.sess.features_untracked().impl_trait_in_bindings {
"bindings or function and inherent method return types"
} else {
"function and inherent method return types"
};
ImplTraitContext::Disallowed(_) => {
let mut err = struct_span_err!(
self.sess,
t.span,
E0562,
"`impl Trait` not allowed outside of {}",
allowed_in,
"function and method return types",
);
if pos == ImplTraitPosition::Binding && self.sess.is_nightly_build() {
err.help(
"add `#![feature(impl_trait_in_bindings)]` to the crate \
attributes to enable",
);
}
err.emit();
hir::TyKind::Err
}
@ -1767,21 +1752,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}
fn lower_local(&mut self, l: &Local) -> hir::Local<'hir> {
let ty = l.ty.as_ref().map(|t| {
let mut capturable_lifetimes;
self.lower_ty(
t,
if self.sess.features_untracked().impl_trait_in_bindings {
capturable_lifetimes = FxHashSet::default();
ImplTraitContext::OtherOpaqueTy {
capturable_lifetimes: &mut capturable_lifetimes,
origin: hir::OpaqueTyOrigin::Binding,
}
} else {
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
},
)
});
let ty = l
.ty
.as_ref()
.map(|t| self.lower_ty(t, ImplTraitContext::Disallowed(ImplTraitPosition::Binding)));
let init = l.init.as_ref().map(|e| self.lower_expr(e));
let hir_id = self.lower_node_id(l.id);
self.lower_attrs(hir_id, &l.attrs);
@ -2332,13 +2306,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
)),
_ => None,
});
if let ImplTraitContext::OtherOpaqueTy { ref mut capturable_lifetimes, .. } = itctx {
if let ImplTraitContext::TypeAliasesOpaqueTy { ref mut capturable_lifetimes, .. } =
itctx
{
capturable_lifetimes.extend(lt_def_names.clone());
}
let res = this.lower_trait_ref(&p.trait_ref, itctx.reborrow());
if let ImplTraitContext::OtherOpaqueTy { ref mut capturable_lifetimes, .. } = itctx {
if let ImplTraitContext::TypeAliasesOpaqueTy { ref mut capturable_lifetimes, .. } =
itctx
{
for param in lt_def_names {
capturable_lifetimes.remove(&param);
}

View File

@ -455,9 +455,6 @@ declare_features! (
/// Allows non-builtin attributes in inner attribute position.
(active, custom_inner_attributes, "1.30.0", Some(54726), None),
/// Allows `impl Trait` in bindings (`let`, `const`, `static`).
(incomplete, impl_trait_in_bindings, "1.30.0", Some(63065), None),
/// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
(active, lint_reasons, "1.31.0", Some(54503), None),

View File

@ -148,6 +148,10 @@ declare_features! (
(removed, const_raw_ptr_to_usize_cast, "1.55.0", Some(51910), None,
Some("at compile-time, pointers do not have an integer value, so these casts cannot be properly supported")),
/// Allows `impl Trait` in bindings (`let`, `const`, `static`).
(removed, impl_trait_in_bindings, "1.55.0", Some(63065), None,
Some("the implementation was not maintainable, the feature may get reintroduced once the current refactorings are done")),
// -------------------------------------------------------------------------
// feature-group-end: removed features
// -------------------------------------------------------------------------

View File

@ -2264,18 +2264,14 @@ pub struct OpaqueTy<'hir> {
}
/// From whence the opaque type came.
#[derive(Copy, Clone, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
pub enum OpaqueTyOrigin {
/// `-> impl Trait`
FnReturn,
/// `async fn`
AsyncFn,
/// `let _: impl Trait = ...`
Binding,
/// type aliases: `type Foo = impl Trait;`
TyAlias,
/// Impl trait consts, statics, bounds.
Misc,
}
/// The various kinds of types recognized by the compiler.

View File

@ -491,11 +491,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
span
};
let is_named_and_not_impl_trait = |ty: Ty<'_>| {
&ty.to_string() != "_" &&
// FIXME: Remove this check after `impl_trait_in_bindings` is stabilized. #63527
(!ty.is_impl_trait() || self.tcx.features().impl_trait_in_bindings)
};
let is_named_and_not_impl_trait =
|ty: Ty<'_>| &ty.to_string() != "_" && !ty.is_impl_trait();
let ty_msg = match (local_visitor.found_node_ty, local_visitor.found_exact_method_call) {
(_, Some(_)) => String::new(),

View File

@ -1,5 +1,4 @@
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::DefId;
use rustc_index::vec::IndexVec;
use rustc_middle::infer::MemberConstraint;
use rustc_middle::ty::{self, Ty};
@ -32,9 +31,6 @@ where
crate struct NllMemberConstraint<'tcx> {
next_constraint: Option<NllMemberConstraintIndex>,
/// The opaque type whose hidden type is being inferred. (Used in error reporting.)
crate opaque_type_def_id: DefId,
/// The span where the hidden type was instantiated.
crate definition_span: Span,
@ -91,7 +87,6 @@ impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> {
let constraint_index = self.constraints.push(NllMemberConstraint {
next_constraint,
member_region_vid,
opaque_type_def_id: m_c.opaque_type_def_id,
definition_span: m_c.definition_span,
hidden_ty: m_c.hidden_ty,
start_index,

View File

@ -551,7 +551,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
polonius_output: Option<Rc<PoloniusOutput>>,
) -> (Option<ClosureRegionRequirements<'tcx>>, RegionErrors<'tcx>) {
let mir_def_id = body.source.def_id();
self.propagate_constraints(body, infcx.tcx);
self.propagate_constraints(body);
let mut errors_buffer = RegionErrors::new();
@ -599,7 +599,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
/// for each region variable until all the constraints are
/// satisfied. Note that some values may grow **too** large to be
/// feasible, but we check this later.
fn propagate_constraints(&mut self, _body: &Body<'tcx>, tcx: TyCtxt<'tcx>) {
fn propagate_constraints(&mut self, _body: &Body<'tcx>) {
debug!("propagate_constraints()");
debug!("propagate_constraints: constraints={:#?}", {
@ -617,7 +617,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
// own.
let constraint_sccs = self.constraint_sccs.clone();
for scc in constraint_sccs.all_sccs() {
self.compute_value_for_scc(scc, tcx);
self.compute_value_for_scc(scc);
}
// Sort the applied member constraints so we can binary search
@ -629,7 +629,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
/// computed, by unioning the values of its successors.
/// Assumes that all successors have been computed already
/// (which is assured by iterating over SCCs in dependency order).
fn compute_value_for_scc(&mut self, scc_a: ConstraintSccIndex, tcx: TyCtxt<'tcx>) {
fn compute_value_for_scc(&mut self, scc_a: ConstraintSccIndex) {
let constraint_sccs = self.constraint_sccs.clone();
// Walk each SCC `B` such that `A: B`...
@ -652,12 +652,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
// Now take member constraints into account.
let member_constraints = self.member_constraints.clone();
for m_c_i in member_constraints.indices(scc_a) {
self.apply_member_constraint(
tcx,
scc_a,
m_c_i,
member_constraints.choice_regions(m_c_i),
);
self.apply_member_constraint(scc_a, m_c_i, member_constraints.choice_regions(m_c_i));
}
debug!(
@ -680,31 +675,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
/// If we make any changes, returns true, else false.
fn apply_member_constraint(
&mut self,
tcx: TyCtxt<'tcx>,
scc: ConstraintSccIndex,
member_constraint_index: NllMemberConstraintIndex,
choice_regions: &[ty::RegionVid],
) -> bool {
debug!("apply_member_constraint(scc={:?}, choice_regions={:#?})", scc, choice_regions,);
if let Some(uh_oh) =
choice_regions.iter().find(|&&r| !self.universal_regions.is_universal_region(r))
{
// FIXME(#61773): This case can only occur with
// `impl_trait_in_bindings`, I believe, and we are just
// opting not to handle it for now. See #61773 for
// details.
tcx.sess.delay_span_bug(
self.member_constraints[member_constraint_index].definition_span,
&format!(
"member constraint for `{:?}` has an option region `{:?}` \
that is not a universal region",
self.member_constraints[member_constraint_index].opaque_type_def_id, uh_oh,
),
);
return false;
}
// Create a mutable vector of the options. We'll try to winnow
// them down.
let mut choice_regions: Vec<ty::RegionVid> = choice_regions.to_vec();

View File

@ -122,7 +122,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if let Err(terr) = self.eq_opaque_type_and_type(
mir_output_ty,
normalized_output_ty,
mir_def_id,
Locations::All(output_span),
ConstraintCategory::BoringNoLocation,
) {
@ -145,7 +144,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if let Err(err) = self.eq_opaque_type_and_type(
mir_output_ty,
user_provided_output_ty,
mir_def_id,
Locations::All(output_span),
ConstraintCategory::BoringNoLocation,
) {

View File

@ -1119,6 +1119,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
)
}
/// Try to relate `sub <: sup`
fn sub_types(
&mut self,
sub: Ty<'tcx>,
@ -1129,32 +1130,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
self.relate_types(sub, ty::Variance::Covariant, sup, locations, category)
}
/// Try to relate `sub <: sup`; if this fails, instantiate opaque
/// variables in `sub` with their inferred definitions and try
/// again. This is used for opaque types in places (e.g., `let x:
/// impl Foo = ..`).
fn sub_types_or_anon(
&mut self,
sub: Ty<'tcx>,
sup: Ty<'tcx>,
locations: Locations,
category: ConstraintCategory,
) -> Fallible<()> {
if let Err(terr) = self.sub_types(sub, sup, locations, category) {
if let ty::Opaque(..) = sup.kind() {
// When you have `let x: impl Foo = ...` in a closure,
// the resulting inferend values are stored with the
// def-id of the base function.
let parent_def_id =
self.tcx().closure_base_def_id(self.body.source.def_id()).expect_local();
return self.eq_opaque_type_and_type(sub, sup, parent_def_id, locations, category);
} else {
return Err(terr);
}
}
Ok(())
}
fn eq_types(
&mut self,
a: Ty<'tcx>,
@ -1207,7 +1182,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
}
/// Equates a type `anon_ty` that may contain opaque types whose
/// values are to be inferred by the MIR with def-id `anon_owner_def_id`.
/// values are to be inferred by the MIR.
///
/// The type `revealed_ty` contains the same type as `anon_ty`, but with the
/// hidden types for impl traits revealed.
@ -1235,12 +1210,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
/// generics of `foo`). Note that `anon_ty` is not just the opaque type,
/// but the entire return type (which may contain opaque types within it).
/// * `revealed_ty` would be `Box<(T, u32)>`
/// * `anon_owner_def_id` would be the def-id of `foo`
fn eq_opaque_type_and_type(
&mut self,
revealed_ty: Ty<'tcx>,
anon_ty: Ty<'tcx>,
anon_owner_def_id: LocalDefId,
locations: Locations,
category: ConstraintCategory,
) -> Fallible<()> {
@ -1270,12 +1243,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
let tcx = infcx.tcx;
let param_env = self.param_env;
let body = self.body;
let mir_def_id = body.source.def_id().expect_local();
// the "concrete opaque types" maps
let concrete_opaque_types = &tcx.typeck(anon_owner_def_id).concrete_opaque_types;
let concrete_opaque_types = &tcx.typeck(mir_def_id).concrete_opaque_types;
let mut opaque_type_values = VecMap::new();
debug!("eq_opaque_type_and_type: mir_def_id={:?}", body.source.def_id());
debug!("eq_opaque_type_and_type: mir_def_id={:?}", mir_def_id);
let opaque_type_map = self.fully_perform_op(
locations,
category,
@ -1293,7 +1267,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
// any generic parameters.)
let (output_ty, opaque_type_map) =
obligations.add(infcx.instantiate_opaque_types(
anon_owner_def_id,
mir_def_id,
dummy_body_id,
param_env,
anon_ty,
@ -1489,7 +1463,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
let rv_ty = rv.ty(body, tcx);
let rv_ty = self.normalize(rv_ty, location);
if let Err(terr) =
self.sub_types_or_anon(rv_ty, place_ty, location.to_locations(), category)
self.sub_types(rv_ty, place_ty, location.to_locations(), category)
{
span_mirbug!(
self,
@ -1776,9 +1750,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
let locations = term_location.to_locations();
if let Err(terr) =
self.sub_types_or_anon(sig.output(), dest_ty, locations, category)
{
if let Err(terr) = self.sub_types(sig.output(), dest_ty, locations, category) {
span_mirbug!(
self,
term,

View File

@ -133,9 +133,6 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
traits::NonStructuralMatchTy::Generator => {
"generators cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Closure => {
"closures cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Param => {
bug!("use of a constant whose type is a parameter inside a pattern")
}

View File

@ -402,9 +402,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
// These opaque type inherit all lifetime parameters from their
// parent, so we have to check them all.
hir::OpaqueTyOrigin::Binding
| hir::OpaqueTyOrigin::TyAlias
| hir::OpaqueTyOrigin::Misc => 0,
hir::OpaqueTyOrigin::TyAlias => 0,
};
let span = tcx.def_span(def_id);
@ -996,7 +994,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
may_define_opaque_type(tcx, self.parent_def_id, opaque_hir_id),
origin,
),
_ => (def_scope_default(), hir::OpaqueTyOrigin::Misc),
_ => (def_scope_default(), hir::OpaqueTyOrigin::TyAlias),
};
if in_definition_scope {
let opaque_type_key =

View File

@ -19,7 +19,6 @@ pub enum NonStructuralMatchTy<'tcx> {
Opaque,
Generator,
Projection,
Closure,
}
/// This method traverses the structure of `ty`, trying to find an
@ -155,9 +154,6 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
ty::Generator(..) | ty::GeneratorWitness(..) => {
return ControlFlow::Break(NonStructuralMatchTy::Generator);
}
ty::Closure(..) => {
return ControlFlow::Break(NonStructuralMatchTy::Closure);
}
ty::RawPtr(..) => {
// structural-match ignores substructure of
// `*const _`/`*mut _`, so skip `super_visit_with`.
@ -198,7 +194,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
// First check all contained types and then tell the caller to continue searching.
return ty.super_visit_with(self);
}
ty::Infer(_) | ty::Placeholder(_) | ty::Bound(..) => {
ty::Closure(..) | ty::Infer(_) | ty::Placeholder(_) | ty::Bound(..) => {
bug!("unexpected type during structural-match checking: {:?}", ty);
}
ty::Error(_) => {

View File

@ -221,9 +221,7 @@ pub(super) fn check_fn<'a, 'tcx>(
fcx.resume_yield_tys = Some((resume_ty, yield_ty));
}
let outer_def_id = tcx.closure_base_def_id(hir.local_def_id(fn_id).to_def_id()).expect_local();
let outer_hir_id = hir.local_def_id_to_hir_id(outer_def_id);
GatherLocalsVisitor::new(&fcx, outer_hir_id).visit_body(body);
GatherLocalsVisitor::new(&fcx).visit_body(body);
// C-variadic fns also have a `VaList` input that's not listed in `fn_sig`
// (as it's created inside the body itself, not passed in from outside).
@ -665,13 +663,9 @@ pub(super) fn check_opaque_for_cycles<'tcx>(
span: Span,
origin: &hir::OpaqueTyOrigin,
) -> Result<(), ErrorReported> {
if let Err(partially_expanded_type) = tcx.try_expand_impl_trait_type(def_id.to_def_id(), substs)
{
if tcx.try_expand_impl_trait_type(def_id.to_def_id(), substs).is_err() {
match origin {
hir::OpaqueTyOrigin::AsyncFn => async_opaque_type_cycle_error(tcx, span),
hir::OpaqueTyOrigin::Binding => {
binding_opaque_type_cycle_error(tcx, def_id, span, partially_expanded_type)
}
_ => opaque_type_cycle_error(tcx, def_id, span),
}
Err(ErrorReported)
@ -704,8 +698,7 @@ fn check_opaque_meets_bounds<'tcx>(
// Checked when type checking the function containing them.
hir::OpaqueTyOrigin::FnReturn | hir::OpaqueTyOrigin::AsyncFn => return,
// Can have different predicates to their defining use
hir::OpaqueTyOrigin::Binding | hir::OpaqueTyOrigin::Misc | hir::OpaqueTyOrigin::TyAlias => {
}
hir::OpaqueTyOrigin::TyAlias => {}
}
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);

View File

@ -4,12 +4,11 @@ use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::PatKind;
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_middle::ty::Ty;
use rustc_span::{sym, Span};
use rustc_span::Span;
use rustc_trait_selection::traits;
pub(super) struct GatherLocalsVisitor<'a, 'tcx> {
fcx: &'a FnCtxt<'a, 'tcx>,
parent_id: hir::HirId,
// parameters are special cases of patterns, but we want to handle them as
// *distinct* cases. so track when we are hitting a pattern *within* an fn
// parameter.
@ -17,8 +16,8 @@ pub(super) struct GatherLocalsVisitor<'a, 'tcx> {
}
impl<'a, 'tcx> GatherLocalsVisitor<'a, 'tcx> {
pub(super) fn new(fcx: &'a FnCtxt<'a, 'tcx>, parent_id: hir::HirId) -> Self {
Self { fcx, parent_id, outermost_fn_param_pat: None }
pub(super) fn new(fcx: &'a FnCtxt<'a, 'tcx>) -> Self {
Self { fcx, outermost_fn_param_pat: None }
}
fn assign(&mut self, span: Span, nid: hir::HirId, ty_opt: Option<LocalTy<'tcx>>) -> Ty<'tcx> {
@ -57,26 +56,15 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
Some(ref ty) => {
let o_ty = self.fcx.to_ty(&ty);
let revealed_ty = self.fcx.instantiate_opaque_types_from_value(
self.parent_id,
o_ty,
ty.span,
Some(sym::impl_trait_in_bindings),
);
let c_ty =
self.fcx.inh.infcx.canonicalize_user_type_annotation(UserType::Ty(revealed_ty));
debug!(
"visit_local: ty.hir_id={:?} o_ty={:?} revealed_ty={:?} c_ty={:?}",
ty.hir_id, o_ty, revealed_ty, c_ty
);
let c_ty = self.fcx.inh.infcx.canonicalize_user_type_annotation(UserType::Ty(o_ty));
debug!("visit_local: ty.hir_id={:?} o_ty={:?} c_ty={:?}", ty.hir_id, o_ty, c_ty);
self.fcx
.typeck_results
.borrow_mut()
.user_provided_types_mut()
.insert(ty.hir_id, c_ty);
Some(LocalTy { decl_ty: o_ty, revealed_ty })
Some(LocalTy { decl_ty: o_ty, revealed_ty: o_ty })
}
None => None,
};

View File

@ -118,9 +118,9 @@ use rustc_middle::ty::{self, Ty, TyCtxt, UserType};
use rustc_session::config;
use rustc_session::parse::feature_err;
use rustc_session::Session;
use rustc_span::source_map::DUMMY_SP;
use rustc_span::symbol::{kw, Ident};
use rustc_span::{self, BytePos, MultiSpan, Span};
use rustc_span::{source_map::DUMMY_SP, sym};
use rustc_target::abi::VariantIdx;
use rustc_target::spec::abi::Abi;
use rustc_trait_selection::traits;
@ -441,19 +441,12 @@ fn typeck_with_fallback<'tcx>(
let expected_type = fcx.normalize_associated_types_in(body.value.span, expected_type);
fcx.require_type_is_sized(expected_type, body.value.span, traits::ConstSized);
let revealed_ty = fcx.instantiate_opaque_types_from_value(
id,
expected_type,
body.value.span,
Some(sym::impl_trait_in_bindings),
);
// Gather locals in statics (because of block expressions).
GatherLocalsVisitor::new(&fcx, id).visit_body(body);
GatherLocalsVisitor::new(&fcx).visit_body(body);
fcx.check_expr_coercable_to_type(&body.value, revealed_ty, None);
fcx.check_expr_coercable_to_type(&body.value, expected_type, None);
fcx.write_ty(id, revealed_ty);
fcx.write_ty(id, expected_type);
fcx
};
@ -573,66 +566,6 @@ fn get_owner_return_paths(
})
}
/// Emit an error for recursive opaque types in a `let` binding.
fn binding_opaque_type_cycle_error(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
span: Span,
partially_expanded_type: Ty<'tcx>,
) {
let mut err = struct_span_err!(tcx.sess, span, E0720, "cannot resolve opaque type");
err.span_label(span, "cannot resolve opaque type");
// Find the owner that declared this `impl Trait` type.
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
let mut prev_hir_id = hir_id;
let mut hir_id = tcx.hir().get_parent_node(hir_id);
while let Some(node) = tcx.hir().find(hir_id) {
match node {
hir::Node::Local(hir::Local {
pat,
init: None,
ty: Some(ty),
source: hir::LocalSource::Normal,
..
}) => {
err.span_label(pat.span, "this binding might not have a concrete type");
err.span_suggestion_verbose(
ty.span.shrink_to_hi(),
"set the binding to a value for a concrete type to be resolved",
" = /* value */".to_string(),
Applicability::HasPlaceholders,
);
}
hir::Node::Local(hir::Local {
init: Some(expr),
source: hir::LocalSource::Normal,
..
}) => {
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
let typeck_results =
tcx.typeck(tcx.hir().local_def_id(tcx.hir().get_parent_item(hir_id)));
if let Some(ty) = typeck_results.node_type_opt(expr.hir_id) {
err.span_label(
expr.span,
&format!(
"this is of type `{}`, which doesn't constrain \
`{}` enough to arrive to a concrete type",
ty, partially_expanded_type
),
);
}
}
_ => {}
}
if prev_hir_id == hir_id {
break;
}
prev_hir_id = hir_id;
hir_id = tcx.hir().get_parent_node(hir_id);
}
err.emit();
}
// Forbid defining intrinsics in Rust code,
// as they must always be defined by the compiler.
fn fn_maybe_err(tcx: TyCtxt<'_>, sp: Span, abi: Abi) {

View File

@ -521,8 +521,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
let mut skip_add = false;
if let ty::Opaque(definition_ty_def_id, _substs) = *definition_ty.kind() {
if let hir::OpaqueTyOrigin::Misc | hir::OpaqueTyOrigin::TyAlias = opaque_defn.origin
{
if opaque_defn.origin == hir::OpaqueTyOrigin::TyAlias {
if opaque_type_key.def_id == definition_ty_def_id {
debug!(
"skipping adding concrete definition for opaque type {:?} {:?}",

View File

@ -356,9 +356,6 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
let substs = InternalSubsts::identity_for_item(tcx, def_id.to_def_id());
tcx.mk_adt(def, substs)
}
ItemKind::OpaqueTy(OpaqueTy { origin: hir::OpaqueTyOrigin::Binding, .. }) => {
let_position_impl_trait_type(tcx, def_id)
}
ItemKind::OpaqueTy(OpaqueTy { impl_trait_fn: None, .. }) => {
find_opaque_ty_constraints(tcx, def_id)
}
@ -696,60 +693,6 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
}
}
/// Retrieve the inferred concrete type for let position impl trait.
///
/// This is different to other kinds of impl trait because:
///
/// 1. We know which function contains the defining use (the function that
/// contains the let statement)
/// 2. We do not currently allow (free) lifetimes in the return type. `let`
/// statements in some statically unreachable code are removed from the MIR
/// by the time we borrow check, and it's not clear how we should handle
/// those.
fn let_position_impl_trait_type(tcx: TyCtxt<'_>, opaque_ty_id: LocalDefId) -> Ty<'_> {
let scope = tcx.hir().get_defining_scope(tcx.hir().local_def_id_to_hir_id(opaque_ty_id));
let scope_def_id = tcx.hir().local_def_id(scope);
let opaque_ty_def_id = opaque_ty_id.to_def_id();
let owner_typeck_results = tcx.typeck(scope_def_id);
let concrete_ty = owner_typeck_results
.concrete_opaque_types
.get_by(|(key, _)| key.def_id == opaque_ty_def_id)
.map(|concrete_ty| *concrete_ty)
.unwrap_or_else(|| {
tcx.sess.delay_span_bug(
DUMMY_SP,
&format!(
"owner {:?} has no opaque type for {:?} in its typeck results",
scope_def_id, opaque_ty_id
),
);
if let Some(ErrorReported) = owner_typeck_results.tainted_by_errors {
// Some error in the owner fn prevented us from populating the
// `concrete_opaque_types` table.
tcx.ty_error()
} else {
// We failed to resolve the opaque type or it resolves to
// itself. Return the non-revealed type, which should result in
// E0720.
tcx.mk_opaque(
opaque_ty_def_id,
InternalSubsts::identity_for_item(tcx, opaque_ty_def_id),
)
}
});
debug!("concrete_ty = {:?}", concrete_ty);
if concrete_ty.has_erased_regions() {
// FIXME(impl_trait_in_bindings) Handle this case.
tcx.sess.span_fatal(
tcx.hir().span(tcx.hir().local_def_id_to_hir_id(opaque_ty_id)),
"lifetimes in impl Trait types in bindings are not currently supported",
);
}
concrete_ty
}
fn infer_placeholder_type<'a>(
tcx: TyCtxt<'a>,
def_id: LocalDefId,

View File

@ -1,28 +0,0 @@
# `impl_trait_in_bindings`
The tracking issue for this feature is: [#63065]
[#63065]: https://github.com/rust-lang/rust/issues/63065
------------------------
The `impl_trait_in_bindings` feature gate lets you use `impl Trait` syntax in
`let`, `static`, and `const` bindings.
A simple example is:
```rust
#![feature(impl_trait_in_bindings)]
use std::fmt::Debug;
fn main() {
let a: impl Debug + Clone = 42;
let b = a.clone();
println!("{:?}", b); // prints `42`
}
```
Note however that because the types of `a` and `b` are opaque in the above
example, calling inherent methods or methods outside of the specified traits
(e.g., `a.abs()` or `b.abs()`) is not allowed, and yields an error.

View File

@ -7,16 +7,8 @@ LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/duplicate.rs:6:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:11:36
--> $DIR/duplicate.rs:10:36
|
LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -24,7 +16,7 @@ LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:13:36
--> $DIR/duplicate.rs:12:36
|
LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -32,7 +24,7 @@ LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:15:39
--> $DIR/duplicate.rs:14:39
|
LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -40,7 +32,7 @@ LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:17:45
--> $DIR/duplicate.rs:16:45
|
LL | struct SW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -48,7 +40,7 @@ LL | struct SW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:19:45
--> $DIR/duplicate.rs:18:45
|
LL | struct SW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -56,7 +48,7 @@ LL | struct SW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:21:48
--> $DIR/duplicate.rs:20:48
|
LL | struct SW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -64,7 +56,7 @@ LL | struct SW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:24:34
--> $DIR/duplicate.rs:23:34
|
LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -72,7 +64,7 @@ LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:26:34
--> $DIR/duplicate.rs:25:34
|
LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -80,7 +72,7 @@ LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:28:37
--> $DIR/duplicate.rs:27:37
|
LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> { V(T) }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -88,7 +80,7 @@ LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:30:43
--> $DIR/duplicate.rs:29:43
|
LL | enum EW1<T> where T: Iterator<Item: Copy, Item: Send> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -96,7 +88,7 @@ LL | enum EW1<T> where T: Iterator<Item: Copy, Item: Send> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:32:43
--> $DIR/duplicate.rs:31:43
|
LL | enum EW2<T> where T: Iterator<Item: Copy, Item: Copy> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -104,7 +96,7 @@ LL | enum EW2<T> where T: Iterator<Item: Copy, Item: Copy> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:34:46
--> $DIR/duplicate.rs:33:46
|
LL | enum EW3<T> where T: Iterator<Item: 'static, Item: 'static> { V(T) }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -112,7 +104,7 @@ LL | enum EW3<T> where T: Iterator<Item: 'static, Item: 'static> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:37:35
--> $DIR/duplicate.rs:36:35
|
LL | union UI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -120,7 +112,7 @@ LL | union UI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:39:35
--> $DIR/duplicate.rs:38:35
|
LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -128,7 +120,7 @@ LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:41:38
--> $DIR/duplicate.rs:40:38
|
LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -136,7 +128,7 @@ LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:43:44
--> $DIR/duplicate.rs:42:44
|
LL | union UW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -144,7 +136,7 @@ LL | union UW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:45:44
--> $DIR/duplicate.rs:44:44
|
LL | union UW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -152,7 +144,7 @@ LL | union UW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:47:47
--> $DIR/duplicate.rs:46:47
|
LL | union UW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -160,7 +152,7 @@ LL | union UW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:50:32
--> $DIR/duplicate.rs:49:32
|
LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| ---------- ^^^^^^^^^^ re-bound here
@ -168,7 +160,7 @@ LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:52:32
--> $DIR/duplicate.rs:51:32
|
LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| ---------- ^^^^^^^^^^ re-bound here
@ -176,7 +168,7 @@ LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:54:35
--> $DIR/duplicate.rs:53:35
|
LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -184,7 +176,7 @@ LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:56:43
--> $DIR/duplicate.rs:55:43
|
LL | fn FW1<T>() where T: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -192,7 +184,7 @@ LL | fn FW1<T>() where T: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:58:43
--> $DIR/duplicate.rs:57:43
|
LL | fn FW2<T>() where T: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -200,7 +192,7 @@ LL | fn FW2<T>() where T: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:60:46
--> $DIR/duplicate.rs:59:46
|
LL | fn FW3<T>() where T: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -208,7 +200,7 @@ LL | fn FW3<T>() where T: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:66:40
--> $DIR/duplicate.rs:65:40
|
LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -216,7 +208,7 @@ LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:68:40
--> $DIR/duplicate.rs:67:40
|
LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -224,7 +216,7 @@ LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:70:43
--> $DIR/duplicate.rs:69:43
|
LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -232,79 +224,7 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:73:39
|
LL | const CIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:75:39
|
LL | const CIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:77:42
|
LL | const CIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:79:40
|
LL | static SIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:81:40
|
LL | static SIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:83:43
|
LL | static SIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:86:46
|
LL | fn lit1() { let _: impl Iterator<Item: Copy, Item: Send> = iter::empty(); }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:88:46
|
LL | fn lit2() { let _: impl Iterator<Item: Copy, Item: Copy> = iter::empty(); }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:90:49
|
LL | fn lit3() { let _: impl Iterator<Item: 'static, Item: 'static> = iter::empty(); }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:93:35
--> $DIR/duplicate.rs:72:35
|
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -312,7 +232,7 @@ LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:95:35
--> $DIR/duplicate.rs:74:35
|
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -320,7 +240,7 @@ LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:97:38
--> $DIR/duplicate.rs:76:38
|
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -328,7 +248,7 @@ LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:99:44
--> $DIR/duplicate.rs:78:44
|
LL | type TAW1<T> where T: Iterator<Item: Copy, Item: Send> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -336,7 +256,7 @@ LL | type TAW1<T> where T: Iterator<Item: Copy, Item: Send> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:101:44
--> $DIR/duplicate.rs:80:44
|
LL | type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -344,7 +264,7 @@ LL | type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:103:47
--> $DIR/duplicate.rs:82:47
|
LL | type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -352,7 +272,7 @@ LL | type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:106:36
--> $DIR/duplicate.rs:85:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -360,7 +280,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:108:36
--> $DIR/duplicate.rs:87:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -368,7 +288,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:110:39
--> $DIR/duplicate.rs:89:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -376,7 +296,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:112:40
--> $DIR/duplicate.rs:91:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -384,7 +304,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:114:40
--> $DIR/duplicate.rs:93:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -392,7 +312,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:116:43
--> $DIR/duplicate.rs:95:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -400,7 +320,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:119:36
--> $DIR/duplicate.rs:98:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -408,7 +328,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:121:36
--> $DIR/duplicate.rs:100:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -416,7 +336,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:123:39
--> $DIR/duplicate.rs:102:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -424,7 +344,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:125:34
--> $DIR/duplicate.rs:104:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -432,7 +352,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:127:34
--> $DIR/duplicate.rs:106:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -440,7 +360,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:129:37
--> $DIR/duplicate.rs:108:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -448,7 +368,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:131:45
--> $DIR/duplicate.rs:110:45
|
LL | trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -456,7 +376,7 @@ LL | trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:133:45
--> $DIR/duplicate.rs:112:45
|
LL | trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -464,7 +384,7 @@ LL | trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:135:48
--> $DIR/duplicate.rs:114:48
|
LL | trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -472,7 +392,7 @@ LL | trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:137:46
--> $DIR/duplicate.rs:116:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -480,7 +400,7 @@ LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:137:46
--> $DIR/duplicate.rs:116:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -488,7 +408,7 @@ LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:140:46
--> $DIR/duplicate.rs:119:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -496,7 +416,7 @@ LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:140:46
--> $DIR/duplicate.rs:119:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -504,7 +424,7 @@ LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:143:49
--> $DIR/duplicate.rs:122:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -512,7 +432,7 @@ LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:143:49
--> $DIR/duplicate.rs:122:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -520,7 +440,7 @@ LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:153:40
--> $DIR/duplicate.rs:132:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -528,7 +448,7 @@ LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:155:44
--> $DIR/duplicate.rs:134:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ---------- ^^^^^^^^^^ re-bound here
@ -536,7 +456,7 @@ LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:157:43
--> $DIR/duplicate.rs:136:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -544,7 +464,7 @@ LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:146:43
--> $DIR/duplicate.rs:125:43
|
LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| ---------- ^^^^^^^^^^ re-bound here
@ -552,7 +472,7 @@ LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:148:43
--> $DIR/duplicate.rs:127:43
|
LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| ---------- ^^^^^^^^^^ re-bound here
@ -560,13 +480,13 @@ LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:150:46
--> $DIR/duplicate.rs:129:46
|
LL | trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 69 previous errors; 2 warnings emitted
error: aborting due to 60 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0719`.

View File

@ -1,14 +1,5 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/duplicate.rs:6:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:11:36
--> $DIR/duplicate.rs:10:36
|
LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -16,7 +7,7 @@ LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:13:36
--> $DIR/duplicate.rs:12:36
|
LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -24,7 +15,7 @@ LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:15:39
--> $DIR/duplicate.rs:14:39
|
LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -32,7 +23,7 @@ LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:17:45
--> $DIR/duplicate.rs:16:45
|
LL | struct SW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -40,7 +31,7 @@ LL | struct SW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:19:45
--> $DIR/duplicate.rs:18:45
|
LL | struct SW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -48,7 +39,7 @@ LL | struct SW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:21:48
--> $DIR/duplicate.rs:20:48
|
LL | struct SW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -56,7 +47,7 @@ LL | struct SW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:24:34
--> $DIR/duplicate.rs:23:34
|
LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -64,7 +55,7 @@ LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:26:34
--> $DIR/duplicate.rs:25:34
|
LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -72,7 +63,7 @@ LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:28:37
--> $DIR/duplicate.rs:27:37
|
LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> { V(T) }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -80,7 +71,7 @@ LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:30:43
--> $DIR/duplicate.rs:29:43
|
LL | enum EW1<T> where T: Iterator<Item: Copy, Item: Send> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -88,7 +79,7 @@ LL | enum EW1<T> where T: Iterator<Item: Copy, Item: Send> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:32:43
--> $DIR/duplicate.rs:31:43
|
LL | enum EW2<T> where T: Iterator<Item: Copy, Item: Copy> { V(T) }
| ---------- ^^^^^^^^^^ re-bound here
@ -96,7 +87,7 @@ LL | enum EW2<T> where T: Iterator<Item: Copy, Item: Copy> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:34:46
--> $DIR/duplicate.rs:33:46
|
LL | enum EW3<T> where T: Iterator<Item: 'static, Item: 'static> { V(T) }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -104,7 +95,7 @@ LL | enum EW3<T> where T: Iterator<Item: 'static, Item: 'static> { V(T) }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:37:35
--> $DIR/duplicate.rs:36:35
|
LL | union UI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -112,7 +103,7 @@ LL | union UI1<T: Iterator<Item: Copy, Item: Send>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:39:35
--> $DIR/duplicate.rs:38:35
|
LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -120,7 +111,7 @@ LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:41:38
--> $DIR/duplicate.rs:40:38
|
LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -128,7 +119,7 @@ LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:43:44
--> $DIR/duplicate.rs:42:44
|
LL | union UW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -136,7 +127,7 @@ LL | union UW1<T> where T: Iterator<Item: Copy, Item: Send> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:45:44
--> $DIR/duplicate.rs:44:44
|
LL | union UW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| ---------- ^^^^^^^^^^ re-bound here
@ -144,7 +135,7 @@ LL | union UW2<T> where T: Iterator<Item: Copy, Item: Copy> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:47:47
--> $DIR/duplicate.rs:46:47
|
LL | union UW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -152,7 +143,7 @@ LL | union UW3<T> where T: Iterator<Item: 'static, Item: 'static> { f: T }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:50:32
--> $DIR/duplicate.rs:49:32
|
LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| ---------- ^^^^^^^^^^ re-bound here
@ -160,7 +151,7 @@ LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:52:32
--> $DIR/duplicate.rs:51:32
|
LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| ---------- ^^^^^^^^^^ re-bound here
@ -168,7 +159,7 @@ LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:54:35
--> $DIR/duplicate.rs:53:35
|
LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -176,7 +167,7 @@ LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:56:43
--> $DIR/duplicate.rs:55:43
|
LL | fn FW1<T>() where T: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -184,7 +175,7 @@ LL | fn FW1<T>() where T: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:58:43
--> $DIR/duplicate.rs:57:43
|
LL | fn FW2<T>() where T: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -192,7 +183,7 @@ LL | fn FW2<T>() where T: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:60:46
--> $DIR/duplicate.rs:59:46
|
LL | fn FW3<T>() where T: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -200,7 +191,7 @@ LL | fn FW3<T>() where T: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:66:40
--> $DIR/duplicate.rs:65:40
|
LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -208,7 +199,7 @@ LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:68:40
--> $DIR/duplicate.rs:67:40
|
LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -216,7 +207,7 @@ LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:70:43
--> $DIR/duplicate.rs:69:43
|
LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -224,79 +215,7 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:73:39
|
LL | const CIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:75:39
|
LL | const CIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:77:42
|
LL | const CIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:79:40
|
LL | static SIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:81:40
|
LL | static SIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:83:43
|
LL | static SIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:86:46
|
LL | fn lit1() { let _: impl Iterator<Item: Copy, Item: Send> = iter::empty(); }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:88:46
|
LL | fn lit2() { let _: impl Iterator<Item: Copy, Item: Copy> = iter::empty(); }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:90:49
|
LL | fn lit3() { let _: impl Iterator<Item: 'static, Item: 'static> = iter::empty(); }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:93:35
--> $DIR/duplicate.rs:72:35
|
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -304,7 +223,7 @@ LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:95:35
--> $DIR/duplicate.rs:74:35
|
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -312,7 +231,7 @@ LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:97:38
--> $DIR/duplicate.rs:76:38
|
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -320,7 +239,7 @@ LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:99:44
--> $DIR/duplicate.rs:78:44
|
LL | type TAW1<T> where T: Iterator<Item: Copy, Item: Send> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -328,7 +247,7 @@ LL | type TAW1<T> where T: Iterator<Item: Copy, Item: Send> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:101:44
--> $DIR/duplicate.rs:80:44
|
LL | type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -336,7 +255,7 @@ LL | type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:103:47
--> $DIR/duplicate.rs:82:47
|
LL | type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -344,7 +263,7 @@ LL | type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:106:36
--> $DIR/duplicate.rs:85:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -352,7 +271,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:108:36
--> $DIR/duplicate.rs:87:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -360,7 +279,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:110:39
--> $DIR/duplicate.rs:89:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -368,7 +287,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:112:40
--> $DIR/duplicate.rs:91:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -376,7 +295,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:114:40
--> $DIR/duplicate.rs:93:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -384,7 +303,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:116:43
--> $DIR/duplicate.rs:95:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -392,7 +311,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:119:36
--> $DIR/duplicate.rs:98:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -400,7 +319,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:121:36
--> $DIR/duplicate.rs:100:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -408,7 +327,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:123:39
--> $DIR/duplicate.rs:102:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -416,7 +335,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:125:34
--> $DIR/duplicate.rs:104:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -424,7 +343,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:127:34
--> $DIR/duplicate.rs:106:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -432,7 +351,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:129:37
--> $DIR/duplicate.rs:108:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -440,7 +359,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:131:45
--> $DIR/duplicate.rs:110:45
|
LL | trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -448,7 +367,7 @@ LL | trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:133:45
--> $DIR/duplicate.rs:112:45
|
LL | trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -456,7 +375,7 @@ LL | trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:135:48
--> $DIR/duplicate.rs:114:48
|
LL | trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -464,7 +383,7 @@ LL | trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:137:46
--> $DIR/duplicate.rs:116:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -472,7 +391,7 @@ LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:137:46
--> $DIR/duplicate.rs:116:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -480,7 +399,7 @@ LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:140:46
--> $DIR/duplicate.rs:119:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -488,7 +407,7 @@ LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:140:46
--> $DIR/duplicate.rs:119:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -496,7 +415,7 @@ LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:143:49
--> $DIR/duplicate.rs:122:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -504,7 +423,7 @@ LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:143:49
--> $DIR/duplicate.rs:122:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -512,7 +431,7 @@ LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:153:40
--> $DIR/duplicate.rs:132:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -520,7 +439,7 @@ LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:155:44
--> $DIR/duplicate.rs:134:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ---------- ^^^^^^^^^^ re-bound here
@ -528,7 +447,7 @@ LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:157:43
--> $DIR/duplicate.rs:136:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -536,7 +455,7 @@ LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:146:43
--> $DIR/duplicate.rs:125:43
|
LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| ---------- ^^^^^^^^^^ re-bound here
@ -544,7 +463,7 @@ LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:148:43
--> $DIR/duplicate.rs:127:43
|
LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| ---------- ^^^^^^^^^^ re-bound here
@ -552,13 +471,13 @@ LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:150:46
--> $DIR/duplicate.rs:129:46
|
LL | trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 69 previous errors; 1 warning emitted
error: aborting due to 60 previous errors
For more information about this error, try `rustc --explain E0719`.

View File

@ -3,7 +3,6 @@
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
#![feature(impl_trait_in_bindings)] //~ WARN the feature `impl_trait_in_bindings` is incomplete
#![feature(untagged_unions)]
use std::iter;
@ -70,26 +69,6 @@ fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
const CIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
const CIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
const CIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
static SIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
static SIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
static SIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
fn lit1() { let _: impl Iterator<Item: Copy, Item: Send> = iter::empty(); }
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
fn lit2() { let _: impl Iterator<Item: Copy, Item: Copy> = iter::empty(); }
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
fn lit3() { let _: impl Iterator<Item: 'static, Item: 'static> = iter::empty(); }
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;

View File

@ -1,69 +0,0 @@
// run-pass
#![feature(associated_type_bounds)]
#![feature(impl_trait_in_bindings)]
//~^ WARNING `impl_trait_in_bindings` is incomplete
#![allow(non_upper_case_globals)]
use std::ops::Add;
trait Tr1 { type As1; fn mk(&self) -> Self::As1; }
trait Tr2<'a> { fn tr2(self) -> &'a Self; }
fn assert_copy<T: Copy>(x: T) { let _x = x; let _x = x; }
fn assert_static<T: 'static>(_: T) {}
fn assert_forall_tr2<T: for<'a> Tr2<'a>>(_: T) {}
#[derive(Copy, Clone)]
struct S1;
#[derive(Copy, Clone)]
struct S2;
impl Tr1 for S1 { type As1 = S2; fn mk(&self) -> Self::As1 { S2 } }
const cdef_et1: &dyn Tr1<As1: Copy> = &S1;
const sdef_et1: &dyn Tr1<As1: Copy> = &S1;
pub fn use_et1() { assert_copy(cdef_et1.mk()); assert_copy(sdef_et1.mk()); }
const cdef_et2: &(dyn Tr1<As1: 'static> + Sync) = &S1;
static sdef_et2: &(dyn Tr1<As1: 'static> + Sync) = &S1;
pub fn use_et2() { assert_static(cdef_et2.mk()); assert_static(sdef_et2.mk()); }
const cdef_et3: &dyn Tr1<As1: Clone + Iterator<Item: Add<u8, Output: Into<u8>>>> = {
struct A;
impl Tr1 for A {
type As1 = core::ops::Range<u8>;
fn mk(&self) -> Self::As1 { 0..10 }
}
&A
};
pub fn use_et3() {
let _0 = cdef_et3.mk().clone();
let mut s = 0u8;
for _1 in _0 {
let _2 = _1 + 1u8;
s += _2.into();
}
assert_eq!(s, (0..10).map(|x| x + 1).sum());
}
const cdef_et4: &(dyn Tr1<As1: for<'a> Tr2<'a>> + Sync) = {
#[derive(Copy, Clone)]
struct A;
impl Tr1 for A {
type As1 = A;
fn mk(&self) -> A { A }
}
impl<'a> Tr2<'a> for A {
fn tr2(self) -> &'a Self { &A }
}
&A
};
static sdef_et4: &(dyn Tr1<As1: for<'a> Tr2<'a>> + Sync) = cdef_et4;
pub fn use_et4() { assert_forall_tr2(cdef_et4.mk()); assert_forall_tr2(sdef_et4.mk()); }
fn main() {
let _ = use_et1();
let _ = use_et2();
let _ = use_et3();
let _ = use_et4();
}

View File

@ -1,11 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/dyn-lcsit.rs:4:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: 1 warning emitted

View File

@ -1,78 +0,0 @@
// run-pass
#![feature(associated_type_bounds)]
#![feature(impl_trait_in_bindings)]
//~^ WARNING `impl_trait_in_bindings` is incomplete
#![allow(non_upper_case_globals)]
use std::ops::Add;
trait Tr1 { type As1; fn mk(&self) -> Self::As1; }
trait Tr2<'a> { fn tr2(self) -> &'a Self; }
fn assert_copy<T: Copy>(x: T) { let _x = x; let _x = x; }
fn assert_static<T: 'static>(_: T) {}
fn assert_forall_tr2<T: for<'a> Tr2<'a>>(_: T) {}
#[derive(Copy, Clone)]
struct S1;
#[derive(Copy, Clone)]
struct S2;
impl Tr1 for S1 { type As1 = S2; fn mk(&self) -> Self::As1 { S2 } }
const cdef_et1: impl Copy + Tr1<As1: Copy> = {
let x: impl Copy + Tr1<As1: Copy> = S1;
x
};
static sdef_et1: impl Copy + Tr1<As1: Copy> = cdef_et1;
pub fn use_et1() { assert_copy(cdef_et1.mk()); assert_copy(sdef_et1.mk()); }
const cdef_et2: impl Tr1<As1: 'static> = {
let x: impl Tr1<As1: 'static> = S1;
x
};
static sdef_et2: impl Tr1<As1: 'static> = cdef_et2;
pub fn use_et2() { assert_static(cdef_et2.mk()); assert_static(sdef_et2.mk()); }
const cdef_et3: impl Tr1<As1: Clone + Iterator<Item: Add<u8, Output: Into<u8>>>> = {
struct A;
impl Tr1 for A {
type As1 = core::ops::Range<u8>;
fn mk(&self) -> Self::As1 { 0..10 }
}
let x: impl Tr1<As1: Clone + Iterator<Item: Add<u8, Output: Into<u8>>>> = A;
x
};
pub fn use_et3() {
let _0 = cdef_et3.mk().clone();
let mut s = 0u8;
for _1 in _0 {
let _2 = _1 + 1u8;
s += _2.into();
}
assert_eq!(s, (0..10).map(|x| x + 1).sum());
}
const cdef_et4: impl Copy + Tr1<As1: for<'a> Tr2<'a>> = {
#[derive(Copy, Clone)]
struct A;
impl Tr1 for A {
type As1 = A;
fn mk(&self) -> A { A }
}
impl<'a> Tr2<'a> for A {
fn tr2(self) -> &'a Self { &A }
}
let x: impl Copy + Tr1<As1: for<'a> Tr2<'a>> = A;
x
};
static sdef_et4: impl Copy + Tr1<As1: for<'a> Tr2<'a>> = cdef_et4;
pub fn use_et4() { assert_forall_tr2(cdef_et4.mk()); assert_forall_tr2(sdef_et4.mk()); }
fn main() {
let _ = use_et1();
let _ = use_et2();
let _ = use_et3();
let _ = use_et4();
}

View File

@ -1,11 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/lcsit.rs:4:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: 1 warning emitted

View File

@ -1,12 +1,14 @@
#![feature(imported_main)]
#![feature(min_type_alias_impl_trait, impl_trait_in_bindings)]
#![feature(min_type_alias_impl_trait)]
#![allow(incomplete_features)]
//~^^^ ERROR `main` function not found in crate
pub mod foo {
type MainFn = impl Fn();
//~^ ERROR could not find defining uses
fn bar() {}
pub const BAR: MainFn = bar;
//~^ ERROR mismatched types [E0308]
}
use foo::BAR as main;

View File

@ -2,7 +2,7 @@ error[E0601]: `main` function not found in crate `imported_main_const_fn_item_ty
--> $DIR/imported_main_const_fn_item_type_forbidden.rs:1:1
|
LL | / #![feature(imported_main)]
LL | | #![feature(min_type_alias_impl_trait, impl_trait_in_bindings)]
LL | | #![feature(min_type_alias_impl_trait)]
LL | | #![allow(incomplete_features)]
LL | |
... |
@ -12,6 +12,25 @@ LL | | use foo::BAR as main;
| |
| non-function item at `crate::main` is found
error: aborting due to previous error
error[E0308]: mismatched types
--> $DIR/imported_main_const_fn_item_type_forbidden.rs:10:29
|
LL | type MainFn = impl Fn();
| --------- the expected opaque type
...
LL | pub const BAR: MainFn = bar;
| ^^^ expected opaque type, found fn item
|
= note: expected opaque type `impl Fn<()>`
found fn item `fn() {bar}`
For more information about this error, try `rustc --explain E0601`.
error: could not find defining uses
--> $DIR/imported_main_const_fn_item_type_forbidden.rs:6:19
|
LL | type MainFn = impl Fn();
| ^^^^^^^^^
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0308, E0601.
For more information about an error, try `rustc --explain E0308`.

View File

@ -57,20 +57,20 @@ fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
const _cdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
//~| ERROR `impl Trait` not allowed outside of function and method return types [E0562]
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1;
static _sdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
//~| ERROR `impl Trait` not allowed outside of function and method return types [E0562]
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1;
fn main() {
let _: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
//~| ERROR `impl Trait` not allowed outside of function and method return types [E0562]
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// let _: &dyn Tr1<As1: Copy> = &S1;
}

View File

@ -115,29 +115,23 @@ LL | let _: impl Tr1<As1: Copy> = S1;
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/feature-gate-associated_type_bounds.rs:58:14
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/feature-gate-associated_type_bounds.rs:64:15
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/feature-gate-associated_type_bounds.rs:71:12
|
LL | let _: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0277]: the trait bound `<<Self as _Tr3>::A as Iterator>::Item: Copy` is not satisfied
--> $DIR/feature-gate-associated_type_bounds.rs:15:28

View File

@ -1,11 +0,0 @@
const FOO: impl Copy = 42;
//~^ ERROR `impl Trait` not allowed
static BAR: impl Copy = 42;
//~^ ERROR `impl Trait` not allowed
fn main() {
let foo = impl Copy = 42;
//~^ ERROR expected expression, found keyword `impl`
let foo: impl Copy = 42;
}

View File

@ -1,25 +0,0 @@
error: expected expression, found keyword `impl`
--> $DIR/feature-gate-impl_trait_in_bindings.rs:8:15
|
LL | let foo = impl Copy = 42;
| ^^^^ expected expression
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-impl_trait_in_bindings.rs:1:12
|
LL | const FOO: impl Copy = 42;
| ^^^^^^^^^
|
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-impl_trait_in_bindings.rs:4:13
|
LL | static BAR: impl Copy = 42;
| ^^^^^^^^^
|
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0562`.

View File

@ -106,7 +106,7 @@ LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debu
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/feature-gate-min_type_alias_impl_trait.rs:23:18
|
LL | type Assoc = impl Debug;

View File

@ -31,7 +31,7 @@ type Foo4 = impl Debug;
fn define4() {
let y: Foo4 = 42;
//~^ ERROR not permitted here
//~^ ERROR mismatched types [E0308]
}
fn main() {}

View File

@ -45,14 +45,19 @@ LL | define3(42)
= note: expected opaque type `impl Debug`
found type `{integer}`
error[E0658]: type alias impl trait is not permitted here
--> $DIR/feature-gate-type_alias_impl_trait.rs:33:12
error[E0308]: mismatched types
--> $DIR/feature-gate-type_alias_impl_trait.rs:33:19
|
LL | type Foo4 = impl Debug;
| ---------- the expected opaque type
...
LL | let y: Foo4 = 42;
| ^^^^
| ---- ^^ expected opaque type, found integer
| |
| expected due to this
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
= note: expected opaque type `impl Debug`
found type `{integer}`
error: could not find defining uses
--> $DIR/feature-gate-type_alias_impl_trait.rs:5:12

View File

@ -1,26 +1,18 @@
error[E0425]: cannot find value `Foo` in this scope
--> $DIR/layout-error.rs:25:17
--> $DIR/layout-error.rs:24:17
|
LL | let a = Foo;
| ^^^ not found in this scope
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/layout-error.rs:8:32
|
LL | #![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^^
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/layout-error.rs:8:56
|
LL | #![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
error: aborting due to previous error; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0425`.

View File

@ -1,11 +1,11 @@
error[E0425]: cannot find value `Foo` in this scope
--> $DIR/layout-error.rs:25:17
--> $DIR/layout-error.rs:24:17
|
LL | let a = Foo;
| ^^^ not found in this scope
error[E0658]: type alias impl trait is not permitted here
--> $DIR/layout-error.rs:31:27
--> $DIR/layout-error.rs:30:27
|
LL | Task::spawn(&POOL, || cb());
| ^
@ -13,28 +13,7 @@ LL | Task::spawn(&POOL, || cb());
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: type alias impl trait is not permitted here
--> $DIR/layout-error.rs:30:28
|
LL | static POOL: Task<F> = Task::new();
| ^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error: concrete type differs from previous defining opaque type use
--> $DIR/layout-error.rs:31:24
|
LL | Task::spawn(&POOL, || cb());
| ^^^^^^^ expected `[type error]`, got `impl Future`
|
note: previous use here
--> $DIR/layout-error.rs:30:5
|
LL | static POOL: Task<F> = Task::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.

View File

@ -5,9 +5,8 @@
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
//[full_tait]~| WARN incomplete
use std::future::Future;
pub struct Task<F: Future>(F);
@ -27,7 +26,6 @@ fn main() {
type F = impl Future;
// Check that statics are inhabited computes they layout.
static POOL: Task<F> = Task::new(); //[min_tait]~ ERROR not permitted here
static POOL: Task<F> = Task::new();
Task::spawn(&POOL, || cb()); //[min_tait]~ ERROR type alias impl trait is not permitted here
//[min_tait]~^ ERROR concrete type differs from previous
}

View File

@ -1,25 +1,17 @@
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/metadata-sufficient-for-layout.rs:10:32
|
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/metadata-sufficient-for-layout.rs:10:55
|
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error: fatal error triggered by #[rustc_error]
--> $DIR/metadata-sufficient-for-layout.rs:29:1
--> $DIR/metadata-sufficient-for-layout.rs:28:1
|
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to previous error; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted

View File

@ -1,24 +1,8 @@
error[E0658]: type alias impl trait is not permitted here
--> $DIR/metadata-sufficient-for-layout.rs:22:23
error: fatal error triggered by #[rustc_error]
--> $DIR/metadata-sufficient-for-layout.rs:28:1
|
LL | static A: Option<F> = None;
| ^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
LL | fn main() {}
| ^^^^^^^^^
error: concrete type differs from previous defining opaque type use
--> $DIR/metadata-sufficient-for-layout.rs:25:1
|
LL | fn f() -> F { metadata_sufficient_for_layout::g() }
| ^^^^^^^^^^^ expected `[type error]`, got `impl Generator`
|
note: previous use here
--> $DIR/metadata-sufficient-for-layout.rs:22:1
|
LL | static A: Option<F> = None;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -7,9 +7,8 @@
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait, rustc_attrs)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
//[full_tait]~| WARN incomplete
#![feature(generator_trait)]
extern crate metadata_sufficient_for_layout;
@ -20,10 +19,10 @@ type F = impl Generator<(), Yield = (), Return = ()>;
// Static queries the layout of the generator.
static A: Option<F> = None;
//[min_tait]~^ ERROR not permitted here
fn f() -> F { metadata_sufficient_for_layout::g() }
//[min_tait]~^ ERROR concrete type differs
fn f() -> F {
metadata_sufficient_for_layout::g()
}
#[rustc_error]
fn main() {} //[full_tait]~ ERROR
fn main() {} //~ ERROR

View File

@ -1,9 +0,0 @@
#![allow(incomplete_features)]
#![feature(impl_trait_in_bindings)]
fn foo() {
let _ : impl Copy;
//~^ ERROR cannot resolve opaque type
}
fn main() {}

View File

@ -1,16 +0,0 @@
error[E0720]: cannot resolve opaque type
--> $DIR/binding-without-value.rs:5:13
|
LL | let _ : impl Copy;
| - ^^^^^^^^^ cannot resolve opaque type
| |
| this binding might not have a concrete type
|
help: set the binding to a value for a concrete type to be resolved
|
LL | let _ : impl Copy = /* value */;
| ^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0720`.

View File

@ -1,17 +0,0 @@
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete
const FOO: impl Copy = 42;
static BAR: impl Copy = 42;
fn main() {
let foo: impl Copy = 42;
let _ = FOO.count_ones();
//~^ ERROR no method
let _ = BAR.count_ones();
//~^ ERROR no method
let _ = foo.count_ones();
//~^ ERROR no method
}

View File

@ -1,30 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bindings-opaque.rs:1:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0599]: no method named `count_ones` found for opaque type `impl Copy` in the current scope
--> $DIR/bindings-opaque.rs:11:17
|
LL | let _ = FOO.count_ones();
| ^^^^^^^^^^ method not found in `impl Copy`
error[E0599]: no method named `count_ones` found for opaque type `impl Copy` in the current scope
--> $DIR/bindings-opaque.rs:13:17
|
LL | let _ = BAR.count_ones();
| ^^^^^^^^^^ method not found in `impl Copy`
error[E0599]: no method named `count_ones` found for opaque type `impl Copy` in the current scope
--> $DIR/bindings-opaque.rs:15:17
|
LL | let _ = foo.count_ones();
| ^^^^^^^^^^ method not found in `impl Copy`
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0599`.

View File

@ -1,30 +0,0 @@
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete
fn a<T: Clone>(x: T) {
const foo: impl Clone = x;
//~^ ERROR attempt to use a non-constant value in a constant
}
fn b<T: Clone>(x: T) {
let _ = move || {
const foo: impl Clone = x;
//~^ ERROR attempt to use a non-constant value in a constant
};
}
trait Foo<T: Clone> {
fn a(x: T) {
const foo: impl Clone = x;
//~^ ERROR attempt to use a non-constant value in a constant
}
}
impl<T: Clone> Foo<T> for i32 {
fn a(x: T) {
const foo: impl Clone = x;
//~^ ERROR attempt to use a non-constant value in a constant
}
}
fn main() { }

View File

@ -1,44 +0,0 @@
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:5:29
|
LL | const foo: impl Clone = x;
| --------- ^ non-constant value
| |
| help: consider using `let` instead of `const`: `let foo`
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:11:33
|
LL | const foo: impl Clone = x;
| --------- ^ non-constant value
| |
| help: consider using `let` instead of `const`: `let foo`
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:18:33
|
LL | const foo: impl Clone = x;
| --------- ^ non-constant value
| |
| help: consider using `let` instead of `const`: `let foo`
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:25:33
|
LL | const foo: impl Clone = x;
| --------- ^ non-constant value
| |
| help: consider using `let` instead of `const`: `let foo`
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bindings.rs:1:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error: aborting due to 4 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0435`.

View File

@ -1,15 +1,14 @@
// edition:2018
#![feature(impl_trait_in_bindings)]
//~^ WARNING the feature `impl_trait_in_bindings` is incomplete
// See issue 60414
// Reduction to `impl Trait`
struct Foo<T>(T);
trait FooLike { type Output; }
trait FooLike {
type Output;
}
impl<T> FooLike for Foo<T> {
type Output = T;
@ -23,7 +22,7 @@ mod impl_trait {
}
/// `T::Assoc` can't be normalized any further here.
fn foo_fail<T: Trait>() -> impl FooLike<Output=T::Assoc> {
fn foo_fail<T: Trait>() -> impl FooLike<Output = T::Assoc> {
//~^ ERROR: type mismatch
Foo(())
}
@ -39,9 +38,9 @@ mod lifetimes {
}
/// Missing bound constraining `Assoc`, `T::Assoc` can't be normalized further.
fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> {
//~^ ERROR: type mismatch
//~^^ ERROR `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
//~^ ERROR: type mismatch
//~^^ ERROR `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
Foo(())
}
}

View File

@ -1,45 +1,36 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bound-normalization-fail.rs:3:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as impl_trait::Trait>::Assoc`
--> $DIR/bound-normalization-fail.rs:26:32
--> $DIR/bound-normalization-fail.rs:25:32
|
LL | fn foo_fail<T: Trait>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()`
LL | fn foo_fail<T: Trait>() -> impl FooLike<Output = T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()`
|
= note: expected associated type `<T as impl_trait::Trait>::Assoc`
found type `()`
help: consider constraining the associated type `<T as impl_trait::Trait>::Assoc` to `()`
|
LL | fn foo_fail<T: Trait<Assoc = ()>>() -> impl FooLike<Output=T::Assoc> {
LL | fn foo_fail<T: Trait<Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
| ^^^^^^^^^^^^
error[E0760]: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
--> $DIR/bound-normalization-fail.rs:42:41
--> $DIR/bound-normalization-fail.rs:41:41
|
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'static>>::Assoc`
--> $DIR/bound-normalization-fail.rs:42:41
--> $DIR/bound-normalization-fail.rs:41:41
|
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()`
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()`
|
= note: expected associated type `<T as lifetimes::Trait<'static>>::Assoc`
found type `()`
help: consider constraining the associated type `<T as lifetimes::Trait<'static>>::Assoc` to `()`
|
LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike<Output=T::Assoc> {
LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
| ^^^^^^^^^^^^
error: aborting due to 3 previous errors; 1 warning emitted
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0271, E0760.
For more information about an error, try `rustc --explain E0271`.

View File

@ -1,11 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bound-normalization-pass.rs:8:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: 1 warning emitted

View File

@ -5,8 +5,6 @@
//-^ To make this the regression test for #75962.
#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
//~^ WARNING the feature `impl_trait_in_bindings` is incomplete
// See issue 60414
@ -14,7 +12,9 @@
struct Foo<T>(T);
trait FooLike { type Output; }
trait FooLike {
type Output;
}
impl<T> FooLike for Foo<T> {
type Output = T;
@ -28,7 +28,7 @@ mod impl_trait {
}
/// `T::Assoc` should be normalized to `()` here.
fn foo_pass<T: Trait<Assoc=()>>() -> impl FooLike<Output=T::Assoc> {
fn foo_pass<T: Trait<Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
Foo(())
}
}
@ -45,40 +45,20 @@ mod lifetimes {
/// Like above.
///
/// FIXME(#51525) -- the shorter notation `T::Assoc` winds up referencing `'static` here
fn foo2_pass<'a, T: Trait<'a, Assoc=()> + 'a>(
) -> impl FooLike<Output=<T as Trait<'a>>::Assoc> + 'a {
fn foo2_pass<'a, T: Trait<'a, Assoc = ()> + 'a>()
-> impl FooLike<Output = <T as Trait<'a>>::Assoc> + 'a {
Foo(())
}
/// Normalization to type containing bound region.
///
/// FIXME(#51525) -- the shorter notation `T::Assoc` winds up referencing `'static` here
fn foo2_pass2<'a, T: Trait<'a, Assoc=&'a ()> + 'a>(
) -> impl FooLike<Output=<T as Trait<'a>>::Assoc> + 'a {
fn foo2_pass2<'a, T: Trait<'a, Assoc = &'a ()> + 'a>()
-> impl FooLike<Output = <T as Trait<'a>>::Assoc> + 'a {
Foo(&())
}
}
// Reduction using `impl Trait` in bindings
mod impl_trait_in_bindings {
struct Foo;
trait FooLike { type Output; }
impl FooLike for Foo {
type Output = u32;
}
trait Trait {
type Assoc;
}
fn foo<T: Trait<Assoc=u32>>() {
let _: impl FooLike<Output=T::Assoc> = Foo;
}
}
// The same applied to `type Foo = impl Bar`s
mod opaque_types {

View File

@ -1,11 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bound-normalization-pass.rs:8:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: 1 warning emitted

View File

@ -1,8 +0,0 @@
// check-pass
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete
const _: impl Fn() = ||();
fn main() {}

View File

@ -1,11 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/impl-trait-in-bindings-issue-73003.rs:3:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: 1 warning emitted

View File

@ -1,49 +0,0 @@
// run-pass
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete
use std::fmt::Debug;
const FOO: impl Debug + Clone + PartialEq<i32> = 42;
static BAR: impl Debug + Clone + PartialEq<i32> = 42;
fn a<T: Clone>(x: T) {
let y: impl Clone = x;
let _ = y.clone();
}
fn b<T: Clone>(x: T) {
let f = move || {
let y: impl Clone = x;
let _ = y.clone();
};
f();
}
trait Foo<T: Clone> {
fn a(x: T) {
let y: impl Clone = x;
let _ = y.clone();
}
}
impl<T: Clone> Foo<T> for i32 {
fn a(x: T) {
let y: impl Clone = x;
let _ = y.clone();
}
}
fn main() {
let foo: impl Debug + Clone + PartialEq<i32> = 42;
assert_eq!(FOO.clone(), 42);
assert_eq!(BAR.clone(), 42);
assert_eq!(foo.clone(), 42);
a(42);
b(42);
i32::a(42);
}

View File

@ -1,11 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/impl-trait-in-bindings.rs:3:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: 1 warning emitted

View File

@ -1,15 +0,0 @@
// Regression test for #57200
// FIXME: The error is temporary hack, we'll revisit here at some point.
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
fn bug<'a, 'b, T>()
where
'a: 'b,
{
let f: impl Fn(&'a T) -> &'b T = |x| x;
//~^ ERROR: lifetimes in impl Trait types in bindings are not currently supported
}
fn main() {}

View File

@ -1,8 +0,0 @@
error: lifetimes in impl Trait types in bindings are not currently supported
--> $DIR/issue-57200.rs:11:12
|
LL | let f: impl Fn(&'a T) -> &'b T = |x| x;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,15 +0,0 @@
// Regression test for #57201
// FIXME: The error is temporary hack, we'll revisit here at some point.
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
fn bug<'a, 'b, T>()
where
'a: 'b,
{
let f: &impl Fn(&'a T) -> &'b T = &|x| x;
//~^ ERROR: lifetimes in impl Trait types in bindings are not currently supported
}
fn main() {}

View File

@ -1,8 +0,0 @@
error: lifetimes in impl Trait types in bindings are not currently supported
--> $DIR/issue-57201.rs:11:13
|
LL | let f: &impl Fn(&'a T) -> &'b T = &|x| x;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,15 +0,0 @@
// Regression test for #60473
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
struct A<'a>(&'a ());
trait Trait<T> {}
impl<T> Trait<T> for () {}
fn main() {
let x: impl Trait<A> = ();
//~^ ERROR: missing lifetime specifier
}

View File

@ -1,15 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/issue-60473.rs:13:23
|
LL | let x: impl Trait<A> = ();
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | fn main<'a>() {
LL | let x: impl Trait<A<'a>> = ();
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,11 +0,0 @@
// Regression test for #67166
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
pub fn run() {
let _foo: Box<impl Copy + '_> = Box::new(());
//~^ ERROR: missing lifetime specifier
}
fn main() {}

View File

@ -1,15 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/issue-67166.rs:7:31
|
LL | let _foo: Box<impl Copy + '_> = Box::new(());
| ^^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | pub fn run<'a>() {
LL | let _foo: Box<impl Copy + 'a> = Box::new(());
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,16 +0,0 @@
// check-pass
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
struct A<'a>(&'a ());
trait Trait<T> {}
impl<T> Trait<T> for () {}
pub fn foo<'a>() {
let _x: impl Trait<A<'a>> = ();
}
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<Bar as Iterator>::Item == Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> Option<String> + 'static)>`
--> $DIR/issue-70877.rs:11:12
--> $DIR/issue-70877.rs:10:12
|
LL | type FooRet = impl std::fmt::Debug;
| -------------------- the found opaque type

View File

@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<Bar as Iterator>::Item == Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> Option<String> + 'static)>`
--> $DIR/issue-70877.rs:11:12
--> $DIR/issue-70877.rs:10:12
|
LL | type FooRet = impl std::fmt::Debug;
| -------------------- the found opaque type

View File

@ -1,7 +1,6 @@
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
type FooArg<'a> = &'a dyn ToString;

View File

@ -1,15 +0,0 @@
// edition:2018
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete
struct Bug {
V1: [(); {
let f: impl core::future::Future<Output = u8> = async { 1 };
//~^ ERROR `async` blocks are not allowed in constants
//~| ERROR destructors cannot be evaluated at compile-time
1
}],
}
fn main() {}

View File

@ -1,31 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-78721.rs:3:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0658]: `async` blocks are not allowed in constants
--> $DIR/issue-78721.rs:8:57
|
LL | let f: impl core::future::Future<Output = u8> = async { 1 };
| ^^^^^^^^^^^
|
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/issue-78721.rs:8:13
|
LL | let f: impl core::future::Future<Output = u8> = async { 1 };
| ^ constants cannot evaluate destructors
...
LL | }],
| - value is dropped here
error: aborting due to 2 previous errors; 1 warning emitted
Some errors have detailed explanations: E0493, E0658.
For more information about an error, try `rustc --explain E0493`.

View File

@ -7,33 +7,26 @@ LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-78722.rs:7:12
error[E0308]: mismatched types
--> $DIR/issue-78722.rs:15:20
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0658]: `async` blocks are not allowed in constants
--> $DIR/issue-78722.rs:17:20
|
LL | let f: F = async { 1 };
| ^^^^^^^^^^^
|
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/issue-78722.rs:17:13
|
LL | let f: F = async { 1 };
| ^ constants cannot evaluate destructors
LL | type F = impl core::future::Future<Output = u8>;
| -------------------------------------- the expected opaque type
...
LL | }],
| - value is dropped here
LL | let f: F = async { 1 };
| - ^^^^^^^^^^^ expected opaque type, found a different opaque type
| |
| expected due to this
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
| ------------------------------- the found opaque type
|
= note: expected opaque type `impl Future` (opaque type at <$DIR/issue-78722.rs:8:10>)
found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>)
= note: distinct uses of `impl Trait` result in different opaque types
error: aborting due to 2 previous errors; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted
Some errors have detailed explanations: E0493, E0658.
For more information about an error, try `rustc --explain E0493`.
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,31 +1,23 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-78722.rs:7:12
error[E0308]: mismatched types
--> $DIR/issue-78722.rs:15:20
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0658]: `async` blocks are not allowed in constants
--> $DIR/issue-78722.rs:17:20
|
LL | let f: F = async { 1 };
| ^^^^^^^^^^^
|
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/issue-78722.rs:17:13
|
LL | let f: F = async { 1 };
| ^ constants cannot evaluate destructors
LL | type F = impl core::future::Future<Output = u8>;
| -------------------------------------- the expected opaque type
...
LL | }],
| - value is dropped here
LL | let f: F = async { 1 };
| - ^^^^^^^^^^^ expected opaque type, found a different opaque type
| |
| expected due to this
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
| ------------------------------- the found opaque type
|
= note: expected opaque type `impl Future` (opaque type at <$DIR/issue-78722.rs:8:10>)
found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>)
= note: distinct uses of `impl Trait` result in different opaque types
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to previous error
Some errors have detailed explanations: E0493, E0658.
For more information about an error, try `rustc --explain E0493`.
For more information about this error, try `rustc --explain E0308`.

View File

@ -4,8 +4,6 @@
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete
type F = impl core::future::Future<Output = u8>;
@ -15,8 +13,7 @@ struct Bug {
async {}
}
let f: F = async { 1 };
//~^ ERROR `async` blocks are not allowed in constants
//~| ERROR destructors cannot be evaluated at compile-time
//~^ ERROR mismatched types [E0308]
1
}],
}

View File

@ -1,8 +1,8 @@
struct Foo<T = impl Copy>(T);
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// should not cause ICE
fn x() -> Foo {

View File

@ -1,10 +1,10 @@
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:1:16
|
LL | struct Foo<T = impl Copy>(T);
| ^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:4:20
|
LL | type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;

View File

@ -34,13 +34,13 @@ LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| | nested `impl Trait` here
| outer `impl Trait`
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/nested_impl_trait.rs:8:32
|
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
| ^^^^^^^^^^^^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/nested_impl_trait.rs:25:42
|
LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {

View File

@ -13,61 +13,61 @@ fn in_adt_in_parameters(_: Vec<impl Debug>) { panic!() }
// Disallowed
fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
//~^^ ERROR nested `impl Trait` is not allowed
// Disallowed
fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
//~| ERROR nested `impl Trait` is not allowed
// Disallowed
fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Allowed
@ -80,22 +80,22 @@ fn in_impl_Trait_in_return() -> impl IntoIterator<Item = impl IntoIterator> {
// Disallowed
struct InBraceStructField { x: impl Debug }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
struct InAdtInBraceStructField { x: Vec<impl Debug> }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
struct InTupleStructField(impl Debug);
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
enum InEnum {
InBraceVariant { x: impl Debug },
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
InTupleVariant(impl Debug),
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Allowed
@ -106,7 +106,7 @@ trait InTraitDefnParameters {
// Disallowed
trait InTraitDefnReturn {
fn in_return() -> impl Debug;
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Allowed and disallowed in trait impls
@ -123,7 +123,7 @@ impl DummyTrait for () {
// Allowed
fn in_trait_impl_return() -> impl Debug { () }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Allowed
@ -136,10 +136,10 @@ impl DummyType {
// Disallowed
extern "C" {
fn in_foreign_parameters(_: impl Debug);
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
fn in_foreign_return() -> impl Debug;
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Allowed
@ -155,96 +155,96 @@ type InTypeAlias<R> = impl Debug;
//~^ ERROR `impl Trait` in type aliases is unstable
type InReturnInTypeAlias<R> = fn() -> impl Debug;
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
//~| ERROR `impl Trait` in type aliases is unstable
// Disallowed in impl headers
impl PartialEq<impl Debug> for () {
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Disallowed in impl headers
impl PartialEq<()> for impl Debug {
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Disallowed in inherent impls
impl impl Debug {
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Disallowed in inherent impls
struct InInherentImplAdt<T> { t: T }
impl InInherentImplAdt<impl Debug> {
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}
// Disallowed in where clauses
fn in_fn_where_clause()
where impl Debug: Debug
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
{
}
// Disallowed in where clauses
fn in_adt_in_fn_where_clause()
where Vec<impl Debug>: Debug
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
{
}
// Disallowed
fn in_trait_parameter_in_fn_where_clause<T>()
where T: PartialEq<impl Debug>
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
{
}
// Disallowed
fn in_Fn_parameter_in_fn_where_clause<T>()
where T: Fn(impl Debug)
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
{
}
// Disallowed
fn in_Fn_return_in_fn_where_clause<T>()
where T: Fn() -> impl Debug
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
{
}
// Disallowed
struct InStructGenericParamDefault<T = impl Debug>(T);
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
trait InTraitGenericParamDefault<T = impl Debug> {}
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
type InTypeAliasGenericParamDefault<T = impl Debug> = T;
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
impl <T = impl Debug> T {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types
//~| ERROR `impl Trait` not allowed outside of function and method return types
// Disallowed
fn in_method_generic_param_default<T = impl Debug>(_: T) {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types
//~| ERROR `impl Trait` not allowed outside of function and method return types
fn main() {
let _in_local_variable: impl Fn() = || {};
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
let _in_return_in_local_variable = || -> impl Fn() { || {} };
//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types
//~^ ERROR `impl Trait` not allowed outside of function and method return types
}

View File

@ -43,249 +43,247 @@ LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:15:40
|
LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:19:42
|
LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:23:38
|
LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:27:40
|
LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:31:49
|
LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:35:51
|
LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:39:55
|
LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:43:57
|
LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:47:51
|
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:52:53
|
LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:56:57
|
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:61:59
|
LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:65:38
|
LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:69:40
|
LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:82:32
|
LL | struct InBraceStructField { x: impl Debug }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:86:41
|
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:90:27
|
LL | struct InTupleStructField(impl Debug);
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:95:25
|
LL | InBraceVariant { x: impl Debug },
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:97:20
|
LL | InTupleVariant(impl Debug),
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:108:23
|
LL | fn in_return() -> impl Debug;
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:125:34
|
LL | fn in_trait_impl_return() -> impl Debug { () }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:138:33
|
LL | fn in_foreign_parameters(_: impl Debug);
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:141:31
|
LL | fn in_foreign_return() -> impl Debug;
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:157:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:162:16
|
LL | impl PartialEq<impl Debug> for () {
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:167:24
|
LL | impl PartialEq<()> for impl Debug {
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:172:6
|
LL | impl impl Debug {
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:178:24
|
LL | impl InInherentImplAdt<impl Debug> {
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:184:11
|
LL | where impl Debug: Debug
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:191:15
|
LL | where Vec<impl Debug>: Debug
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:198:24
|
LL | where T: PartialEq<impl Debug>
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:205:17
|
LL | where T: Fn(impl Debug)
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:212:22
|
LL | where T: Fn() -> impl Debug
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:218:40
|
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:222:36
|
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:226:38
|
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:230:41
|
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:234:11
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:240:40
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:246:29
|
LL | let _in_local_variable: impl Fn() = || {};
| ^^^^^^^^^
|
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/where-allowed.rs:248:46
|
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };

View File

@ -1,17 +0,0 @@
// edition:2018
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete
use std::io::Error;
fn make_unit() -> Result<(), Error> {
Ok(())
}
fn main() {
let fut = async {
make_unit()?;
Ok(()) //~ ERROR type annotations needed
};
}

View File

@ -1,21 +0,0 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/cannot-infer-async-enabled-impl-trait-bindings.rs:2:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0282]: type annotations needed for `impl Future`
--> $DIR/cannot-infer-async-enabled-impl-trait-bindings.rs:15:9
|
LL | let fut = async {
| --- consider giving `fut` the explicit type `impl Future`, where the type parameter `E` is specified
...
LL | Ok(())
| ^^ cannot infer type for type parameter `E` declared on the enum `Result`
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0282`.

View File

@ -1,22 +1,22 @@
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/issue-47715.rs:9:37
|
LL | struct Container<T: Iterable<Item = impl Foo>> {
| ^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/issue-47715.rs:14:30
|
LL | enum Enum<T: Iterable<Item = impl Foo>> {
| ^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/issue-47715.rs:19:32
|
LL | union Union<T: Iterable<Item = impl Foo> + Copy> {
| ^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/issue-47715.rs:24:30
|
LL | type Type<T: Iterable<Item = impl Foo>> = T;

View File

@ -7,15 +7,11 @@ LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
error[E0658]: type alias impl trait is not permitted here
--> $DIR/issue-75053.rs:52:15
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-75053.rs:49:1
|
LL | let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
LL | fn main() {
| ^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,24 +1,11 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
error[E0557]: feature has been removed
--> $DIR/issue-75053.rs:7:34
|
LL | #![cfg_attr(in_bindings, feature(impl_trait_in_bindings))]
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^ feature has been removed
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= note: removed due to being incomplete and unstable
error[E0282]: type annotations needed
--> $DIR/issue-75053.rs:52:38
|
LL | type O;
| ------- `<Self as MyIndex<T>>::O` defined here
...
LL | let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
| ^^^^^^^^^^-------------
| |
| this method call resolves to `<Self as MyIndex<T>>::O`
| cannot infer type for type parameter `T`
error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0282`.
For more information about this error, try `rustc --explain E0557`.

View File

@ -1,12 +1,8 @@
error[E0658]: type alias impl trait is not permitted here
--> $DIR/issue-75053.rs:52:15
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-75053.rs:49:1
|
LL | let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
LL | fn main() {
| ^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,11 +1,9 @@
// compile-flags: -Z mir-opt-level=3
// revisions: min_tait full_tait in_bindings
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait, rustc_attrs)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
#![cfg_attr(in_bindings, feature(impl_trait_in_bindings))]
//[in_bindings]~^ WARN incomplete
use std::marker::PhantomData;
@ -49,7 +47,6 @@ impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
#[rustc_error]
fn main() {
//~^ ERROR
let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
//[min_tait,full_tait]~^ ERROR not permitted here
//[in_bindings]~^^ ERROR type annotations needed
}

View File

@ -1,10 +0,0 @@
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
fn main() {
const C: impl Copy = 0;
match C {
C | //~ ERROR: `impl Copy` cannot be used in patterns
_ => {}
}
}

View File

@ -1,8 +0,0 @@
error: `impl Copy` cannot be used in patterns
--> $DIR/issue-71042-opaquely-typed-constant-used-in-pattern.rs:7:9
|
LL | C |
| ^
error: aborting due to previous error

View File

@ -1,18 +1,10 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-53096.rs:4:32
|
LL | #![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^^
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-53096.rs:4:56
|
LL | #![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
error: fatal error triggered by #[rustc_error]
@ -21,5 +13,5 @@ error: fatal error triggered by #[rustc_error]
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to previous error; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted

View File

@ -1,12 +1,8 @@
error[E0658]: type alias impl trait is not permitted here
--> $DIR/issue-53096.rs:10:19
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-53096.rs:14:1
|
LL | const BAZR: Foo = bar();
| ^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,14 +1,14 @@
#![feature(const_impl_trait, const_fn_fn_ptr_basics, rustc_attrs)]
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
//[full_tait]~| WARN incomplete
type Foo = impl Fn() -> usize;
const fn bar() -> Foo { || 0usize }
const fn bar() -> Foo {
|| 0usize
}
const BAZR: Foo = bar();
//[min_tait]~^ ERROR not permitted here
#[rustc_error]
fn main() {} //[full_tait]~ ERROR
fn main() {} //~ ERROR

View File

@ -1,25 +1,17 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-53678-generator-and-const-fn.rs:4:32
|
LL | #![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^^
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-53678-generator-and-const-fn.rs:4:56
|
LL | #![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-53678-generator-and-const-fn.rs:23:1
--> $DIR/issue-53678-generator-and-const-fn.rs:22:1
|
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to previous error; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted

View File

@ -1,12 +1,8 @@
error[E0658]: type alias impl trait is not permitted here
--> $DIR/issue-53678-generator-and-const-fn.rs:20:36
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-53678-generator-and-const-fn.rs:22:1
|
LL | const FOO: GenOnce<usize, usize> = const_generator(10, 100);
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,9 +1,8 @@
#![feature(const_impl_trait, generators, generator_trait, rustc_attrs)]
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
//[full_tait]~| WARN incomplete
use std::ops::Generator;
@ -17,7 +16,7 @@ const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> {
}
}
const FOO: GenOnce<usize, usize> = const_generator(10, 100); //[min_tait]~ ERROR not permitted here
const FOO: GenOnce<usize, usize> = const_generator(10, 100);
#[rustc_error]
fn main() {} //[full_tait]~ ERROR
fn main() {} //~ ERROR

View File

@ -8,13 +8,13 @@ LL | type Item = impl Bug;
= help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: type alias impl trait is not permitted here
--> $DIR/issue-60371.rs:14:37
--> $DIR/issue-60371.rs:14:40
|
LL | const FUN: fn() -> Self::Item = || ();
| ^^^^^
| ^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0277]: the trait bound `(): Bug` is not satisfied
--> $DIR/issue-60371.rs:10:17

View File

@ -1,25 +1,17 @@
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-60407.rs:3:32
|
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-60407.rs:3:55
|
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-60407.rs:12:1
--> $DIR/issue-60407.rs:11:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to previous error; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted

View File

@ -1,24 +1,8 @@
error[E0658]: type alias impl trait is not permitted here
--> $DIR/issue-60407.rs:9:39
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-60407.rs:11:1
|
LL | static mut TEST: Option<Debuggable> = None;
| ^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
LL | fn main() {
| ^^^^^^^^^
error: concrete type differs from previous defining opaque type use
--> $DIR/issue-60407.rs:16:1
|
LL | fn foo() -> Debuggable {
| ^^^^^^^^^^^^^^^^^^^^^^ expected `[type error]`, got `u32`
|
note: previous use here
--> $DIR/issue-60407.rs:9:1
|
LL | static mut TEST: Option<Debuggable> = None;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,18 +1,18 @@
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait, rustc_attrs)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
//[full_tait]~| WARN incomplete
type Debuggable = impl core::fmt::Debug;
static mut TEST: Option<Debuggable> = None; //[min_tait]~ ERROR not permitted here
static mut TEST: Option<Debuggable> = None;
#[rustc_error]
fn main() { //[full_tait]~ ERROR
fn main() {
//~^ ERROR
unsafe { TEST = Some(foo()) }
}
fn foo() -> Debuggable { //[min_tait]~ ERROR concrete type differs
fn foo() -> Debuggable {
0u32
}

View File

@ -1,25 +1,17 @@
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-65679-inst-opaque-ty-from-val-twice.rs:5:32
|
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-65679-inst-opaque-ty-from-val-twice.rs:5:55
|
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-65679-inst-opaque-ty-from-val-twice.rs:19:1
--> $DIR/issue-65679-inst-opaque-ty-from-val-twice.rs:18:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to previous error; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted

View File

@ -2,9 +2,8 @@
// revisions: min_tait full_tait
#![feature(min_type_alias_impl_trait, rustc_attrs)]
#![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))]
#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
//[full_tait]~^ WARN incomplete
//[full_tait]~| WARN incomplete
type T = impl Sized;
// The concrete type referred by impl-trait-type-alias(`T`) is guaranteed
@ -16,7 +15,8 @@ type T = impl Sized;
fn take(_: fn() -> T) {}
#[rustc_error]
fn main() { //[full_tait]~ ERROR fatal error triggered by #[rustc_error]
fn main() {
//[full_tait]~^ ERROR fatal error triggered by #[rustc_error]
take(|| {});
//[min_tait]~^ ERROR not permitted here
take(|| {});

View File

@ -1,23 +0,0 @@
#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]
type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
//~^ ERROR: hidden type for `impl Trait` captures lifetime that does not appear in bounds
//~| ERROR: the type `&'<empty> str` does not fulfill the required lifetime
//~| ERROR: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
trait Output<'a> {}
impl<'a> Output<'a> for &'a str {}
fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> {
//~^ ERROR: concrete type differs from previous defining opaque type use
let out: OpaqueOutputImpl<'a> = arg;
arg
}
fn main() {
let s = String::from("wassup");
cool_fn(&s);
}

Some files were not shown because too many files have changed in this diff Show More