xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/renamed_deps/mod3.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifan // This crate depends on 2 crates with one of them depending on the other one.
2*d4726bddSHONG Yifan // If the crates are not set correctly in the dependency chain, this crate won't
3*d4726bddSHONG Yifan // compile. The order of the `extern crate` is important to trigger that bug.
4*d4726bddSHONG Yifan extern crate alias_a;
5*d4726bddSHONG Yifan extern crate alias_b;
6*d4726bddSHONG Yifan 
greet(name: &str)7*d4726bddSHONG Yifan pub fn greet(name: &str) {
8*d4726bddSHONG Yifan     println!("{}", alias_b::greeter(name))
9*d4726bddSHONG Yifan }
10*d4726bddSHONG Yifan 
greet_default()11*d4726bddSHONG Yifan pub fn greet_default() {
12*d4726bddSHONG Yifan     println!("{}", alias_b::default_greeter())
13*d4726bddSHONG Yifan }
14*d4726bddSHONG Yifan 
15*d4726bddSHONG Yifan /// This is a documentation.
16*d4726bddSHONG Yifan ///
17*d4726bddSHONG Yifan /// # Examples
18*d4726bddSHONG Yifan ///
19*d4726bddSHONG Yifan /// ```rust
20*d4726bddSHONG Yifan /// assert!(
21*d4726bddSHONG Yifan ///   mod3::am_i_the_world("world") == true
22*d4726bddSHONG Yifan /// );
23*d4726bddSHONG Yifan /// assert!(
24*d4726bddSHONG Yifan ///   mod3::am_i_the_world("myself") == false
25*d4726bddSHONG Yifan /// );
26*d4726bddSHONG Yifan /// ```
am_i_the_world(me: &str) -> bool27*d4726bddSHONG Yifan pub fn am_i_the_world(me: &str) -> bool {
28*d4726bddSHONG Yifan     me == alias_a::world()
29*d4726bddSHONG Yifan }
30*d4726bddSHONG Yifan 
31*d4726bddSHONG Yifan #[cfg(test)]
32*d4726bddSHONG Yifan mod test {
33*d4726bddSHONG Yifan     #[test]
test_am_i_the_world()34*d4726bddSHONG Yifan     fn test_am_i_the_world() {
35*d4726bddSHONG Yifan         assert!(super::am_i_the_world("world"));
36*d4726bddSHONG Yifan         assert!(!super::am_i_the_world("bob"));
37*d4726bddSHONG Yifan     }
38*d4726bddSHONG Yifan }
39