Skip to content

Commit d29e4f3

Browse files
Add regression test for rustdoc scrape-examples feature crash (#144752)
1 parent 768f977 commit d29e4f3

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "foo"
3+
version = "0.0.1"
4+
edition = "2024"
5+
6+
[[example]]
7+
name = "complex"
8+
doc-scrape-examples = true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
let mut x = foo::X::new();
3+
}

tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pub struct X;
2+
3+
impl X {
4+
pub fn new() -> Self {
5+
X
6+
}
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//! Test to ensure that the rustdoc `scrape-examples` feature is not panicking.
2+
//! Regression test for <https://github.com/rust-lang/rust/issues/144752>.
3+
4+
use run_make_support::{cargo, path, rfs};
5+
6+
fn main() {
7+
let tmp = std::env::temp_dir();
8+
let test_crate = tmp.join("foo");
9+
rfs::copy_dir_all(path("foo"), &test_crate);
10+
11+
cargo()
12+
.current_dir(&test_crate)
13+
.args([
14+
"doc",
15+
"-p",
16+
"foo",
17+
"-Zrustdoc-scrape-examples",
18+
])
19+
.run();
20+
}

0 commit comments

Comments
 (0)