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

View File

@ -115,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
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/feature-gate-associated_type_bounds.rs:58:14
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/feature-gate-associated_type_bounds.rs:64:15
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/feature-gate-associated_type_bounds.rs:71:12
|
LL | let _: impl Tr1<As1: Copy> = S1;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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