How to attach a shape onto another?

Hello.
So I have a shape for a character’s shorts on a separate layer, but I want to create an illusion effect where the shape of the shorts is only visible on the torso layer without manually erasing the shape to fit the character’s torso. I don’t know how else to word that properly but I hope it makes sense.
I’ve been struggling with this for days and tried to find different tutorials but I haven’t found a solution that’s specific to mine.

I don’t understand. Show or elaborate in details what effect do you want to achieve. What do you mean that you want shorts to be visible on torso layer? The fact what layer is this may not be as important in your specific case. What do you mean by “illusion”? Do you want that effect to be animated, or do you build a character?