1
Fork 0

Improve impl trait disallowed context error text

This commit is contained in:
Santiago Pastorino 2021-07-19 09:21:27 -03:00
parent e0745e8f5d
commit 3e857f5743
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
10 changed files with 100 additions and 100 deletions

View file

@ -1466,7 +1466,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
t.span, t.span,
E0562, E0562,
"`impl Trait` not allowed outside of {}", "`impl Trait` not allowed outside of {}",
"function and inherent method return types", "function and method return types",
); );
err.emit(); err.emit();
hir::TyKind::Err hir::TyKind::Err

View file

@ -57,20 +57,20 @@ fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
const _cdef: impl Tr1<As1: Copy> = S1; const _cdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable //~^ 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. // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1; // const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1;
static _sdef: impl Tr1<As1: Copy> = S1; static _sdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable //~^ 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. // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1; // static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1;
fn main() { fn main() {
let _: impl Tr1<As1: Copy> = S1; let _: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable //~^ 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. // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// let _: &dyn Tr1<As1: Copy> = &S1; // let _: &dyn Tr1<As1: Copy> = &S1;
} }

View file

@ -115,19 +115,19 @@ LL | let _: impl Tr1<As1: Copy> = S1;
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = 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 --> $DIR/feature-gate-associated_type_bounds.rs:58:14
| |
LL | const _cdef: impl Tr1<As1: Copy> = S1; LL | const _cdef: impl Tr1<As1: Copy> = 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 --> $DIR/feature-gate-associated_type_bounds.rs:64:15
| |
LL | static _sdef: impl Tr1<As1: Copy> = S1; LL | static _sdef: impl Tr1<As1: Copy> = 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 --> $DIR/feature-gate-associated_type_bounds.rs:71:12
| |
LL | let _: impl Tr1<As1: Copy> = S1; LL | let _: impl Tr1<As1: Copy> = S1;

View file

@ -106,7 +106,7 @@ LL | type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debu
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable = 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 --> $DIR/feature-gate-min_type_alias_impl_trait.rs:23:18
| |
LL | type Assoc = impl Debug; LL | type Assoc = impl Debug;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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