rust/tests/incremental/decl_macro.rs

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

35 lines
488 B
Rust
Raw Normal View History

//@ revisions: rpass1 rpass2
// issue#112680
#![feature(decl_macro)]
pub trait T {
type Key;
fn index_from_key(key: Self::Key) -> usize;
}
pub macro m($key_ty:ident, $val_ty:ident) {
struct $key_ty {
inner: usize,
}
impl T for $val_ty {
type Key = $key_ty;
fn index_from_key(key: Self::Key) -> usize {
key.inner
}
}
}
m!(TestId, Test);
#[cfg(rpass1)]
struct Test(u32);
#[cfg(rpass2)]
struct Test;
fn main() {}