1
Fork 0

allow inference vars in type_implements_trait

This commit is contained in:
Niko Matsakis 2021-07-04 11:26:32 -04:00
parent 26f7030b16
commit 40ee019c17
9 changed files with 118 additions and 46 deletions

View file

@ -1331,7 +1331,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
// to avoid panics
if !return_ty.has_infer_types() {
if let Some(iter_trait) = tcx.get_diagnostic_item(sym::Iterator) {
if tcx.type_implements_trait((iter_trait, return_ty, ty_params, self.param_env))
if tcx
.type_implements_trait((iter_trait, return_ty, ty_params, self.param_env))
.must_apply_modulo_regions()
{
if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(return_span) {
err.span_suggestion_hidden(