]> git.lizzy.rs Git - rust.git/commit
Fix Rustdoc ICE when checking blanket impls
authorAaron Hill <aa1ronham@gmail.com>
Mon, 22 Oct 2018 04:12:16 +0000 (00:12 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Mon, 22 Oct 2018 23:40:43 +0000 (19:40 -0400)
commit4f2624cac90ee9145175d6e4b9c59b9ab7875a9c
tree55d71dee6692252002f407575265b35560944a8f
parentca2639e82ec4a18d7359efbfb555ea69dd644c97
Fix Rustdoc ICE when checking blanket impls

Fixes #55001, #54744

Previously, SelectionContext would unconditionally cache the selection
result for an obligation. This worked fine for most users of
SelectionContext, but it caused an issue when used by Rustdoc's blanket
impl finder.

The issue occured when SelectionContext chose a ParamCandidate which
contained inference variables. Since inference variables can change
between calls to select(), it's not safe to cache the selection result -
the chosen candidate might not be applicable for future results, leading
to an ICE when we try to run confirmation.

This commit prevents SelectionContext from caching any ParamCandidate
that contains inference variables. This should always be completely
safe, as trait selection should never depend on a particular result
being cached.

I've also added some extra debug!() statements, which I found helpful in
tracking down this bug.
src/librustc/infer/combine.rs
src/librustc/infer/equate.rs
src/librustc/traits/select.rs
src/librustdoc/clean/blanket_impl.rs
src/test/rustdoc/issue-55001.rs [new file with mode: 0644]