diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a8d6a99cbeb..0306196f65a 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -264,7 +264,7 @@ enum ImplTraitContext<'b, 'a> { /// Origin: Either OpaqueTyOrigin::FnReturn or OpaqueTyOrigin::AsyncFn, origin: hir::OpaqueTyOrigin, }, - /// Impl trait in type aliases, consts and statics. + /// Impl trait in type aliases. OtherOpaqueTy { /// Set of lifetimes that this opaque type can capture, if it uses /// them. This includes lifetimes bound since we entered this context. @@ -1767,21 +1767,10 @@ fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) { } 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); diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 4b2679e164a..141788e7df4 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2270,8 +2270,6 @@ pub enum OpaqueTyOrigin { FnReturn, /// `async fn` AsyncFn, - /// `let _: impl Trait = ...` - Binding, /// type aliases: `type Foo = impl Trait;` TyAlias, /// Impl trait consts, statics, bounds. diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index cc98cd72566..f380ad54d7f 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -402,9 +402,7 @@ fn constrain_opaque_type>( } // 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 | hir::OpaqueTyOrigin::Misc => 0, }; let span = tcx.def_span(def_id); diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 496721e6f76..98ac604b09f 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -665,13 +665,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 +700,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::Misc | hir::OpaqueTyOrigin::TyAlias => {} } let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); diff --git a/compiler/rustc_typeck/src/check/mod.rs b/compiler/rustc_typeck/src/check/mod.rs index 34d0908bcc7..11f0b47a457 100644 --- a/compiler/rustc_typeck/src/check/mod.rs +++ b/compiler/rustc_typeck/src/check/mod.rs @@ -573,66 +573,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) { diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 7b0002914ec..15469cb0066 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -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 visit_trait_item(&mut self, it: &'tcx TraitItem<'tcx>) { } } -/// 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, diff --git a/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr b/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr index bd3cac1f887..1d230b43c9f 100644 --- a/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr +++ b/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr @@ -280,31 +280,7 @@ LL | static SIT3: impl Iterator = iter::empty(); | `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 = 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 = 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 = 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:86:35 | LL | type TAI1> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -312,7 +288,7 @@ LL | type TAI1> = 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:88:35 | LL | type TAI2> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -320,7 +296,7 @@ LL | type TAI2> = 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:90:38 | LL | type TAI3> = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -328,7 +304,7 @@ LL | type TAI3> = 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:92:44 | LL | type TAW1 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -336,7 +312,7 @@ LL | type TAW1 where T: Iterator = 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:94:44 | LL | type TAW2 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -344,7 +320,7 @@ LL | type TAW2 where T: Iterator = 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:96:47 | LL | type TAW3 where T: Iterator = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -352,7 +328,7 @@ LL | type TAW3 where T: Iterator = 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:99:36 | LL | type ETAI1> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -360,7 +336,7 @@ LL | type ETAI1> = 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:101:36 | LL | type ETAI2> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -368,7 +344,7 @@ LL | type ETAI2> = 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:103:39 | LL | type ETAI3> = impl Copy; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -376,7 +352,7 @@ LL | type ETAI3> = 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:105:40 | LL | type ETAI4 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -384,7 +360,7 @@ LL | type ETAI4 = impl Iterator; | `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:107:40 | LL | type ETAI5 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -392,7 +368,7 @@ LL | type ETAI5 = impl Iterator; | `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:109:43 | LL | type ETAI6 = impl Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -400,7 +376,7 @@ LL | type ETAI6 = impl Iterator; | `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:112:36 | LL | trait TRI1> {} | ---------- ^^^^^^^^^^ re-bound here @@ -408,7 +384,7 @@ LL | trait TRI1> {} | `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:114:36 | LL | trait TRI2> {} | ---------- ^^^^^^^^^^ re-bound here @@ -416,7 +392,7 @@ LL | trait TRI2> {} | `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:116:39 | LL | trait TRI3> {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -424,7 +400,7 @@ LL | trait TRI3> {} | `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:118:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -432,7 +408,7 @@ LL | trait TRS1: Iterator {} | `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:120:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -440,7 +416,7 @@ LL | trait TRS2: Iterator {} | `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:122:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -448,7 +424,7 @@ LL | trait TRS3: Iterator {} | `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:124:45 | LL | trait TRW1 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -456,7 +432,7 @@ LL | trait TRW1 where T: Iterator {} | `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:126:45 | LL | trait TRW2 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -464,7 +440,7 @@ LL | trait TRW2 where T: Iterator {} | `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:128:48 | LL | trait TRW3 where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -472,7 +448,7 @@ LL | trait TRW3 where T: Iterator {} | `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:130:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -480,7 +456,7 @@ LL | trait TRSW1 where Self: Iterator {} | `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:130:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -488,7 +464,7 @@ LL | trait TRSW1 where Self: Iterator {} | `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:133:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -496,7 +472,7 @@ LL | trait TRSW2 where Self: Iterator {} | `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:133:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -504,7 +480,7 @@ LL | trait TRSW2 where Self: Iterator {} | `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:136:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -512,7 +488,7 @@ LL | trait TRSW3 where Self: Iterator {} | `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:136:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -520,7 +496,7 @@ LL | trait TRSW3 where Self: Iterator {} | `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:146:40 | LL | type TADyn1 = dyn Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -528,7 +504,7 @@ LL | type TADyn1 = dyn Iterator; | `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:148:44 | LL | type TADyn2 = Box>; | ---------- ^^^^^^^^^^ re-bound here @@ -536,7 +512,7 @@ LL | type TADyn2 = Box>; | `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:150:43 | LL | type TADyn3 = dyn Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -544,7 +520,7 @@ LL | type TADyn3 = dyn Iterator; | `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:139:43 | LL | trait TRA1 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -552,7 +528,7 @@ LL | trait TRA1 { type A: Iterator; } | `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:141:43 | LL | trait TRA2 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -560,13 +536,13 @@ LL | trait TRA2 { type A: Iterator; } | `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:143:46 | LL | trait TRA3 { type A: Iterator; } | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 69 previous errors; 2 warnings emitted +error: aborting due to 66 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0719`. diff --git a/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr b/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr index 500e527a018..d978a0c85fe 100644 --- a/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr +++ b/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr @@ -272,31 +272,7 @@ LL | static SIT3: impl Iterator = iter::empty(); | `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 = 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 = 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 = 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:86:35 | LL | type TAI1> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -304,7 +280,7 @@ LL | type TAI1> = 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:88:35 | LL | type TAI2> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -312,7 +288,7 @@ LL | type TAI2> = 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:90:38 | LL | type TAI3> = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -320,7 +296,7 @@ LL | type TAI3> = 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:92:44 | LL | type TAW1 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -328,7 +304,7 @@ LL | type TAW1 where T: Iterator = 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:94:44 | LL | type TAW2 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -336,7 +312,7 @@ LL | type TAW2 where T: Iterator = 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:96:47 | LL | type TAW3 where T: Iterator = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -344,7 +320,7 @@ LL | type TAW3 where T: Iterator = 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:99:36 | LL | type ETAI1> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -352,7 +328,7 @@ LL | type ETAI1> = 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:101:36 | LL | type ETAI2> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -360,7 +336,7 @@ LL | type ETAI2> = 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:103:39 | LL | type ETAI3> = impl Copy; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -368,7 +344,7 @@ LL | type ETAI3> = 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:105:40 | LL | type ETAI4 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -376,7 +352,7 @@ LL | type ETAI4 = impl Iterator; | `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:107:40 | LL | type ETAI5 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -384,7 +360,7 @@ LL | type ETAI5 = impl Iterator; | `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:109:43 | LL | type ETAI6 = impl Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -392,7 +368,7 @@ LL | type ETAI6 = impl Iterator; | `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:112:36 | LL | trait TRI1> {} | ---------- ^^^^^^^^^^ re-bound here @@ -400,7 +376,7 @@ LL | trait TRI1> {} | `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:114:36 | LL | trait TRI2> {} | ---------- ^^^^^^^^^^ re-bound here @@ -408,7 +384,7 @@ LL | trait TRI2> {} | `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:116:39 | LL | trait TRI3> {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -416,7 +392,7 @@ LL | trait TRI3> {} | `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:118:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -424,7 +400,7 @@ LL | trait TRS1: Iterator {} | `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:120:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -432,7 +408,7 @@ LL | trait TRS2: Iterator {} | `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:122:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -440,7 +416,7 @@ LL | trait TRS3: Iterator {} | `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:124:45 | LL | trait TRW1 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -448,7 +424,7 @@ LL | trait TRW1 where T: Iterator {} | `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:126:45 | LL | trait TRW2 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -456,7 +432,7 @@ LL | trait TRW2 where T: Iterator {} | `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:128:48 | LL | trait TRW3 where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -464,7 +440,7 @@ LL | trait TRW3 where T: Iterator {} | `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:130:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -472,7 +448,7 @@ LL | trait TRSW1 where Self: Iterator {} | `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:130:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -480,7 +456,7 @@ LL | trait TRSW1 where Self: Iterator {} | `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:133:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -488,7 +464,7 @@ LL | trait TRSW2 where Self: Iterator {} | `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:133:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -496,7 +472,7 @@ LL | trait TRSW2 where Self: Iterator {} | `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:136:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -504,7 +480,7 @@ LL | trait TRSW3 where Self: Iterator {} | `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:136:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -512,7 +488,7 @@ LL | trait TRSW3 where Self: Iterator {} | `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:146:40 | LL | type TADyn1 = dyn Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -520,7 +496,7 @@ LL | type TADyn1 = dyn Iterator; | `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:148:44 | LL | type TADyn2 = Box>; | ---------- ^^^^^^^^^^ re-bound here @@ -528,7 +504,7 @@ LL | type TADyn2 = Box>; | `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:150:43 | LL | type TADyn3 = dyn Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -536,7 +512,7 @@ LL | type TADyn3 = dyn Iterator; | `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:139:43 | LL | trait TRA1 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -544,7 +520,7 @@ LL | trait TRA1 { type A: Iterator; } | `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:141:43 | LL | trait TRA2 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -552,13 +528,13 @@ LL | trait TRA2 { type A: Iterator; } | `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:143:46 | LL | trait TRA3 { type A: Iterator; } | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 69 previous errors; 1 warning emitted +error: aborting due to 66 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0719`. diff --git a/src/test/ui/associated-type-bounds/duplicate.rs b/src/test/ui/associated-type-bounds/duplicate.rs index c3319a7050d..bb535e0add7 100644 --- a/src/test/ui/associated-type-bounds/duplicate.rs +++ b/src/test/ui/associated-type-bounds/duplicate.rs @@ -83,13 +83,6 @@ fn FAPIT3(_: impl Iterator) {} static SIT3: impl Iterator = iter::empty(); //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -fn lit1() { let _: impl Iterator = iter::empty(); } -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -fn lit2() { let _: impl Iterator = iter::empty(); } -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -fn lit3() { let _: impl Iterator = iter::empty(); } -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] - type TAI1> = T; //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] type TAI2> = T; diff --git a/src/test/ui/associated-type-bounds/lcsit.rs b/src/test/ui/associated-type-bounds/lcsit.rs deleted file mode 100644 index 5364f25f89a..00000000000 --- a/src/test/ui/associated-type-bounds/lcsit.rs +++ /dev/null @@ -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(x: T) { let _x = x; let _x = x; } -fn assert_static(_: T) {} -fn assert_forall_tr2 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 = { - let x: impl Copy + Tr1 = S1; - x -}; -static sdef_et1: impl Copy + Tr1 = cdef_et1; -pub fn use_et1() { assert_copy(cdef_et1.mk()); assert_copy(sdef_et1.mk()); } - -const cdef_et2: impl Tr1 = { - let x: impl Tr1 = S1; - x -}; -static sdef_et2: impl Tr1 = cdef_et2; -pub fn use_et2() { assert_static(cdef_et2.mk()); assert_static(sdef_et2.mk()); } - -const cdef_et3: impl Tr1>>> = { - struct A; - impl Tr1 for A { - type As1 = core::ops::Range; - fn mk(&self) -> Self::As1 { 0..10 } - } - let x: impl Tr1>>> = 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 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 Tr2<'a>> = A; - x -}; - -static sdef_et4: impl Copy + Tr1 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(); -} diff --git a/src/test/ui/associated-type-bounds/lcsit.stderr b/src/test/ui/associated-type-bounds/lcsit.stderr deleted file mode 100644 index 11ff03db361..00000000000 --- a/src/test/ui/associated-type-bounds/lcsit.stderr +++ /dev/null @@ -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 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs deleted file mode 100644 index 39cc64f11a7..00000000000 --- a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs +++ /dev/null @@ -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; -} diff --git a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr deleted file mode 100644 index bd648b40590..00000000000 --- a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr +++ /dev/null @@ -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`. diff --git a/src/test/ui/impl-trait/binding-without-value.rs b/src/test/ui/impl-trait/binding-without-value.rs deleted file mode 100644 index 6a97f28ff55..00000000000 --- a/src/test/ui/impl-trait/binding-without-value.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![allow(incomplete_features)] -#![feature(impl_trait_in_bindings)] - -fn foo() { - let _ : impl Copy; - //~^ ERROR cannot resolve opaque type -} - -fn main() {} diff --git a/src/test/ui/impl-trait/binding-without-value.stderr b/src/test/ui/impl-trait/binding-without-value.stderr deleted file mode 100644 index 0d2faeaf85d..00000000000 --- a/src/test/ui/impl-trait/binding-without-value.stderr +++ /dev/null @@ -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`. diff --git a/src/test/ui/impl-trait/bindings-opaque.rs b/src/test/ui/impl-trait/bindings-opaque.rs deleted file mode 100644 index d1f42be077d..00000000000 --- a/src/test/ui/impl-trait/bindings-opaque.rs +++ /dev/null @@ -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 -} diff --git a/src/test/ui/impl-trait/bindings-opaque.stderr b/src/test/ui/impl-trait/bindings-opaque.stderr deleted file mode 100644 index 170bd461234..00000000000 --- a/src/test/ui/impl-trait/bindings-opaque.stderr +++ /dev/null @@ -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 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`. diff --git a/src/test/ui/impl-trait/bound-normalization-pass.rs b/src/test/ui/impl-trait/bound-normalization-pass.rs index 6a01753b4c2..5144f05681b 100644 --- a/src/test/ui/impl-trait/bound-normalization-pass.rs +++ b/src/test/ui/impl-trait/bound-normalization-pass.rs @@ -14,7 +14,9 @@ struct Foo(T); -trait FooLike { type Output; } +trait FooLike { + type Output; +} impl FooLike for Foo { type Output = T; @@ -28,7 +30,7 @@ trait Trait { } /// `T::Assoc` should be normalized to `()` here. - fn foo_pass>() -> impl FooLike { + fn foo_pass>() -> impl FooLike { Foo(()) } } @@ -45,40 +47,20 @@ trait Trait<'a> { /// 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>::Assoc> + 'a { + fn foo2_pass<'a, T: Trait<'a, Assoc = ()> + 'a>() + -> impl FooLike>::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>::Assoc> + 'a { + fn foo2_pass2<'a, T: Trait<'a, Assoc = &'a ()> + 'a>() + -> impl FooLike>::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>() { - let _: impl FooLike = Foo; - } -} - // The same applied to `type Foo = impl Bar`s mod opaque_types { diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs b/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs deleted file mode 100644 index fd8fe5f48df..00000000000 --- a/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs +++ /dev/null @@ -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() {} diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr b/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr deleted file mode 100644 index 715671c8add..00000000000 --- a/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr +++ /dev/null @@ -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 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings.rs b/src/test/ui/impl-trait/impl-trait-in-bindings.rs deleted file mode 100644 index c7fae45d5ca..00000000000 --- a/src/test/ui/impl-trait/impl-trait-in-bindings.rs +++ /dev/null @@ -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 = 42; - -static BAR: impl Debug + Clone + PartialEq = 42; - -fn a(x: T) { - let y: impl Clone = x; - let _ = y.clone(); -} - -fn b(x: T) { - let f = move || { - let y: impl Clone = x; - let _ = y.clone(); - }; - f(); -} - -trait Foo { - fn a(x: T) { - let y: impl Clone = x; - let _ = y.clone(); - } -} - -impl Foo for i32 { - fn a(x: T) { - let y: impl Clone = x; - let _ = y.clone(); - } -} - -fn main() { - let foo: impl Debug + Clone + PartialEq = 42; - - assert_eq!(FOO.clone(), 42); - assert_eq!(BAR.clone(), 42); - assert_eq!(foo.clone(), 42); - - a(42); - b(42); - i32::a(42); -} diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings.stderr b/src/test/ui/impl-trait/impl-trait-in-bindings.stderr deleted file mode 100644 index bf739d4722f..00000000000 --- a/src/test/ui/impl-trait/impl-trait-in-bindings.stderr +++ /dev/null @@ -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 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/impl-trait/issue-57200.rs b/src/test/ui/impl-trait/issue-57200.rs deleted file mode 100644 index e0c71d1ac9a..00000000000 --- a/src/test/ui/impl-trait/issue-57200.rs +++ /dev/null @@ -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() {} diff --git a/src/test/ui/impl-trait/issue-57200.stderr b/src/test/ui/impl-trait/issue-57200.stderr deleted file mode 100644 index b44f332d58c..00000000000 --- a/src/test/ui/impl-trait/issue-57200.stderr +++ /dev/null @@ -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 - diff --git a/src/test/ui/impl-trait/issue-57201.rs b/src/test/ui/impl-trait/issue-57201.rs deleted file mode 100644 index c1a98d8897b..00000000000 --- a/src/test/ui/impl-trait/issue-57201.rs +++ /dev/null @@ -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() {} diff --git a/src/test/ui/impl-trait/issue-57201.stderr b/src/test/ui/impl-trait/issue-57201.stderr deleted file mode 100644 index 462b17bf45e..00000000000 --- a/src/test/ui/impl-trait/issue-57201.stderr +++ /dev/null @@ -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 - diff --git a/src/test/ui/impl-trait/issue-60473.rs b/src/test/ui/impl-trait/issue-60473.rs deleted file mode 100644 index 2ef86f03d34..00000000000 --- a/src/test/ui/impl-trait/issue-60473.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Regression test for #60473 - -#![feature(impl_trait_in_bindings)] -#![allow(incomplete_features)] - -struct A<'a>(&'a ()); - -trait Trait {} - -impl Trait for () {} - -fn main() { - let x: impl Trait = (); - //~^ ERROR: missing lifetime specifier -} diff --git a/src/test/ui/impl-trait/issue-60473.stderr b/src/test/ui/impl-trait/issue-60473.stderr deleted file mode 100644 index 367b5db5d2d..00000000000 --- a/src/test/ui/impl-trait/issue-60473.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/issue-60473.rs:13:23 - | -LL | let x: impl Trait = (); - | ^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | fn main<'a>() { -LL | let x: impl Trait> = (); - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/impl-trait/issue-67166.rs b/src/test/ui/impl-trait/issue-67166.rs deleted file mode 100644 index efa67558bd7..00000000000 --- a/src/test/ui/impl-trait/issue-67166.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Regression test for #67166 - -#![feature(impl_trait_in_bindings)] -#![allow(incomplete_features)] - -pub fn run() { - let _foo: Box = Box::new(()); - //~^ ERROR: missing lifetime specifier -} - -fn main() {} diff --git a/src/test/ui/impl-trait/issue-67166.stderr b/src/test/ui/impl-trait/issue-67166.stderr deleted file mode 100644 index 14c78684e3e..00000000000 --- a/src/test/ui/impl-trait/issue-67166.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/issue-67166.rs:7:31 - | -LL | let _foo: Box = Box::new(()); - | ^^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | pub fn run<'a>() { -LL | let _foo: Box = Box::new(()); - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/impl-trait/issue-69840.rs b/src/test/ui/impl-trait/issue-69840.rs deleted file mode 100644 index b270f88b688..00000000000 --- a/src/test/ui/impl-trait/issue-69840.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass - -#![feature(impl_trait_in_bindings)] -#![allow(incomplete_features)] - -struct A<'a>(&'a ()); - -trait Trait {} - -impl Trait for () {} - -pub fn foo<'a>() { - let _x: impl Trait> = (); -} - -fn main() {} diff --git a/src/test/ui/impl-trait/issues/issue-78721.rs b/src/test/ui/impl-trait/issues/issue-78721.rs deleted file mode 100644 index f7dbef9e3ff..00000000000 --- a/src/test/ui/impl-trait/issues/issue-78721.rs +++ /dev/null @@ -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 = async { 1 }; - //~^ ERROR `async` blocks are not allowed in constants - //~| ERROR destructors cannot be evaluated at compile-time - 1 - }], -} - -fn main() {} diff --git a/src/test/ui/impl-trait/issues/issue-78721.stderr b/src/test/ui/impl-trait/issues/issue-78721.stderr deleted file mode 100644 index d5712dd9200..00000000000 --- a/src/test/ui/impl-trait/issues/issue-78721.stderr +++ /dev/null @@ -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 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 = async { 1 }; - | ^^^^^^^^^^^ - | - = note: see issue #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 = 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`.