summaryrefslogtreecommitdiffstats
path: root/tests/incremental/auxiliary
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/incremental/auxiliary
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/incremental/auxiliary')
-rw-r--r--tests/incremental/auxiliary/incremental_proc_macro_aux.rs22
-rw-r--r--tests/incremental/auxiliary/issue-49482-macro-def.rs40
-rw-r--r--tests/incremental/auxiliary/issue-49482-reexport.rs6
-rw-r--r--tests/incremental/auxiliary/issue-54059.rs50
-rw-r--r--tests/incremental/auxiliary/issue-79661.rs6
-rw-r--r--tests/incremental/auxiliary/issue-79890.rs1
-rw-r--r--tests/incremental/auxiliary/rustc-rust-log-aux.rs8
7 files changed, 133 insertions, 0 deletions
diff --git a/tests/incremental/auxiliary/incremental_proc_macro_aux.rs b/tests/incremental/auxiliary/incremental_proc_macro_aux.rs
new file mode 100644
index 000000000..6961450b4
--- /dev/null
+++ b/tests/incremental/auxiliary/incremental_proc_macro_aux.rs
@@ -0,0 +1,22 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+// Add a function to shift DefIndex of registrar function
+#[cfg(cfail2)]
+fn foo() {}
+
+#[proc_macro_derive(IncrementalMacro)]
+pub fn derive(input: TokenStream) -> TokenStream {
+ #[cfg(cfail2)]
+ {
+ foo();
+ }
+
+ "".parse().unwrap()
+}
diff --git a/tests/incremental/auxiliary/issue-49482-macro-def.rs b/tests/incremental/auxiliary/issue-49482-macro-def.rs
new file mode 100644
index 000000000..bfa7abb1a
--- /dev/null
+++ b/tests/incremental/auxiliary/issue-49482-macro-def.rs
@@ -0,0 +1,40 @@
+// force-host
+// 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/tests/incremental/auxiliary/issue-49482-reexport.rs b/tests/incremental/auxiliary/issue-49482-reexport.rs
new file mode 100644
index 000000000..39f19e3f1
--- /dev/null
+++ b/tests/incremental/auxiliary/issue-49482-reexport.rs
@@ -0,0 +1,6 @@
+#[macro_use]
+extern crate issue_49482_macro_def;
+
+pub use issue_49482_macro_def::*;
+
+pub fn foo() {}
diff --git a/tests/incremental/auxiliary/issue-54059.rs b/tests/incremental/auxiliary/issue-54059.rs
new file mode 100644
index 000000000..fa2814a77
--- /dev/null
+++ b/tests/incremental/auxiliary/issue-54059.rs
@@ -0,0 +1,50 @@
+// force-host
+// no-prefer-dynamic
+
+// check that having extern "C" functions in a proc macro doesn't crash.
+
+#![crate_type="proc-macro"]
+#![allow(non_snake_case)]
+
+extern crate proc_macro;
+
+macro_rules! proc_macro_tokenstream {
+ () => {
+ ::proc_macro::TokenStream
+ };
+}
+
+macro_rules! proc_macro_expr_impl {
+ ($(
+ $( #[$attr:meta] )*
+ pub fn $func:ident($input:ident: &str) -> String $body:block
+ )+) => {
+ $(
+ // Parses an input that looks like:
+ //
+ // ```
+ // #[allow(unused)]
+ // enum ProcMacroHack {
+ // Input = (stringify!(ARGS), 0).1,
+ // }
+ // ```
+ $( #[$attr] )*
+ #[proc_macro_derive($func)]
+ pub fn $func(input: proc_macro_tokenstream!()) -> proc_macro_tokenstream!() {
+ unsafe { rust_dbg_extern_identity_u64(0); }
+ panic!()
+ }
+ )+
+ };
+}
+
+proc_macro_expr_impl! {
+ pub fn base2_impl(input: &str) -> String {
+ panic!()
+ }
+}
+
+#[link(name="rust_test_helpers")]
+extern "C" {
+ pub fn rust_dbg_extern_identity_u64(v: u64) -> u64;
+}
diff --git a/tests/incremental/auxiliary/issue-79661.rs b/tests/incremental/auxiliary/issue-79661.rs
new file mode 100644
index 000000000..cd32a52eb
--- /dev/null
+++ b/tests/incremental/auxiliary/issue-79661.rs
@@ -0,0 +1,6 @@
+#![feature(rustc_attrs)]
+
+#[cfg_attr(any(rpass2, rpass3), doc = "Some comment")]
+pub struct Foo;
+
+pub struct Wrapper(Foo);
diff --git a/tests/incremental/auxiliary/issue-79890.rs b/tests/incremental/auxiliary/issue-79890.rs
new file mode 100644
index 000000000..8eaeafa52
--- /dev/null
+++ b/tests/incremental/auxiliary/issue-79890.rs
@@ -0,0 +1 @@
+pub trait MyTrait {}
diff --git a/tests/incremental/auxiliary/rustc-rust-log-aux.rs b/tests/incremental/auxiliary/rustc-rust-log-aux.rs
new file mode 100644
index 000000000..a361373dc
--- /dev/null
+++ b/tests/incremental/auxiliary/rustc-rust-log-aux.rs
@@ -0,0 +1,8 @@
+// rustc-env:RUSTC_LOG=debug
+#[cfg(rpass1)]
+pub fn foo() {}
+
+#[cfg(rpass2)]
+pub fn foo() {
+ println!();
+}