File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -424,3 +424,49 @@ fn allow_priv_in_examples() {
424
424
)
425
425
. run ( )
426
426
}
427
+
428
+ #[ cargo_test( nightly, reason = "exported_private_dependencies lint is unstable" ) ]
429
+ fn allow_priv_in_custom_build ( ) {
430
+ Package :: new ( "priv_dep" , "0.1.0" )
431
+ . file ( "src/lib.rs" , "pub struct FromPriv;" )
432
+ . publish ( ) ;
433
+
434
+ let p = project ( )
435
+ . file (
436
+ "Cargo.toml" ,
437
+ r#"
438
+ cargo-features = ["public-dependency"]
439
+
440
+ [package]
441
+ name = "foo"
442
+ version = "0.0.1"
443
+
444
+ [build-dependencies]
445
+ priv_dep = "0.1.0"
446
+ "# ,
447
+ )
448
+ . file ( "src/main.rs" , "fn main() {}" )
449
+ . file (
450
+ "build.rs" ,
451
+ "
452
+ extern crate priv_dep;
453
+ pub fn use_priv(_: priv_dep::FromPriv) {}
454
+ fn main() {}
455
+ " ,
456
+ )
457
+ . build ( ) ;
458
+
459
+ p. cargo ( "check --all-targets --message-format=short" )
460
+ . masquerade_as_nightly_cargo ( & [ "public-dependency" ] )
461
+ . with_stderr (
462
+ "\
463
+ [UPDATING] `[..]` index
464
+ [DOWNLOADING] crates ...
465
+ [DOWNLOADED] priv_dep v0.1.0 ([..])
466
+ [COMPILING] priv_dep v0.1.0
467
+ [COMPILING] foo v0.0.1 ([CWD])
468
+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
469
+ " ,
470
+ )
471
+ . run ( )
472
+ }
You can’t perform that action at this time.
0 commit comments