Enter your book access code

The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).

Don’t have the book yet? The landing page stays open — purchase unlocks this gym.

beginner · order 4

Copy and Drop cannot coexist

own-copy-01Related book chapters: 5 (optional — this page is complete on its own)CopyDropE0184

Slug: own-copy-01 · Paired reading: Chapter 5

Prompt

Define struct Point { x: i32, y: i32 } with Copy + Clone. Implement fn translate(p: Point, dx: i32, dy: i32) -> Point. Because Point: Copy, the caller may still use p after the call — demonstrate that in a test.

Predict first

Could Point also implement Drop? What error code?