What 's wrong with this integral substitution? What's wrong with the following solution?
Let $t=\sin x,$ then $x=\arcsin t.$ By substitution method we have the following:
$\int_0^{2\pi}\sin^2x \rm{dx}=\int_0^0 \frac{t^2}{\sqrt{1-t^2}}\rm{dt}=0$.
However, we know that  $\int_0^{2\pi}\sin^2x \rm{dx}=\int_0^{2\pi}\frac{1-\cos 2x}{2} \rm{dx}=\pi.$
I can't find the problem.
Thanks for any suggestions.

The reason why the lower and upper limits turn into the same value $0$ after changing variable is due to the lack of bijectivity of the substitution, even though the calculation is incorrect. Bijectivity in changing the variable is not a strong requirement, but it needs to be careful in calculation when a non-bijective substitution is applied.
Correct calculation using the same substitution is as follows: From $1-t^2 = x$, $t^2 = 1-x \ge 0$ and so
$$t = \begin{cases}
\sqrt{1-x} & \text{for $t \ge 0$,} \\
-\sqrt{1-x} & \text{for $t < 0$.}
\end{cases}$$
with
$$dt = \begin{cases}
-\frac{1}{2\sqrt{1-x}}\,dx & \text{for $t > 0$} \\
\frac{1}{2\sqrt{1-x}}\,dx & \text{for $t < 0$.}
\end{cases}$$
Hence
\begin{align*}
\int_{-1}^{1}(1-t^2)\,dt 
  & = \int_{-1}^{0} (1-t^2)\,dt + \int_0^1 (1-t^2)\,dt \\
  & = \int_0^1 x\left(\frac{1}{2\sqrt{1-x}}\right)\,dx 
      + \int_1^0 x\left(\color{red}{-}\frac{1}{2\sqrt{1-x}}\right)\,dx\\
  & = \int_0^1 \frac{x}{2\sqrt{1-x}}\,dx 
      + \int_\color{red}{0}^\color{red}{1} \frac{x}{2\sqrt{1-x}}\,dx \\
  & = \int_0^1 \frac{x}{\sqrt{1-x}}\,dx 
    = \lim_{\varepsilon \rightarrow 1^-} \int_0^{\varepsilon} \frac{x}{\sqrt{1-x}}\,dx\\
  & = \lim_{\varepsilon \rightarrow 1^-} \left[\left.-\frac{2}{3}\sqrt{1-x}(x+2)\right|_0^\varepsilon\right] \\
  & = \lim_{\varepsilon \rightarrow 1^-} \left[\left(-\frac{2}{3}\sqrt{1-\varepsilon}(\varepsilon+2)\right) - \left(-\frac{4}{3}\right)\right] \\ 
  & = 0 - \left(-\frac{4}{3}\right) = \frac{4}{3}.
\end{align*}
