Skip to content

Commit 63377fc

Browse files
committed
Added a swap-test for an edge case in path change recovery.
1 parent 92c4f19 commit 63377fc

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

tests/cases/swap/new.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pub mod a {
2+
pub use super::b::Abc;
3+
}
4+
5+
pub mod b {
6+
pub struct Abc;
7+
}

tests/cases/swap/old.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pub mod a {
2+
pub struct Abc;
3+
}
4+
5+
pub mod b {
6+
pub use super::a::Abc;
7+
}

tests/cases/swap/stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version bump: 1.0.0 -> (patch) -> 1.0.1

tests/cases/traits/dump

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
13:28:48 eddyb | you need a fulfillment context that you put in all the bounds of the new item
2+
13:28:59 eddyb | (and assuming you used the translated old bounds as the ParamEnv)
3+
13:29:11 eddyb | (or rather, translated tcx.param_env(old_def_id))
4+
13:29:30 eddyb | you should be able to call the resolve_or_error or whatever it is thing
5+
13:29:55 eddyb | once you do that, impls are pretty easy
6+
13:30:03 twk | no, I didn't yet do this :P. But it seems I'll find most of what I need from browsing ParamEnv and friends
7+
13:30:20 eddyb | rustc::traits::fulfill
8+
13:30:22 eddyb | that's the important part
9+
13:31:07 twk | okay, I'll report back once there's something which doesn't fall over all the time
10+
13:31:09 eddyb | so for impls: for every old impl, e.g. impl Trait for X, check that X: Trait still holds, after translating (both X and Trait) to the new
11+
13:31:37 eddyb | it's the same fulfillment context thing as making sure the bounds are satisfied
12+
13:31:48 twk | hm, okay

tests/examples.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,6 @@ test!(regions, "tests/cases/regions");
111111
test!(removal, "tests/cases/removal");
112112
test!(removal_path, "tests/cases/removal_path");
113113
test!(structs, "tests/cases/structs");
114+
test!(swap, "tests/cases/swap");
114115
test!(traits, "tests/cases/traits");
115116
test!(ty_alias, "tests/cases/ty_alias");

0 commit comments

Comments
 (0)