Skip to content

Commit 1f9a232

Browse files
committed
Rename RegionFudger to InferenceFudger
1 parent 6cc09fc commit 1f9a232

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/librustc/infer/fudge.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1818
/// from `&[u32; 3]` to `&[u32]` and make the users life more
1919
/// pleasant.
2020
///
21-
/// The way we do this is using `fudge_regions_if_ok`. What the
21+
/// The way we do this is using `fudge_inference_if_ok`. What the
2222
/// routine actually does is to start a snapshot and execute the
2323
/// closure `f`. In our example above, what this closure will do
2424
/// is to unify the expectation (`Option<&[u32]>`) with the actual
@@ -27,7 +27,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
2727
/// with `&?a [u32]`, where `?a` is a fresh lifetime variable. The
2828
/// input type (`?T`) is then returned by `f()`.
2929
///
30-
/// At this point, `fudge_regions_if_ok` will normalize all type
30+
/// At this point, `fudge_inference_if_ok` will normalize all type
3131
/// variables, converting `?T` to `&?a [u32]` and end the
3232
/// snapshot. The problem is that we can't just return this type
3333
/// out, because it references the region variable `?a`, and that
@@ -46,15 +46,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
4646
/// the actual types (`?T`, `Option<?T>`) -- and remember that
4747
/// after the snapshot is popped, the variable `?T` is no longer
4848
/// unified.
49-
pub fn fudge_regions_if_ok<T, E, F>(
49+
pub fn fudge_inference_if_ok<T, E, F>(
5050
&self,
5151
origin: &RegionVariableOrigin,
5252
f: F,
5353
) -> Result<T, E> where
5454
F: FnOnce() -> Result<T, E>,
5555
T: TypeFoldable<'tcx>,
5656
{
57-
debug!("fudge_regions_if_ok(origin={:?})", origin);
57+
debug!("fudge_inference_if_ok(origin={:?})", origin);
5858

5959
let (type_variables, region_vars, value) = self.probe(|snapshot| {
6060
match f() {
@@ -91,7 +91,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
9191
return Ok(value);
9292
}
9393

94-
let mut fudger = RegionFudger {
94+
let mut fudger = InferenceFudger {
9595
infcx: self,
9696
type_variables: &type_variables,
9797
region_vars: &region_vars,
@@ -102,14 +102,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
102102
}
103103
}
104104

105-
pub struct RegionFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
105+
pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
106106
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
107107
type_variables: &'a Range<TyVid>,
108108
region_vars: &'a Range<RegionVid>,
109109
origin: &'a RegionVariableOrigin,
110110
}
111111

112-
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> {
112+
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx> {
113113
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> {
114114
self.infcx.tcx
115115
}

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3231,7 +3231,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
32313231
Some(ret) => ret,
32323232
None => return Vec::new()
32333233
};
3234-
let expect_args = self.fudge_regions_if_ok(&RegionVariableOrigin::Coercion(call_span), || {
3234+
let expect_args = self.fudge_inference_if_ok(&RegionVariableOrigin::Coercion(call_span), || {
32353235
// Attempt to apply a subtyping relationship between the formal
32363236
// return type (likely containing type variables if the function
32373237
// is polymorphic) and the expected return type.

0 commit comments

Comments
 (0)