@@ -7,6 +7,7 @@ const DEFAULT_EDITION: crate::core::features::Edition =
7
7
crate :: core:: features:: Edition :: LATEST_STABLE ;
8
8
const DEFAULT_VERSION : & str = "0.0.0" ;
9
9
const DEFAULT_PUBLISH : bool = false ;
10
+ const AUTO_FIELDS : & [ & str ] = & [ "autobins" , "autoexamples" , "autotests" , "autobenches" ] ;
10
11
11
12
pub fn expand_manifest (
12
13
content : & str ,
@@ -57,8 +58,11 @@ fn expand_manifest_(
57
58
. or_insert_with ( || toml:: Table :: new ( ) . into ( ) )
58
59
. as_table_mut ( )
59
60
. ok_or_else ( || anyhow:: format_err!( "`package` must be a table" ) ) ?;
60
- for key in [ "workspace" , "build" , "links" ] {
61
- if package. contains_key ( key) {
61
+ for key in [ "workspace" , "build" , "links" ]
62
+ . iter ( )
63
+ . chain ( AUTO_FIELDS . iter ( ) )
64
+ {
65
+ if package. contains_key ( * key) {
62
66
anyhow:: bail!( "`package.{key}` is not allowed in embedded manifests" )
63
67
}
64
68
}
@@ -86,6 +90,11 @@ fn expand_manifest_(
86
90
package
87
91
. entry ( "publish" . to_owned ( ) )
88
92
. or_insert_with ( || toml:: Value :: Boolean ( DEFAULT_PUBLISH ) ) ;
93
+ for field in AUTO_FIELDS {
94
+ package
95
+ . entry ( field. to_owned ( ) )
96
+ . or_insert_with ( || toml:: Value :: Boolean ( false ) ) ;
97
+ }
89
98
90
99
let mut bin = toml:: Table :: new ( ) ;
91
100
bin. insert ( "name" . to_owned ( ) , toml:: Value :: String ( bin_name) ) ;
@@ -361,6 +370,10 @@ name = "test_a472c7a31645d310613df407eab80844346938a3b8fe4f392cae059cb181aa85"
361
370
path = "/home/me/test.rs"
362
371
363
372
[package]
373
+ autobenches = false
374
+ autobins = false
375
+ autoexamples = false
376
+ autotests = false
364
377
edition = "2021"
365
378
name = "test"
366
379
publish = false
@@ -386,6 +399,10 @@ path = "/home/me/test.rs"
386
399
time = "0.1.25"
387
400
388
401
[package]
402
+ autobenches = false
403
+ autobins = false
404
+ autoexamples = false
405
+ autotests = false
389
406
edition = "2021"
390
407
name = "test"
391
408
publish = false
0 commit comments