You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO: Fix these use statementsuseself::fruits::PEARas ???
useself::veggies::CUCUMBERas ???
// ... snipfnmain(){println!("favorite snacks: {} and {}",
delicious_snacks::fruit,
delicious_snacks::veggie
);}
At first glance it seems as though the solution would simply be to replace the ??? with respective fruit and veggie;
However after much struggling and leaning on the rust discord community for assistance it was pointed out that the use statement itself should also be changed to pub use. This was not clear in the original problem, as the concept of making an import public is not one I'm accustomed to coming from other languages. The compiler doesn't event suggest this change, making it even more difficult to come to the correct answer without external assistance.
The text was updated successfully, but these errors were encountered:
Including a link to the Rust Book documentation on re-exporting names in the hint might make this one clear enough. I also fumbled with this exercise a bit, but I knew I had read something in the Rust Book about this. I just couldn't remember where it was.
In addition to the above, could this exercise benefit from extending the TODO comment directive to include a subtle nod to the fact that each use statement requires two distinct changes or perhaps that fixing the compiler error is a two-stage process here?
Step one: identify and correct the alias in the use statement
Step two: correct the access level of the constant import
The use of ??? here was helpful but made me zone in on it a bit too much, and I think that prevented me understanding what was needed properly.
At first glance it seems as though the solution would simply be to replace the
???
with respectivefruit
andveggie
;However after much struggling and leaning on the rust discord community for assistance it was pointed out that the
use
statement itself should also be changed topub use
. This was not clear in the original problem, as the concept of making an import public is not one I'm accustomed to coming from other languages. The compiler doesn't event suggest this change, making it even more difficult to come to the correct answer without external assistance.The text was updated successfully, but these errors were encountered: