parent
79f38b7914
commit
041e54bd92
40 changed files with 136 additions and 136 deletions
|
@ -99,7 +99,7 @@ ast_lowering_misplaced_double_dot =
|
||||||
.note = only allowed in tuple, tuple struct, and slice patterns
|
.note = only allowed in tuple, tuple struct, and slice patterns
|
||||||
|
|
||||||
ast_lowering_misplaced_impl_trait =
|
ast_lowering_misplaced_impl_trait =
|
||||||
`impl Trait` only allowed in function and inherent method return types, not in {$position}
|
`impl Trait` only allowed in function and inherent method argument and return types, not in {$position}
|
||||||
|
|
||||||
ast_lowering_misplaced_relax_trait_bound =
|
ast_lowering_misplaced_relax_trait_bound =
|
||||||
`?Trait` bounds are only permitted at the point where a type parameter is declared
|
`?Trait` bounds are only permitted at the point where a type parameter is declared
|
||||||
|
|
|
@ -33,7 +33,7 @@ LL | fn main<A: TraitWAssocConst<A=32>>() {
|
||||||
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
|
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
|
||||||
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
|
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
|
||||||
--> $DIR/issue-105330.rs:6:27
|
--> $DIR/issue-105330.rs:6:27
|
||||||
|
|
|
|
||||||
LL | impl TraitWAssocConst for impl Demo {
|
LL | impl TraitWAssocConst for impl Demo {
|
||||||
|
|
|
@ -11,7 +11,7 @@ trait MyTrait {
|
||||||
|
|
||||||
impl MyTrait for i32 {
|
impl MyTrait for i32 {
|
||||||
fn foo(&self) -> impl Future<Output = i32> {
|
fn foo(&self) -> impl Future<Output = i32> {
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in `impl` method return types
|
||||||
async { *self }
|
async { *self }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `impl` method return types
|
||||||
--> $DIR/fn-not-async-err2.rs:13:22
|
--> $DIR/fn-not-async-err2.rs:13:22
|
||||||
|
|
|
|
||||||
LL | fn foo(&self) -> impl Future<Output = i32> {
|
LL | fn foo(&self) -> impl Future<Output = i32> {
|
||||||
|
|
|
@ -54,20 +54,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` only allowed in function and inherent method return types
|
//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
// 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` only allowed in function and inherent method return types
|
//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
// 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` only allowed in function and inherent method return types
|
//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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` only allowed in function and inherent method return types, not in const types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
|
||||||
--> $DIR/feature-gate-associated_type_bounds.rs:55:14
|
--> $DIR/feature-gate-associated_type_bounds.rs:55:14
|
||||||
|
|
|
|
||||||
LL | const _cdef: impl Tr1<As1: Copy> = S1;
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
|
||||||
--> $DIR/feature-gate-associated_type_bounds.rs:61:15
|
--> $DIR/feature-gate-associated_type_bounds.rs:61:15
|
||||||
|
|
|
|
||||||
LL | static _sdef: impl Tr1<As1: Copy> = S1;
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/feature-gate-associated_type_bounds.rs:68:12
|
--> $DIR/feature-gate-associated_type_bounds.rs:68:12
|
||||||
|
|
|
|
||||||
LL | let _: impl Tr1<As1: Copy> = S1;
|
LL | let _: impl Tr1<As1: Copy> = S1;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
fn f() -> impl Fn() -> impl Sized { || () }
|
fn f() -> impl Fn() -> impl Sized { || () }
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return
|
||||||
fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
|
fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
|
||||||
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:1:24
|
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:1:24
|
||||||
|
|
|
|
||||||
LL | fn f() -> impl Fn() -> impl Sized { || () }
|
LL | fn f() -> impl Fn() -> impl Sized { || () }
|
||||||
|
@ -7,7 +7,7 @@ LL | fn f() -> impl Fn() -> impl Sized { || () }
|
||||||
= note: see issue #99697 <https://github.com/rust-lang/rust/issues/99697> for more information
|
= note: see issue #99697 <https://github.com/rust-lang/rust/issues/99697> for more information
|
||||||
= help: add `#![feature(impl_trait_in_fn_trait_return)]` to the crate attributes to enable
|
= help: add `#![feature(impl_trait_in_fn_trait_return)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
|
||||||
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:3:32
|
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:3:32
|
||||||
|
|
|
|
||||||
LL | fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
|
LL | fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
|
|
||||||
trait Foo {
|
trait Foo {
|
||||||
fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return
|
||||||
fn baz() -> Box<impl std::fmt::Display>; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
fn baz() -> Box<impl std::fmt::Display>; //~ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
|
// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
|
||||||
// feature-gate-async_fn_in_trait.rs)
|
// feature-gate-async_fn_in_trait.rs)
|
||||||
trait AsyncFoo {
|
trait AsyncFoo {
|
||||||
async fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
|
async fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return types
|
||||||
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:8:17
|
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:8:17
|
||||||
|
|
|
|
||||||
LL | fn bar() -> impl Sized;
|
LL | fn bar() -> impl Sized;
|
||||||
|
@ -7,7 +7,7 @@ LL | fn bar() -> impl Sized;
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return types
|
||||||
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:9:21
|
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:9:21
|
||||||
|
|
|
|
||||||
LL | fn baz() -> Box<impl std::fmt::Display>;
|
LL | fn baz() -> Box<impl std::fmt::Display>;
|
||||||
|
@ -16,7 +16,7 @@ LL | fn baz() -> Box<impl std::fmt::Display>;
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return types
|
||||||
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:15:23
|
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:15:23
|
||||||
|
|
|
|
||||||
LL | async fn bar() -> impl Sized;
|
LL | async fn bar() -> impl Sized;
|
||||||
|
|
|
@ -2,6 +2,6 @@ use std::fmt::Debug;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: Option<impl Debug> = Some(44_u32);
|
let x: Option<impl Debug> = Some(44_u32);
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
println!("{:?}", x);
|
println!("{:?}", x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-54600.rs:4:19
|
--> $DIR/issue-54600.rs:4:19
|
||||||
|
|
|
|
||||||
LL | let x: Option<impl Debug> = Some(44_u32);
|
LL | let x: Option<impl Debug> = Some(44_u32);
|
||||||
|
|
|
@ -3,5 +3,5 @@ use std::ops::Add;
|
||||||
fn main() {
|
fn main() {
|
||||||
let i: i32 = 0;
|
let i: i32 = 0;
|
||||||
let j: &impl Add = &i;
|
let j: &impl Add = &i;
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-54840.rs:5:13
|
--> $DIR/issue-54840.rs:5:13
|
||||||
|
|
|
|
||||||
LL | let j: &impl Add = &i;
|
LL | let j: &impl Add = &i;
|
||||||
|
|
|
@ -8,5 +8,5 @@ fn mk_gen() -> impl Generator<Return=!, Yield=()> {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
|
let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-58504.rs:10:16
|
--> $DIR/issue-58504.rs:10:16
|
||||||
|
|
|
|
||||||
LL | let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
|
LL | let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
|
||||||
|
|
|
@ -5,9 +5,9 @@ impl Lam for B {}
|
||||||
pub struct Wrap<T>(T);
|
pub struct Wrap<T>(T);
|
||||||
|
|
||||||
const _A: impl Lam = {
|
const _A: impl Lam = {
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
let x: Wrap<impl Lam> = Wrap(B);
|
let x: Wrap<impl Lam> = Wrap(B);
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
x.0
|
x.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
|
||||||
--> $DIR/issue-58956.rs:7:11
|
--> $DIR/issue-58956.rs:7:11
|
||||||
|
|
|
|
||||||
LL | const _A: impl Lam = {
|
LL | const _A: impl Lam = {
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-58956.rs:9:17
|
--> $DIR/issue-58956.rs:9:17
|
||||||
|
|
|
|
||||||
LL | let x: Wrap<impl Lam> = Wrap(B);
|
LL | let x: Wrap<impl Lam> = Wrap(B);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x : (impl Copy,) = (true,);
|
let x : (impl Copy,) = (true,);
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-70971.rs:2:14
|
--> $DIR/issue-70971.rs:2:14
|
||||||
|
|
|
|
||||||
LL | let x : (impl Copy,) = (true,);
|
LL | let x : (impl Copy,) = (true,);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
struct Bug {
|
struct Bug {
|
||||||
V1: [(); {
|
V1: [(); {
|
||||||
let f: impl core::future::Future<Output = u8> = async { 1 };
|
let f: impl core::future::Future<Output = u8> = async { 1 };
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
//~| expected identifier
|
//~| expected identifier
|
||||||
1
|
1
|
||||||
}],
|
}],
|
||||||
|
|
|
@ -9,7 +9,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
|
||||||
= help: pass `--edition 2021` to `rustc`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-79099.rs:3:16
|
--> $DIR/issue-79099.rs:3:16
|
||||||
|
|
|
|
||||||
LL | let f: impl core::future::Future<Output = u8> = async { 1 };
|
LL | let f: impl core::future::Future<Output = u8> = async { 1 };
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
struct Foo<T = impl Copy>(T);
|
struct Foo<T = impl Copy>(T);
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// should not cause ICE
|
// should not cause ICE
|
||||||
fn x() -> Foo {
|
fn x() -> Foo {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $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` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $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>;
|
||||||
|
|
|
@ -3,7 +3,7 @@ impl Trait for () {}
|
||||||
|
|
||||||
fn foo<'a: 'a>() {
|
fn foo<'a: 'a>() {
|
||||||
let _x: impl Trait = ();
|
let _x: impl Trait = ();
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-84919.rs:5:13
|
--> $DIR/issue-84919.rs:5:13
|
||||||
|
|
|
|
||||||
LL | let _x: impl Trait = ();
|
LL | let _x: impl Trait = ();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
|
static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
let res = (move |source| Ok(source))(source);
|
let res = (move |source| Ok(source))(source);
|
||||||
let res = res.or((move |source| Ok(source))(source));
|
let res = res.or((move |source| Ok(source))(source));
|
||||||
res
|
res
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
|
||||||
--> $DIR/issue-86642.rs:1:11
|
--> $DIR/issue-86642.rs:1:11
|
||||||
|
|
|
|
||||||
LL | static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
|
LL | static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
|
||||||
|
|
|
@ -14,5 +14,5 @@ impl<F> Struct<F> {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
|
let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
|
||||||
//~^ `impl Trait` only allowed in function and inherent method return types
|
//~^ `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-87295.rs:16:31
|
--> $DIR/issue-87295.rs:16:31
|
||||||
|
|
|
|
||||||
LL | let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
|
LL | let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
||||||
|
|
||||||
fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
|
fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
|
||||||
//~^ ERROR nested `impl Trait` is not allowed
|
//~^ ERROR nested `impl Trait` is not allowed
|
||||||
//~| `impl Trait` only allowed in function and inherent method return types
|
//~| `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
fn bad_in_arg_position(_: impl Into<impl Debug>) { }
|
fn bad_in_arg_position(_: impl Into<impl Debug>) { }
|
||||||
//~^ ERROR nested `impl Trait` is not allowed
|
//~^ ERROR nested `impl Trait` is not allowed
|
||||||
|
|
|
@ -34,7 +34,7 @@ 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` only allowed in function and inherent method return types, not in `fn` pointer return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
|
||||||
--> $DIR/nested_impl_trait.rs:10:32
|
--> $DIR/nested_impl_trait.rs:10: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>) {}
|
||||||
|
|
|
@ -16,47 +16,47 @@ 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// Allowed
|
// Allowed
|
||||||
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!() }
|
||||||
|
|
||||||
// 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
//~| ERROR nested `impl Trait` is not allowed
|
//~| ERROR nested `impl Trait` is not allowed
|
||||||
|
|
||||||
// Allowed
|
// Allowed
|
||||||
|
@ -64,11 +64,11 @@ fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!()
|
||||||
|
|
||||||
// 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
|
|
||||||
// Allowed
|
// Allowed
|
||||||
|
@ -81,22 +81,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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
struct InAdtInBraceStructField { x: Vec<impl Debug> }
|
struct InAdtInBraceStructField { x: Vec<impl Debug> }
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
struct InTupleStructField(impl Debug);
|
struct InTupleStructField(impl Debug);
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
enum InEnum {
|
enum InEnum {
|
||||||
InBraceVariant { x: impl Debug },
|
InBraceVariant { x: impl Debug },
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
InTupleVariant(impl Debug),
|
InTupleVariant(impl Debug),
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allowed
|
// Allowed
|
||||||
|
@ -107,7 +107,7 @@ trait InTraitDefnParameters {
|
||||||
// Disallowed
|
// Disallowed
|
||||||
trait InTraitDefnReturn {
|
trait InTraitDefnReturn {
|
||||||
fn in_return() -> impl Debug;
|
fn in_return() -> impl Debug;
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allowed and disallowed in trait impls
|
// Allowed and disallowed in trait impls
|
||||||
|
@ -124,7 +124,7 @@ impl DummyTrait for () {
|
||||||
// Allowed
|
// Allowed
|
||||||
|
|
||||||
fn in_trait_impl_return() -> impl Debug { () }
|
fn in_trait_impl_return() -> impl Debug { () }
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allowed
|
// Allowed
|
||||||
|
@ -137,10 +137,10 @@ impl DummyType {
|
||||||
// Disallowed
|
// Disallowed
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn in_foreign_parameters(_: impl Debug);
|
fn in_foreign_parameters(_: impl Debug);
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
fn in_foreign_return() -> impl Debug;
|
fn in_foreign_return() -> impl Debug;
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allowed
|
// Allowed
|
||||||
|
@ -156,97 +156,97 @@ 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallowed in impl headers
|
// Disallowed in impl headers
|
||||||
impl PartialEq<()> for impl Debug {
|
impl PartialEq<()> for impl Debug {
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallowed in inherent impls
|
// Disallowed in inherent impls
|
||||||
impl impl Debug {
|
impl impl Debug {
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
struct InStructGenericParamDefault<T = impl Debug>(T);
|
struct InStructGenericParamDefault<T = impl Debug>(T);
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
|
enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
trait InTraitGenericParamDefault<T = impl Debug> {}
|
trait InTraitGenericParamDefault<T = impl Debug> {}
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
type InTypeAliasGenericParamDefault<T = impl Debug> = T;
|
type InTypeAliasGenericParamDefault<T = impl Debug> = T;
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and 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` only allowed in function and inherent method return types
|
//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
//~| ERROR no nominal type found
|
//~| ERROR no nominal type found
|
||||||
|
|
||||||
// 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` only allowed in function and inherent method return types
|
//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _in_local_variable: impl Fn() = || {};
|
let _in_local_variable: impl Fn() = || {};
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
let _in_return_in_local_variable = || -> impl Fn() { || {} };
|
let _in_return_in_local_variable = || -> impl Fn() { || {} };
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,109 +43,109 @@ 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(type_alias_impl_trait)]` to the crate attributes to enable
|
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
|
||||||
--> $DIR/where-allowed.rs:18:40
|
--> $DIR/where-allowed.rs:18: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` only allowed in function and inherent method return types, not in `fn` pointer return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
|
||||||
--> $DIR/where-allowed.rs:22:42
|
--> $DIR/where-allowed.rs:22: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` only allowed in function and inherent method return types, not in `fn` pointer params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
|
||||||
--> $DIR/where-allowed.rs:26:38
|
--> $DIR/where-allowed.rs:26: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` only allowed in function and inherent method return types, not in `fn` pointer return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
|
||||||
--> $DIR/where-allowed.rs:30:40
|
--> $DIR/where-allowed.rs:30: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` only allowed in function and inherent method return types, not in `Fn` trait params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
|
||||||
--> $DIR/where-allowed.rs:34:49
|
--> $DIR/where-allowed.rs:34: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` only allowed in function and inherent method return types, not in `Fn` trait return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
|
||||||
--> $DIR/where-allowed.rs:38:51
|
--> $DIR/where-allowed.rs:38: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` only allowed in function and inherent method return types, not in `Fn` trait params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
|
||||||
--> $DIR/where-allowed.rs:42:55
|
--> $DIR/where-allowed.rs:42: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` only allowed in function and inherent method return types, not in `Fn` trait params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
|
||||||
--> $DIR/where-allowed.rs:49:51
|
--> $DIR/where-allowed.rs:49: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` only allowed in function and inherent method return types, not in `Fn` trait return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
|
||||||
--> $DIR/where-allowed.rs:54:53
|
--> $DIR/where-allowed.rs:54: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` only allowed in function and inherent method return types, not in `Fn` trait params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
|
||||||
--> $DIR/where-allowed.rs:58:57
|
--> $DIR/where-allowed.rs:58: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` only allowed in function and inherent method return types, not in `Fn` trait params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
|
||||||
--> $DIR/where-allowed.rs:66:38
|
--> $DIR/where-allowed.rs:66: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` only allowed in function and inherent method return types, not in `Fn` trait return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
|
||||||
--> $DIR/where-allowed.rs:70:40
|
--> $DIR/where-allowed.rs:70: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` only allowed in function and inherent method return types, not in field types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
|
||||||
--> $DIR/where-allowed.rs:83:32
|
--> $DIR/where-allowed.rs:83:32
|
||||||
|
|
|
|
||||||
LL | struct InBraceStructField { x: impl Debug }
|
LL | struct InBraceStructField { x: impl Debug }
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
|
||||||
--> $DIR/where-allowed.rs:87:41
|
--> $DIR/where-allowed.rs:87:41
|
||||||
|
|
|
|
||||||
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
|
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
|
||||||
--> $DIR/where-allowed.rs:91:27
|
--> $DIR/where-allowed.rs:91:27
|
||||||
|
|
|
|
||||||
LL | struct InTupleStructField(impl Debug);
|
LL | struct InTupleStructField(impl Debug);
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
|
||||||
--> $DIR/where-allowed.rs:96:25
|
--> $DIR/where-allowed.rs:96:25
|
||||||
|
|
|
|
||||||
LL | InBraceVariant { x: impl Debug },
|
LL | InBraceVariant { x: impl Debug },
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
|
||||||
--> $DIR/where-allowed.rs:98:20
|
--> $DIR/where-allowed.rs:98:20
|
||||||
|
|
|
|
||||||
LL | InTupleVariant(impl Debug),
|
LL | InTupleVariant(impl Debug),
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in trait method return types
|
||||||
--> $DIR/where-allowed.rs:109:23
|
--> $DIR/where-allowed.rs:109:23
|
||||||
|
|
|
|
||||||
LL | fn in_return() -> impl Debug;
|
LL | fn in_return() -> impl Debug;
|
||||||
|
@ -154,7 +154,7 @@ LL | fn in_return() -> impl Debug;
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `impl` method return types
|
||||||
--> $DIR/where-allowed.rs:126:34
|
--> $DIR/where-allowed.rs:126:34
|
||||||
|
|
|
|
||||||
LL | fn in_trait_impl_return() -> impl Debug { () }
|
LL | fn in_trait_impl_return() -> impl Debug { () }
|
||||||
|
@ -163,121 +163,121 @@ LL | fn in_trait_impl_return() -> impl Debug { () }
|
||||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` params
|
||||||
--> $DIR/where-allowed.rs:139:33
|
--> $DIR/where-allowed.rs:139:33
|
||||||
|
|
|
|
||||||
LL | fn in_foreign_parameters(_: impl Debug);
|
LL | fn in_foreign_parameters(_: impl Debug);
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` return types
|
||||||
--> $DIR/where-allowed.rs:142:31
|
--> $DIR/where-allowed.rs:142:31
|
||||||
|
|
|
|
||||||
LL | fn in_foreign_return() -> impl Debug;
|
LL | fn in_foreign_return() -> impl Debug;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
|
||||||
--> $DIR/where-allowed.rs:158:39
|
--> $DIR/where-allowed.rs:158:39
|
||||||
|
|
|
|
||||||
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in traits
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in traits
|
||||||
--> $DIR/where-allowed.rs:163:16
|
--> $DIR/where-allowed.rs:163:16
|
||||||
|
|
|
|
||||||
LL | impl PartialEq<impl Debug> for () {
|
LL | impl PartialEq<impl Debug> for () {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
|
||||||
--> $DIR/where-allowed.rs:168:24
|
--> $DIR/where-allowed.rs:168:24
|
||||||
|
|
|
|
||||||
LL | impl PartialEq<()> for impl Debug {
|
LL | impl PartialEq<()> for impl Debug {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
|
||||||
--> $DIR/where-allowed.rs:173:6
|
--> $DIR/where-allowed.rs:173:6
|
||||||
|
|
|
|
||||||
LL | impl impl Debug {
|
LL | impl impl Debug {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
|
||||||
--> $DIR/where-allowed.rs:179:24
|
--> $DIR/where-allowed.rs:179:24
|
||||||
|
|
|
|
||||||
LL | impl InInherentImplAdt<impl Debug> {
|
LL | impl InInherentImplAdt<impl Debug> {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
|
||||||
--> $DIR/where-allowed.rs:185:11
|
--> $DIR/where-allowed.rs:185:11
|
||||||
|
|
|
|
||||||
LL | where impl Debug: Debug
|
LL | where impl Debug: Debug
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
|
||||||
--> $DIR/where-allowed.rs:192:15
|
--> $DIR/where-allowed.rs:192:15
|
||||||
|
|
|
|
||||||
LL | where Vec<impl Debug>: Debug
|
LL | where Vec<impl Debug>: Debug
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
|
||||||
--> $DIR/where-allowed.rs:199:24
|
--> $DIR/where-allowed.rs:199:24
|
||||||
|
|
|
|
||||||
LL | where T: PartialEq<impl Debug>
|
LL | where T: PartialEq<impl Debug>
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
|
||||||
--> $DIR/where-allowed.rs:206:17
|
--> $DIR/where-allowed.rs:206:17
|
||||||
|
|
|
|
||||||
LL | where T: Fn(impl Debug)
|
LL | where T: Fn(impl Debug)
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
|
||||||
--> $DIR/where-allowed.rs:213:22
|
--> $DIR/where-allowed.rs:213:22
|
||||||
|
|
|
|
||||||
LL | where T: Fn() -> impl Debug
|
LL | where T: Fn() -> impl Debug
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $DIR/where-allowed.rs:219:40
|
--> $DIR/where-allowed.rs:219:40
|
||||||
|
|
|
|
||||||
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
|
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $DIR/where-allowed.rs:223:36
|
--> $DIR/where-allowed.rs:223:36
|
||||||
|
|
|
|
||||||
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
|
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $DIR/where-allowed.rs:227:38
|
--> $DIR/where-allowed.rs:227:38
|
||||||
|
|
|
|
||||||
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
|
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $DIR/where-allowed.rs:231:41
|
--> $DIR/where-allowed.rs:231:41
|
||||||
|
|
|
|
||||||
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
|
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $DIR/where-allowed.rs:235:11
|
--> $DIR/where-allowed.rs:235:11
|
||||||
|
|
|
|
||||||
LL | impl <T = impl Debug> T {}
|
LL | impl <T = impl Debug> T {}
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
|
||||||
--> $DIR/where-allowed.rs:242:40
|
--> $DIR/where-allowed.rs:242: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` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/where-allowed.rs:248:29
|
--> $DIR/where-allowed.rs:248:29
|
||||||
|
|
|
|
||||||
LL | let _in_local_variable: impl Fn() = || {};
|
LL | let _in_local_variable: impl Fn() = || {};
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in closure return types
|
||||||
--> $DIR/where-allowed.rs:250:46
|
--> $DIR/where-allowed.rs:250:46
|
||||||
|
|
|
|
||||||
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
|
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
|
||||||
|
|
|
@ -7,22 +7,22 @@ trait Iterable {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Container<T: Iterable<Item = impl Foo>> {
|
struct Container<T: Iterable<Item = impl Foo>> {
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
field: T
|
field: T
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Enum<T: Iterable<Item = impl Foo>> {
|
enum Enum<T: Iterable<Item = impl Foo>> {
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
A(T),
|
A(T),
|
||||||
}
|
}
|
||||||
|
|
||||||
union Union<T: Iterable<Item = impl Foo> + Copy> {
|
union Union<T: Iterable<Item = impl Foo> + Copy> {
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
x: T,
|
x: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
type Type<T: Iterable<Item = impl Foo>> = T;
|
type Type<T: Iterable<Item = impl Foo>> = T;
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
|
||||||
--> $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` only allowed in function and inherent method return types, not in generics
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
|
||||||
--> $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` only allowed in function and inherent method return types, not in generics
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
|
||||||
--> $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` only allowed in function and inherent method return types, not in generics
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
|
||||||
--> $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;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// FIXME: this is ruled out for now but should work
|
// FIXME: this is ruled out for now but should work
|
||||||
|
|
||||||
type Foo = fn() -> impl Send;
|
type Foo = fn() -> impl Send;
|
||||||
//~^ ERROR: `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR: `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
|
|
||||||
fn make_foo() -> Foo {
|
fn make_foo() -> Foo {
|
||||||
|| 15
|
|| 15
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
|
||||||
--> $DIR/type-alias-impl-trait-fn-type.rs:6:20
|
--> $DIR/type-alias-impl-trait-fn-type.rs:6:20
|
||||||
|
|
|
|
||||||
LL | type Foo = fn() -> impl Send;
|
LL | type Foo = fn() -> impl Send;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
struct S;
|
struct S;
|
||||||
fn f() {
|
fn f() {
|
||||||
let _: S<impl Oops> = S; //~ ERROR cannot find trait `Oops` in this scope
|
let _: S<impl Oops> = S; //~ ERROR cannot find trait `Oops` in this scope
|
||||||
//~^ ERROR `impl Trait` only allowed in function and inherent method return types
|
//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
|
||||||
}
|
}
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Oops` in this scope
|
||||||
LL | let _: S<impl Oops> = S;
|
LL | let _: S<impl Oops> = S;
|
||||||
| ^^^^ not found in this scope
|
| ^^^^ not found in this scope
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
|
error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
|
||||||
--> $DIR/issue-104513-ice.rs:3:14
|
--> $DIR/issue-104513-ice.rs:3:14
|
||||||
|
|
|
|
||||||
LL | let _: S<impl Oops> = S;
|
LL | let _: S<impl Oops> = S;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue