Skip to content

Commit 71a97b7

Browse files
committed
---
yaml --- r: 85343 b: refs/heads/dist-snap c: 0efbb25 h: refs/heads/master i: 85341: 650ac61 85339: e79b8e6 85335: a26bc58 85327: 29450e3 85311: 7928096 v: v3
1 parent e67fb81 commit 71a97b7

22 files changed

+142
-338
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 0983ebe5310d4eb6d289f636f7ed0536c08bbc0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 783c6a1fbf9c44bc58e3ba9224d5920db1de91f0
9+
refs/heads/dist-snap: 0efbb25a26d9a793ce5aa67e030b3d0bee43f5fa
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/typeck/check/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,10 +3208,19 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
32083208
ty_param_count, ty_substs_len));
32093209
fcx.infcx().next_ty_vars(ty_param_count)
32103210
} else if ty_substs_len < ty_param_count {
3211+
let is_static_method = match fcx.ccx.tcx.def_map.find(&node_id) {
3212+
Some(&ast::def_static_method(*)) => true,
3213+
_ => false
3214+
};
32113215
fcx.ccx.tcx.sess.span_err
32123216
(span,
32133217
fmt!("not enough type parameters provided: expected %u, found %u",
32143218
ty_param_count, ty_substs_len));
3219+
if is_static_method {
3220+
fcx.ccx.tcx.sess.span_note
3221+
(span, "Static methods have an extra implicit type parameter -- \
3222+
did you omit the type parameter for the `Self` type?");
3223+
}
32153224
fcx.infcx().next_ty_vars(ty_param_count)
32163225
} else {
32173226
pth.types.map(|aty| fcx.to_ty(aty))

branches/dist-snap/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ fn visit_expr(expr: @ast::expr, (rcx, v): (@mut Rcx, rvt)) {
391391
let target_ty = rcx.resolve_node_type(expr.id);
392392
match ty::get(target_ty).sty {
393393
ty::ty_trait(_, _, ty::RegionTraitStore(trait_region), _, _) => {
394-
let source_ty = rcx.fcx.expr_ty(source);
394+
let source_ty = rcx.resolve_expr_type_adjusted(source);
395395
constrain_regions_in_type(
396396
rcx,
397397
trait_region,
@@ -1153,17 +1153,20 @@ pub mod guarantor {
11531153
match ty::get(ty).sty {
11541154
ty::ty_rptr(r, _) |
11551155
ty::ty_evec(_, ty::vstore_slice(r)) |
1156+
ty::ty_trait(_, _, ty::RegionTraitStore(r), _, _) |
11561157
ty::ty_estr(ty::vstore_slice(r)) => {
11571158
BorrowedPointer(r)
11581159
}
11591160
ty::ty_uniq(*) |
11601161
ty::ty_estr(ty::vstore_uniq) |
1162+
ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
11611163
ty::ty_evec(_, ty::vstore_uniq) => {
11621164
OwnedPointer
11631165
}
11641166
ty::ty_box(*) |
11651167
ty::ty_ptr(*) |
11661168
ty::ty_evec(_, ty::vstore_box) |
1169+
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) |
11671170
ty::ty_estr(ty::vstore_box) => {
11681171
OtherPointer
11691172
}

branches/dist-snap/src/librustc/middle/typeck/infer/coercion.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ impl Coerce {
121121
};
122122
}
123123

124-
ty::ty_trait(_, _, ty::RegionTraitStore(*), _, _) => {
124+
ty::ty_trait(_, _, ty::RegionTraitStore(*), m, _) => {
125125
return do self.unpack_actual_value(a) |sty_a| {
126-
self.coerce_borrowed_object(a, sty_a, b)
126+
self.coerce_borrowed_object(a, sty_a, b, m)
127127
};
128128
}
129129

@@ -274,34 +274,30 @@ impl Coerce {
274274
fn coerce_borrowed_object(&self,
275275
a: ty::t,
276276
sty_a: &ty::sty,
277-
b: ty::t) -> CoerceResult
277+
b: ty::t,
278+
b_mutbl: ast::mutability) -> CoerceResult
278279
{
279280
debug!("coerce_borrowed_object(a=%s, sty_a=%?, b=%s)",
280281
a.inf_str(self.infcx), sty_a,
281282
b.inf_str(self.infcx));
282283

283284
let tcx = self.infcx.tcx;
284285
let r_a = self.infcx.next_region_var(Coercion(self.trace));
285-
let trt_mut;
286286

287287
let a_borrowed = match *sty_a {
288-
ty::ty_trait(_, _, ty::RegionTraitStore(_), _, _) => {
289-
return self.subtype(a, b);
290-
}
291-
ty::ty_trait(did, ref substs, _, m, b) => {
292-
trt_mut = m;
288+
ty::ty_trait(did, ref substs, _, _, b) => {
293289
ty::mk_trait(tcx, did, substs.clone(),
294-
ty::RegionTraitStore(r_a), m, b)
290+
ty::RegionTraitStore(r_a), b_mutbl, b)
295291
}
296292
_ => {
297293
return self.subtype(a, b);
298294
}
299295
};
300296

301-
if_ok!(self.tys(a_borrowed, b));
297+
if_ok!(self.subtype(a_borrowed, b));
302298
Ok(Some(@AutoDerefRef(AutoDerefRef {
303299
autoderefs: 0,
304-
autoref: Some(AutoBorrowObj(r_a, trt_mut))
300+
autoref: Some(AutoBorrowObj(r_a, b_mutbl))
305301
})))
306302
}
307303

branches/dist-snap/src/test/auxiliary/iss.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

branches/dist-snap/src/test/auxiliary/issue_3907.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

branches/dist-snap/src/test/compile-fail/issue-3907.rs renamed to branches/dist-snap/src/test/compile-fail/issue-4096.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// aux-build:issue_3907.rs
12-
extern mod issue_3907;
13-
14-
type Foo = issue_3907::Foo; //~ ERROR: reference to trait
15-
16-
struct S {
17-
name: int
11+
pub trait Nummy {
12+
fn from_inty<T>() -> Self;
1813
}
1914

20-
impl Foo for S { //~ ERROR: Foo is not a trait
21-
fn bar() { }
15+
impl Nummy for float {
16+
fn from_inty<T>() -> float { 0.0 }
2217
}
2318

2419
fn main() {
25-
let s = S {
26-
name: 0
27-
};
28-
s.bar();
20+
let _1:float = Nummy::from_inty::<int>(); //~ ERROR not enough type
21+
//~^ NOTE Static methods have an extra implicit type parameter
2922
}
30-

branches/dist-snap/src/test/compile-fail/issue-5439.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// error-pattern:borrowed
2+
3+
trait Foo {
4+
fn foo(&self, @mut int);
5+
}
6+
7+
impl Foo for int {
8+
fn foo(&self, x: @mut int) {
9+
*x += *self;
10+
}
11+
}
12+
13+
fn it_takes_two(f: &Foo, g: &mut Foo) {
14+
}
15+
16+
fn main() {
17+
let x = @mut 3_i;
18+
let y = x as @mut Foo;
19+
let z = y;
20+
21+
it_takes_two(y, z);
22+
}

branches/dist-snap/src/test/run-pass/issue-4464.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

branches/dist-snap/src/test/run-pass/issue-4759-1.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

branches/dist-snap/src/test/run-pass/issue-4759.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

branches/dist-snap/src/test/run-pass/issue-5666.rs

Lines changed: 0 additions & 35 deletions
This file was deleted.

branches/dist-snap/src/test/run-pass/issue-5884.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

branches/dist-snap/src/test/run-pass/issue-5926.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

branches/dist-snap/src/test/run-pass/issue-6318.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)