xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/conflicting_deps/lib.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifan extern crate example_name_conflict;
2*d4726bddSHONG Yifan 
3*d4726bddSHONG Yifan // This crate depends on a pair of dependencies (transitively) that have the same name. This should
4*d4726bddSHONG Yifan // work OK.
5*d4726bddSHONG Yifan 
example_conflicting_symbol() -> String6*d4726bddSHONG Yifan pub fn example_conflicting_symbol() -> String {
7*d4726bddSHONG Yifan     format!(
8*d4726bddSHONG Yifan         "[from main lib] -> {}",
9*d4726bddSHONG Yifan         example_name_conflict::example_conflicting_symbol()
10*d4726bddSHONG Yifan     )
11*d4726bddSHONG Yifan }
12*d4726bddSHONG Yifan 
13*d4726bddSHONG Yifan #[cfg(test)]
14*d4726bddSHONG Yifan mod tests {
15*d4726bddSHONG Yifan     #[test]
symbols_all_resolve_correctly()16*d4726bddSHONG Yifan     fn symbols_all_resolve_correctly() {
17*d4726bddSHONG Yifan         assert_eq!(
18*d4726bddSHONG Yifan             ::example_conflicting_symbol(),
19*d4726bddSHONG Yifan             "[from main lib] -> [from first_crate] -> [from second_crate]".to_owned()
20*d4726bddSHONG Yifan         );
21*d4726bddSHONG Yifan     }
22*d4726bddSHONG Yifan }
23