Skip to content

Rolling up PRs in the queue #23963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 85 commits into from
Apr 2, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
e05c2f8
trans: Add early-out when translating unreachable controlflow express…
michaelwoerister Mar 5, 2015
3527507
Remove unneeded `T: Send + Sync` bounds from `Arc`.
huonw Mar 8, 2015
25d070f
Remove unneeded `Send`/`Sync` bounds from `Mutex`/`RwLock`.
huonw Mar 8, 2015
0f6b43a
Remove unneeded `Send` bounds from `std::sync::mpsc`.
huonw Mar 8, 2015
fb78ca8
rustup: Fix comment about Darwin's uname -m
richo Mar 29, 2015
ee3dffa
Add support for channel selection
richo Mar 29, 2015
45c10db
Clarified and simplified algorithm for increasing size of buffer in
Mar 29, 2015
2982fe3
80 character line limit
Mar 29, 2015
8d3e559
Clearer wording
Mar 29, 2015
240734c
Only zero at most 64k at a time. We still use the doubling
Mar 30, 2015
0939837
Rename the cryptic cres and ures types.
nikomatsakis Mar 9, 2015
4b0edb9
Combine `try` and `commit_if_ok` and make some details of inference
nikomatsakis Mar 10, 2015
7c62640
Refactor unification interface by moving the methods off of inferctxt…
nikomatsakis Feb 15, 2015
c581840
Make union-find helper fns private, change to u32.
nikomatsakis Feb 16, 2015
a6d9930
Extract more `ty` and `infer` dependencies from the unification engine
nikomatsakis Mar 10, 2015
e78550b
Switch to FnvHashMap
nikomatsakis Mar 18, 2015
e301d7c
Remove unused import
nikomatsakis Mar 18, 2015
8403b82
Port over type inference to using the new type relation stuff
nikomatsakis Mar 22, 2015
cead47c
Add a "match" relation that can be used to make recursion check during
nikomatsakis Mar 20, 2015
cdb10b8
A very simple hack to force an autoderef if the callee has type `&mut
nikomatsakis Mar 31, 2015
27b7841
Add blanket impls for references to the `Fn` traits.
nikomatsakis Mar 20, 2015
11111bb
Add tests for blanket impls.
nikomatsakis Mar 31, 2015
a547962
Pretty print ids for assoc items
nrc Mar 24, 2015
bfc2f5d
Improvements to PhantomData<T>'s docs 👻
steveklabnik Apr 1, 2015
0dd0925
Tidying up and reformatting
nrc Mar 29, 2015
39aa668
Added Arc::try_unique
kvark Mar 29, 2015
8ded156
Add examples + documentation for std::path
steveklabnik Apr 1, 2015
343c110
Fix rust book error-handling.md for new std::io.
Apr 1, 2015
4b6248a
Simplify `match` branches in iter.rs example
frewsxcv Apr 1, 2015
03d3ba7
Implement the changes to coherence such that we consider a type to be
nikomatsakis Mar 30, 2015
35c261a
Add `#[fundamental]` annotations into libcore so that `Sized` and the
nikomatsakis Mar 30, 2015
b0af587
Update tests for new coherence rules, and add a swatch of new tests
nikomatsakis Mar 30, 2015
30b2d9e
Fallout in libstd: remove impls now considered to conflict.
nikomatsakis Mar 30, 2015
15b58fe
Fallout in libsyntax/librustc: use newtype'd options for linked lists,
nikomatsakis Mar 30, 2015
c4edd0c
Make the trait Copy extend Clone.
nikomatsakis Mar 26, 2015
890ed5c
Fallout in tests
nikomatsakis Mar 30, 2015
d9530c0
Fallout out rustc
nikomatsakis Mar 30, 2015
49b76a0
Fallout in libsyntax
nikomatsakis Mar 30, 2015
c35c468
Fallout in public-facing and semi-public-facing libs
nikomatsakis Mar 30, 2015
943729f
Missing imports
nikomatsakis Apr 1, 2015
c054ae2
Merge branch 'fix-rustup' of https://github.com/richo/rust
alexcrichton Apr 1, 2015
28d7693
iOS: os::last_os_error() fallout
vhbit Apr 1, 2015
63f3d7f
rustup: Default to the beta channel
alexcrichton Apr 1, 2015
ed63d32
Add (unstable) FnBox trait as a nicer replacement for `Thunk`. The doc
nikomatsakis Apr 1, 2015
cade32a
Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an alias
nikomatsakis Apr 1, 2015
02b38a2
Rollup merge of #23066 - michaelwoerister:unreachable-if, r=pnkfelix
Manishearth Apr 1, 2015
1d17e6e
Rollup merge of #23844 - kvark:try_unique, r=alexcrichton
Manishearth Apr 1, 2015
abd747c
Rollup merge of #23847 - bcoopers:read_clarification, r=sfackler
Manishearth Apr 1, 2015
9eb0bab
Rollup merge of #23867 - nikomatsakis:issue-23086-take-3, r=pnkfelix
Manishearth Apr 1, 2015
debac97
Rollup merge of #23895 - nikomatsakis:fn-trait-inheritance-add-impls,…
Manishearth Apr 1, 2015
6a3e844
Rollup merge of #23924 - nrc:unqual-assoc3, r=alexcrichton
Manishearth Apr 1, 2015
2159bbf
Rollup merge of #23925 - steveklabnik:gh22914, r=Gankro
Manishearth Apr 1, 2015
77112bb
Rollup merge of #23927 - frewsxcv:patch-7, r=Manishearth
Manishearth Apr 1, 2015
ec6c2c3
Rollup merge of #23932 - steveklabnik:doc_std_path, r=flaper87
Manishearth Apr 1, 2015
eac94fa
Re-write closures chapter
steveklabnik Mar 20, 2015
19d3dab
Collect the definition of the `Error` trait into `libstd` for now. This
nikomatsakis Apr 1, 2015
c0f86a9
Re-add min_value, max_value methods
aturon Apr 1, 2015
4496433
Fix enum timezone across all platforms.
nikomatsakis Apr 1, 2015
d81e866
Feature gate rust-call ABI.
nikomatsakis Apr 1, 2015
8eed73f
Remove TODO
nikomatsakis Apr 1, 2015
971c355
rustup: Fix typo in nightly
richo Apr 1, 2015
3d8df31
Path rustdoc test
nikomatsakis Apr 1, 2015
232e79f
rollup merge of #23568: steveklabnik/closure_docs
alexcrichton Apr 1, 2015
a3f6273
rollup merge of #23867: nikomatsakis/issue-23086-take-3
alexcrichton Apr 1, 2015
fd182f4
rollup merge of #23933: kgv/kgv_fix
alexcrichton Apr 1, 2015
a3e5b35
rollup merge of #23942: vhbit/ios-rand
alexcrichton Apr 1, 2015
d55ffa9
rollup merge of #23944: alexcrichton/rustup-beta
alexcrichton Apr 1, 2015
fb4029f
rollup merge of #23947: aturon/revise-num
alexcrichton Apr 1, 2015
e98dce3
std: Changing the meaning of the count to splitn
alexcrichton Apr 1, 2015
e9bacba
rollup merge of #23951: alexcrichton/splitn
alexcrichton Apr 1, 2015
9bb05fd
rollup merge of #23939: nikomatsakis/fn-box
alexcrichton Apr 1, 2015
371277f
Stabilize basic timeout functionality
aturon Apr 1, 2015
f0a9a0c
manually adding the last two bitrig snapshots
Apr 1, 2015
bb252a8
rollup merge of #23948: nikomatsakis/feature-gate-rust-abi
alexcrichton Apr 1, 2015
655634e
rollup merge of #23949: aturon/stab-timeout
alexcrichton Apr 1, 2015
0304e15
Test fixes and rebase conflicts, round 1
alexcrichton Apr 1, 2015
2e3b0c0
Auto merge of #23955 - alexcrichton:rollup, r=alexcrichton
bors Apr 1, 2015
35a6a37
Add release notes for 1.0.0-beta
aturon Apr 1, 2015
9edbf42
rollup merge of #23945: pnkfelix/gate-u-negate
alexcrichton Apr 2, 2015
05654e5
rollup merge of #23953: dhuseby/master
alexcrichton Apr 2, 2015
f92e7ab
rollup merge of #23860: nikomatsakis/copy-requires-clone
alexcrichton Apr 2, 2015
d49b67e
rollup merge of #23176: huonw/rm-bounds
alexcrichton Apr 2, 2015
57f5ac9
Test fixes and rebase conflicts, round 2
alexcrichton Apr 1, 2015
fb77443
rollup merge of #23959: aturon/beta-relnotes
alexcrichton Apr 2, 2015
e3b7e6c
Tweak relese notes + rebase fixes
alexcrichton Apr 2, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Combine try and commit_if_ok and make some details of inference
context private.
  • Loading branch information
nikomatsakis committed Mar 31, 2015
commit 4b0edb96d080fadccc542dad50e6576c8e11bd85
6 changes: 3 additions & 3 deletions src/librustc/middle/infer/higher_ranked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C

// Start a snapshot so we can examine "all bindings that were
// created as part of this type comparison".
return self.infcx().try(|snapshot| {
return self.infcx().commit_if_ok(|snapshot| {
// First, we instantiate each bound region in the subtype with a fresh
// region variable.
let (a_prime, _) =
Expand Down Expand Up @@ -109,7 +109,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
{
// Start a snapshot so we can examine "all bindings that were
// created as part of this type comparison".
return self.infcx().try(|snapshot| {
return self.infcx().commit_if_ok(|snapshot| {
// Instantiate each bound region with a fresh region variable.
let span = self.trace().origin.span();
let (a_with_fresh, a_map) =
Expand Down Expand Up @@ -202,7 +202,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C

// Make a snapshot so we can examine "all bindings that were
// created as part of this type comparison".
return self.infcx().try(|snapshot| {
return self.infcx().commit_if_ok(|snapshot| {
// Instantiate each bound region with a fresh region variable.
let (a_with_fresh, a_map) =
self.infcx().replace_late_bound_regions_with_fresh_var(
Expand Down
90 changes: 37 additions & 53 deletions src/librustc/middle/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pub enum LateBoundRegionConversionTime {
///
/// See `error_reporting.rs` for more details
#[derive(Clone, Debug)]
pub enum RegionVariableOrigin<'tcx> {
pub enum RegionVariableOrigin {
// Region variables created for ill-categorized reasons,
// mostly indicates places in need of refactoring
MiscVariable(Span),
Expand All @@ -280,7 +280,7 @@ pub enum RegionVariableOrigin<'tcx> {
Autoref(Span),

// Regions created as part of an automatic coercion
Coercion(TypeTrace<'tcx>),
Coercion(Span),

// Region variables created as the values for early-bound regions
EarlyBoundRegion(Span, ast::Name),
Expand Down Expand Up @@ -343,8 +343,7 @@ pub fn common_supertype<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
values: Types(expected_found(a_is_expected, a, b))
};

let result =
cx.commit_if_ok(|| cx.lub(a_is_expected, trace.clone()).tys(a, b));
let result = cx.commit_if_ok(|_| cx.lub(a_is_expected, trace.clone()).tys(a, b));
match result {
Ok(t) => t,
Err(ref err) => {
Expand All @@ -362,9 +361,7 @@ pub fn mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
-> UnitResult<'tcx>
{
debug!("mk_subty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx));
cx.commit_if_ok(|| {
cx.sub_types(a_is_expected, origin, a, b)
})
cx.sub_types(a_is_expected, origin, a, b)
}

pub fn can_mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
Expand Down Expand Up @@ -404,8 +401,7 @@ pub fn mk_eqty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
-> UnitResult<'tcx>
{
debug!("mk_eqty({} <: {})", a.repr(cx.tcx), b.repr(cx.tcx));
cx.commit_if_ok(
|| cx.eq_types(a_is_expected, origin, a, b))
cx.commit_if_ok(|_| cx.eq_types(a_is_expected, origin, a, b))
}

pub fn mk_sub_poly_trait_refs<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
Expand All @@ -417,8 +413,7 @@ pub fn mk_sub_poly_trait_refs<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
{
debug!("mk_sub_trait_refs({} <: {})",
a.repr(cx.tcx), b.repr(cx.tcx));
cx.commit_if_ok(
|| cx.sub_poly_trait_refs(a_is_expected, origin, a.clone(), b.clone()))
cx.commit_if_ok(|_| cx.sub_poly_trait_refs(a_is_expected, origin, a.clone(), b.clone()))
}

fn expected_found<T>(a_is_expected: bool,
Expand Down Expand Up @@ -476,25 +471,25 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}
}

pub fn combine_fields<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> CombineFields<'b, 'tcx> {
fn combine_fields<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> CombineFields<'b, 'tcx> {
CombineFields {infcx: self,
a_is_expected: a_is_expected,
trace: trace}
}

pub fn equate<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> Equate<'b, 'tcx> {
fn equate<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> Equate<'b, 'tcx> {
Equate(self.combine_fields(a_is_expected, trace))
}

pub fn sub<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> Sub<'b, 'tcx> {
fn sub<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> Sub<'b, 'tcx> {
Sub(self.combine_fields(a_is_expected, trace))
}

pub fn lub<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> Lub<'b, 'tcx> {
fn lub<'b>(&'b self, a_is_expected: bool, trace: TypeTrace<'tcx>)
-> Lub<'b, 'tcx> {
Lub(self.combine_fields(a_is_expected, trace))
}

Expand Down Expand Up @@ -558,11 +553,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
r
}

/// Execute `f` and commit the bindings if successful
/// Execute `f` and commit the bindings if closure `f` returns `Ok(_)`
pub fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E> where
F: FnOnce() -> Result<T, E>
F: FnOnce(&CombinedSnapshot) -> Result<T, E>
{
self.commit_unconditionally(move || self.try(move |_| f()))
debug!("commit_if_ok()");
let snapshot = self.start_snapshot();
let r = f(&snapshot);
debug!("commit_if_ok() -- r.is_ok() = {}", r.is_ok());
match r {
Ok(_) => { self.commit_from(snapshot); }
Err(_) => { self.rollback_to(snapshot); }
}
r
}

/// Execute `f` and commit only the region bindings if successful.
Expand All @@ -577,7 +580,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
float_snapshot,
region_vars_snapshot } = self.start_snapshot();

let r = self.try(move |_| f());
let r = self.commit_if_ok(|_| f());

// Roll back any non-region bindings - they should be resolved
// inside `f`, with, e.g. `resolve_type_vars_if_possible`.
Expand All @@ -598,25 +601,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
r
}

/// Execute `f`, unroll bindings on panic
pub fn try<T, E, F>(&self, f: F) -> Result<T, E> where
F: FnOnce(&CombinedSnapshot) -> Result<T, E>
{
debug!("try()");
let snapshot = self.start_snapshot();
let r = f(&snapshot);
debug!("try() -- r.is_ok() = {}", r.is_ok());
match r {
Ok(_) => {
self.commit_from(snapshot);
}
Err(_) => {
self.rollback_to(snapshot);
}
}
r
}

/// Execute `f` then unroll any bindings it creates
pub fn probe<R, F>(&self, f: F) -> R where
F: FnOnce(&CombinedSnapshot) -> R,
Expand All @@ -643,7 +627,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
-> UnitResult<'tcx>
{
debug!("sub_types({} <: {})", a.repr(self.tcx), b.repr(self.tcx));
self.commit_if_ok(|| {
self.commit_if_ok(|_| {
let trace = TypeTrace::types(origin, a_is_expected, a, b);
self.sub(a_is_expected, trace).tys(a, b).map(|_| ())
})
Expand All @@ -656,7 +640,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
b: Ty<'tcx>)
-> UnitResult<'tcx>
{
self.commit_if_ok(|| {
self.commit_if_ok(|_| {
let trace = TypeTrace::types(origin, a_is_expected, a, b);
self.equate(a_is_expected, trace).tys(a, b).map(|_| ())
})
Expand All @@ -672,7 +656,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
debug!("sub_trait_refs({} <: {})",
a.repr(self.tcx),
b.repr(self.tcx));
self.commit_if_ok(|| {
self.commit_if_ok(|_| {
let trace = TypeTrace {
origin: origin,
values: TraitRefs(expected_found(a_is_expected, a.clone(), b.clone()))
Expand All @@ -691,7 +675,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
debug!("sub_poly_trait_refs({} <: {})",
a.repr(self.tcx),
b.repr(self.tcx));
self.commit_if_ok(|| {
self.commit_if_ok(|_| {
let trace = TypeTrace {
origin: origin,
values: PolyTraitRefs(expected_found(a_is_expected, a.clone(), b.clone()))
Expand Down Expand Up @@ -749,7 +733,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
span: Span,
predicate: &ty::PolyEquatePredicate<'tcx>)
-> UnitResult<'tcx> {
self.try(|snapshot| {
self.commit_if_ok(|snapshot| {
let (ty::EquatePredicate(a, b), skol_map) =
self.skolemize_late_bound_regions(predicate, snapshot);
let origin = EquatePredicate(span);
Expand All @@ -762,7 +746,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
span: Span,
predicate: &ty::PolyRegionOutlivesPredicate)
-> UnitResult<'tcx> {
self.try(|snapshot| {
self.commit_if_ok(|snapshot| {
let (ty::OutlivesPredicate(r_a, r_b), skol_map) =
self.skolemize_late_bound_regions(predicate, snapshot);
let origin = RelateRegionParamBound(span);
Expand Down Expand Up @@ -801,7 +785,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
.new_key(None)
}

pub fn next_region_var(&self, origin: RegionVariableOrigin<'tcx>) -> ty::Region {
pub fn next_region_var(&self, origin: RegionVariableOrigin) -> ty::Region {
ty::ReInfer(ty::ReVar(self.region_vars.new_region_var(origin)))
}

Expand Down Expand Up @@ -1253,14 +1237,14 @@ impl<'tcx> Repr<'tcx> for SubregionOrigin<'tcx> {
}
}

impl<'tcx> RegionVariableOrigin<'tcx> {
impl RegionVariableOrigin {
pub fn span(&self) -> Span {
match *self {
MiscVariable(a) => a,
PatternRegion(a) => a,
AddrOfRegion(a) => a,
Autoref(a) => a,
Coercion(ref a) => a.span(),
Coercion(a) => a,
EarlyBoundRegion(a, _) => a,
LateBoundRegion(a, _, _) => a,
BoundRegionInCoherence(_) => codemap::DUMMY_SP,
Expand All @@ -1269,7 +1253,7 @@ impl<'tcx> RegionVariableOrigin<'tcx> {
}
}

impl<'tcx> Repr<'tcx> for RegionVariableOrigin<'tcx> {
impl<'tcx> Repr<'tcx> for RegionVariableOrigin {
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
match *self {
MiscVariable(a) => {
Expand All @@ -1282,7 +1266,7 @@ impl<'tcx> Repr<'tcx> for RegionVariableOrigin<'tcx> {
format!("AddrOfRegion({})", a.repr(tcx))
}
Autoref(a) => format!("Autoref({})", a.repr(tcx)),
Coercion(ref a) => format!("Coercion({})", a.repr(tcx)),
Coercion(a) => format!("Coercion({})", a.repr(tcx)),
EarlyBoundRegion(a, b) => {
format!("EarlyBoundRegion({},{})", a.repr(tcx), b.repr(tcx))
}
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/middle/infer/region_inference/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub enum RegionResolutionError<'tcx> {
/// Could not infer a value for `v` because `sub_r <= v` (due to
/// `sub_origin`) but `v <= sup_r` (due to `sup_origin`) and
/// `sub_r <= sup_r` does not hold.
SubSupConflict(RegionVariableOrigin<'tcx>,
SubSupConflict(RegionVariableOrigin,
SubregionOrigin<'tcx>, Region,
SubregionOrigin<'tcx>, Region),

Expand All @@ -124,15 +124,15 @@ pub enum RegionResolutionError<'tcx> {
/// Could not infer a value for `v` because `v <= r1` (due to
/// `origin1`) and `v <= r2` (due to `origin2`) and
/// `r1` and `r2` have no intersection.
SupSupConflict(RegionVariableOrigin<'tcx>,
SupSupConflict(RegionVariableOrigin,
SubregionOrigin<'tcx>, Region,
SubregionOrigin<'tcx>, Region),

/// For subsets of `ConcreteFailure` and `SubSupConflict`, we can derive
/// more specific errors message by suggesting to the user where they
/// should put a lifetime. In those cases we process and put those errors
/// into `ProcessedErrors` before we do any reporting.
ProcessedErrors(Vec<RegionVariableOrigin<'tcx>>,
ProcessedErrors(Vec<RegionVariableOrigin>,
Vec<(TypeTrace<'tcx>, ty::type_err<'tcx>)>,
Vec<SameRegions>),
}
Expand Down Expand Up @@ -168,7 +168,7 @@ pub type CombineMap = FnvHashMap<TwoRegions, RegionVid>;

pub struct RegionVarBindings<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
var_origins: RefCell<Vec<RegionVariableOrigin<'tcx>>>,
var_origins: RefCell<Vec<RegionVariableOrigin>>,

// Constraints of the form `A <= B` introduced by the region
// checker. Here at least one of `A` and `B` must be a region
Expand Down Expand Up @@ -316,7 +316,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
len as u32
}

pub fn new_region_var(&self, origin: RegionVariableOrigin<'tcx>) -> RegionVid {
pub fn new_region_var(&self, origin: RegionVariableOrigin) -> RegionVid {
let id = self.num_vars();
self.var_origins.borrow_mut().push(origin.clone());
let vid = RegionVid { index: id };
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn poly_project_and_unify_type<'cx,'tcx>(
obligation.repr(selcx.tcx()));

let infcx = selcx.infcx();
infcx.try(|snapshot| {
infcx.commit_if_ok(|snapshot| {
let (skol_predicate, skol_map) =
infcx.skolemize_late_bound_regions(&obligation.predicate, snapshot);

Expand Down
10 changes: 5 additions & 5 deletions src/librustc/middle/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
return;
}

self.infcx.try(|snapshot| {
self.infcx.commit_if_ok(|snapshot| {
let bound_self_ty =
self.infcx.resolve_type_vars_if_possible(&obligation.self_ty());
let (self_ty, _) =
Expand Down Expand Up @@ -1778,7 +1778,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {

// For each type, produce a vector of resulting obligations
let obligations: Result<Vec<Vec<_>>, _> = bound_types.iter().map(|nested_ty| {
self.infcx.try(|snapshot| {
self.infcx.commit_if_ok(|snapshot| {
let (skol_ty, skol_map) =
self.infcx().skolemize_late_bound_regions(nested_ty, snapshot);
let Normalized { value: normalized_ty, mut obligations } =
Expand Down Expand Up @@ -1888,7 +1888,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation: &TraitObligation<'tcx>)
{
let _: Result<(),()> =
self.infcx.try(|snapshot| {
self.infcx.commit_if_ok(|snapshot| {
let result =
self.match_projection_obligation_against_bounds_from_trait(obligation,
snapshot);
Expand Down Expand Up @@ -2043,7 +2043,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
trait_def_id,
nested);

let trait_obligations: Result<VecPerParamSpace<_>,()> = self.infcx.try(|snapshot| {
let trait_obligations: Result<VecPerParamSpace<_>,()> = self.infcx.commit_if_ok(|snapshot| {
let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
let (trait_ref, skol_map) =
self.infcx().skolemize_late_bound_regions(&poly_trait_ref, snapshot);
Expand Down Expand Up @@ -2077,7 +2077,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {

// First, create the substitutions by matching the impl again,
// this time not in a probe.
self.infcx.try(|snapshot| {
self.infcx.commit_if_ok(|snapshot| {
let (skol_obligation_trait_ref, skol_map) =
self.infcx().skolemize_late_bound_regions(&obligation.predicate, snapshot);
let substs =
Expand Down
Loading