Review comments
- Fix typo - Add docstring - Remove spurious test output file
This commit is contained in:
parent
c13a913e5b
commit
7dad2958be
|
@ -632,6 +632,28 @@ impl<'hir> Map<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Retrieve the NodeId for `id`'s enclosing method, unless there's a
|
||||
/// `while` or `loop` before reacing it, as block tail returns are not
|
||||
/// available in them.
|
||||
///
|
||||
/// ```
|
||||
/// fn foo(x: usize) -> bool {
|
||||
/// if x == 1 {
|
||||
/// true // `get_return_block` gets passed the `id` corresponding
|
||||
/// } else { // to this, it will return `foo`'s `NodeId`.
|
||||
/// false
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
/// fn foo(x: usize) -> bool {
|
||||
/// loop {
|
||||
/// true // `get_return_block` gets passed the `id` corresponding
|
||||
/// } // to this, it will return `None`.
|
||||
/// false
|
||||
/// }
|
||||
/// ```
|
||||
pub fn get_return_block(&self, id: NodeId) -> Option<NodeId> {
|
||||
let match_fn = |node: &Node| {
|
||||
match *node {
|
||||
|
|
|
@ -4214,7 +4214,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
ty
|
||||
}
|
||||
|
||||
/// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and wether it is
|
||||
/// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and whether it is
|
||||
/// `fn main` if it is a method, `None` otherwise.
|
||||
pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, bool)> {
|
||||
// Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or
|
||||
|
@ -4227,7 +4227,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
}) = parent {
|
||||
decl.clone().and_then(|decl| {
|
||||
// This is less than ideal, it will not present the return type span on any
|
||||
// method called `main`, regardless of wether it is actually the entry point.
|
||||
// method called `main`, regardless of whether it is actually the entry point.
|
||||
Some((decl, name == Symbol::intern("main")))
|
||||
})
|
||||
} else if let Node::NodeTraitItem(&hir::TraitItem {
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
error[E0601]: main function not found
|
||||
|
||||
error: aborting due to previous error(s)
|
||||
|
Loading…
Reference in New Issue