Skip to content

Commit 57547a6

Browse files
committed
---
yaml --- r: 182899 b: refs/heads/beta c: 1a51eb9 h: refs/heads/master i: 182897: 4f394c8 182895: 8d104f1 v: v3
1 parent 3ca7fdb commit 57547a6

File tree

14 files changed

+446
-306
lines changed

14 files changed

+446
-306
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: 023d49e347e9d155a8a713d40f63329902ad249d
34+
refs/heads/beta: 1a51eb9cca3ae5f815825096de4dfbdc9267f735
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/src/librustc/middle/infer/mod.rs

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ use std::rc::Rc;
3333
use syntax::ast;
3434
use syntax::codemap;
3535
use syntax::codemap::Span;
36-
use util::common::indent;
3736
use util::nodemap::FnvHashMap;
3837
use util::ppaux::{ty_to_string};
3938
use util::ppaux::{Repr, UserString};
4039

41-
use self::coercion::Coerce;
4240
use self::combine::{Combine, Combineable, CombineFields};
4341
use self::region_inference::{RegionVarBindings, RegionSnapshot};
4442
use self::equate::Equate;
@@ -47,7 +45,6 @@ use self::lub::Lub;
4745
use self::unify::{UnificationTable, InferCtxtMethodsForSimplyUnifiableTypes};
4846
use self::error_reporting::ErrorReporting;
4947

50-
pub mod coercion;
5148
pub mod combine;
5249
pub mod doc;
5350
pub mod equate;
@@ -68,7 +65,6 @@ pub type Bound<T> = Option<T>;
6865
pub type cres<'tcx, T> = Result<T,ty::type_err<'tcx>>; // "combine result"
6966
pub type ures<'tcx> = cres<'tcx, ()>; // "unify result"
7067
pub type fres<T> = Result<T, fixup_err>; // "fixup result"
71-
pub type CoerceResult<'tcx> = cres<'tcx, Option<ty::AutoAdjustment<'tcx>>>;
7268

7369
pub struct InferCtxt<'a, 'tcx: 'a> {
7470
pub tcx: &'a ty::ctxt<'tcx>,
@@ -409,24 +405,6 @@ fn expected_found<T>(a_is_expected: bool,
409405
}
410406
}
411407

412-
pub fn mk_coercety<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
413-
a_is_expected: bool,
414-
origin: TypeOrigin,
415-
a: Ty<'tcx>,
416-
b: Ty<'tcx>)
417-
-> CoerceResult<'tcx> {
418-
debug!("mk_coercety({} -> {})", a.repr(cx.tcx), b.repr(cx.tcx));
419-
indent(|| {
420-
cx.commit_if_ok(|| {
421-
let trace = TypeTrace {
422-
origin: origin,
423-
values: Types(expected_found(a_is_expected, a, b))
424-
};
425-
Coerce(cx.combine_fields(a_is_expected, trace)).tys(a, b)
426-
})
427-
})
428-
}
429-
430408
trait then<'tcx> {
431409
fn then<T, F>(&self, f: F) -> Result<T, ty::type_err<'tcx>> where
432410
T: Clone,
@@ -689,10 +667,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
689667
{
690668
debug!("sub_types({} <: {})", a.repr(self.tcx), b.repr(self.tcx));
691669
self.commit_if_ok(|| {
692-
let trace = TypeTrace {
693-
origin: origin,
694-
values: Types(expected_found(a_is_expected, a, b))
695-
};
670+
let trace = TypeTrace::types(origin, a_is_expected, a, b);
696671
self.sub(a_is_expected, trace).tys(a, b).to_ures()
697672
})
698673
}
@@ -705,10 +680,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
705680
-> ures<'tcx>
706681
{
707682
self.commit_if_ok(|| {
708-
let trace = TypeTrace {
709-
origin: origin,
710-
values: Types(expected_found(a_is_expected, a, b))
711-
};
683+
let trace = TypeTrace::types(origin, a_is_expected, a, b);
712684
self.equate(a_is_expected, trace).tys(a, b).to_ures()
713685
})
714686
}
@@ -1118,6 +1090,17 @@ impl<'tcx> TypeTrace<'tcx> {
11181090
self.origin.span()
11191091
}
11201092

1093+
pub fn types(origin: TypeOrigin,
1094+
a_is_expected: bool,
1095+
a: Ty<'tcx>,
1096+
b: Ty<'tcx>)
1097+
-> TypeTrace<'tcx> {
1098+
TypeTrace {
1099+
origin: origin,
1100+
values: Types(expected_found(a_is_expected, a, b))
1101+
}
1102+
}
1103+
11211104
pub fn dummy(tcx: &ty::ctxt<'tcx>) -> TypeTrace<'tcx> {
11221105
TypeTrace {
11231106
origin: Misc(codemap::DUMMY_SP),

branches/beta/src/librustc_trans/trans/expr.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,15 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
420420
let tcx = bcx.tcx();
421421

422422
let datum_ty = datum.ty;
423-
// Arrange cleanup
424-
let lval = unpack_datum!(bcx,
425-
datum.to_lvalue_datum(bcx, "unsize_unique_vec", expr.id));
423+
424+
debug!("unsize_unique_vec expr.id={} datum_ty={} len={}",
425+
expr.id, datum_ty.repr(tcx), len);
426+
427+
// We do not arrange cleanup ourselves; if we already are an
428+
// L-value, then cleanup will have already been scheduled (and
429+
// the `datum.store_to` call below will emit code to zero the
430+
// drop flag when moving out of the L-value). If we are an R-value,
431+
// then we do not need to schedule cleanup.
426432

427433
let ll_len = C_uint(bcx.ccx(), len);
428434
let unit_ty = ty::sequence_element_type(tcx, ty::type_content(datum_ty));
@@ -433,7 +439,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
433439
let base = PointerCast(bcx,
434440
base,
435441
type_of::type_of(bcx.ccx(), datum_ty).ptr_to());
436-
bcx = lval.store_to(bcx, base);
442+
bcx = datum.store_to(bcx, base);
437443

438444
Store(bcx, ll_len, get_len(bcx, scratch.val));
439445
DatumBlock::new(bcx, scratch.to_expr_datum())
@@ -455,22 +461,20 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
455461
};
456462
let result_ty = ty::mk_uniq(tcx, ty::unsize_ty(tcx, unboxed_ty, k, expr.span));
457463

458-
let lval = unpack_datum!(bcx,
459-
datum.to_lvalue_datum(bcx, "unsize_unique_expr", expr.id));
464+
// We do not arrange cleanup ourselves; if we already are an
465+
// L-value, then cleanup will have already been scheduled (and
466+
// the `datum.store_to` call below will emit code to zero the
467+
// drop flag when moving out of the L-value). If we are an R-value,
468+
// then we do not need to schedule cleanup.
460469

461470
let scratch = rvalue_scratch_datum(bcx, result_ty, "__uniq_fat_ptr");
462471
let llbox_ty = type_of::type_of(bcx.ccx(), datum_ty);
463472
let base = PointerCast(bcx, get_dataptr(bcx, scratch.val), llbox_ty.ptr_to());
464-
bcx = lval.store_to(bcx, base);
473+
bcx = datum.store_to(bcx, base);
465474

466475
let info = unsized_info(bcx, k, expr.id, unboxed_ty, |t| ty::mk_uniq(tcx, t));
467476
Store(bcx, info, get_len(bcx, scratch.val));
468477

469-
let scratch = unpack_datum!(bcx,
470-
scratch.to_expr_datum().to_lvalue_datum(bcx,
471-
"fresh_uniq_fat_ptr",
472-
expr.id));
473-
474478
DatumBlock::new(bcx, scratch.to_expr_datum())
475479
}
476480
}

branches/beta/src/librustc_typeck/check/callee.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use super::LvaluePreference;
2121
use super::method;
2222
use super::structurally_resolved_type;
2323
use super::TupleArgumentsFlag;
24+
use super::UnresolvedTypeAction;
2425
use super::write_call;
2526

2627
use middle::infer;
@@ -77,6 +78,7 @@ pub fn check_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
7778
callee_expr.span,
7879
original_callee_ty,
7980
Some(callee_expr),
81+
UnresolvedTypeAction::Error,
8082
LvaluePreference::NoPreference,
8183
|adj_ty, idx| {
8284
let autoderefref = ty::AutoDerefRef { autoderefs: idx, autoref: None };

0 commit comments

Comments
 (0)