rust/tests/ui/impl-trait/precise-capturing/bad-params.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
641 B
Rust
Raw Permalink Normal View History

2024-06-05 20:18:52 +00:00
fn missing() -> impl Sized + use<T> {}
//~^ ERROR cannot find type or const parameter `T` in this scope
2024-04-04 16:54:56 +00:00
2024-06-05 20:18:52 +00:00
fn missing_self() -> impl Sized + use<Self> {}
//~^ ERROR cannot find type or const parameter `Self` in this scope
2024-04-04 16:54:56 +00:00
struct MyType;
impl MyType {
2024-06-05 20:18:52 +00:00
fn self_is_not_param() -> impl Sized + use<Self> {}
//~^ ERROR `Self` can't be captured in `use<...>` precise captures list, since it is an alias
2024-04-04 16:54:56 +00:00
}
2024-06-05 20:18:52 +00:00
fn hello() -> impl Sized + use<hello> {}
//~^ ERROR expected type or const parameter, found function `hello`
fn arg(x: ()) -> impl Sized + use<x> {}
//~^ ERROR expected type or const parameter, found local variable `x`
2024-04-05 00:36:18 +00:00
2024-04-04 16:54:56 +00:00
fn main() {}