Skip to content
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

Move thread::spawn to separate function #1020

Merged
merged 1 commit into from
Jul 24, 2023
Merged

Move thread::spawn to separate function #1020

merged 1 commit into from
Jul 24, 2023

Conversation

mgeisler
Copy link
Collaborator

This might make it clearer why the thread cannot borrow from the string.

@djmitche, do you think this is worth the extra vertical space?

This might make it clearer why the thread cannot borrow from the string.
@mgeisler mgeisler requested a review from djmitche July 24, 2023 14:35
@djmitche
Copy link
Collaborator

Yes, I think that's worthwhile. Does the playground run #[test] blocks if given in this context? That might save space, and I don't think there's anything in the test harness that "kills" threads between tests.

@mgeisler
Copy link
Collaborator Author

Yes, I think that's worthwhile. Does the playground run #[test] blocks if given in this context? That might save space, and I don't think there's anything in the test harness that "kills" threads between tests.

The full Playground supports running tests: the Run button changes to Test when it notices a unit test.

Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error[E0601]: `main` function not found in crate `playground`
  --> src/main.rs:12:2
   |
12 | }
   |  ^ consider adding a `main` function to `src/main.rs`

so looks like #[test] won't work..

@henrif75 henrif75 merged commit 2c820e7 into main Jul 24, 2023
@henrif75 henrif75 deleted the mgeisler-patch-1 branch July 24, 2023 21:28
@mgeisler
Copy link
Collaborator Author

Yeah, unit tests only work in the full playground. The embedded playground is not smart enough to detect the unit tests. It would be nice to extend it to be as clever as the full playground.

yohcop pushed a commit to yohcop/comprehensive-rust that referenced this pull request Sep 12, 2023
This might make it clearer why the thread cannot borrow from the string.
mgeisler added a commit that referenced this pull request Jun 5, 2024
mgeisler added a commit that referenced this pull request Oct 17, 2024
mgeisler added a commit that referenced this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants