File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -874,7 +874,15 @@ impl CliUnstable {
874
874
"namespaced-features" => self . namespaced_features = parse_empty ( k, v) ?,
875
875
"weak-dep-features" => self . weak_dep_features = parse_empty ( k, v) ?,
876
876
"credential-process" => self . credential_process = parse_empty ( k, v) ?,
877
- "rustdoc-scrape-examples" => self . rustdoc_scrape_examples = v. map ( |s| s. to_string ( ) ) ,
877
+ "rustdoc-scrape-examples" => {
878
+ if let Some ( s) = v {
879
+ self . rustdoc_scrape_examples = Some ( s. to_string ( ) )
880
+ } else {
881
+ bail ! (
882
+ r#"-Z rustdoc-scrape-examples must take "all" or "examples" as an argument"#
883
+ )
884
+ }
885
+ }
878
886
"skip-rustdoc-fingerprint" => self . skip_rustdoc_fingerprint = parse_empty ( k, v) ?,
879
887
"compile-progress" => stabilized_warn ( k, "1.30" , STABILIZED_COMPILE_PROGRESS ) ,
880
888
"offline" => stabilized_err ( k, "1.36" , STABILIZED_OFFLINE ) ?,
Original file line number Diff line number Diff line change @@ -2326,3 +2326,28 @@ fn scrape_examples_crate_with_dash() {
2326
2326
let doc_html = p. read_file ( "target/doc/da_sh/fn.foo.html" ) ;
2327
2327
assert ! ( doc_html. contains( "Examples found in repository" ) ) ;
2328
2328
}
2329
+
2330
+ #[ cargo_test]
2331
+ fn scrape_examples_missing_flag ( ) {
2332
+ if !is_nightly ( ) {
2333
+ return ;
2334
+ }
2335
+
2336
+ let p = project ( )
2337
+ . file (
2338
+ "Cargo.toml" ,
2339
+ r#"
2340
+ [package]
2341
+ name = "foo"
2342
+ version = "1.2.4"
2343
+ authors = []
2344
+ "# ,
2345
+ )
2346
+ . file ( "src/lib.rs" , "//! These are the docs!" )
2347
+ . build ( ) ;
2348
+ p. cargo ( "doc -Zrustdoc-scrape-examples" )
2349
+ . masquerade_as_nightly_cargo ( )
2350
+ . with_status ( 101 )
2351
+ . with_stderr ( "error: -Z rustdoc-scrape-examples must take [..] an argument" )
2352
+ . run ( ) ;
2353
+ }
You can’t perform that action at this time.
0 commit comments