diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-06-24 19:54:23 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-06-30 01:53:32 +0300 |
| commit | 99ecdb3f5fc49efb3eccdd10fbe12dc98623a938 (patch) | |
| tree | 7c82e4221bf6f94e44ca58399c873b2b9eb29a25 /src/test/ui/hygiene/transparent-basic.rs | |
| parent | 09856c85b73feff1db93990cd3d80f2c585b40c4 (diff) | |
| download | rust-99ecdb3f5fc49efb3eccdd10fbe12dc98623a938.tar.gz rust-99ecdb3f5fc49efb3eccdd10fbe12dc98623a938.zip | |
hygiene: Implement transparent marks
Diffstat (limited to 'src/test/ui/hygiene/transparent-basic.rs')
| -rw-r--r-- | src/test/ui/hygiene/transparent-basic.rs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/test/ui/hygiene/transparent-basic.rs b/src/test/ui/hygiene/transparent-basic.rs new file mode 100644 index 00000000000..81ece1f11bc --- /dev/null +++ b/src/test/ui/hygiene/transparent-basic.rs @@ -0,0 +1,53 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-pass +// aux-build:transparent-basic.rs + +#![feature(decl_macro, rustc_attrs)] + +extern crate transparent_basic; + +#[rustc_transparent_macro] +macro binding() { + let x = 10; +} + +#[rustc_transparent_macro] +macro label() { + break 'label +} + +macro_rules! legacy { + () => { + binding!(); + let y = x; + } +} + +fn legacy_interaction1() { + legacy!(); +} + +struct S; + +fn check_dollar_crate() { + // `$crate::S` inside the macro resolves to `S` from this crate. + transparent_basic::dollar_crate!(); +} + +fn main() { + binding!(); + let y = x; + + 'label: loop { + label!(); + } +} |
