|
| 1 | +// Test for the Path::name field within a single crate. |
| 2 | +// |
| 3 | +// See https://github.com/rust-lang/rust/issues/135600 |
| 4 | +// and https://github.com/rust-lang/rust/pull/134880#issuecomment-2596386111 |
| 5 | + |
| 6 | +mod priv_mod { |
| 7 | + pub struct InPrivMod; |
| 8 | +} |
| 9 | + |
| 10 | +pub mod pub_mod { |
| 11 | + pub struct InPubMod; |
| 12 | +} |
| 13 | + |
| 14 | +use priv_mod::InPrivMod as InPrivMod3; |
| 15 | +pub use priv_mod::{InPrivMod, InPrivMod as InPrivMod2}; |
| 16 | +use pub_mod::InPubMod as InPubMod3; |
| 17 | +pub use pub_mod::{InPubMod, InPubMod as InPubMod2}; |
| 18 | + |
| 19 | +//@ is "$.index[*][?(@.name=='T0')].inner.type_alias.type.resolved_path.name" '"priv_mod::InPrivMod"' |
| 20 | +pub type T0 = priv_mod::InPrivMod; |
| 21 | +//@ is "$.index[*][?(@.name=='T1')].inner.type_alias.type.resolved_path.name" '"InPrivMod"' |
| 22 | +pub type T1 = InPrivMod; |
| 23 | +//@ is "$.index[*][?(@.name=='T2')].inner.type_alias.type.resolved_path.name" '"InPrivMod2"' |
| 24 | +pub type T2 = InPrivMod2; |
| 25 | +//@ is "$.index[*][?(@.name=='T3')].inner.type_alias.type.resolved_path.name" '"priv_mod::InPrivMod"' |
| 26 | +pub type T3 = InPrivMod3; |
| 27 | + |
| 28 | +//@ is "$.index[*][?(@.name=='U0')].inner.type_alias.type.resolved_path.name" '"pub_mod::InPubMod"' |
| 29 | +pub type U0 = pub_mod::InPubMod; |
| 30 | +//@ is "$.index[*][?(@.name=='U1')].inner.type_alias.type.resolved_path.name" '"InPubMod"' |
| 31 | +pub type U1 = InPubMod; |
| 32 | +//@ is "$.index[*][?(@.name=='U2')].inner.type_alias.type.resolved_path.name" '"InPubMod2"' |
| 33 | +pub type U2 = InPubMod2; |
| 34 | +//@ is "$.index[*][?(@.name=='U3')].inner.type_alias.type.resolved_path.name" '"pub_mod::InPubMod"' |
| 35 | +pub type U3 = InPubMod3; |
| 36 | + |
| 37 | +// Check we only have paths for structs at there origonal path |
| 38 | +//@ ismany "$.paths[*][?(@.crate_id==0 && @.kind=='struct')].path" '["path_name", "priv_mod", "InPrivMod"]' '["path_name", "pub_mod", "InPubMod"]' |
0 commit comments