Skip to content

Commit e16fc4c

Browse files
committed
---
yaml --- r: 193023 b: refs/heads/beta c: fe512da h: refs/heads/master i: 193021: 828f7ff 193019: 79f20e7 193015: 9cca949 193007: 11970f0 192991: 5a1d9bc 192959: 29caa4a 192895: c9afc3c 192767: cbd6c6f 192511: 68c3002 v: v3
1 parent cda65d9 commit e16fc4c

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 8f5d22593328d18bd140e7ab10bdeccd0690928a
34+
refs/heads/beta: fe512dacc84932de7eb044c0961598f9203446b9
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/src/librustc_typeck/check/method/confirm.rs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -404,26 +404,9 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
404404
all_substs.repr(self.tcx()));
405405

406406
// Instantiate the bounds on the method with the
407-
// type/early-bound-regions substitutions performed. The only
408-
// late-bound-regions that can appear in bounds are from the
409-
// impl, and those were already instantiated above.
410-
//
411-
// FIXME(DST). Super hack. For a method on a trait object
412-
// `Trait`, the generic signature requires that
413-
// `Self:Trait`. Since, for an object, we bind `Self` to the
414-
// type `Trait`, this leads to an obligation
415-
// `Trait:Trait`. Until such time we DST is fully implemented,
416-
// that obligation is not necessarily satisfied. (In the
417-
// future, it would be.) But we know that the true `Self` DOES implement
418-
// the trait. So we just delete this requirement. Hack hack hack.
419-
let mut method_predicates = pick.method_ty.predicates.instantiate(self.tcx(), &all_substs);
420-
match pick.kind {
421-
probe::ObjectPick(..) => {
422-
assert_eq!(method_predicates.predicates.get_slice(subst::SelfSpace).len(), 1);
423-
method_predicates.predicates.pop(subst::SelfSpace);
424-
}
425-
_ => { }
426-
}
407+
// type/early-bound-regions substitutions performed. There can
408+
// be no late-bound regions appearing here.
409+
let method_predicates = pick.method_ty.predicates.instantiate(self.tcx(), &all_substs);
427410
let method_predicates = self.fcx.normalize_associated_types_in(self.span,
428411
&method_predicates);
429412

branches/beta/src/test/compile-fail/issue-18959.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ impl Foo for Thing {
1717
fn foo<T>(&self, _: &T) {}
1818
}
1919

20-
#[inline(never)] fn foo(b: &Bar) { b.foo(&0_usize) }
20+
#[inline(never)]
21+
fn foo(b: &Bar) {
22+
b.foo(&0usize)
23+
//~^ ERROR the trait `Foo` is not implemented for the type `Bar`
24+
}
2125

2226
fn main() {
2327
let mut thing = Thing;

branches/beta/src/test/compile-fail/trait-test-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ fn main() {
1818
10.dup::<i32>(); //~ ERROR does not take type parameters
1919
10.blah::<i32, i32>(); //~ ERROR incorrect number of type parameters
2020
(box 10 as Box<bar>).dup(); //~ ERROR cannot convert to a trait object
21+
//~^ ERROR the trait `bar` is not implemented for the type `bar`
2122
}

0 commit comments

Comments
 (0)