rust/tests/ui/lint/non-local-defs/weird-exprs.rs
Urgau 0c0dfb88ee Switch back non_local_definitions lint to allow-by-default
as request T-lang is requesting some major changes in the lint inner
workings in #126768#issuecomment-2192634762
2024-06-27 08:05:07 +02:00

56 lines
849 B
Rust

//@ check-pass
//@ edition:2021
#![warn(non_local_definitions)]
trait Uto {}
struct Test;
type A = [u32; {
impl Uto for *mut Test {}
//~^ WARN non-local `impl` definition
1
}];
enum Enum {
Discr = {
impl Uto for Test {}
//~^ WARN non-local `impl` definition
1
}
}
fn main() {
let _array = [0i32; {
impl Test {
//~^ WARN non-local `impl` definition
fn bar() {}
}
1
}];
type A = [u32; {
impl Uto for &Test {}
//~^ WARN non-local `impl` definition
1
}];
fn a(_: [u32; {
impl Uto for &(Test,) {}
//~^ WARN non-local `impl` definition
1
}]) {}
fn b() -> [u32; {
impl Uto for &(Test,Test) {}
//~^ WARN non-local `impl` definition
1
}] { todo!() }
}