-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Ports and channels tutorial example code #2097
Comments
This is perfectly correct code, though. |
It hasn't worked anywhere I have tried it. It fails with this code for example: import comm; fn main(args: [str])
} compiled with |
Here's the example again (github thought some of the code was markup):
|
That's not code from the tutorial, is it? In value expressions ( We are aware of the fact that this is confusing (I think there's a bug open on it, though I can't find it just now), but we haven't been able to find a satisfactory alternative. |
No, that code wasn't from the tutorial. And, yes the difference is confusing, especially because the tutorial doesn't point out the distinction. Not sure if the reference manual does. I spent a few minutes looking and didn't find anything. |
For what it's worth, section 8.3 of the tutorial does point out this distinction. |
Format tests and benches with rustfmt (1-50 of 300) Extracted from rust-lang#2097. I filtered this PR to contain exclusively "easy" cases to start off with, i.e. where there is no compiletest_rs (or other) comment in the vicinity that might need to get manually repositioned.
Format tests with rustfmt (101-150 of 300) Extracted from rust-lang#2097. Like rust-lang/miri#2244, these are "easy" cases that do not involve moving around comments.
Format tests with rustfmt (51-100 of 300) Extracted from rust-lang#2097. Like rust-lang#2244, this is intended to be "easy" cases which don't involve comments in the vicinity.
Format tests with rustfmt (151-200 of 300) Extracted from rust-lang#2097. This PR is still only doing the easy cases with no comments involved. In the next PRs after this, I'll start grouping by common comment patterns, e.g. all the cases resembling rust-lang/miri#2097 (comment) together in one PR.
Format tests with rustfmt (201-224 of 300) Extracted from rust-lang#2097. Last of the easy cases which do not involve moving around a comment.
Format tests with rustfmt (276-287 of 299) Extracted from rust-lang#2097. This is one half of the last 24 files (left for last because they require more unique attention than the first 275 "easy" files). I'll comment below to call attention to cases where I exercised my own judgement in how to format the test. rust-lang/rustfmt#3255 is especially annoying: rustfmt does not like `…( //` and `…{ //`.
Format tests with rustfmt (225-275 of 300) Extracted from rust-lang#2097. These cases all involve a line comment at the end of a block that rustfmt has chosen to wrap. ```diff - unsafe { (*ptr).set(20); } //~ ERROR does not exist in the borrow stack + unsafe { + (*ptr).set(20); + } //~ ERROR does not exist in the borrow stack ``` I have moved all of those comments back onto the same line as the content of the block instead, as was indicated being `@RalfJung's` preference in rust-lang/miri#2097 (comment). ```diff + unsafe { + (*ptr).set(20); //~ ERROR does not exist in the borrow stack + } ```
Format tests with rustfmt (288-299 of 299) Extracted from rust-lang#2097. I'll make a separate PR to enable checking the `tests` directory's formatting in CI. I'll need to rebase that after both this and rust-lang#2254 have landed, and if any new non-rustfmt-formatted files appear in the meantime, we can include formatting those in the same PR that enables the CI.
Co-authored-by: Zyad Hassan <88045115+zhassan-aws@users.noreply.github.com>
Has code like
comm::port::<int>()
which looks odd and seems erroneous.The text was updated successfully, but these errors were encountered: