mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
35 lines
488 B
Rust
35 lines
488 B
Rust
//@ 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() {}
|