Skip to content

Commit 8900a64

Browse files
luqmanaalexcrichton
authored andcommitted
---
yaml --- r: 118261 b: refs/heads/try c: 735e518 h: refs/heads/master i: 118259: 2376a27 v: v3
1 parent e0da7fa commit 8900a64

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
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: 3770c42a4959cbabc73da52abc7e3db96657974e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d6736a1440d42f6af967a8a20ab8d73522112b72
5-
refs/heads/try: f35328caed68528380cf5f19e4c04eba70f03638
5+
refs/heads/try: 735e518a815bd06fa99ea343351041ba22751fe4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
432432
// function check_cast_for_escaping_regions() in kind.rs
433433
// explaining how it goes about doing that.
434434

435-
let source_ty = rcx.fcx.expr_ty(expr);
435+
let source_ty = rcx.resolve_node_type(expr.id);
436436
constrain_regions_in_type(rcx, trait_region,
437437
infer::RelateObjectBound(expr.span), source_ty);
438438
}

branches/try/src/librustc/middle/typeck/check/writeback.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,14 @@ impl<'cx> WritebackCx<'cx> {
260260
})
261261
}
262262

263-
adjustment => adjustment
263+
ty::AutoObject(trait_store, bb, def_id, substs) => {
264+
ty::AutoObject(
265+
self.resolve(&trait_store, reason),
266+
self.resolve(&bb, reason),
267+
def_id,
268+
self.resolve(&substs, reason)
269+
)
270+
}
264271
};
265272
debug!("Adjustments for node {}: {:?}", id, resolved_adjustment);
266273
self.tcx().adjustments.borrow_mut().insert(
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
// #11612
12+
// We weren't updating the auto adjustments with all the resolved
13+
// type information after type check.
14+
15+
trait A {}
16+
17+
struct B<'a, T> {
18+
f: &'a T
19+
}
20+
21+
impl<'a, T> A for B<'a, T> {}
22+
23+
fn foo(_: &A) {}
24+
25+
fn bar<G>(b: &B<G>) {
26+
foo(b); // Coercion should work
27+
foo(b as &A); // Explicit cast should work as well
28+
}
29+
30+
fn main() {}

0 commit comments

Comments
 (0)