Fix hygiene bug.
This commit is contained in:
parent
560a5da9f1
commit
dfa6c25afd
7 changed files with 89 additions and 8 deletions
|
|
@ -23,5 +23,5 @@ fn main() {
|
|||
bang_proc_macro2!();
|
||||
//~^ ERROR cannot find value `foobar2` in this scope
|
||||
//~^^ did you mean `foobar`?
|
||||
println!("{}", x);
|
||||
println!("{}", x); //~ ERROR cannot find value `x` in this scope
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![crate_type = "proc-macro"]
|
||||
#![feature(proc_macro)]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
#[proc_macro_derive(Test)]
|
||||
pub fn derive(_input: TokenStream) -> TokenStream {
|
||||
"fn f(s: S) { s.x }".parse().unwrap()
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn attr_test(_attr: TokenStream, input: TokenStream) -> TokenStream {
|
||||
input
|
||||
}
|
||||
36
src/test/run-pass-fulldeps/proc-macro/issue-42708.rs
Normal file
36
src/test/run-pass-fulldeps/proc-macro/issue-42708.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
// aux-build:issue-42708.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(decl_macro, proc_macro)]
|
||||
#![allow(unused)]
|
||||
|
||||
extern crate issue_42708;
|
||||
|
||||
macro m() {
|
||||
#[derive(issue_42708::Test)]
|
||||
struct S { x: () }
|
||||
|
||||
#[issue_42708::attr_test]
|
||||
struct S2 { x: () }
|
||||
|
||||
#[derive(Clone)]
|
||||
struct S3 { x: () }
|
||||
|
||||
fn g(s: S, s2: S2, s3: S3) {
|
||||
(s.x, s2.x, s3.x);
|
||||
}
|
||||
}
|
||||
|
||||
m!();
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue