blob: 6cab4fabb1ffb35cc44eee5b9f679aeb682fa0f9 [file] [log] [blame] [edit]
error[E0666]: nested `impl Trait` is not allowed
--> $DIR/where-allowed.rs:51:51
|
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
| --------^^^^^^^^^^-
| | |
| | nested `impl Trait` here
| outer `impl Trait`
error[E0666]: nested `impl Trait` is not allowed
--> $DIR/where-allowed.rs:60:57
|
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
| --------^^^^^^^^^^-
| | |
| | nested `impl Trait` here
| outer `impl Trait`
error[E0658]: `impl Trait` in associated types is unstable
--> $DIR/where-allowed.rs:122:16
|
LL | type Out = impl Debug;
| ^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/where-allowed.rs:159:23
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `impl Trait` in type aliases is unstable
--> $DIR/where-allowed.rs:163:39
|
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(type_alias_impl_trait)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0562]: `impl Trait` is not allowed in `fn` pointer parameters
--> $DIR/where-allowed.rs:19:40
|
LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
--> $DIR/where-allowed.rs:23:42
|
LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in `fn` pointer parameters
--> $DIR/where-allowed.rs:27:38
|
LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
--> $DIR/where-allowed.rs:31:40
|
LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
--> $DIR/where-allowed.rs:35:49
|
LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
--> $DIR/where-allowed.rs:39:51
|
LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
--> $DIR/where-allowed.rs:43:55
|
LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
--> $DIR/where-allowed.rs:51:51
|
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
--> $DIR/where-allowed.rs:56:53
|
LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
--> $DIR/where-allowed.rs:60:57
|
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
--> $DIR/where-allowed.rs:69:38
|
LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
--> $DIR/where-allowed.rs:73:40
|
LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in field types
--> $DIR/where-allowed.rs:86:32
|
LL | struct InBraceStructField { x: impl Debug }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in field types
--> $DIR/where-allowed.rs:90:41
|
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in field types
--> $DIR/where-allowed.rs:94:27
|
LL | struct InTupleStructField(impl Debug);
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in field types
--> $DIR/where-allowed.rs:99:25
|
LL | InBraceVariant { x: impl Debug },
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in field types
--> $DIR/where-allowed.rs:101:20
|
LL | InTupleVariant(impl Debug),
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in `extern fn` parameters
--> $DIR/where-allowed.rs:143:33
|
LL | fn in_foreign_parameters(_: impl Debug);
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in `extern fn` return types
--> $DIR/where-allowed.rs:146:31
|
LL | fn in_foreign_return() -> impl Debug;
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
--> $DIR/where-allowed.rs:163:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in traits
--> $DIR/where-allowed.rs:168:16
|
LL | impl PartialEq<impl Debug> for () {
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in impl headers
--> $DIR/where-allowed.rs:173:24
|
LL | impl PartialEq<()> for impl Debug {
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in impl headers
--> $DIR/where-allowed.rs:178:6
|
LL | impl impl Debug {
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in impl headers
--> $DIR/where-allowed.rs:184:24
|
LL | impl InInherentImplAdt<impl Debug> {
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in bounds
--> $DIR/where-allowed.rs:190:11
|
LL | where impl Debug: Debug
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in bounds
--> $DIR/where-allowed.rs:197:15
|
LL | where Vec<impl Debug>: Debug
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in bounds
--> $DIR/where-allowed.rs:204:24
|
LL | where T: PartialEq<impl Debug>
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
--> $DIR/where-allowed.rs:211:17
|
LL | where T: Fn(impl Debug)
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
--> $DIR/where-allowed.rs:218:22
|
LL | where T: Fn() -> impl Debug
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in generic parameter defaults
--> $DIR/where-allowed.rs:224:40
|
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in generic parameter defaults
--> $DIR/where-allowed.rs:228:36
|
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in generic parameter defaults
--> $DIR/where-allowed.rs:232:38
|
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in generic parameter defaults
--> $DIR/where-allowed.rs:236:41
|
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in generic parameter defaults
--> $DIR/where-allowed.rs:241:10
|
LL | impl<T = impl Debug> T {}
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in generic parameter defaults
--> $DIR/where-allowed.rs:247:40
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the type of variable bindings
--> $DIR/where-allowed.rs:251:29
|
LL | let _in_local_variable: impl Fn() = || {};
| ^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0562]: `impl Trait` is not allowed in closure return types
--> $DIR/where-allowed.rs:253:46
|
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
| ^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0053]: method `in_trait_impl_return` has an incompatible type for trait
--> $DIR/where-allowed.rs:129:34
|
LL | type Out = impl Debug;
| ---------- the expected opaque type
...
LL | fn in_trait_impl_return() -> impl Debug { () }
| ^^^^^^^^^^ expected opaque type, found a different opaque type
|
note: type in trait
--> $DIR/where-allowed.rs:119:34
|
LL | fn in_trait_impl_return() -> Self::Out;
| ^^^^^^^^^
= note: expected signature `fn() -> <() as DummyTrait>::Out`
found signature `fn() -> impl Debug`
= note: distinct uses of `impl Trait` result in different opaque types
help: change the output type to match the trait
|
LL - fn in_trait_impl_return() -> impl Debug { () }
LL + fn in_trait_impl_return() -> <() as DummyTrait>::Out { () }
|
error[E0283]: type annotations needed
--> $DIR/where-allowed.rs:47:57
|
LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
| ^^^^^^^^^^ cannot infer type
|
= note: cannot satisfy `_: Debug`
error[E0283]: type annotations needed
--> $DIR/where-allowed.rs:65:46
|
LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
= note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
- impl<A, F> Fn<A> for &F
where A: Tuple, F: Fn<A>, F: ?Sized;
- impl<Args, F, A> Fn<Args> for Box<F, A>
where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
- impl<F, Args> Fn<Args> for Exclusive<F>
where F: Sync, F: Fn<Args>, Args: Tuple;
error[E0118]: no nominal type found for inherent implementation
--> $DIR/where-allowed.rs:241:1
|
LL | impl<T = impl Debug> T {}
| ^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
|
= note: either implement a trait on it or create a newtype to wrap it instead
error: unconstrained opaque type
--> $DIR/where-allowed.rs:122:16
|
LL | type Out = impl Debug;
| ^^^^^^^^^^
|
= note: `Out` must be used in combination with a concrete type within the same impl
error: unconstrained opaque type
--> $DIR/where-allowed.rs:159:23
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^
|
= note: `InTypeAlias` must be used in combination with a concrete type within the same crate
error: aborting due to 48 previous errors
Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0658, E0666.
For more information about an error, try `rustc --explain E0053`.
Future incompatibility report: Future breakage diagnostic:
warning: defaults for generic parameters are not allowed here
--> $DIR/where-allowed.rs:247:36
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^^^^^
Future breakage diagnostic:
warning: defaults for generic parameters are not allowed here
--> $DIR/where-allowed.rs:241:6
|
LL | impl<T = impl Debug> T {}
| ^^^^^^^^^^^^^^