1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // The explicit `extern crate` will catch if a GN target specifies conflicting 6 // dependencies. 7 // 8 // When libraries are included implicitly from the command line, rustc seems to 9 // silently pick the first one that matches. On the other hand with an explicit 10 // "extern crate" directive, which tells rustc to link a dependency no matter 11 // what, rustc will see the conflict. 12 extern crate transitive_dep; 13 14 chromium::import! { 15 "//build/rust/tests/test_rust_metadata:foo_dependency"; 16 } 17 18 pub use foo_dependency::say_foo; 19 pub use foo_dependency::say_foo_directly; 20 pub use transitive_dep::say_something; 21 22 #[no_mangle] print_foo_bar()23pub extern "C" fn print_foo_bar() { 24 println!("{}", foo_dependency::say_foo()); 25 println!("{}", transitive_dep::say_something()); 26 } 27