about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-03 10:59:24 +0000
committerbors <bors@rust-lang.org>2021-04-03 10:59:24 +0000
commit640ce99bfe70375a24c6775a937d6a258b40398b (patch)
tree2cb8aa2003dc7ae7d030460f65ce5d7e4f5bfd4a /src/test/rustdoc-ui
parentccd997592bf545fc54a9cce31f1280f833915ba1 (diff)
parente4244e37103d83b2cd54637ca2ac4f1c76c35a43 (diff)
downloadrust-640ce99bfe70375a24c6775a937d6a258b40398b.tar.gz
rust-640ce99bfe70375a24c6775a937d6a258b40398b.zip
Auto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkov
rustdoc: Don't load all extern crates unconditionally

Instead, only load the crates that are linked to with intra-doc links.

This doesn't help very much with any of rustdoc's fundamental issues
with freezing the resolver, but it at least fixes a stable-to-stable
regression, and makes the crate loading model somewhat more consistent
with rustc's. I tested and it unfortunately does not help at all with https://github.com/rust-lang/rust/pull/82496.

Closes https://github.com/rust-lang/rust/issues/68427. Let me know if you want me to open a separate issue for not freezing the resolver.
r? `@petrochenkov` cc `@eddyb` `@ollie27`
Diffstat (limited to 'src/test/rustdoc-ui')
-rw-r--r--src/test/rustdoc-ui/auxiliary/panic-item.rs17
-rw-r--r--src/test/rustdoc-ui/unused-extern-crate.rs3
2 files changed, 20 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/auxiliary/panic-item.rs b/src/test/rustdoc-ui/auxiliary/panic-item.rs
new file mode 100644
index 00000000000..17b26850d4d
--- /dev/null
+++ b/src/test/rustdoc-ui/auxiliary/panic-item.rs
@@ -0,0 +1,17 @@
+// no-prefer-dynamic
+#![crate_type = "lib"]
+#![no_std]
+#![feature(lang_items)]
+
+use core::panic::PanicInfo;
+use core::sync::atomic::{self, Ordering};
+
+#[panic_handler]
+fn panic(_info: &PanicInfo) -> ! {
+    loop {
+        atomic::compiler_fence(Ordering::SeqCst);
+    }
+}
+
+#[lang = "eh_personality"]
+fn foo() {}
diff --git a/src/test/rustdoc-ui/unused-extern-crate.rs b/src/test/rustdoc-ui/unused-extern-crate.rs
new file mode 100644
index 00000000000..f703a183790
--- /dev/null
+++ b/src/test/rustdoc-ui/unused-extern-crate.rs
@@ -0,0 +1,3 @@
+// check-pass
+// aux-crate:panic_item=panic-item.rs
+// @has unused_extern_crate/index.html