Skip to content

Commit

Permalink
Rollup merge of rust-lang#80302 - pierwill:fix-80287, r=lcnr
Browse files Browse the repository at this point in the history
docs: Update rustc_middle::middle::region::ScopeTree

Correct return type in docs for [`yield_in_source`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/middle/region/struct.ScopeTree.html#method.yield_in_scope) method.

Closes rust-lang#80287.
  • Loading branch information
GuillaumeGomez committed Dec 22, 2020
2 parents f711f3f + f078f7c commit 67f8244
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions compiler/rustc_middle/src/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ pub struct ScopeTree {
pub struct YieldData {
/// The `Span` of the yield.
pub span: Span,
/// The number of expressions and patterns appearing before the `yield` in the body plus one.
/// The number of expressions and patterns appearing before the `yield` in the body, plus one.
pub expr_and_pat_count: usize,
pub source: hir::YieldSource,
}
Expand Down Expand Up @@ -449,9 +449,7 @@ impl ScopeTree {
}

/// Checks whether the given scope contains a `yield`. If so,
/// returns `Some((span, expr_count))` with the span of a yield we found and
/// the number of expressions and patterns appearing before the `yield` in the body + 1.
/// If there a are multiple yields in a scope, the one with the highest number is returned.
/// returns `Some(YieldData)`. If not, returns `None`.
pub fn yield_in_scope(&self, scope: Scope) -> Option<YieldData> {
self.yield_in_scope.get(&scope).cloned()
}
Expand Down

0 comments on commit 67f8244

Please sign in to comment.