]> git.lizzy.rs Git - rust.git/commit
Fix cycle error when emitting suggestion for mismatched `fn` type
authorAaron Hill <aa1ronham@gmail.com>
Wed, 11 Mar 2020 19:35:46 +0000 (15:35 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Wed, 11 Mar 2020 19:35:46 +0000 (15:35 -0400)
commitff65bffe2b143528ff90d5226b18ceca750d7c02
tree81460c9fb685036177271c12ca252802dbbf8290
parentc20d7eecbc0928b57da8fe30b2ef8528e2bdd5be
Fix cycle error when emitting suggestion for mismatched `fn` type

Fixes #66667

Previously, we called `tcx.typeck_tables_of` when determining whether or
not to emit a suggestion for a type error. However, we might already be
type-checking the `DefId` we pass to `typeck_tables_of` (it could be
anywhere in the query stack).

Fortunately, we only need the function signature, not the entire
`TypeckTables`. By using `tcx.fn_sig`, we avoid the possibility of cycle
errors while retaining the ability to emit a suggestion.
src/librustc_typeck/check/op.rs
src/test/ui/issues/issue-66667-function-cmp-cycle.rs [new file with mode: 0644]
src/test/ui/issues/issue-66667-function-cmp-cycle.stderr [new file with mode: 0644]