diff options
| author | varkor <github@varkor.com> | 2019-03-21 12:39:05 +0000 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-03-27 09:44:55 +0000 |
| commit | 1f9a2326b58b1de43cb3d1bfae1e1403f5d059ef (patch) | |
| tree | ee5c97d21d32ffd4157ca33931fb022e037984b7 | |
| parent | 6cc09fc8b2b678ea605254ea9a0fd58da3e4d44b (diff) | |
| download | rust-1f9a2326b58b1de43cb3d1bfae1e1403f5d059ef.tar.gz rust-1f9a2326b58b1de43cb3d1bfae1e1403f5d059ef.zip | |
Rename `RegionFudger` to `InferenceFudger`
| -rw-r--r-- | src/librustc/infer/fudge.rs | 14 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index d8107e64d28..a335a21359b 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -18,7 +18,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// from `&[u32; 3]` to `&[u32]` and make the users life more /// pleasant. /// - /// The way we do this is using `fudge_regions_if_ok`. What the + /// The way we do this is using `fudge_inference_if_ok`. What the /// routine actually does is to start a snapshot and execute the /// closure `f`. In our example above, what this closure will do /// is to unify the expectation (`Option<&[u32]>`) with the actual @@ -27,7 +27,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// with `&?a [u32]`, where `?a` is a fresh lifetime variable. The /// input type (`?T`) is then returned by `f()`. /// - /// At this point, `fudge_regions_if_ok` will normalize all type + /// At this point, `fudge_inference_if_ok` will normalize all type /// variables, converting `?T` to `&?a [u32]` and end the /// snapshot. The problem is that we can't just return this type /// out, because it references the region variable `?a`, and that @@ -46,7 +46,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// the actual types (`?T`, `Option<?T>`) -- and remember that /// after the snapshot is popped, the variable `?T` is no longer /// unified. - pub fn fudge_regions_if_ok<T, E, F>( + pub fn fudge_inference_if_ok<T, E, F>( &self, origin: &RegionVariableOrigin, f: F, @@ -54,7 +54,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { F: FnOnce() -> Result<T, E>, T: TypeFoldable<'tcx>, { - debug!("fudge_regions_if_ok(origin={:?})", origin); + debug!("fudge_inference_if_ok(origin={:?})", origin); let (type_variables, region_vars, value) = self.probe(|snapshot| { match f() { @@ -91,7 +91,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { return Ok(value); } - let mut fudger = RegionFudger { + let mut fudger = InferenceFudger { infcx: self, type_variables: &type_variables, region_vars: ®ion_vars, @@ -102,14 +102,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } -pub struct RegionFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { +pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, type_variables: &'a Range<TyVid>, region_vars: &'a Range<RegionVid>, origin: &'a RegionVariableOrigin, } -impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx> { fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index b11bd9c2408..c0a869d99b9 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3231,7 +3231,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Some(ret) => ret, None => return Vec::new() }; - let expect_args = self.fudge_regions_if_ok(&RegionVariableOrigin::Coercion(call_span), || { + let expect_args = self.fudge_inference_if_ok(&RegionVariableOrigin::Coercion(call_span), || { // Attempt to apply a subtyping relationship between the formal // return type (likely containing type variables if the function // is polymorphic) and the expected return type. |
