Skip to content

Commit 8617604

Browse files
committed
Cleanup. Generalized last bugfix to projections.
Removed unused imports and fixed projections in a similar, but much more ugly manner. This will have to be cleanly solved in rustc.
1 parent 4835764 commit 8617604

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

src/bin/rust_semverver.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ extern crate getopts;
66
extern crate rustc;
77
extern crate rustc_driver;
88
extern crate rustc_errors;
9-
extern crate rustc_metadata;
10-
extern crate semver;
119
extern crate semverver;
1210
extern crate syntax;
1311

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ extern crate log;
1010
extern crate quickcheck;
1111

1212
extern crate rustc;
13-
extern crate rustc_data_structures;
14-
extern crate rustc_errors;
1513
extern crate semver;
1614
extern crate syntax;
1715
extern crate syntax_pos;

src/semcheck/translate.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,20 @@ impl<'a, 'gcx, 'tcx> TranslationContext<'a, 'gcx, 'tcx> {
202202
err_pred
203203
}
204204
},
205-
Projection(ExistentialProjection { item_def_id, substs, ty }) => {
205+
Projection(existential_projection) => {
206+
let projection_pred = Binder(existential_projection)
207+
.with_self_ty(self.tcx, self.tcx.types.err);
208+
let item_def_id =
209+
projection_pred.skip_binder().projection_ty.item_def_id;
210+
let substs = projection_pred.skip_binder().projection_ty.substs;
211+
206212
if let Some((target_def_id, target_substs)) =
207213
self.translate_orig_substs(index_map, item_def_id, substs)
208214
{
209215
Projection(ExistentialProjection {
210216
item_def_id: target_def_id,
211-
substs: target_substs,
217+
// TODO: should be it's own method in rustc
218+
substs: self.tcx.intern_substs(&target_substs[1..]),
212219
ty: ty,
213220
})
214221
} else {

tests/cases/trait_objects/new.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(unboxed_closures)]
2+
3+
pub trait Abc { }
4+
5+
pub struct Def;
6+
7+
impl Abc for Def { }
8+
9+
pub fn a(_: &Abc) { }
10+
11+
pub trait A<T> { }
12+
13+
pub type Something = A<()>;

tests/cases/trait_objects/old.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(unboxed_closures)]
2+
3+
pub trait Abc { }
4+
5+
pub struct Def;
6+
7+
impl Abc for Def { }
8+
9+
pub fn a(_: &Abc) { }
10+
11+
pub trait A<T> { }
12+
13+
pub type Something = A<()>;

tests/cases/trait_objects/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

0 commit comments

Comments
 (0)