File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -288,6 +288,48 @@ fn host_proc_macro() {
288288 . run ( ) ;
289289}
290290
291+ #[ cargo_test( build_std_real) ]
292+ fn build_std_does_not_warn_about_implicit_std_deps ( ) {
293+ let p = project ( )
294+ . file (
295+ "Cargo.toml" ,
296+ r#"
297+ [package]
298+ name = "buildstd_test"
299+ version = "0.1.0"
300+ edition = "2021"
301+
302+ [dependencies]
303+ bar = { path = "bar" }
304+ "# ,
305+ )
306+ . file ( "src/main.rs" , "fn main() {}" )
307+ . file (
308+ "bar/Cargo.toml" ,
309+ r#"
310+ [package]
311+ name = "bar"
312+ version = "0.1.0"
313+ edition = "2021"
314+ "# ,
315+ )
316+ . file ( "bar/src/lib.rs" , "" )
317+ . build ( ) ;
318+
319+ p. cargo ( "build" )
320+ . build_std ( )
321+ . target_host ( )
322+ . env ( "RUSTFLAGS" , "-W unused-crate-dependencies" )
323+ // correctly warns
324+ . with_stderr_contains ( "[WARNING] extern crate `bar` is unused in crate `buildstd_test`" )
325+ // should NOT warn but currently do
326+ . with_stderr_contains ( "[WARNING] extern crate `core` is unused [..]" )
327+ . with_stderr_contains ( "[WARNING] extern crate `alloc` is unused [..]" )
328+ . with_stderr_contains ( "[WARNING] extern crate `compiler_builtins` is unused [..]" )
329+ . with_stderr_contains ( "[WARNING] extern crate `proc_macro` is unused [..]" )
330+ . with_stderr_contains ( "[WARNING] extern crate `panic_unwind` is unused [..]" )
331+ . run ( ) ;
332+ }
291333#[ cargo_test( build_std_real) ]
292334fn cross_custom ( ) {
293335 let p = project ( )
You can’t perform that action at this time.
0 commit comments