Answer: D. X gives compilation error, Y prints "Kernel"
"The task supplied to `spawn` must implement `Send`. However, it is
possible to **use** `!Send` values from the task as long as they only
exist between calls to `.await`."
I am still trying to find reason why X gives compilation error. The Y will work since it is get dropped before the next await (line 15)
------
I have attached few more example code snippets.
In this example, both e1 and e2 will work
In 1st, there is no await inside the spawn block so it allows
In 2nd, everything gets dropped before next await (which makes you doubt why Y in the quiz didn't work) and works
Reference:
https://docs.rs/tokio/latest/tokio/task/fn.spawn.html#using-send-values-from-a-task