rust/tests/ui/consts/underscore_const_names.rs

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

32 lines
593 B
Rust
Raw Permalink Normal View History

//@ build-pass (FIXME(62277): could be check-pass?)
2019-05-30 05:30:03 -05:00
#![deny(unused)]
2024-02-06 20:42:01 -06:00
pub trait Trt {}
2019-05-30 05:30:03 -05:00
pub struct Str {}
impl Trt for Str {}
macro_rules! check_impl {
2024-02-06 20:42:01 -06:00
($struct:ident, $trait:ident) => {
const _ : () = {
use std::marker::PhantomData;
struct ImplementsTrait<T: $trait>(PhantomData<T>);
let _ = ImplementsTrait::<$struct>(PhantomData);
()
};
}
}
const _ : () = ();
const _ : i32 = 42;
const _ : Str = Str{};
check_impl!(Str, Trt);
check_impl!(Str, Trt);
fn main() {
check_impl!(Str, Trt);
check_impl!(Str, Trt);
}