Skip to content

Commit cad7b4f

Browse files
committedJan 10, 2018
Fixes rust-lang#46983. Fixes bad error message when converting anonymous lifetime to 'static
1 parent ee43e6d commit cad7b4f

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed
 

‎src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs

+13
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,17 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
118118
.emit();
119119
return Some(ErrorReported);
120120
}
121+
122+
// This method returns whether the given Region is Named
123+
pub(super) fn is_named_region(&self, region: ty::Region<'tcx>) -> bool {
124+
match *region {
125+
ty::ReStatic => true,
126+
ty::ReFree(ref free_region) => match free_region.bound_region {
127+
ty::BrNamed(..) => true,
128+
_ => false,
129+
},
130+
ty::ReEarlyBound(_) => true,
131+
_ => false,
132+
}
133+
}
121134
}

‎src/librustc/infer/error_reporting/nice_region_error/util.rs

-12
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,4 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
198198
}
199199
false
200200
}
201-
202-
// This method returns whether the given Region is Named
203-
pub(super) fn is_named_region(&self, region: Region<'tcx>) -> bool {
204-
match *region {
205-
ty::ReFree(ref free_region) => match free_region.bound_region {
206-
ty::BrNamed(..) => true,
207-
_ => false,
208-
},
209-
ty::ReEarlyBound(_) => true,
210-
_ => false,
211-
}
212-
}
213201
}

0 commit comments

Comments
 (0)
Please sign in to comment.