  The Sun shows a $\sim 10$% depletion in refractory elements relative to
nearby solar twins. It has been suggested that this depletion is a signpost of
planet formation. The exoplanet statistics are now good enough to show that the
origin of this depletion does not arise from the sequestration of refractory
material inside the planets themselves. This conclusion arises because most
sun-like stars host close-in planetary systems that are on average more massive
than the Sun's. Using evolutionary models for the protoplanetary discs that
surrounded the young Sun and solar twins we demonstrate that the origin of the
depletion likely arises due to the trapping of dust exterior to the orbit of a
forming giant planet. In this scenario a forming giant planet opens a gap in
the gas disc, creating a pressure trap. If the planet forms early enough, while
the disc is still massive, the planet can trap $\gtrsim 100 $M$_\oplus$ of dust
exterior to its orbit, preventing the dust from accreting onto the star in
contrast to the gas. Forming giant planets can create refractory depletions of
$\sim 5-15$%, with the larger values occurring for initial conditions that
favour giant planet formation (e.g. more massive discs, that live longer). The
incidence of solar-twins that show refractory depletion matches both the
occurrence of giant planets discovered in exoplanet surveys and "transition"
discs that show similar depletion patterns in the material that is accreting
onto the star.
