If you want the pre-comp to move directly (e.g. up) by a straight line, you can create the layer mask and adjust the layer and the mask moving opposite (e.g. layer moves up, mask path moves down). This allows you to avoid creating the additional layer but you have to be very careful to get a good interaction.
If moving must be more complex, the track matte from the Milenium answer is the best way. You can use the masked solid or a shape layer (rectangle). But in this case, you have to make sure that nothing is selected on the Timeline, to avoid the unwanted masking instead of the shape creating.