]> git.lizzy.rs Git - rust.git/commit
Don't create impl candidates when obligation contains errors
authorAaron Hill <aa1ronham@gmail.com>
Thu, 4 Jun 2020 23:32:09 +0000 (19:32 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Thu, 4 Jun 2020 23:32:09 +0000 (19:32 -0400)
commit7f7729d83be2ff8e9e933b94ff02f1bb77d688f8
tree25ab52601c9930f70cdfc2f675727046f5d1094b
parent3d5d0f898c2f3998e50c2180c6202f193c3acdbc
Don't create impl candidates when obligation contains errors

Fixes #72839

In PR #72621, trait selection was modified to no longer bail out early
when an error type was encountered. This allowed us treat `ty::Error` as
`Sized`, causing us to avoid emitting a spurious "not sized" error after
a type error had already occured.

However, this means that we may now try to match an impl candidate
against the error type. Since the error type will unify with almost
anything, this can cause us to infinitely recurse (eventually triggering
an overflow) when trying to verify certain `where` clauses.

This commit causes us to skip generating any impl candidates when an
error type is involved.
src/librustc_trait_selection/traits/select/candidate_assembly.rs
src/test/ui/issues/issue-72839-error-overflow.rs [new file with mode: 0644]
src/test/ui/issues/issue-72839-error-overflow.stderr [new file with mode: 0644]