In the HoTT Book, lemma 3.3.4 states that "every mere proposition is a set", where a mere proposition is a type $A$ such that $IsProp(A) = \prod_{x,y: A}(x=_Ay)$ holds, and a set is a type $A$ such that $IsSet(A) = \prod_{x,y:A} IsProp(x=_Ay)$ holds.
The proof of this lemma starts with "Fix $x:A$ [insert proof].", but never discharges the $x:A$ (as far as I can see).
So in fact, what the proof does is exhibit an element of type $\prod_{x:A}( isProp(A)\to IsSet(A))$, in other words of type $A\to isProp(A)\to IsSet(A)$ : as far as I can see, this not enough to get an element of type $isProp(A) \to IsSet(A)$ (without excluded middle) : am I missing something ?
If not, how can one fix the proof ?


It does discharge $x$. The statement being proved is $\prod_{x, y: A} \prod_{p, q: x = y} p = q$ (i.e. $\text{IsSet} A$) under the assumption of $f: \text{IsProp} A$. Along the way, the statement $\prod_{y, z: A} \prod_{p: y = z} p = g(y)^{-1} \cdot g(z)$ is proved, but then it's instantiated with $y := x$ and $z := y$ for the last line.