1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#![feature(rustc_private)]
//@ edition: 2021
//@ check-pass
// Checks that the derive macro still works even if the surrounding code has
// shadowed the relevant library types.
extern crate rustc_macros;
mod submod {
use rustc_macros::TryFromU32;
struct Result;
trait TryFrom {}
#[allow(non_camel_case_types)]
struct u32;
struct Ok;
struct Err;
mod core {}
mod std {}
#[derive(TryFromU32)]
pub(crate) enum MyEnum {
Zero,
One,
}
}
fn main() {
use submod::MyEnum;
let _: Result<MyEnum, u32> = MyEnum::try_from(1u32);
}
|