From a9183a607d368d0a119c356f4e83c2fb50b0e456 Mon Sep 17 00:00:00 2001 From: SID <65087687+ss-deshmukh@users.noreply.github.com> Date: Wed, 18 Jun 2025 19:45:28 +0530 Subject: [PATCH] Update ch10-01-generics.toml --- quizzes/ch10-01-generics.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/quizzes/ch10-01-generics.toml b/quizzes/ch10-01-generics.toml index 93cd102ac5..cbd90d9b89 100644 --- a/quizzes/ch10-01-generics.toml +++ b/quizzes/ch10-01-generics.toml @@ -28,8 +28,11 @@ fn mystery(x: T) -> T { } ``` -The function could of course panic or print, but the return value can only be the input. `mystery` does not know -what type `T` is, so there is no way for `mystery` to generate or mutate a value of `T`. +Since the function mystery(x: T) -> T has no trait bounds and 'T' is an unknown type, the function doesnt +know which operations 'T' supports and thus cannot generate or mutate a value of 'T' (+, ==, or .clone() to +change the value of x). Additionally since we also assume that it has no unsafe code thus it's forced to just +return the input x unchanged, making x = 3. + See [Theorems for free!](https://dl.acm.org/doi/pdf/10.1145/99370.99404) for more examples of this idea. **3 really is the correct answer! If you disagree with the answer, please don't submit a bug report!**