Please tidy

This commit is contained in:
John Kåre Alsaker 2017-08-11 09:25:44 +02:00
parent 54db165f8e
commit 2e3eaca0fa
3 changed files with 11 additions and 3 deletions

View file

@ -1213,7 +1213,9 @@ impl<'a, 'tcx> Visitor<'tcx> for YieldFinder<'a> {
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
/// Checks whether the given code extent contains a `yield`. If so,
/// returns `Some(span)` with the span of a yield we found.
pub fn yield_in_extent(self, extent: CodeExtent, cache: &mut FxHashMap<NodeId, Option<Span>>) -> Option<Span> {
pub fn yield_in_extent(self,
extent: CodeExtent,
cache: &mut FxHashMap<NodeId, Option<Span>>) -> Option<Span> {
let mut finder = YieldFinder {
cache,
result: None,

View file

@ -1893,7 +1893,9 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
AggregateKind::Closure(id, substs) =>
AggregateKind::Closure(id, substs.fold_with(folder)),
AggregateKind::Generator(id, substs, interior) =>
AggregateKind::Generator(id, substs.fold_with(folder), interior.fold_with(folder)),
AggregateKind::Generator(id,
substs.fold_with(folder),
interior.fold_with(folder)),
};
Aggregate(kind, fields.fold_with(folder))
}

View file

@ -32,7 +32,11 @@ impl<'a, 'gcx, 'tcx> InteriorVisitor<'a, 'gcx, 'tcx> {
fn record(&mut self, ty: Ty<'tcx>, scope: Option<CodeExtent>, expr: Option<&'tcx Expr>) {
use syntax_pos::DUMMY_SP;
if scope.map(|s| self.fcx.tcx.yield_in_extent(s, &mut self.cache).is_some()).unwrap_or(true) {
let live_across_yield = scope.map(|s| {
self.fcx.tcx.yield_in_extent(s, &mut self.cache).is_some()
}).unwrap_or(true);
if live_across_yield {
if log_enabled!(log::LogLevel::Debug) {
if let Some(s) = scope {
let span = s.span(&self.fcx.tcx.hir).unwrap_or(DUMMY_SP);