Skip to content

Commit d380db8

Browse files
committed
---
yaml --- r: 187271 b: refs/heads/try c: fe512da h: refs/heads/master i: 187269: 58246bc 187267: 34b9ee7 187263: db4ffc2 v: v3
1 parent 01ce65c commit d380db8

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
@@ -2,7 +2,7 @@
22
refs/heads/master: b4c965ee803a4521d8b4575f634e036f93e408f3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 8f5d22593328d18bd140e7ab10bdeccd0690928a
5+
refs/heads/try: fe512dacc84932de7eb044c0961598f9203446b9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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/try/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/try/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)