Questions
Read the code, predict what happens, then see why. Hand-written questions on C++, Rust, and the systems underneath them.
- A match over an enum that omits one variantMedium
- while let with Vec::pop as the scrutineeMedium
- Two threads locking two mutexes in opposite ordersHard
- std::mem::forget on a Vec::drain iteratorHard
- Ten threads incrementing an Arc<Mutex<i32>>Medium
- Two Rc<Node>s storing an Rc to each otherHard
- PhantomData<T> in a hand-rolled smart pointerHard
- A trait default method with one implementor overriding itMedium
- Lifetime elision with one input reference vs. twoHard
- Reassigning an i32 versus reassigning a StringMedium
- Calling a closure twice when its body consumes a captureMedium
- Three successive let bindings reusing the same nameMedium
- A generic type parameter vs. a &dyn Trait parameter in codegenHard
- Calling recv() after every mpsc Sender has been droppedMedium
- Dereferencing a raw pointer built from a callee's localHard
- Pushing to a Vec while iterating over itMedium
- Returning a reference to a local with an explicit lifetime annotationMedium
- A panic inside Drop while the stack is already unwindingHard
- Shortening an element lifetime behind &'a Vec vs. &'a mut VecHard
- An explicit drop() call vs. end-of-scope destruction orderMedium
1–20 of 53
Page 1 of 3