Skip to content

Commit 59b394c

Browse files
committed
---
yaml --- r: 157662 b: refs/heads/snap-stage3 c: 737e396 h: refs/heads/master v: v3
1 parent 645b9ad commit 59b394c

File tree

5 files changed

+35
-13
lines changed

5 files changed

+35
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 065caf34f5ff29e04605f95d9c5d511af219439a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 14398f29290b0d96dbe60f329b69062442eefb33
4+
refs/heads/snap-stage3: 737e39696ba0964729f29410cf4e75a061ce120a
55
refs/heads/try: 0ee4d8b0b112c608646fa75463ab4dc59132efd9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/typeck/check/vtable.rs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,25 @@ pub fn maybe_report_ambiguity(fcx: &FnCtxt, obligation: &Obligation) {
303303
// has_errors() to be sure that compilation isn't happening
304304
// anyway. In that case, why inundate the user.
305305
if !fcx.tcx().sess.has_errors() {
306-
fcx.tcx().sess.span_err(
307-
obligation.cause.span,
308-
format!(
309-
"unable to infer enough type information to \
310-
locate the impl of the trait `{}` for \
311-
the type `{}`; type annotations required",
312-
trait_ref.user_string(fcx.tcx()),
313-
self_ty.user_string(fcx.tcx())).as_slice());
314-
note_obligation_cause(fcx, obligation);
306+
if fcx.ccx.tcx.lang_items.sized_trait()
307+
.map_or(false, |sized_id| sized_id == trait_ref.def_id) {
308+
fcx.tcx().sess.span_err(
309+
obligation.cause.span,
310+
format!(
311+
"unable to infer enough type information about `{}`; type annotations \
312+
required",
313+
self_ty.user_string(fcx.tcx())).as_slice());
314+
} else {
315+
fcx.tcx().sess.span_err(
316+
obligation.cause.span,
317+
format!(
318+
"unable to infer enough type information to \
319+
locate the impl of the trait `{}` for \
320+
the type `{}`; type annotations required",
321+
trait_ref.user_string(fcx.tcx()),
322+
self_ty.user_string(fcx.tcx())).as_slice());
323+
note_obligation_cause(fcx, obligation);
324+
}
315325
}
316326
} else if !fcx.tcx().sess.has_errors() {
317327
// Ambiguity. Coherence should have reported an error.

branches/snap-stage3/src/test/compile-fail/issue-16562.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ struct Col<D, C> {
1616
}
1717

1818
impl<T, M: MatrixShape> Collection for Col<M, uint> {
19-
//~^ ERROR unable to infer enough type information to locate the impl of the trait
20-
//~^^ NOTE the trait `core::kinds::Sized` must be implemented because it is required by
19+
//~^ ERROR unable to infer enough type information
2120
fn len(&self) -> uint {
2221
unimplemented!()
2322
}

branches/snap-stage3/src/test/compile-fail/issue-17551.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
struct B<T>;
1414

1515
fn main() {
16-
let foo = B; //~ ERROR unable to infer enough type information to locate the impl of the trait
16+
let foo = B; //~ ERROR unable to infer enough type information
1717
let closure = |:| foo;
1818
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let x; //~ ERROR unable to infer enough type information
13+
}

0 commit comments

Comments
 (0)