Skip to content

Commit 06a5060

Browse files
Daniel J RollinsManishearth
Daniel J Rollins
authored andcommitted
---
yaml --- r: 273365 b: refs/heads/beta c: 2dd5776 h: refs/heads/master i: 273363: 4dbbaea
1 parent 30ef806 commit 06a5060

34 files changed

+493
-640
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 78e8a00514052bf812af0677dde8710336d77cbb
26+
refs/heads/beta: 2dd5776b1110a24d9ceb1d1f89dd684d0e63fbf7
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/libcore/intrinsics.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,35 +53,19 @@ extern "rust-intrinsic" {
5353
// NB: These intrinsics take raw pointers because they mutate aliased
5454
// memory, which is not valid for either `&` or `&mut`.
5555

56-
#[cfg(stage0)]
5756
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
58-
#[cfg(stage0)]
5957
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
60-
#[cfg(stage0)]
6158
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
62-
#[cfg(stage0)]
6359
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
64-
#[cfg(stage0)]
6560
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;
66-
67-
#[cfg(not(stage0))]
68-
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool);
69-
#[cfg(not(stage0))]
70-
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
71-
#[cfg(not(stage0))]
72-
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
73-
#[cfg(not(stage0))]
74-
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
75-
#[cfg(not(stage0))]
76-
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
7761
#[cfg(not(stage0))]
78-
pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
62+
pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
7963
#[cfg(not(stage0))]
80-
pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
64+
pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> T;
8165
#[cfg(not(stage0))]
82-
pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
66+
pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
8367
#[cfg(not(stage0))]
84-
pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
68+
pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
8569

8670
#[cfg(not(stage0))]
8771
pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool);

branches/beta/src/libcore/sync/atomic.rs

Lines changed: 83 additions & 114 deletions
Large diffs are not rendered by default.

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

Lines changed: 76 additions & 138 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ pub fn common_supertype<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
407407
match result {
408408
Ok(t) => t,
409409
Err(ref err) => {
410-
cx.report_and_explain_type_error(trace, err).emit();
410+
cx.report_and_explain_type_error(trace, err);
411411
cx.tcx.types.err
412412
}
413413
}
@@ -1396,7 +1396,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13961396
found: actual
13971397
})
13981398
};
1399-
self.report_and_explain_type_error(trace, &err).emit();
1399+
self.report_and_explain_type_error(trace, &err);
14001400
}
14011401

14021402
pub fn report_conflicting_default_types(&self,
@@ -1411,13 +1411,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14111411
})
14121412
};
14131413

1414-
self.report_and_explain_type_error(
1415-
trace,
1414+
self.report_and_explain_type_error(trace,
14161415
&TypeError::TyParamDefaultMismatch(ExpectedFound {
14171416
expected: expected,
14181417
found: actual
1419-
}))
1420-
.emit();
1418+
}));
14211419
}
14221420

14231421
pub fn replace_late_bound_regions_with_fresh_var<T>(

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

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use self::CombineMapType::*;
1717
pub use self::RegionResolutionError::*;
1818
pub use self::VarValue::*;
1919

20-
use super::{RegionVariableOrigin, SubregionOrigin, MiscVariable};
20+
use super::{RegionVariableOrigin, SubregionOrigin, TypeTrace, MiscVariable};
2121
use super::unify_key;
2222

2323
use rustc_data_structures::graph::{self, Direction, NodeIndex};
@@ -27,6 +27,7 @@ use middle::ty::{self, Ty, TyCtxt};
2727
use middle::ty::{BoundRegion, Region, RegionVid};
2828
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
2929
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
30+
use middle::ty::error::TypeError;
3031
use util::common::indenter;
3132
use util::nodemap::{FnvHashMap, FnvHashSet};
3233

@@ -151,16 +152,11 @@ pub enum RegionResolutionError<'tcx> {
151152
/// more specific errors message by suggesting to the user where they
152153
/// should put a lifetime. In those cases we process and put those errors
153154
/// into `ProcessedErrors` before we do any reporting.
154-
ProcessedErrors(Vec<ProcessedErrorOrigin<'tcx>>,
155+
ProcessedErrors(Vec<RegionVariableOrigin>,
156+
Vec<(TypeTrace<'tcx>, TypeError<'tcx>)>,
155157
Vec<SameRegions>),
156158
}
157159

158-
#[derive(Clone, Debug)]
159-
pub enum ProcessedErrorOrigin<'tcx> {
160-
ConcreteFailure(SubregionOrigin<'tcx>, Region, Region),
161-
VariableFailure(RegionVariableOrigin),
162-
}
163-
164160
/// SameRegions is used to group regions that we think are the same and would
165161
/// like to indicate so to the user.
166162
/// For example, the following function
@@ -534,14 +530,16 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
534530
assert!(self.values_are_none());
535531

536532
debug!("RegionVarBindings: lub_regions({:?}, {:?})", a, b);
537-
if a == ty::ReStatic || b == ty::ReStatic {
538-
ReStatic // nothing lives longer than static
539-
} else if a == b {
540-
a // LUB(a,a) = a
541-
} else {
542-
self.combine_vars(Lub, a, b, origin.clone(), |this, old_r, new_r| {
543-
this.make_subregion(origin.clone(), old_r, new_r)
544-
})
533+
match (a, b) {
534+
(ReStatic, _) | (_, ReStatic) => {
535+
ReStatic // nothing lives longer than static
536+
}
537+
538+
_ => {
539+
self.combine_vars(Lub, a, b, origin.clone(), |this, old_r, new_r| {
540+
this.make_subregion(origin.clone(), old_r, new_r)
541+
})
542+
}
545543
}
546544
}
547545

@@ -552,11 +550,8 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
552550
debug!("RegionVarBindings: glb_regions({:?}, {:?})", a, b);
553551
match (a, b) {
554552
(ReStatic, r) | (r, ReStatic) => {
555-
r // static lives longer than everything else
556-
}
557-
558-
_ if a == b => {
559-
a // GLB(a,a) = a
553+
// static lives longer than everything else
554+
r
560555
}
561556

562557
_ => {

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
725725
(_, name) if name.starts_with("atomic_") => {
726726
let split: Vec<&str> = name.split('_').collect();
727727

728-
let is_cxchg = split[1] == "cxchg" || split[1] == "cxchgweak";
729728
let (order, failorder) = match split.len() {
730729
2 => (llvm::SequentiallyConsistent, llvm::SequentiallyConsistent),
731730
3 => match split[2] {
@@ -734,34 +733,39 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
734733
"acq" => (llvm::Acquire, llvm::Acquire),
735734
"rel" => (llvm::Release, llvm::Monotonic),
736735
"acqrel" => (llvm::AcquireRelease, llvm::Acquire),
737-
"failrelaxed" if is_cxchg =>
736+
"failrelaxed" if split[1] == "cxchg" || split[1] == "cxchgweak" =>
738737
(llvm::SequentiallyConsistent, llvm::Monotonic),
739-
"failacq" if is_cxchg =>
738+
"failacq" if split[1] == "cxchg" || split[1] == "cxchgweak" =>
740739
(llvm::SequentiallyConsistent, llvm::Acquire),
741740
_ => ccx.sess().fatal("unknown ordering in atomic intrinsic")
742741
},
743742
4 => match (split[2], split[3]) {
744-
("acq", "failrelaxed") if is_cxchg =>
743+
("acq", "failrelaxed") if split[1] == "cxchg" || split[1] == "cxchgweak" =>
745744
(llvm::Acquire, llvm::Monotonic),
746-
("acqrel", "failrelaxed") if is_cxchg =>
745+
("acqrel", "failrelaxed") if split[1] == "cxchg" || split[1] == "cxchgweak" =>
747746
(llvm::AcquireRelease, llvm::Monotonic),
748747
_ => ccx.sess().fatal("unknown ordering in atomic intrinsic")
749748
},
750749
_ => ccx.sess().fatal("Atomic intrinsic not in correct format"),
751750
};
752751

753752
match split[1] {
754-
"cxchg" | "cxchgweak" => {
753+
"cxchg" => {
755754
let cmp = from_immediate(bcx, llargs[1]);
756755
let src = from_immediate(bcx, llargs[2]);
757756
let ptr = PointerCast(bcx, llargs[0], val_ty(src).ptr_to());
758-
let weak = if split[1] == "cxchgweak" { llvm::True } else { llvm::False };
759-
let val = AtomicCmpXchg(bcx, ptr, cmp, src, order, failorder, weak);
757+
let res = AtomicCmpXchg(bcx, ptr, cmp, src, order, failorder, llvm::False);
758+
ExtractValue(bcx, res, 0)
759+
}
760+
761+
"cxchgweak" => {
762+
let cmp = from_immediate(bcx, llargs[1]);
763+
let src = from_immediate(bcx, llargs[2]);
764+
let ptr = PointerCast(bcx, llargs[0], val_ty(src).ptr_to());
765+
let val = AtomicCmpXchg(bcx, ptr, cmp, src, order, failorder, llvm::True);
760766
let result = ExtractValue(bcx, val, 0);
761767
let success = ZExt(bcx, ExtractValue(bcx, val, 1), Type::bool(bcx.ccx()));
762-
Store(bcx,
763-
result,
764-
PointerCast(bcx, StructGEP(bcx, llresult, 0), val_ty(src).ptr_to()));
768+
Store(bcx, result, StructGEP(bcx, llresult, 0));
765769
Store(bcx, success, StructGEP(bcx, llresult, 1));
766770
C_nil(ccx)
767771
}
@@ -774,7 +778,6 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
774778
}
775779
to_immediate(bcx, AtomicLoad(bcx, ptr, order), tp_ty)
776780
}
777-
778781
"store" => {
779782
let val = from_immediate(bcx, llargs[1]);
780783
let ptr = PointerCast(bcx, llargs[0], val_ty(val).ptr_to());

0 commit comments

Comments
 (0)