diff options
Diffstat (limited to 'src/test')
3 files changed, 106 insertions, 0 deletions
diff --git a/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs b/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs new file mode 100644 index 00000000000..763c9eb138e --- /dev/null +++ b/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs @@ -0,0 +1,49 @@ +// 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. + +// no-prefer-dynamic + +#![crate_type="proc-macro"] +#![allow(non_snake_case)] + +extern crate proc_macro; + +macro_rules! proc_macro_expr_impl { + ($( + $( #[$attr:meta] )* + pub fn $func:ident($input:ident: &str) -> String; + )+) => { + $( + $( #[$attr] )* + #[proc_macro_derive($func)] + pub fn $func(_input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream { + panic!() + } + )+ + }; +} + +proc_macro_expr_impl! { + pub fn f1(input: &str) -> String; + pub fn f2(input: &str) -> String; + pub fn f3(input: &str) -> String; + pub fn f4(input: &str) -> String; + pub fn f5(input: &str) -> String; + pub fn f6(input: &str) -> String; + pub fn f7(input: &str) -> String; + pub fn f8(input: &str) -> String; + pub fn f9(input: &str) -> String; + pub fn fA(input: &str) -> String; + pub fn fB(input: &str) -> String; + pub fn fC(input: &str) -> String; + pub fn fD(input: &str) -> String; + pub fn fE(input: &str) -> String; + pub fn fF(input: &str) -> String; +} diff --git a/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs b/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs new file mode 100644 index 00000000000..aa9aa3b58b9 --- /dev/null +++ b/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs @@ -0,0 +1,16 @@ +// 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. + +#[macro_use] +extern crate issue_49482_macro_def; + +pub use issue_49482_macro_def::*; + +pub fn foo() {} diff --git a/src/test/incremental-fulldeps/issue-49482.rs b/src/test/incremental-fulldeps/issue-49482.rs new file mode 100644 index 00000000000..3261b5ae092 --- /dev/null +++ b/src/test/incremental-fulldeps/issue-49482.rs @@ -0,0 +1,41 @@ +// 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. + +// aux-build:issue_49482_macro_def.rs +// aux-build:issue_49482_reexport.rs +// ignore-stage1 +// revisions: rpass1 + +extern crate issue_49482_reexport; + +pub trait KvStorage +{ + fn get(&self); +} + +impl<K> KvStorage for Box<K> +where + K: KvStorage + ?Sized, +{ + fn get(&self) { + (**self).get() + } +} + +impl KvStorage for u32 { + fn get(&self) {} +} + +fn main() { + /* force issue_49482_reexport to be loaded */ + issue_49482_reexport::foo(); + + Box::new(2).get(); +} |
