-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark code that shouldn't compile or fails in runtime #343
Comments
This should resolve #343 by adding a shortcode that goes around code blocks that should be marked incorrect (`incorrect_code_block()`), highlights them in a dark red, and makes the left border red. Looks like this: <img width="1213" alt="Screen Shot 2022-04-16 at 4 50 25 PM" src="https://user-images.githubusercontent.com/1479994/163690976-77abfe98-fd71-4988-afcb-02e3be35491a.png"> from: ~~~markdown Just keep in mind that `&World` will conflict with _any_ mutable Query: {% incorrect_code_block() %} ```rust fn invalid_system(world: &World, transforms: Query<&mut Transform>) { } ``` {% end %} In these cases, consider using our new [ParamSets](/news/bevy-0-7/#paramsets) to resolve the conflict: ```rust fn valid_system(set: ParamSet<(&World, Query<&mut Transform>)>) { } ``` ~~~
Now that #348 is in, this should be a simple matter of adding this to the places where it should be :) I think we just have the news post for now. Do you think we should add this to our "compiler error" output too? |
That was quick)
not sure what do you mean |
I was definitely imprecise there. I meant general error messages like seen at https://bevyengine.org/learn/book/troubleshooting/ |
Yeah, that may be a nice addition. |
The given example is already marked in red, does this need to be added anywhere else or can this be closed? |
The official Rust book has fancy Ferris showing whether a given snippet compiles or not like so. Rust documentation system has it too (no Ferris tho)
So I suggest following that and explicitly show that a piece of code won't compile or will give a runtime error.
e.g. in recent 0.7 blog post we have this https://bevyengine.org/news/bevy-0-7/#world-system-param chapter and it would be a bit better if the code snippet after "... &World will conflict with any mutable Query:" was made into reddish borders or had a corresponding label.
The text was updated successfully, but these errors were encountered: