summaryrefslogtreecommitdiffstats
path: root/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /src/test/run-make-fulldeps/rustdoc-scrape-examples-macros
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make-fulldeps/rustdoc-scrape-examples-macros')
-rw-r--r--src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile18
-rw-r--r--src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs27
-rw-r--r--src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs12
-rw-r--r--src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs39
4 files changed, 0 insertions, 96 deletions
diff --git a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile b/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile
deleted file mode 100644
index c857aa4b9..000000000
--- a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-include ../../run-make-fulldeps/tools.mk
-
-OUTPUT_DIR := "$(TMPDIR)/rustdoc"
-DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foobar_macro --crate-type dylib --print file-names -)
-
-all:
- $(RUSTC) src/proc.rs --crate-name foobar_macro --edition=2021 --crate-type proc-macro --emit=dep-info,link
-
- $(RUSTC) src/lib.rs --crate-name foobar --edition=2021 --crate-type lib --emit=dep-info,link
-
- $(RUSTDOC) examples/ex.rs --crate-name ex --crate-type bin --output $(OUTPUT_DIR) \
- --extern foobar=$(TMPDIR)/libfoobar.rlib --extern foobar_macro=$(TMPDIR)/$(DYLIB_NAME) \
- -Z unstable-options --scrape-examples-output-path $(TMPDIR)/ex.calls --scrape-examples-target-crate foobar
-
- $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \
- -Z unstable-options --with-examples $(TMPDIR)/ex.calls
-
- $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs
diff --git a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs b/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs
deleted file mode 100644
index 4d8c8b30e..000000000
--- a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-extern crate foobar;
-extern crate foobar_macro;
-
-use foobar::*;
-use foobar_macro::*;
-
-a_proc_macro!(); // no
-
-#[an_attr_macro]
-fn a() {
- f(); // no
-}
-
-#[an_attr_macro(with_span)]
-fn b() {
- f(); // yes
-}
-
-fn c() {
- a_rules_macro!(f()); // yes
-}
-
-fn d() {
- a_rules_macro!(()); // no
-}
-
-fn main(){}
diff --git a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs b/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs
deleted file mode 100644
index d8658a0f2..000000000
--- a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Scraped example should only include line numbers for items b and c in ex.rs
-// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14'
-// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15'
-// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21'
-// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22'
-
-pub fn f() {}
-
-#[macro_export]
-macro_rules! a_rules_macro {
- ($e:expr) => { ($e, foobar::f()); }
-}
diff --git a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs b/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs
deleted file mode 100644
index 46e518fdf..000000000
--- a/src/test/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-extern crate proc_macro;
-use proc_macro::*;
-
-#[proc_macro]
-pub fn a_proc_macro(_item: TokenStream) -> TokenStream {
- "fn ex() { foobar::f(); }".parse().unwrap()
-}
-
-// inserts foobar::f() to the end of the function
-#[proc_macro_attribute]
-pub fn an_attr_macro(attr: TokenStream, item: TokenStream) -> TokenStream {
- let new_call: TokenStream = "foobar::f();".parse().unwrap();
-
- let mut tokens = item.into_iter();
-
- let fn_tok = tokens.next().unwrap();
- let ident_tok = tokens.next().unwrap();
- let args_tok = tokens.next().unwrap();
- let body = match tokens.next().unwrap() {
- TokenTree::Group(g) => {
- let new_g = Group::new(g.delimiter(), new_call);
- let mut outer_g = Group::new(
- g.delimiter(),
- [TokenTree::Group(g.clone()), TokenTree::Group(new_g)].into_iter().collect(),
- );
-
- if attr.to_string() == "with_span" {
- outer_g.set_span(g.span());
- }
-
- TokenTree::Group(outer_g)
- }
- _ => unreachable!(),
- };
-
- let tokens = vec![fn_tok, ident_tok, args_tok, body].into_iter().collect::<TokenStream>();
-
- tokens
-}