Be more explicit about #[test] dependency on std. #3241
Labels
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone
Another ticket, issue #1127 describes how dropping the std import will give confusing error messages when compiling with --test. In addition to improving those error messages, the tutorial should be very clear about this need.
The example already includes std:
However the surrounding text does not emphasize that "use std" is necessary for tests. A complementary fix (and quicker) to #1127 is to simple change the sentence preceding the code snippet to something like this:
"Tests can be interspersed with other code, and annotated with the #[test] attribute. The #[test] attribute requires std to be in scope, so "use std" is required for compiling test code."
The text was updated successfully, but these errors were encountered: