From 66c9cd9e66012cfbbd1a111e0cca96e4b214aa8c Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 12:31:58 -0300 Subject: [PATCH 01/17] Remove OpaqueTyOrigin::Binding --- compiler/rustc_ast_lowering/src/lib.rs | 21 +---- compiler/rustc_hir/src/hir.rs | 2 - .../rustc_trait_selection/src/opaque_types.rs | 4 +- compiler/rustc_typeck/src/check/check.rs | 9 +- compiler/rustc_typeck/src/check/mod.rs | 60 ------------ compiler/rustc_typeck/src/collect/type_of.rs | 57 ------------ .../duplicate.full_tait.stderr | 92 +++++++------------ .../duplicate.min_tait.stderr | 92 +++++++------------ .../ui/associated-type-bounds/duplicate.rs | 7 -- src/test/ui/associated-type-bounds/lcsit.rs | 78 ---------------- .../ui/associated-type-bounds/lcsit.stderr | 11 --- .../feature-gate-impl_trait_in_bindings.rs | 11 --- ...feature-gate-impl_trait_in_bindings.stderr | 25 ----- .../ui/impl-trait/binding-without-value.rs | 9 -- .../impl-trait/binding-without-value.stderr | 16 ---- src/test/ui/impl-trait/bindings-opaque.rs | 17 ---- src/test/ui/impl-trait/bindings-opaque.stderr | 30 ------ .../ui/impl-trait/bound-normalization-pass.rs | 34 ++----- .../impl-trait-in-bindings-issue-73003.rs | 8 -- .../impl-trait-in-bindings-issue-73003.stderr | 11 --- .../ui/impl-trait/impl-trait-in-bindings.rs | 49 ---------- .../impl-trait/impl-trait-in-bindings.stderr | 11 --- src/test/ui/impl-trait/issue-57200.rs | 15 --- src/test/ui/impl-trait/issue-57200.stderr | 8 -- src/test/ui/impl-trait/issue-57201.rs | 15 --- src/test/ui/impl-trait/issue-57201.stderr | 8 -- src/test/ui/impl-trait/issue-60473.rs | 15 --- src/test/ui/impl-trait/issue-60473.stderr | 15 --- src/test/ui/impl-trait/issue-67166.rs | 11 --- src/test/ui/impl-trait/issue-67166.stderr | 15 --- src/test/ui/impl-trait/issue-69840.rs | 16 ---- src/test/ui/impl-trait/issues/issue-78721.rs | 15 --- .../ui/impl-trait/issues/issue-78721.stderr | 31 ------- 33 files changed, 84 insertions(+), 734 deletions(-) delete mode 100644 src/test/ui/associated-type-bounds/lcsit.rs delete mode 100644 src/test/ui/associated-type-bounds/lcsit.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr delete mode 100644 src/test/ui/impl-trait/binding-without-value.rs delete mode 100644 src/test/ui/impl-trait/binding-without-value.stderr delete mode 100644 src/test/ui/impl-trait/bindings-opaque.rs delete mode 100644 src/test/ui/impl-trait/bindings-opaque.stderr delete mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs delete mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr delete mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings.rs delete mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings.stderr delete mode 100644 src/test/ui/impl-trait/issue-57200.rs delete mode 100644 src/test/ui/impl-trait/issue-57200.stderr delete mode 100644 src/test/ui/impl-trait/issue-57201.rs delete mode 100644 src/test/ui/impl-trait/issue-57201.stderr delete mode 100644 src/test/ui/impl-trait/issue-60473.rs delete mode 100644 src/test/ui/impl-trait/issue-60473.stderr delete mode 100644 src/test/ui/impl-trait/issue-67166.rs delete mode 100644 src/test/ui/impl-trait/issue-67166.stderr delete mode 100644 src/test/ui/impl-trait/issue-69840.rs delete mode 100644 src/test/ui/impl-trait/issues/issue-78721.rs delete mode 100644 src/test/ui/impl-trait/issues/issue-78721.stderr 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 @@ 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); 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 @@ 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 | 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 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, 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 @@ static SIT2: impl Iterator = iter::empty(); 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 @@ mod impl_trait { } /// `T::Assoc` should be normalized to `()` here. - fn foo_pass>() -> impl FooLike { + fn foo_pass>() -> impl FooLike { Foo(()) } } @@ -45,40 +47,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>::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`. From 13287d8dd27ea8c1c2542945ca4250137b64a5e1 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 15:06:02 -0300 Subject: [PATCH 02/17] Rename OtherOpaqueTy to TypeAliasesOpaqueTy --- compiler/rustc_ast_lowering/src/item.rs | 6 +++--- compiler/rustc_ast_lowering/src/lib.rs | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 292643d6d75..d8c4fdbb46a 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -343,7 +343,7 @@ 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, }, @@ -487,7 +487,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let mut capturable_lifetimes; let itctx = if self.sess.features_untracked().impl_trait_in_bindings { capturable_lifetimes = FxHashSet::default(); - ImplTraitContext::OtherOpaqueTy { + ImplTraitContext::TypeAliasesOpaqueTy { capturable_lifetimes: &mut capturable_lifetimes, origin: hir::OpaqueTyOrigin::Misc, } @@ -926,7 +926,7 @@ 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, }, diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 0306196f65a..d5284c1a43d 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -265,7 +265,7 @@ enum ImplTraitContext<'b, 'a> { origin: hir::OpaqueTyOrigin, }, /// Impl trait in type aliases. - OtherOpaqueTy { + 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: @@ -310,8 +310,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, origin } => { + TypeAliasesOpaqueTy { capturable_lifetimes, origin: *origin } } Disallowed(pos) => Disallowed(*pos), } @@ -1126,7 +1126,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // // fn foo() -> impl Iterator ImplTraitContext::ReturnPositionOpaqueTy { .. } - | ImplTraitContext::OtherOpaqueTy { .. } => (true, itctx), + | ImplTraitContext::TypeAliasesOpaqueTy { .. } => (true, itctx), // We are in the argument position, but within a dyn type: // @@ -1150,7 +1150,7 @@ 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,11 +1416,11 @@ 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, origin } => { // 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, }; @@ -2321,13 +2321,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(¶m); } From ac3a43b3161ade83a9c5c21baf898bef921393ed Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 15:45:24 -0300 Subject: [PATCH 03/17] Fix TypeAliasesOpaqueTy origin docs --- compiler/rustc_ast_lowering/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index d5284c1a43d..21c9721e3c6 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -280,7 +280,7 @@ enum ImplTraitContext<'b, 'a> { // FIXME(impl_trait): but `required_region_bounds` will ICE later // anyway. capturable_lifetimes: &'b mut FxHashSet, - /// Origin: Either OpaqueTyOrigin::Misc or OpaqueTyOrigin::Binding, + /// Origin: Either OpaqueTyOrigin::TyAlias or OpaqueTyOrigin::Misc, origin: hir::OpaqueTyOrigin, }, /// `impl Trait` is not accepted in this position. From bc106ebb5a8f96f905a3d96606b052fbf41b8332 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 15:48:33 -0300 Subject: [PATCH 04/17] Remove impl traits bindings error message handling on AST lowering --- compiler/rustc_ast_lowering/src/lib.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 21c9721e3c6..6ce03a9c564 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1465,17 +1465,12 @@ 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" - }; let mut err = struct_span_err!( self.sess, t.span, E0562, "`impl Trait` not allowed outside of {}", - allowed_in, + "function and inherent method return types", ); if pos == ImplTraitPosition::Binding && self.sess.is_nightly_build() { err.help( From 4d2d90307d7a7ac70a2cd4545dbe917f79eb9dff Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 16:17:56 -0300 Subject: [PATCH 05/17] Remove impl trait bindings handling on const AST lowering --- compiler/rustc_ast_lowering/src/item.rs | 12 +- .../duplicate.full_tait.stderr | 116 +++++------------- .../duplicate.min_tait.stderr | 116 +++++------------- .../ui/associated-type-bounds/duplicate.rs | 13 -- src/test/ui/impl-trait/bindings.rs | 30 ----- src/test/ui/impl-trait/bindings.stderr | 37 +++++- ...opaquely-typed-constant-used-in-pattern.rs | 10 -- ...uely-typed-constant-used-in-pattern.stderr | 8 -- 8 files changed, 104 insertions(+), 238 deletions(-) delete mode 100644 src/test/ui/impl-trait/bindings.rs delete mode 100644 src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.rs delete mode 100644 src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.stderr diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index d8c4fdbb46a..d8c879fd7cb 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -484,17 +484,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::TypeAliasesOpaqueTy { - 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)) } 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 1d230b43c9f..dcc4eac0fbd 100644 --- a/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr +++ b/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr @@ -232,55 +232,7 @@ LL | fn FAPIT3(_: impl Iterator) {} | `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 = 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 = 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 = 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 = 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 = 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 = 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:35 + --> $DIR/duplicate.rs:73:35 | LL | type TAI1> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -288,7 +240,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:88:35 + --> $DIR/duplicate.rs:75:35 | LL | type TAI2> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -296,7 +248,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:90:38 + --> $DIR/duplicate.rs:77:38 | LL | type TAI3> = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -304,7 +256,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:92:44 + --> $DIR/duplicate.rs:79:44 | LL | type TAW1 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -312,7 +264,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:94:44 + --> $DIR/duplicate.rs:81:44 | LL | type TAW2 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -320,7 +272,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:96:47 + --> $DIR/duplicate.rs:83:47 | LL | type TAW3 where T: Iterator = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -328,7 +280,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:99:36 + --> $DIR/duplicate.rs:86:36 | LL | type ETAI1> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -336,7 +288,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:101:36 + --> $DIR/duplicate.rs:88:36 | LL | type ETAI2> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -344,7 +296,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:103:39 + --> $DIR/duplicate.rs:90:39 | LL | type ETAI3> = impl Copy; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -352,7 +304,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:105:40 + --> $DIR/duplicate.rs:92:40 | LL | type ETAI4 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -360,7 +312,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:107:40 + --> $DIR/duplicate.rs:94:40 | LL | type ETAI5 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -368,7 +320,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:109:43 + --> $DIR/duplicate.rs:96:43 | LL | type ETAI6 = impl Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -376,7 +328,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:112:36 + --> $DIR/duplicate.rs:99:36 | LL | trait TRI1> {} | ---------- ^^^^^^^^^^ re-bound here @@ -384,7 +336,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:114:36 + --> $DIR/duplicate.rs:101:36 | LL | trait TRI2> {} | ---------- ^^^^^^^^^^ re-bound here @@ -392,7 +344,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:116:39 + --> $DIR/duplicate.rs:103:39 | LL | trait TRI3> {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -400,7 +352,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:118:34 + --> $DIR/duplicate.rs:105:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -408,7 +360,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:120:34 + --> $DIR/duplicate.rs:107:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -416,7 +368,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:122:37 + --> $DIR/duplicate.rs:109:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -424,7 +376,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:124:45 + --> $DIR/duplicate.rs:111:45 | LL | trait TRW1 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -432,7 +384,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:126:45 + --> $DIR/duplicate.rs:113:45 | LL | trait TRW2 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -440,7 +392,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:128:48 + --> $DIR/duplicate.rs:115:48 | LL | trait TRW3 where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -448,7 +400,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:130:46 + --> $DIR/duplicate.rs:117:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -456,7 +408,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:130:46 + --> $DIR/duplicate.rs:117:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -464,7 +416,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:133:46 + --> $DIR/duplicate.rs:120:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -472,7 +424,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:133:46 + --> $DIR/duplicate.rs:120:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -480,7 +432,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:136:49 + --> $DIR/duplicate.rs:123:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -488,7 +440,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:136:49 + --> $DIR/duplicate.rs:123:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -496,7 +448,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:146:40 + --> $DIR/duplicate.rs:133:40 | LL | type TADyn1 = dyn Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -504,7 +456,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:148:44 + --> $DIR/duplicate.rs:135:44 | LL | type TADyn2 = Box>; | ---------- ^^^^^^^^^^ re-bound here @@ -512,7 +464,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:150:43 + --> $DIR/duplicate.rs:137:43 | LL | type TADyn3 = dyn Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -520,7 +472,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:139:43 + --> $DIR/duplicate.rs:126:43 | LL | trait TRA1 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -528,7 +480,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:141:43 + --> $DIR/duplicate.rs:128:43 | LL | trait TRA2 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -536,13 +488,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:143:46 + --> $DIR/duplicate.rs:130:46 | LL | trait TRA3 { type A: Iterator; } | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 66 previous errors; 2 warnings emitted +error: aborting due to 60 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 d978a0c85fe..92058121ab6 100644 --- a/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr +++ b/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr @@ -224,55 +224,7 @@ LL | fn FAPIT3(_: impl Iterator) {} | `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 = 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 = 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 = 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 = 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 = 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 = 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:35 + --> $DIR/duplicate.rs:73:35 | LL | type TAI1> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -280,7 +232,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:88:35 + --> $DIR/duplicate.rs:75:35 | LL | type TAI2> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -288,7 +240,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:90:38 + --> $DIR/duplicate.rs:77:38 | LL | type TAI3> = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -296,7 +248,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:92:44 + --> $DIR/duplicate.rs:79:44 | LL | type TAW1 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -304,7 +256,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:94:44 + --> $DIR/duplicate.rs:81:44 | LL | type TAW2 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -312,7 +264,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:96:47 + --> $DIR/duplicate.rs:83:47 | LL | type TAW3 where T: Iterator = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -320,7 +272,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:99:36 + --> $DIR/duplicate.rs:86:36 | LL | type ETAI1> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -328,7 +280,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:101:36 + --> $DIR/duplicate.rs:88:36 | LL | type ETAI2> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -336,7 +288,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:103:39 + --> $DIR/duplicate.rs:90:39 | LL | type ETAI3> = impl Copy; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -344,7 +296,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:105:40 + --> $DIR/duplicate.rs:92:40 | LL | type ETAI4 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -352,7 +304,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:107:40 + --> $DIR/duplicate.rs:94:40 | LL | type ETAI5 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -360,7 +312,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:109:43 + --> $DIR/duplicate.rs:96:43 | LL | type ETAI6 = impl Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -368,7 +320,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:112:36 + --> $DIR/duplicate.rs:99:36 | LL | trait TRI1> {} | ---------- ^^^^^^^^^^ re-bound here @@ -376,7 +328,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:114:36 + --> $DIR/duplicate.rs:101:36 | LL | trait TRI2> {} | ---------- ^^^^^^^^^^ re-bound here @@ -384,7 +336,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:116:39 + --> $DIR/duplicate.rs:103:39 | LL | trait TRI3> {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -392,7 +344,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:118:34 + --> $DIR/duplicate.rs:105:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -400,7 +352,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:120:34 + --> $DIR/duplicate.rs:107:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -408,7 +360,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:122:37 + --> $DIR/duplicate.rs:109:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -416,7 +368,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:124:45 + --> $DIR/duplicate.rs:111:45 | LL | trait TRW1 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -424,7 +376,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:126:45 + --> $DIR/duplicate.rs:113:45 | LL | trait TRW2 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -432,7 +384,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:128:48 + --> $DIR/duplicate.rs:115:48 | LL | trait TRW3 where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -440,7 +392,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:130:46 + --> $DIR/duplicate.rs:117:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -448,7 +400,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:130:46 + --> $DIR/duplicate.rs:117:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -456,7 +408,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:133:46 + --> $DIR/duplicate.rs:120:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -464,7 +416,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:133:46 + --> $DIR/duplicate.rs:120:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -472,7 +424,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:136:49 + --> $DIR/duplicate.rs:123:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -480,7 +432,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:136:49 + --> $DIR/duplicate.rs:123:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -488,7 +440,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:146:40 + --> $DIR/duplicate.rs:133:40 | LL | type TADyn1 = dyn Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -496,7 +448,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:148:44 + --> $DIR/duplicate.rs:135:44 | LL | type TADyn2 = Box>; | ---------- ^^^^^^^^^^ re-bound here @@ -504,7 +456,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:150:43 + --> $DIR/duplicate.rs:137:43 | LL | type TADyn3 = dyn Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -512,7 +464,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:139:43 + --> $DIR/duplicate.rs:126:43 | LL | trait TRA1 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -520,7 +472,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:141:43 + --> $DIR/duplicate.rs:128:43 | LL | trait TRA2 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -528,13 +480,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:143:46 + --> $DIR/duplicate.rs:130:46 | LL | trait TRA3 { type A: Iterator; } | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 66 previous errors; 1 warning emitted +error: aborting due to 60 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 bb535e0add7..d6c73b5ffea 100644 --- a/src/test/ui/associated-type-bounds/duplicate.rs +++ b/src/test/ui/associated-type-bounds/duplicate.rs @@ -70,19 +70,6 @@ fn FAPIT2(_: impl Iterator) {} fn FAPIT3(_: impl Iterator) {} //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -const CIT1: impl Iterator = iter::empty(); -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -const CIT2: impl Iterator = iter::empty(); -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -const CIT3: impl Iterator = iter::empty(); -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -static SIT1: impl Iterator = iter::empty(); -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -static SIT2: impl Iterator = iter::empty(); -//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] -static SIT3: 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/impl-trait/bindings.rs b/src/test/ui/impl-trait/bindings.rs deleted file mode 100644 index fd79ba68fbd..00000000000 --- a/src/test/ui/impl-trait/bindings.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![feature(impl_trait_in_bindings)] -//~^ WARN the feature `impl_trait_in_bindings` is incomplete - -fn a(x: T) { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant -} - -fn b(x: T) { - let _ = move || { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant - }; -} - -trait Foo { - fn a(x: T) { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant - } -} - -impl Foo for i32 { - fn a(x: T) { - const foo: impl Clone = x; - //~^ ERROR attempt to use a non-constant value in a constant - } -} - -fn main() { } diff --git a/src/test/ui/impl-trait/bindings.stderr b/src/test/ui/impl-trait/bindings.stderr index 4da49f4dc7d..05f3f2e0d3e 100644 --- a/src/test/ui/impl-trait/bindings.stderr +++ b/src/test/ui/impl-trait/bindings.stderr @@ -30,6 +30,38 @@ LL | const foo: impl Clone = x; | | | help: consider using `let` instead of `const`: `let foo` +error[E0562]: `impl Trait` not allowed outside of function and inherent method return types + --> $DIR/bindings.rs:5:16 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = 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/bindings.rs:11:20 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = 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/bindings.rs:18:20 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = 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/bindings.rs:25:20 + | +LL | const foo: impl Clone = x; + | ^^^^^^^^^^ + | + = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable + 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 | @@ -39,6 +71,7 @@ LL | #![feature(impl_trait_in_bindings)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #63065 for more information -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 8 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0435`. +Some errors have detailed explanations: E0435, E0562. +For more information about an error, try `rustc --explain E0435`. diff --git a/src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.rs b/src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.rs deleted file mode 100644 index 65f27cf78f1..00000000000 --- a/src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.rs +++ /dev/null @@ -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 - _ => {} - } -} diff --git a/src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.stderr b/src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.stderr deleted file mode 100644 index 62dc856be82..00000000000 --- a/src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.stderr +++ /dev/null @@ -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 - From 962ac8183d174d409db549cd6b502d847aa04f12 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 16:55:31 -0300 Subject: [PATCH 06/17] Remove impl_trait_in_bindings handling on inference error reporting --- .../infer/error_reporting/need_type_info.rs | 7 +- src/test/ui/impl-trait/bindings.stderr | 77 ------------------- ...infer-async-enabled-impl-trait-bindings.rs | 17 ---- ...r-async-enabled-impl-trait-bindings.stderr | 21 ----- 4 files changed, 2 insertions(+), 120 deletions(-) delete mode 100644 src/test/ui/impl-trait/bindings.stderr delete mode 100644 src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs delete mode 100644 src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index d9a1193aac4..9a718102cf1 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -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(), diff --git a/src/test/ui/impl-trait/bindings.stderr b/src/test/ui/impl-trait/bindings.stderr deleted file mode 100644 index 05f3f2e0d3e..00000000000 --- a/src/test/ui/impl-trait/bindings.stderr +++ /dev/null @@ -1,77 +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` - -error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/bindings.rs:5:16 - | -LL | const foo: impl Clone = x; - | ^^^^^^^^^^ - | - = 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/bindings.rs:11:20 - | -LL | const foo: impl Clone = x; - | ^^^^^^^^^^ - | - = 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/bindings.rs:18:20 - | -LL | const foo: impl Clone = x; - | ^^^^^^^^^^ - | - = 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/bindings.rs:25:20 - | -LL | const foo: impl Clone = x; - | ^^^^^^^^^^ - | - = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable - -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 for more information - -error: aborting due to 8 previous errors; 1 warning emitted - -Some errors have detailed explanations: E0435, E0562. -For more information about an error, try `rustc --explain E0435`. diff --git a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs b/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs deleted file mode 100644 index 7beb2db3969..00000000000 --- a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs +++ /dev/null @@ -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 - }; -} diff --git a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr b/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr deleted file mode 100644 index 8e632fbc1de..00000000000 --- a/src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr +++ /dev/null @@ -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 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`. From d98384595f105179fef37960f37a636e562d6425 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 17:12:34 -0300 Subject: [PATCH 07/17] Removing unhandled region constraint error that is only for impl_trait_in_bindings --- .../src/borrow_check/member_constraints.rs | 5 --- .../src/borrow_check/region_infer/mod.rs | 34 +++---------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/compiler/rustc_mir/src/borrow_check/member_constraints.rs b/compiler/rustc_mir/src/borrow_check/member_constraints.rs index baaf6f27ee8..2e2578df011 100644 --- a/compiler/rustc_mir/src/borrow_check/member_constraints.rs +++ b/compiler/rustc_mir/src/borrow_check/member_constraints.rs @@ -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, - /// 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, diff --git a/compiler/rustc_mir/src/borrow_check/region_infer/mod.rs b/compiler/rustc_mir/src/borrow_check/region_infer/mod.rs index 0306782bfe4..c40e6bf1ec3 100644 --- a/compiler/rustc_mir/src/borrow_check/region_infer/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/region_infer/mod.rs @@ -551,7 +551,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { polonius_output: Option>, ) -> (Option>, 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 = choice_regions.to_vec(); From 000b945ceaed1b74b101f96889b63d48d877ba69 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 18:23:36 -0300 Subject: [PATCH 08/17] Remove OpaqueTyOrigin::Misc, use TyAlias instead --- compiler/rustc_ast_lowering/src/lib.rs | 4 ++-- compiler/rustc_hir/src/hir.rs | 2 -- compiler/rustc_trait_selection/src/opaque_types.rs | 4 ++-- compiler/rustc_typeck/src/check/check.rs | 2 +- compiler/rustc_typeck/src/check/writeback.rs | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 6ce03a9c564..37809c377ca 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -280,7 +280,7 @@ enum ImplTraitContext<'b, 'a> { // FIXME(impl_trait): but `required_region_bounds` will ICE later // anyway. capturable_lifetimes: &'b mut FxHashSet, - /// Origin: Either OpaqueTyOrigin::TyAlias or OpaqueTyOrigin::Misc, + /// Origin: OpaqueTyOrigin::TyAlias origin: hir::OpaqueTyOrigin, }, /// `impl Trait` is not accepted in this position. @@ -1152,7 +1152,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { true, ImplTraitContext::TypeAliasesOpaqueTy { capturable_lifetimes: &mut capturable_lifetimes, - origin: hir::OpaqueTyOrigin::Misc, + origin: hir::OpaqueTyOrigin::TyAlias, }, ) } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 141788e7df4..fd5ee75effe 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2272,8 +2272,6 @@ pub enum OpaqueTyOrigin { AsyncFn, /// type aliases: `type Foo = impl Trait;` TyAlias, - /// Impl trait consts, statics, bounds. - Misc, } /// The various kinds of types recognized by the compiler. diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index f380ad54d7f..39013a317fd 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -402,7 +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::TyAlias | hir::OpaqueTyOrigin::Misc => 0, + hir::OpaqueTyOrigin::TyAlias => 0, }; let span = tcx.def_span(def_id); @@ -994,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 = diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 98ac604b09f..8db95957816 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -700,7 +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::Misc | hir::OpaqueTyOrigin::TyAlias => {} + hir::OpaqueTyOrigin::TyAlias => {} } let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); diff --git a/compiler/rustc_typeck/src/check/writeback.rs b/compiler/rustc_typeck/src/check/writeback.rs index 0aa059b7de8..190ce782cfe 100644 --- a/compiler/rustc_typeck/src/check/writeback.rs +++ b/compiler/rustc_typeck/src/check/writeback.rs @@ -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 let hir::OpaqueTyOrigin::TyAlias = opaque_defn.origin { if opaque_type_key.def_id == definition_ty_def_id { debug!( "skipping adding concrete definition for opaque type {:?} {:?}", From 5cefdbdab5f1308c86193db7c92f807e4e49a402 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 15 Jul 2021 12:42:18 -0300 Subject: [PATCH 09/17] Use == to compare OpaqueTyOrigin values --- compiler/rustc_hir/src/hir.rs | 2 +- compiler/rustc_typeck/src/check/writeback.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index fd5ee75effe..5c7d10560ca 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2264,7 +2264,7 @@ 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, diff --git a/compiler/rustc_typeck/src/check/writeback.rs b/compiler/rustc_typeck/src/check/writeback.rs index 190ce782cfe..935bcc9f32e 100644 --- a/compiler/rustc_typeck/src/check/writeback.rs +++ b/compiler/rustc_typeck/src/check/writeback.rs @@ -521,7 +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::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 {:?} {:?}", From c34fb5167ed315fc7f4ae3a3311b9b4de9d060ec Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 15 Jul 2021 12:43:54 -0300 Subject: [PATCH 10/17] Remove origin field from TypeAliasesOpaqueTy --- compiler/rustc_ast_lowering/src/item.rs | 2 -- compiler/rustc_ast_lowering/src/lib.rs | 12 ++++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index d8c879fd7cb..9f9d41c3f3d 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -345,7 +345,6 @@ impl<'hir> LoweringContext<'_, 'hir> { ty, ImplTraitContext::TypeAliasesOpaqueTy { capturable_lifetimes: &mut FxHashSet::default(), - origin: hir::OpaqueTyOrigin::TyAlias, }, ); let generics = self.lower_generics(gen, ImplTraitContext::disallowed()); @@ -918,7 +917,6 @@ impl<'hir> LoweringContext<'_, 'hir> { ty, ImplTraitContext::TypeAliasesOpaqueTy { capturable_lifetimes: &mut FxHashSet::default(), - origin: hir::OpaqueTyOrigin::TyAlias, }, ); hir::ImplItemKind::TyAlias(ty) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 37809c377ca..f6f47b11ce2 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -280,8 +280,6 @@ enum ImplTraitContext<'b, 'a> { // FIXME(impl_trait): but `required_region_bounds` will ICE later // anyway. capturable_lifetimes: &'b mut FxHashSet, - /// Origin: OpaqueTyOrigin::TyAlias - 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 } } - TypeAliasesOpaqueTy { capturable_lifetimes, origin } => { - TypeAliasesOpaqueTy { capturable_lifetimes, origin: *origin } + TypeAliasesOpaqueTy { capturable_lifetimes } => { + TypeAliasesOpaqueTy { capturable_lifetimes } } Disallowed(pos) => Disallowed(*pos), } @@ -1152,7 +1150,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { true, ImplTraitContext::TypeAliasesOpaqueTy { capturable_lifetimes: &mut capturable_lifetimes, - origin: hir::OpaqueTyOrigin::TyAlias, }, ) } @@ -1416,18 +1413,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { None, |this| this.lower_param_bounds(bounds, itctx), ), - ImplTraitContext::TypeAliasesOpaqueTy { 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::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), From ba1e13fa668ee8e634030c90714a091d8dbfc73a Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 14 Jul 2021 19:00:48 -0300 Subject: [PATCH 11/17] Revert "structural_match: non-structural-match ty closures" Reverts #73353 --- compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs | 3 --- .../rustc_trait_selection/src/traits/structural_match.rs | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index 3859b22223c..926bd830da0 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -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") } diff --git a/compiler/rustc_trait_selection/src/traits/structural_match.rs b/compiler/rustc_trait_selection/src/traits/structural_match.rs index 3d20a8d5cf3..a6323a65aad 100644 --- a/compiler/rustc_trait_selection/src/traits/structural_match.rs +++ b/compiler/rustc_trait_selection/src/traits/structural_match.rs @@ -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(_) => { From a0e1291c2db0b76b6cfc31bc14466e5f620b9126 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 15 Jul 2021 09:47:33 -0300 Subject: [PATCH 12/17] Add `sub_types` docs --- compiler/rustc_mir/src/borrow_check/type_check/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs index b4fe3313e8a..d6c3ba61731 100644 --- a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs @@ -1119,6 +1119,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { ) } + /// Try to relate `sub <: sup` fn sub_types( &mut self, sub: Ty<'tcx>, From a002f4513b822aa0f5e694ac37701e41de275232 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 15 Jul 2021 09:48:14 -0300 Subject: [PATCH 13/17] Remove `sub_types_or_anon` --- .../src/borrow_check/type_check/mod.rs | 32 +--------- .../ui/type-alias-impl-trait/issue-85113.rs | 23 ------- .../type-alias-impl-trait/issue-85113.stderr | 60 ------------------- 3 files changed, 2 insertions(+), 113 deletions(-) delete mode 100644 src/test/ui/type-alias-impl-trait/issue-85113.rs delete mode 100644 src/test/ui/type-alias-impl-trait/issue-85113.stderr diff --git a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs index d6c3ba61731..cbcf050c9b8 100644 --- a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs @@ -1130,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>, @@ -1490,7 +1464,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, @@ -1777,9 +1751,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, diff --git a/src/test/ui/type-alias-impl-trait/issue-85113.rs b/src/test/ui/type-alias-impl-trait/issue-85113.rs deleted file mode 100644 index 0c37399df8d..00000000000 --- a/src/test/ui/type-alias-impl-trait/issue-85113.rs +++ /dev/null @@ -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 `&' 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); -} diff --git a/src/test/ui/type-alias-impl-trait/issue-85113.stderr b/src/test/ui/type-alias-impl-trait/issue-85113.stderr deleted file mode 100644 index 233c996340d..00000000000 --- a/src/test/ui/type-alias-impl-trait/issue-85113.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/issue-85113.rs:5:29 - | -LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; - | ^^^^^^^^^^^^^^^^^^^^ - | -note: hidden type `&' str` captures lifetime smaller than the function body - --> $DIR/issue-85113.rs:5:29 - | -LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; - | ^^^^^^^^^^^^^^^^^^^^ - -error: concrete type differs from previous defining opaque type use - --> $DIR/issue-85113.rs:14:1 - | -LL | fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&' str`, got `&'a str` - | -note: previous use here - --> $DIR/issue-85113.rs:14:1 - | -LL | fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0477]: the type `&' str` does not fulfill the required lifetime - --> $DIR/issue-85113.rs:5:29 - | -LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; - | ^^^^^^^^^^^^^^^^^^^^ - | -note: type must outlive the lifetime `'a` as defined on the item at 5:23 - --> $DIR/issue-85113.rs:5:23 - | -LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; - | ^^ - -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/issue-85113.rs:5:29 - | -LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: first, the lifetime cannot outlive the empty lifetime... -note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the item at 5:23... - --> $DIR/issue-85113.rs:5:23 - | -LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; - | ^^ -note: ...so that the types are compatible - --> $DIR/issue-85113.rs:5:29 - | -LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; - | ^^^^^^^^^^^^^^^^^^^^ - = note: expected `Output<'a>` - found `Output<'_>` - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0477, E0495, E0700. -For more information about an error, try `rustc --explain E0477`. From 75585b408fa3563188c3bffa8bb13ad1b1334414 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 15 Jul 2021 09:55:13 -0300 Subject: [PATCH 14/17] Move mir_def_id inside `eq_opaque_type_and_type` --- .../src/borrow_check/type_check/input_output.rs | 2 -- compiler/rustc_mir/src/borrow_check/type_check/mod.rs | 11 +++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs b/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs index 1bb447d1057..37e0643228a 100644 --- a/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs +++ b/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs @@ -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, ) { diff --git a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs index cbcf050c9b8..aa3ff98f7ff 100644 --- a/compiler/rustc_mir/src/borrow_check/type_check/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/type_check/mod.rs @@ -1182,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. @@ -1210,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<()> { @@ -1245,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, @@ -1268,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, From e8c04b4386d015e126591c799b562d6a578acc40 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 16 Jul 2021 10:06:26 -0300 Subject: [PATCH 15/17] Remove impl_trait_in_bindings feature flag --- compiler/rustc_ast_lowering/src/lib.rs | 8 +- compiler/rustc_feature/src/active.rs | 3 - compiler/rustc_feature/src/removed.rs | 4 + compiler/rustc_typeck/src/check/check.rs | 4 +- .../rustc_typeck/src/check/gather_locals.rs | 24 +--- compiler/rustc_typeck/src/check/mod.rs | 15 +- .../impl-trait-in-bindings.md | 28 ---- .../duplicate.full_tait.stderr | 130 ++++++++--------- .../duplicate.min_tait.stderr | 131 ++++++++---------- .../ui/associated-type-bounds/duplicate.rs | 1 - .../ui/associated-type-bounds/dyn-lcsit.rs | 69 --------- .../associated-type-bounds/dyn-lcsit.stderr | 11 -- ...orted_main_const_fn_item_type_forbidden.rs | 4 +- ...d_main_const_fn_item_type_forbidden.stderr | 25 +++- ...feature-gate-associated_type_bounds.stderr | 6 - .../feature-gate-type_alias_impl_trait.rs | 2 +- .../feature-gate-type_alias_impl_trait.stderr | 15 +- .../generator/layout-error.full_tait.stderr | 18 +-- .../ui/generator/layout-error.min_tait.stderr | 27 +--- src/test/ui/generator/layout-error.rs | 6 +- ...ata-sufficient-for-layout.full_tait.stderr | 14 +- ...data-sufficient-for-layout.min_tait.stderr | 26 +--- .../metadata-sufficient-for-layout.rs | 11 +- .../ui/impl-trait/bound-normalization-fail.rs | 15 +- .../bound-normalization-fail.stderr | 33 ++--- .../bound-normalization-pass.default.stderr | 11 -- .../ui/impl-trait/bound-normalization-pass.rs | 2 - .../bound-normalization-pass.sa.stderr | 11 -- .../issues/issue-70877.full_tait.stderr | 2 +- .../issues/issue-70877.min_tait.stderr | 2 +- src/test/ui/impl-trait/issues/issue-70877.rs | 1 - .../issues/issue-78722.full_tait.stderr | 45 +++--- .../issues/issue-78722.min_tait.stderr | 46 +++--- src/test/ui/impl-trait/issues/issue-78722.rs | 5 +- src/test/ui/impl-trait/where-allowed.stderr | 2 - src/test/ui/mir/issue-75053.full_tait.stderr | 12 +- .../ui/mir/issue-75053.in_bindings.stderr | 23 +-- src/test/ui/mir/issue-75053.min_tait.stderr | 12 +- src/test/ui/mir/issue-75053.rs | 7 +- .../issue-53096.full_tait.stderr | 16 +-- .../issue-53096.min_tait.stderr | 12 +- .../ui/type-alias-impl-trait/issue-53096.rs | 10 +- ...78-generator-and-const-fn.full_tait.stderr | 18 +-- ...678-generator-and-const-fn.min_tait.stderr | 12 +- .../issue-53678-generator-and-const-fn.rs | 7 +- .../type-alias-impl-trait/issue-60371.stderr | 8 +- .../issue-60407.full_tait.stderr | 14 +- .../issue-60407.min_tait.stderr | 26 +--- .../ui/type-alias-impl-trait/issue-60407.rs | 10 +- ...-opaque-ty-from-val-twice.full_tait.stderr | 14 +- ...sue-65679-inst-opaque-ty-from-val-twice.rs | 6 +- ..._inferrable_concrete_type.full_tait.stderr | 14 +- ...o_inferrable_concrete_type.min_tait.stderr | 14 +- .../no_inferrable_concrete_type.rs | 9 +- .../structural-match-no-leak.full_tait.stderr | 14 +- .../structural-match-no-leak.min_tait.stderr | 12 +- .../structural-match-no-leak.rs | 7 +- .../structural-match.full_tait.stderr | 14 +- .../structural-match.min_tait.stderr | 12 +- .../type-alias-impl-trait/structural-match.rs | 7 +- ...pe-alias-impl-trait-const.full_tait.stderr | 25 +++- ...ype-alias-impl-trait-const.min_tait.stderr | 24 +++- .../type-alias-impl-trait-const.rs | 13 +- 63 files changed, 388 insertions(+), 741 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/impl-trait-in-bindings.md delete mode 100644 src/test/ui/associated-type-bounds/dyn-lcsit.rs delete mode 100644 src/test/ui/associated-type-bounds/dyn-lcsit.stderr delete mode 100644 src/test/ui/impl-trait/bound-normalization-pass.default.stderr delete mode 100644 src/test/ui/impl-trait/bound-normalization-pass.sa.stderr diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index f6f47b11ce2..9718739f813 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1460,7 +1460,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { }), )) } - ImplTraitContext::Disallowed(pos) => { + ImplTraitContext::Disallowed(_) => { let mut err = struct_span_err!( self.sess, t.span, @@ -1468,12 +1468,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { "`impl Trait` not allowed outside of {}", "function and inherent 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 } diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 15123b5b28d..a3e40daf6bf 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -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), diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index 6d3e2b9c517..d4a7ede8901 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -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("removed due to being incomplete and unstable")), + // ------------------------------------------------------------------------- // feature-group-end: removed features // ------------------------------------------------------------------------- diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 8db95957816..b5db3331d04 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -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). diff --git a/compiler/rustc_typeck/src/check/gather_locals.rs b/compiler/rustc_typeck/src/check/gather_locals.rs index 2683e886eeb..4ebfd7fd212 100644 --- a/compiler/rustc_typeck/src/check/gather_locals.rs +++ b/compiler/rustc_typeck/src/check/gather_locals.rs @@ -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>) -> 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, }; diff --git a/compiler/rustc_typeck/src/check/mod.rs b/compiler/rustc_typeck/src/check/mod.rs index 11f0b47a457..d30b057e26f 100644 --- a/compiler/rustc_typeck/src/check/mod.rs +++ b/compiler/rustc_typeck/src/check/mod.rs @@ -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 }; diff --git a/src/doc/unstable-book/src/language-features/impl-trait-in-bindings.md b/src/doc/unstable-book/src/language-features/impl-trait-in-bindings.md deleted file mode 100644 index 5c6aa912c1b..00000000000 --- a/src/doc/unstable-book/src/language-features/impl-trait-in-bindings.md +++ /dev/null @@ -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. 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 dcc4eac0fbd..bffa5150fe1 100644 --- a/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr +++ b/src/test/ui/associated-type-bounds/duplicate.full_tait.stderr @@ -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 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 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -24,7 +16,7 @@ LL | struct SI1> { 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -32,7 +24,7 @@ LL | struct SI2> { 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> { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -40,7 +32,7 @@ LL | struct SI3> { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -48,7 +40,7 @@ LL | struct SW1 where T: Iterator { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -56,7 +48,7 @@ LL | struct SW2 where T: Iterator { 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 where T: Iterator { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -64,7 +56,7 @@ LL | struct SW3 where T: Iterator { 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> { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -72,7 +64,7 @@ LL | enum EI1> { 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> { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -80,7 +72,7 @@ LL | enum EI2> { 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> { V(T) } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -88,7 +80,7 @@ LL | enum EI3> { 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 where T: Iterator { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -96,7 +88,7 @@ LL | enum EW1 where T: Iterator { 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 where T: Iterator { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -104,7 +96,7 @@ LL | enum EW2 where T: Iterator { 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 where T: Iterator { V(T) } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -112,7 +104,7 @@ LL | enum EW3 where T: Iterator { 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -120,7 +112,7 @@ LL | union UI1> { 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -128,7 +120,7 @@ LL | union UI2> { 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> { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -136,7 +128,7 @@ LL | union UI3> { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -144,7 +136,7 @@ LL | union UW1 where T: Iterator { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -152,7 +144,7 @@ LL | union UW2 where T: Iterator { 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 where T: Iterator { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -160,7 +152,7 @@ LL | union UW3 where T: Iterator { 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>() {} | ---------- ^^^^^^^^^^ re-bound here @@ -168,7 +160,7 @@ LL | fn FI1>() {} | `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>() {} | ---------- ^^^^^^^^^^ re-bound here @@ -176,7 +168,7 @@ LL | fn FI2>() {} | `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>() {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -184,7 +176,7 @@ LL | fn FI3>() {} | `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() where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -192,7 +184,7 @@ LL | fn FW1() 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:58:43 + --> $DIR/duplicate.rs:57:43 | LL | fn FW2() where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -200,7 +192,7 @@ LL | fn FW2() 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:60:46 + --> $DIR/duplicate.rs:59:46 | LL | fn FW3() where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -208,7 +200,7 @@ LL | fn FW3() 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:66:40 + --> $DIR/duplicate.rs:65:40 | LL | fn FAPIT1(_: impl Iterator) {} | ---------- ^^^^^^^^^^ re-bound here @@ -216,7 +208,7 @@ LL | fn FAPIT1(_: impl Iterator) {} | `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) {} | ---------- ^^^^^^^^^^ re-bound here @@ -224,7 +216,7 @@ LL | fn FAPIT2(_: impl Iterator) {} | `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) {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -232,7 +224,7 @@ LL | fn FAPIT3(_: impl Iterator) {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:73:35 + --> $DIR/duplicate.rs:72:35 | LL | type TAI1> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -240,7 +232,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:75:35 + --> $DIR/duplicate.rs:74:35 | LL | type TAI2> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -248,7 +240,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:77:38 + --> $DIR/duplicate.rs:76:38 | LL | type TAI3> = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -256,7 +248,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:79:44 + --> $DIR/duplicate.rs:78:44 | LL | type TAW1 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -264,7 +256,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:81:44 + --> $DIR/duplicate.rs:80:44 | LL | type TAW2 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -272,7 +264,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:83:47 + --> $DIR/duplicate.rs:82:47 | LL | type TAW3 where T: Iterator = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -280,7 +272,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:86:36 + --> $DIR/duplicate.rs:85:36 | LL | type ETAI1> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -288,7 +280,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:88:36 + --> $DIR/duplicate.rs:87:36 | LL | type ETAI2> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -296,7 +288,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:90:39 + --> $DIR/duplicate.rs:89:39 | LL | type ETAI3> = impl Copy; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -304,7 +296,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:92:40 + --> $DIR/duplicate.rs:91:40 | LL | type ETAI4 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -312,7 +304,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:94:40 + --> $DIR/duplicate.rs:93:40 | LL | type ETAI5 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -320,7 +312,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:96:43 + --> $DIR/duplicate.rs:95:43 | LL | type ETAI6 = impl Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -328,7 +320,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:99:36 + --> $DIR/duplicate.rs:98:36 | LL | trait TRI1> {} | ---------- ^^^^^^^^^^ re-bound here @@ -336,7 +328,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:101:36 + --> $DIR/duplicate.rs:100:36 | LL | trait TRI2> {} | ---------- ^^^^^^^^^^ re-bound here @@ -344,7 +336,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:103:39 + --> $DIR/duplicate.rs:102:39 | LL | trait TRI3> {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -352,7 +344,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:105:34 + --> $DIR/duplicate.rs:104:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -360,7 +352,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:107:34 + --> $DIR/duplicate.rs:106:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -368,7 +360,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:109:37 + --> $DIR/duplicate.rs:108:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -376,7 +368,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:111:45 + --> $DIR/duplicate.rs:110:45 | LL | trait TRW1 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -384,7 +376,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:113:45 + --> $DIR/duplicate.rs:112:45 | LL | trait TRW2 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -392,7 +384,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:115:48 + --> $DIR/duplicate.rs:114:48 | LL | trait TRW3 where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -400,7 +392,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:117:46 + --> $DIR/duplicate.rs:116:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -408,7 +400,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:117:46 + --> $DIR/duplicate.rs:116:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -416,7 +408,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:120:46 + --> $DIR/duplicate.rs:119:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -424,7 +416,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:120:46 + --> $DIR/duplicate.rs:119:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -432,7 +424,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:123:49 + --> $DIR/duplicate.rs:122:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -440,7 +432,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:123:49 + --> $DIR/duplicate.rs:122:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -448,7 +440,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:133:40 + --> $DIR/duplicate.rs:132:40 | LL | type TADyn1 = dyn Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -456,7 +448,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:135:44 + --> $DIR/duplicate.rs:134:44 | LL | type TADyn2 = Box>; | ---------- ^^^^^^^^^^ re-bound here @@ -464,7 +456,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:137:43 + --> $DIR/duplicate.rs:136:43 | LL | type TADyn3 = dyn Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -472,7 +464,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:126:43 + --> $DIR/duplicate.rs:125:43 | LL | trait TRA1 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -480,7 +472,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:128:43 + --> $DIR/duplicate.rs:127:43 | LL | trait TRA2 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -488,13 +480,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:130:46 + --> $DIR/duplicate.rs:129:46 | LL | trait TRA3 { type A: Iterator; } | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 60 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`. 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 92058121ab6..06bfac588de 100644 --- a/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr +++ b/src/test/ui/associated-type-bounds/duplicate.min_tait.stderr @@ -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 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -16,7 +7,7 @@ LL | struct SI1> { 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -24,7 +15,7 @@ LL | struct SI2> { 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> { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -32,7 +23,7 @@ LL | struct SI3> { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -40,7 +31,7 @@ LL | struct SW1 where T: Iterator { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -48,7 +39,7 @@ LL | struct SW2 where T: Iterator { 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 where T: Iterator { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -56,7 +47,7 @@ LL | struct SW3 where T: Iterator { 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> { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -64,7 +55,7 @@ LL | enum EI1> { 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> { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -72,7 +63,7 @@ LL | enum EI2> { 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> { V(T) } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -80,7 +71,7 @@ LL | enum EI3> { 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 where T: Iterator { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -88,7 +79,7 @@ LL | enum EW1 where T: Iterator { 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 where T: Iterator { V(T) } | ---------- ^^^^^^^^^^ re-bound here @@ -96,7 +87,7 @@ LL | enum EW2 where T: Iterator { 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 where T: Iterator { V(T) } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -104,7 +95,7 @@ LL | enum EW3 where T: Iterator { 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -112,7 +103,7 @@ LL | union UI1> { 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> { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -120,7 +111,7 @@ LL | union UI2> { 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> { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -128,7 +119,7 @@ LL | union UI3> { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -136,7 +127,7 @@ LL | union UW1 where T: Iterator { 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 where T: Iterator { f: T } | ---------- ^^^^^^^^^^ re-bound here @@ -144,7 +135,7 @@ LL | union UW2 where T: Iterator { 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 where T: Iterator { f: T } | ------------- ^^^^^^^^^^^^^ re-bound here @@ -152,7 +143,7 @@ LL | union UW3 where T: Iterator { 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>() {} | ---------- ^^^^^^^^^^ re-bound here @@ -160,7 +151,7 @@ LL | fn FI1>() {} | `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>() {} | ---------- ^^^^^^^^^^ re-bound here @@ -168,7 +159,7 @@ LL | fn FI2>() {} | `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>() {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -176,7 +167,7 @@ LL | fn FI3>() {} | `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() where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -184,7 +175,7 @@ LL | fn FW1() 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:58:43 + --> $DIR/duplicate.rs:57:43 | LL | fn FW2() where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -192,7 +183,7 @@ LL | fn FW2() 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:60:46 + --> $DIR/duplicate.rs:59:46 | LL | fn FW3() where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -200,7 +191,7 @@ LL | fn FW3() 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:66:40 + --> $DIR/duplicate.rs:65:40 | LL | fn FAPIT1(_: impl Iterator) {} | ---------- ^^^^^^^^^^ re-bound here @@ -208,7 +199,7 @@ LL | fn FAPIT1(_: impl Iterator) {} | `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) {} | ---------- ^^^^^^^^^^ re-bound here @@ -216,7 +207,7 @@ LL | fn FAPIT2(_: impl Iterator) {} | `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) {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -224,7 +215,7 @@ LL | fn FAPIT3(_: impl Iterator) {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:73:35 + --> $DIR/duplicate.rs:72:35 | LL | type TAI1> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -232,7 +223,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:75:35 + --> $DIR/duplicate.rs:74:35 | LL | type TAI2> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -240,7 +231,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:77:38 + --> $DIR/duplicate.rs:76:38 | LL | type TAI3> = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -248,7 +239,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:79:44 + --> $DIR/duplicate.rs:78:44 | LL | type TAW1 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -256,7 +247,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:81:44 + --> $DIR/duplicate.rs:80:44 | LL | type TAW2 where T: Iterator = T; | ---------- ^^^^^^^^^^ re-bound here @@ -264,7 +255,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:83:47 + --> $DIR/duplicate.rs:82:47 | LL | type TAW3 where T: Iterator = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -272,7 +263,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:86:36 + --> $DIR/duplicate.rs:85:36 | LL | type ETAI1> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -280,7 +271,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:88:36 + --> $DIR/duplicate.rs:87:36 | LL | type ETAI2> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -288,7 +279,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:90:39 + --> $DIR/duplicate.rs:89:39 | LL | type ETAI3> = impl Copy; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -296,7 +287,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:92:40 + --> $DIR/duplicate.rs:91:40 | LL | type ETAI4 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -304,7 +295,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:94:40 + --> $DIR/duplicate.rs:93:40 | LL | type ETAI5 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -312,7 +303,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:96:43 + --> $DIR/duplicate.rs:95:43 | LL | type ETAI6 = impl Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -320,7 +311,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:99:36 + --> $DIR/duplicate.rs:98:36 | LL | trait TRI1> {} | ---------- ^^^^^^^^^^ re-bound here @@ -328,7 +319,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:101:36 + --> $DIR/duplicate.rs:100:36 | LL | trait TRI2> {} | ---------- ^^^^^^^^^^ re-bound here @@ -336,7 +327,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:103:39 + --> $DIR/duplicate.rs:102:39 | LL | trait TRI3> {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -344,7 +335,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:105:34 + --> $DIR/duplicate.rs:104:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -352,7 +343,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:107:34 + --> $DIR/duplicate.rs:106:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -360,7 +351,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:109:37 + --> $DIR/duplicate.rs:108:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -368,7 +359,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:111:45 + --> $DIR/duplicate.rs:110:45 | LL | trait TRW1 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -376,7 +367,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:113:45 + --> $DIR/duplicate.rs:112:45 | LL | trait TRW2 where T: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -384,7 +375,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:115:48 + --> $DIR/duplicate.rs:114:48 | LL | trait TRW3 where T: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -392,7 +383,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:117:46 + --> $DIR/duplicate.rs:116:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -400,7 +391,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:117:46 + --> $DIR/duplicate.rs:116:46 | LL | trait TRSW1 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -408,7 +399,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:120:46 + --> $DIR/duplicate.rs:119:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -416,7 +407,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:120:46 + --> $DIR/duplicate.rs:119:46 | LL | trait TRSW2 where Self: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -424,7 +415,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:123:49 + --> $DIR/duplicate.rs:122:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -432,7 +423,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:123:49 + --> $DIR/duplicate.rs:122:49 | LL | trait TRSW3 where Self: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -440,7 +431,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:133:40 + --> $DIR/duplicate.rs:132:40 | LL | type TADyn1 = dyn Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -448,7 +439,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:135:44 + --> $DIR/duplicate.rs:134:44 | LL | type TADyn2 = Box>; | ---------- ^^^^^^^^^^ re-bound here @@ -456,7 +447,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:137:43 + --> $DIR/duplicate.rs:136:43 | LL | type TADyn3 = dyn Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -464,7 +455,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:126:43 + --> $DIR/duplicate.rs:125:43 | LL | trait TRA1 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -472,7 +463,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:128:43 + --> $DIR/duplicate.rs:127:43 | LL | trait TRA2 { type A: Iterator; } | ---------- ^^^^^^^^^^ re-bound here @@ -480,13 +471,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:130:46 + --> $DIR/duplicate.rs:129:46 | LL | trait TRA3 { type A: Iterator; } | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 60 previous errors; 1 warning emitted +error: aborting due to 60 previous errors 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 d6c73b5ffea..0d7804ef1a7 100644 --- a/src/test/ui/associated-type-bounds/duplicate.rs +++ b/src/test/ui/associated-type-bounds/duplicate.rs @@ -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; diff --git a/src/test/ui/associated-type-bounds/dyn-lcsit.rs b/src/test/ui/associated-type-bounds/dyn-lcsit.rs deleted file mode 100644 index b7869e22b4a..00000000000 --- a/src/test/ui/associated-type-bounds/dyn-lcsit.rs +++ /dev/null @@ -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(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: &dyn Tr1 = &S1; -const sdef_et1: &dyn Tr1 = &S1; -pub fn use_et1() { assert_copy(cdef_et1.mk()); assert_copy(sdef_et1.mk()); } - -const cdef_et2: &(dyn Tr1 + Sync) = &S1; -static sdef_et2: &(dyn Tr1 + Sync) = &S1; -pub fn use_et2() { assert_static(cdef_et2.mk()); assert_static(sdef_et2.mk()); } - -const cdef_et3: &dyn Tr1>>> = { - struct A; - impl Tr1 for A { - type As1 = core::ops::Range; - 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 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 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(); -} diff --git a/src/test/ui/associated-type-bounds/dyn-lcsit.stderr b/src/test/ui/associated-type-bounds/dyn-lcsit.stderr deleted file mode 100644 index 3637f9558be..00000000000 --- a/src/test/ui/associated-type-bounds/dyn-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/dyn-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/entry-point/imported_main_const_fn_item_type_forbidden.rs b/src/test/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs index 559f10de109..d8553815b75 100644 --- a/src/test/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs +++ b/src/test/ui/entry-point/imported_main_const_fn_item_type_forbidden.rs @@ -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; diff --git a/src/test/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr b/src/test/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr index 9b879fc09f7..c4c0afc5687 100644 --- a/src/test/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr +++ b/src/test/ui/entry-point/imported_main_const_fn_item_type_forbidden.stderr @@ -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`. diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr index be5d35139b6..6a048ee8797 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr @@ -120,24 +120,18 @@ error[E0562]: `impl Trait` not allowed outside of function and inherent method r | LL | const _cdef: impl Tr1 = 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 --> $DIR/feature-gate-associated_type_bounds.rs:64:15 | LL | static _sdef: impl Tr1 = 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 --> $DIR/feature-gate-associated_type_bounds.rs:71:12 | LL | let _: impl Tr1 = S1; | ^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable error[E0277]: the trait bound `<::A as Iterator>::Item: Copy` is not satisfied --> $DIR/feature-gate-associated_type_bounds.rs:15:28 diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.rs b/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.rs index dfd82a25f4c..4fb1cd2aae1 100644 --- a/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.rs +++ b/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.rs @@ -31,7 +31,7 @@ type Foo4 = impl Debug; fn define4() { let y: Foo4 = 42; - //~^ ERROR not permitted here + //~^ ERROR mismatched types [E0308] } fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr b/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr index 43fd76ef0ed..10409d5fc4b 100644 --- a/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr +++ b/src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.stderr @@ -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 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 diff --git a/src/test/ui/generator/layout-error.full_tait.stderr b/src/test/ui/generator/layout-error.full_tait.stderr index 805a4d1d000..bf647d08983 100644 --- a/src/test/ui/generator/layout-error.full_tait.stderr +++ b/src/test/ui/generator/layout-error.full_tait.stderr @@ -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 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 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`. diff --git a/src/test/ui/generator/layout-error.min_tait.stderr b/src/test/ui/generator/layout-error.min_tait.stderr index be469d781b5..ed31c260cbc 100644 --- a/src/test/ui/generator/layout-error.min_tait.stderr +++ b/src/test/ui/generator/layout-error.min_tait.stderr @@ -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 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 = Task::new(); - | ^^^^^^^^^^^ - | - = note: see issue #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 = 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`. diff --git a/src/test/ui/generator/layout-error.rs b/src/test/ui/generator/layout-error.rs index 9f15a6b2eca..a5efc3899dd 100644 --- a/src/test/ui/generator/layout-error.rs +++ b/src/test/ui/generator/layout-error.rs @@ -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); @@ -27,7 +26,6 @@ fn main() { type F = impl Future; // Check that statics are inhabited computes they layout. - static POOL: Task = Task::new(); //[min_tait]~ ERROR not permitted here + static POOL: Task = 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 } diff --git a/src/test/ui/generator/metadata-sufficient-for-layout.full_tait.stderr b/src/test/ui/generator/metadata-sufficient-for-layout.full_tait.stderr index ce874c1518c..1e609e83882 100644 --- a/src/test/ui/generator/metadata-sufficient-for-layout.full_tait.stderr +++ b/src/test/ui/generator/metadata-sufficient-for-layout.full_tait.stderr @@ -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 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 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 diff --git a/src/test/ui/generator/metadata-sufficient-for-layout.min_tait.stderr b/src/test/ui/generator/metadata-sufficient-for-layout.min_tait.stderr index e2b0d3622a6..52d42fd59a0 100644 --- a/src/test/ui/generator/metadata-sufficient-for-layout.min_tait.stderr +++ b/src/test/ui/generator/metadata-sufficient-for-layout.min_tait.stderr @@ -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 = None; - | ^^^^ - | - = note: see issue #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 = None; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: aborting due to previous error -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/generator/metadata-sufficient-for-layout.rs b/src/test/ui/generator/metadata-sufficient-for-layout.rs index f206093d971..c01354569f0 100644 --- a/src/test/ui/generator/metadata-sufficient-for-layout.rs +++ b/src/test/ui/generator/metadata-sufficient-for-layout.rs @@ -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 = 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 diff --git a/src/test/ui/impl-trait/bound-normalization-fail.rs b/src/test/ui/impl-trait/bound-normalization-fail.rs index d3056fb8851..8ec06e534d1 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.rs +++ b/src/test/ui/impl-trait/bound-normalization-fail.rs @@ -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); -trait FooLike { type Output; } +trait FooLike { + type Output; +} impl FooLike for Foo { type Output = T; @@ -23,7 +22,7 @@ mod impl_trait { } /// `T::Assoc` can't be normalized any further here. - fn foo_fail() -> impl FooLike { + fn foo_fail() -> impl FooLike { //~^ 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 { - //~^ 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 { + //~^ ERROR: type mismatch + //~^^ ERROR `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope Foo(()) } } diff --git a/src/test/ui/impl-trait/bound-normalization-fail.stderr b/src/test/ui/impl-trait/bound-normalization-fail.stderr index ba3a2e7f8d4..611543a1926 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.stderr +++ b/src/test/ui/impl-trait/bound-normalization-fail.stderr @@ -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 for more information - error[E0271]: type mismatch resolving ` as FooLike>::Output == ::Assoc` - --> $DIR/bound-normalization-fail.rs:26:32 + --> $DIR/bound-normalization-fail.rs:25:32 | -LL | fn foo_fail() -> impl FooLike { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()` +LL | fn foo_fail() -> impl FooLike { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()` | = note: expected associated type `::Assoc` found type `()` help: consider constraining the associated type `::Assoc` to `()` | -LL | fn foo_fail>() -> impl FooLike { +LL | fn foo_fail>() -> impl FooLike { | ^^^^^^^^^^^^ 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 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving ` as FooLike>::Output == >::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 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()` +LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `()` | = note: expected associated type `>::Assoc` found type `()` help: consider constraining the associated type `>::Assoc` to `()` | -LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike { +LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike { | ^^^^^^^^^^^^ -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`. diff --git a/src/test/ui/impl-trait/bound-normalization-pass.default.stderr b/src/test/ui/impl-trait/bound-normalization-pass.default.stderr deleted file mode 100644 index ef3cb740112..00000000000 --- a/src/test/ui/impl-trait/bound-normalization-pass.default.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/bound-normalization-pass.rs:8: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/bound-normalization-pass.rs b/src/test/ui/impl-trait/bound-normalization-pass.rs index 5144f05681b..4218bc52065 100644 --- a/src/test/ui/impl-trait/bound-normalization-pass.rs +++ b/src/test/ui/impl-trait/bound-normalization-pass.rs @@ -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 diff --git a/src/test/ui/impl-trait/bound-normalization-pass.sa.stderr b/src/test/ui/impl-trait/bound-normalization-pass.sa.stderr deleted file mode 100644 index ef3cb740112..00000000000 --- a/src/test/ui/impl-trait/bound-normalization-pass.sa.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/bound-normalization-pass.rs:8: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/issues/issue-70877.full_tait.stderr b/src/test/ui/impl-trait/issues/issue-70877.full_tait.stderr index 8e42b9d46db..1f4e3f78afa 100644 --- a/src/test/ui/impl-trait/issues/issue-70877.full_tait.stderr +++ b/src/test/ui/impl-trait/issues/issue-70877.full_tait.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `::Item == Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> Option + 'static)>` - --> $DIR/issue-70877.rs:11:12 + --> $DIR/issue-70877.rs:10:12 | LL | type FooRet = impl std::fmt::Debug; | -------------------- the found opaque type diff --git a/src/test/ui/impl-trait/issues/issue-70877.min_tait.stderr b/src/test/ui/impl-trait/issues/issue-70877.min_tait.stderr index 8e42b9d46db..1f4e3f78afa 100644 --- a/src/test/ui/impl-trait/issues/issue-70877.min_tait.stderr +++ b/src/test/ui/impl-trait/issues/issue-70877.min_tait.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `::Item == Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> Option + 'static)>` - --> $DIR/issue-70877.rs:11:12 + --> $DIR/issue-70877.rs:10:12 | LL | type FooRet = impl std::fmt::Debug; | -------------------- the found opaque type diff --git a/src/test/ui/impl-trait/issues/issue-70877.rs b/src/test/ui/impl-trait/issues/issue-70877.rs index 7ca0f90e2dc..29aa705ef9d 100644 --- a/src/test/ui/impl-trait/issues/issue-70877.rs +++ b/src/test/ui/impl-trait/issues/issue-70877.rs @@ -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; diff --git a/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr b/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr index 7a4be1d5f6d..728644f7579 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr +++ b/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr @@ -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 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 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 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; + | -------------------------------------- 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(gen: T) -> impl Future + | ------------------------------- 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`. diff --git a/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr b/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr index 131033063d2..221b23ae3d2 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr +++ b/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr @@ -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 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 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; + | -------------------------------------- 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(gen: T) -> impl Future + | ------------------------------- 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`. diff --git a/src/test/ui/impl-trait/issues/issue-78722.rs b/src/test/ui/impl-trait/issues/issue-78722.rs index 0999ec63e03..480b55eed21 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.rs +++ b/src/test/ui/impl-trait/issues/issue-78722.rs @@ -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; @@ -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 }], } diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index 09ec4d5b202..32389048148 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -282,8 +282,6 @@ error[E0562]: `impl Trait` not allowed outside of function and inherent method r | 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 --> $DIR/where-allowed.rs:248:46 diff --git a/src/test/ui/mir/issue-75053.full_tait.stderr b/src/test/ui/mir/issue-75053.full_tait.stderr index aff19094b7a..543d15fadc6 100644 --- a/src/test/ui/mir/issue-75053.full_tait.stderr +++ b/src/test/ui/mir/issue-75053.full_tait.stderr @@ -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 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> = Scope::new().my_index(); - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #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`. diff --git a/src/test/ui/mir/issue-75053.in_bindings.stderr b/src/test/ui/mir/issue-75053.in_bindings.stderr index a43fabc8f5d..d75996bf0b3 100644 --- a/src/test/ui/mir/issue-75053.in_bindings.stderr +++ b/src/test/ui/mir/issue-75053.in_bindings.stderr @@ -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 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; - | ------- `>::O` defined here -... -LL | let _pos: Phantom1> = Scope::new().my_index(); - | ^^^^^^^^^^------------- - | | - | this method call resolves to `>::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`. diff --git a/src/test/ui/mir/issue-75053.min_tait.stderr b/src/test/ui/mir/issue-75053.min_tait.stderr index 7ce91e851a7..c533275c99a 100644 --- a/src/test/ui/mir/issue-75053.min_tait.stderr +++ b/src/test/ui/mir/issue-75053.min_tait.stderr @@ -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> = Scope::new().my_index(); - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #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`. diff --git a/src/test/ui/mir/issue-75053.rs b/src/test/ui/mir/issue-75053.rs index 89ae3ca3006..b71f84dd9c2 100644 --- a/src/test/ui/mir/issue-75053.rs +++ b/src/test/ui/mir/issue-75053.rs @@ -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>>, U> MyIndex> for Scope { #[rustc_error] fn main() { + //~^ ERROR let _pos: Phantom1> = Scope::new().my_index(); - //[min_tait,full_tait]~^ ERROR not permitted here - //[in_bindings]~^^ ERROR type annotations needed } diff --git a/src/test/ui/type-alias-impl-trait/issue-53096.full_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-53096.full_tait.stderr index 1a03ce79661..a8dd6a93d3d 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53096.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-53096.full_tait.stderr @@ -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 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 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 diff --git a/src/test/ui/type-alias-impl-trait/issue-53096.min_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-53096.min_tait.stderr index c6c7a51618d..4210d0c1cb1 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53096.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-53096.min_tait.stderr @@ -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 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`. diff --git a/src/test/ui/type-alias-impl-trait/issue-53096.rs b/src/test/ui/type-alias-impl-trait/issue-53096.rs index fb621dc0bce..7bb0066b7ef 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53096.rs +++ b/src/test/ui/type-alias-impl-trait/issue-53096.rs @@ -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 diff --git a/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.full_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.full_tait.stderr index 70d049ffa76..b23fed5dadf 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.full_tait.stderr @@ -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 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 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 diff --git a/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.min_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.min_tait.stderr index a3dea45a6a5..fabba218353 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.min_tait.stderr @@ -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 = const_generator(10, 100); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #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`. diff --git a/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs b/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs index bf607d29ce4..a8215c41826 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs +++ b/src/test/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs @@ -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(yielding: Y, returning: R) -> GenOnce { } } -const FOO: GenOnce = const_generator(10, 100); //[min_tait]~ ERROR not permitted here +const FOO: GenOnce = const_generator(10, 100); #[rustc_error] -fn main() {} //[full_tait]~ ERROR +fn main() {} //~ ERROR diff --git a/src/test/ui/type-alias-impl-trait/issue-60371.stderr b/src/test/ui/type-alias-impl-trait/issue-60371.stderr index 6857d5264b6..4906ea9c2e2 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60371.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-60371.stderr @@ -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 for more information - = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable + = note: see issue #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 diff --git a/src/test/ui/type-alias-impl-trait/issue-60407.full_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-60407.full_tait.stderr index 5edf73c8ced..9d3f366ad81 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60407.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-60407.full_tait.stderr @@ -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 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 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 diff --git a/src/test/ui/type-alias-impl-trait/issue-60407.min_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-60407.min_tait.stderr index edb8141c1b1..1a3ceafa3e2 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60407.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-60407.min_tait.stderr @@ -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 = None; - | ^^^^ - | - = note: see issue #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 = None; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: aborting due to previous error -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/type-alias-impl-trait/issue-60407.rs b/src/test/ui/type-alias-impl-trait/issue-60407.rs index afcbf313cc8..3c6b873b4ca 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60407.rs +++ b/src/test/ui/type-alias-impl-trait/issue-60407.rs @@ -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 = None; //[min_tait]~ ERROR not permitted here +static mut TEST: Option = 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 } diff --git a/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.full_tait.stderr b/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.full_tait.stderr index cf668fc6e06..ee26789d204 100644 --- a/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.full_tait.stderr @@ -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 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 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 diff --git a/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs b/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs index b7f05bd83ed..d37be640e0b 100644 --- a/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs +++ b/src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs @@ -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(|| {}); diff --git a/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.full_tait.stderr b/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.full_tait.stderr index 40949c84d23..faddecb2176 100644 --- a/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.full_tait.stderr @@ -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/no_inferrable_concrete_type.rs:6: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 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/no_inferrable_concrete_type.rs:6:55 - | -LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #63065 for more information - error: could not find defining uses - --> $DIR/no_inferrable_concrete_type.rs:10:12 + --> $DIR/no_inferrable_concrete_type.rs:9:12 | LL | type Foo = impl Copy; | ^^^^^^^^^ -error: aborting due to previous error; 2 warnings emitted +error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.min_tait.stderr b/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.min_tait.stderr index d69e4cccdf0..3194bd76107 100644 --- a/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.min_tait.stderr @@ -1,18 +1,8 @@ -error[E0658]: type alias impl trait is not permitted here - --> $DIR/no_inferrable_concrete_type.rs:16:12 - | -LL | let _: Foo = std::mem::transmute(0u8); - | ^^^ - | - = note: see issue #63065 for more information - = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable - error: could not find defining uses - --> $DIR/no_inferrable_concrete_type.rs:10:12 + --> $DIR/no_inferrable_concrete_type.rs:9:12 | LL | type Foo = impl Copy; | ^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs b/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs index 8ff588ef278..409eec7250f 100644 --- a/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs +++ b/src/test/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs @@ -3,15 +3,16 @@ // revisions: min_tait full_tait #![feature(min_type_alias_impl_trait)] -#![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 Foo = impl Copy; //~ could not find defining uses // make compiler happy about using 'Foo' -fn bar(x: Foo) -> Foo { x } +fn bar(x: Foo) -> Foo { + x +} fn main() { - let _: Foo = std::mem::transmute(0u8); //[min_tait]~ ERROR not permitted here + let _: Foo = std::mem::transmute(0u8); } diff --git a/src/test/ui/type-alias-impl-trait/structural-match-no-leak.full_tait.stderr b/src/test/ui/type-alias-impl-trait/structural-match-no-leak.full_tait.stderr index b560c0c918a..d5a4fa52dfb 100644 --- a/src/test/ui/type-alias-impl-trait/structural-match-no-leak.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/structural-match-no-leak.full_tait.stderr @@ -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/structural-match-no-leak.rs:4: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 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/structural-match-no-leak.rs:4:55 - | -LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #63065 for more information - error: `impl Send` cannot be used in patterns - --> $DIR/structural-match-no-leak.rs:19:9 + --> $DIR/structural-match-no-leak.rs:18:9 | LL | LEAK_FREE => (), | ^^^^^^^^^ -error: aborting due to previous error; 2 warnings emitted +error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/structural-match-no-leak.min_tait.stderr b/src/test/ui/type-alias-impl-trait/structural-match-no-leak.min_tait.stderr index e962b23a587..b7caf8ed298 100644 --- a/src/test/ui/type-alias-impl-trait/structural-match-no-leak.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/structural-match-no-leak.min_tait.stderr @@ -1,12 +1,8 @@ -error[E0658]: type alias impl trait is not permitted here - --> $DIR/structural-match-no-leak.rs:15:24 +error: `impl Send` cannot be used in patterns + --> $DIR/structural-match-no-leak.rs:18:9 | -LL | const LEAK_FREE: Bar = leak_free(); - | ^^^^^^^^^^^ - | - = note: see issue #63065 for more information - = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable +LL | LEAK_FREE => (), + | ^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/type-alias-impl-trait/structural-match-no-leak.rs b/src/test/ui/type-alias-impl-trait/structural-match-no-leak.rs index d0bae30f996..e2b10e7355f 100644 --- a/src/test/ui/type-alias-impl-trait/structural-match-no-leak.rs +++ b/src/test/ui/type-alias-impl-trait/structural-match-no-leak.rs @@ -1,9 +1,8 @@ #![feature(const_impl_trait)] // revisions: min_tait full_tait #![feature(min_type_alias_impl_trait)] -#![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 Bar = impl Send; @@ -12,12 +11,12 @@ type Bar = impl Send; const fn leak_free() -> Bar { 7i32 } -const LEAK_FREE: Bar = leak_free(); //[min_tait]~ ERROR not permitted here +const LEAK_FREE: Bar = leak_free(); fn leak_free_test() { match todo!() { LEAK_FREE => (), - //[full_tait]~^ `impl Send` cannot be used in patterns + //~^ `impl Send` cannot be used in patterns _ => (), } } diff --git a/src/test/ui/type-alias-impl-trait/structural-match.full_tait.stderr b/src/test/ui/type-alias-impl-trait/structural-match.full_tait.stderr index b94e06e6d0e..d394c99df80 100644 --- a/src/test/ui/type-alias-impl-trait/structural-match.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/structural-match.full_tait.stderr @@ -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/structural-match.rs:4: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 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/structural-match.rs:4:55 - | -LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait, impl_trait_in_bindings))] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #63065 for more information - error: `impl Send` cannot be used in patterns - --> $DIR/structural-match.rs:20:9 + --> $DIR/structural-match.rs:19:9 | LL | VALUE => (), | ^^^^^ -error: aborting due to previous error; 2 warnings emitted +error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/structural-match.min_tait.stderr b/src/test/ui/type-alias-impl-trait/structural-match.min_tait.stderr index 36c49a954bd..f63b1fb23df 100644 --- a/src/test/ui/type-alias-impl-trait/structural-match.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/structural-match.min_tait.stderr @@ -1,12 +1,8 @@ -error[E0658]: type alias impl trait is not permitted here - --> $DIR/structural-match.rs:16:20 +error: `impl Send` cannot be used in patterns + --> $DIR/structural-match.rs:19:9 | -LL | const VALUE: Foo = value(); - | ^^^^^^^ - | - = note: see issue #63065 for more information - = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable +LL | VALUE => (), + | ^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/type-alias-impl-trait/structural-match.rs b/src/test/ui/type-alias-impl-trait/structural-match.rs index daf914cc494..aed9334b3cc 100644 --- a/src/test/ui/type-alias-impl-trait/structural-match.rs +++ b/src/test/ui/type-alias-impl-trait/structural-match.rs @@ -1,9 +1,8 @@ #![feature(const_impl_trait)] // revisions: min_tait full_tait #![feature(min_type_alias_impl_trait)] -#![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 Foo = impl Send; @@ -13,12 +12,12 @@ struct A; const fn value() -> Foo { A } -const VALUE: Foo = value(); //[min_tait]~ ERROR not permitted here +const VALUE: Foo = value(); fn test() { match todo!() { VALUE => (), - //[full_tait]~^ `impl Send` cannot be used in patterns + //~^ `impl Send` cannot be used in patterns _ => (), } } diff --git a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.full_tait.stderr b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.full_tait.stderr index 894d61502a7..6f817757cc4 100644 --- a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.full_tait.stderr @@ -1,5 +1,5 @@ warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/type-alias-impl-trait-const.rs:5:32 + --> $DIR/type-alias-impl-trait-const.rs:3:32 | LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))] | ^^^^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,24 @@ LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))] = note: `#[warn(incomplete_features)]` on by default = note: see issue #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/type-alias-impl-trait-const.rs:11:12 +error[E0308]: mismatched types + --> $DIR/type-alias-impl-trait-const.rs:13:19 | -LL | #![feature(impl_trait_in_bindings)] - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | pub type Foo = impl Debug; + | ---------- the expected opaque type +... +LL | const _FOO: Foo = 5; + | ^ expected opaque type, found integer | - = note: see issue #63065 for more information + = note: expected opaque type `impl Debug` + found type `{integer}` -warning: 2 warnings emitted +error: could not find defining uses + --> $DIR/type-alias-impl-trait-const.rs:10:16 + | +LL | pub type Foo = impl Debug; + | ^^^^^^^^^^ +error: aborting due to 2 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.min_tait.stderr b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.min_tait.stderr index 66e4c242168..ce98318333b 100644 --- a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.min_tait.stderr @@ -1,11 +1,21 @@ -warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/type-alias-impl-trait-const.rs:11:12 +error[E0308]: mismatched types + --> $DIR/type-alias-impl-trait-const.rs:13:19 | -LL | #![feature(impl_trait_in_bindings)] - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | pub type Foo = impl Debug; + | ---------- the expected opaque type +... +LL | const _FOO: Foo = 5; + | ^ expected opaque type, found integer | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #63065 for more information + = note: expected opaque type `impl Debug` + found type `{integer}` -warning: 1 warning emitted +error: could not find defining uses + --> $DIR/type-alias-impl-trait-const.rs:10:16 + | +LL | pub type Foo = impl Debug; + | ^^^^^^^^^^ +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs index 0b0551cd96d..751512c5dfc 100644 --- a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs +++ b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-const.rs @@ -1,23 +1,16 @@ -// check-pass - // revisions: min_tait full_tait #![feature(min_type_alias_impl_trait)] #![cfg_attr(full_tait, feature(type_alias_impl_trait))] //[full_tait]~^ WARN incomplete -// Currently, the `type_alias_impl_trait` feature implicitly -// depends on `impl_trait_in_bindings` in order to work properly. -// Specifically, this line requires `impl_trait_in_bindings` to be enabled: -// https://github.com/rust-lang/rust/blob/481068a707679257e2a738b40987246e0420e787/compiler/rustc_typeck/check/mod.rs#L856 -#![feature(impl_trait_in_bindings)] -//~^ WARN the feature `impl_trait_in_bindings` is incomplete // Ensures that `const` items can constrain an opaque `impl Trait`. use std::fmt::Debug; pub type Foo = impl Debug; +//~^ ERROR could not find defining uses const _FOO: Foo = 5; +//~^ ERROR mismatched types [E0308] -fn main() { -} +fn main() {} From e0745e8f5d40626a4fa7a82d396c50d879f5dc0a Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 19 Jul 2021 09:20:15 -0300 Subject: [PATCH 16/17] Improve impl_trait_in_bindings removed feature text --- compiler/rustc_feature/src/removed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index d4a7ede8901..29f4423ec85 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -150,7 +150,7 @@ declare_features! ( /// Allows `impl Trait` in bindings (`let`, `const`, `static`). (removed, impl_trait_in_bindings, "1.55.0", Some(63065), None, - Some("removed due to being incomplete and unstable")), + Some("the implementation was not maintainable, the feature may get reintroduced once the current refactorings are done")), // ------------------------------------------------------------------------- // feature-group-end: removed features From 3e857f5743295bf81380e45467372ab45f322e1c Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 19 Jul 2021 09:21:27 -0300 Subject: [PATCH 17/17] Improve impl trait disallowed context error text --- compiler/rustc_ast_lowering/src/lib.rs | 2 +- .../feature-gate-associated_type_bounds.rs | 6 +- ...feature-gate-associated_type_bounds.stderr | 6 +- ...ture-gate-min_type_alias_impl_trait.stderr | 2 +- ...sue-83929-impl-trait-in-generic-default.rs | 4 +- ...83929-impl-trait-in-generic-default.stderr | 4 +- .../ui/impl-trait/nested_impl_trait.stderr | 4 +- src/test/ui/impl-trait/where-allowed.rs | 82 +++++++++---------- src/test/ui/impl-trait/where-allowed.stderr | 82 +++++++++---------- src/test/ui/issues/issue-47715.stderr | 8 +- 10 files changed, 100 insertions(+), 100 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 9718739f813..d4caba92416 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1466,7 +1466,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { t.span, E0562, "`impl Trait` not allowed outside of {}", - "function and inherent method return types", + "function and method return types", ); err.emit(); hir::TyKind::Err diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs index 38be85ff820..1e48996acb8 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs @@ -57,20 +57,20 @@ fn _rpit_dyn() -> Box> { Box::new(S1) } const _cdef: impl Tr1 = 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 = &S1; static _sdef: impl Tr1 = 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 = &S1; fn main() { let _: impl Tr1 = 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 = &S1; } diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr index 6a048ee8797..2dacb94bcc0 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr @@ -115,19 +115,19 @@ LL | let _: impl Tr1 = S1; = note: see issue #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 = S1; | ^^^^^^^^^^^^^^^^^^^ -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 = S1; | ^^^^^^^^^^^^^^^^^^^ -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 = S1; diff --git a/src/test/ui/feature-gates/feature-gate-min_type_alias_impl_trait.stderr b/src/test/ui/feature-gates/feature-gate-min_type_alias_impl_trait.stderr index b82867c6702..07857289aae 100644 --- a/src/test/ui/feature-gates/feature-gate-min_type_alias_impl_trait.stderr +++ b/src/test/ui/feature-gates/feature-gate-min_type_alias_impl_trait.stderr @@ -106,7 +106,7 @@ LL | type Baa = (Vec, impl Debug, impl Iterator 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; diff --git a/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs b/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs index d9d2e3929b1..773cd0b81cc 100644 --- a/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs +++ b/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs @@ -1,8 +1,8 @@ struct Foo(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 = std::result::Result; -//~^ 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 { diff --git a/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr b/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr index eef6844adfc..d44dcf1f7fa 100644 --- a/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr +++ b/src/test/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr @@ -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); | ^^^^^^^^^ -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 = std::result::Result; diff --git a/src/test/ui/impl-trait/nested_impl_trait.stderr b/src/test/ui/impl-trait/nested_impl_trait.stderr index 3749c268a68..59c7e4d5f4e 100644 --- a/src/test/ui/impl-trait/nested_impl_trait.stderr +++ b/src/test/ui/impl-trait/nested_impl_trait.stderr @@ -34,13 +34,13 @@ LL | fn bad(x: impl Into) -> impl Into { 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) {} | ^^^^^^^^^^^^^^^^^^^^^ -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 { diff --git a/src/test/ui/impl-trait/where-allowed.rs b/src/test/ui/impl-trait/where-allowed.rs index c3e21c81f03..4605e76ac96 100644 --- a/src/test/ui/impl-trait/where-allowed.rs +++ b/src/test/ui/impl-trait/where-allowed.rs @@ -13,61 +13,61 @@ fn in_adt_in_parameters(_: Vec) { 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) { 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 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 { // 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 } -//~^ 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 = impl Debug; //~^ ERROR `impl Trait` in type aliases is unstable type InReturnInTypeAlias = 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 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 } impl InInherentImplAdt { - //~^ 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: 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() where T: PartialEq -//~^ 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() 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() 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); -//~^ 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 { 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 {} -//~^ 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; -//~^ 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 {} //~^ 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) {} //~^ 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 } diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index 32389048148..93a3de61ccf 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -43,247 +43,247 @@ LL | type InReturnInTypeAlias = fn() -> impl Debug; = note: see issue #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) { 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 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 } | ^^^^^^^^^^ -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 = 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 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 { | ^^^^^^^^^^ -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: 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 | ^^^^^^^^^^ -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); | ^^^^^^^^^^ -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 { 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 {} | ^^^^^^^^^^ -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; | ^^^^^^^^^^ -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 {} | ^^^^^^^^^^ -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) {} | ^^^^^^^^^^ -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() = || {}; | ^^^^^^^^^ -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() { || {} }; diff --git a/src/test/ui/issues/issue-47715.stderr b/src/test/ui/issues/issue-47715.stderr index 296de362db1..63a28d997e1 100644 --- a/src/test/ui/issues/issue-47715.stderr +++ b/src/test/ui/issues/issue-47715.stderr @@ -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> { | ^^^^^^^^ -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> { | ^^^^^^^^ -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 + 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;