Try! and File::create - misunderstanding E0308

try! requires that the function return a Result.

If you click on the playpen link in the upper right of the example, you'll see that it is actually wrapped in a function.

See this thread: Problem in the std::fs::File docs? Or a problem with me?

3 Likes