Skip to content

Commit

Permalink
Check the substituted return type in return type suggestions.
Browse files Browse the repository at this point in the history
Fixes #43420.
  • Loading branch information
arielb1 committed Aug 29, 2017
1 parent 6c11b47 commit de0e695
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 120 deletions.
7 changes: 7 additions & 0 deletions src/librustc_typeck/check/method/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ pub enum MethodError<'tcx> {
// Found a `Self: Sized` bound where `Self` is a trait object, also the caller may have
// forgotten to import a trait.
IllegalSizedBound(Vec<DefId>),

// Found a match, but the return type is wrong
BadReturnType,
}

// Contains a list of static methods that may apply, a list of unsatisfied trait predicates which
Expand Down Expand Up @@ -111,6 +114,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
Err(Ambiguity(..)) => true,
Err(PrivateMatch(..)) => allow_private,
Err(IllegalSizedBound(..)) => true,
Err(BadReturnType) => {
bug!("no return type expectations but got BadReturnType")
}

}
}

Expand Down
Loading

0 comments on commit de0e695

Please sign in to comment.