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

add warning sign to UB examples #72431

Merged
merged 1 commit into from
May 23, 2020
Merged

add warning sign to UB examples #72431

merged 1 commit into from
May 23, 2020

Conversation

RalfJung
Copy link
Member

Just to make it less likely that people miss the fact that these are examples for how to not do it.

@rust-highfive
Copy link
Collaborator

r? @shepmaster

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 21, 2020
Copy link
Member

@shepmaster shepmaster left a comment

Choose a reason for hiding this comment

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

And do we care about ⚠️ vs ⚠︎?

@@ -553,7 +553,7 @@ impl<T> MaybeUninit<T> {
/// x.write(Some(vec![0,1,2]));
/// let x1 = unsafe { x.read() };
/// let x2 = unsafe { x.read() };
/// // We now created two copies of the same vector, leading to a double-free when
/// // We now created two copies of the same vector, leading to a double-free ⚠️ when
Copy link
Member

Choose a reason for hiding this comment

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

Just to be clear, this ⚠︎ is supposed to be in the middle of the sentence, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added the warning sign next to the "dangerous noun". But if you think it'd be better to move it to the end of the sentence I can do that, too.

@shepmaster
Copy link
Member

r=me if my questions were what you intended.

@RalfJung
Copy link
Member Author

RalfJung commented May 23, 2020

And do we care about warning vs ⚠︎?

Only one of the two symbols there is an actual uniode emoji, the other is whatever GH uses for emojis it seems...

This is how the one I used renders: https://doc.rust-lang.org/nightly/std/slice/fn.from_raw_parts.html#incorrect-usage
I don't know how to make it yellow (interestingly in @danielhenrymantilla's screenshot at #72350 (comment) it was yellow, so this probably also depends on OS/browser).

@shepmaster
Copy link
Member

I don't know how to make it yellow

⚠️

U+26A0 : WARNING SIGN
U+FE0F : VARIATION SELECTOR-16 [VS16] {emoji variation selector}

⚠︎

U+26A0 : WARNING SIGN
U+FE0E : VARIATION SELECTOR-15 [VS15] {text variation selector}

@shepmaster
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 23, 2020

📌 Commit 80ab025f24be752a01c0fc107b5391afb68ab766 has been approved by shepmaster

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 23, 2020
@RalfJung
Copy link
Member Author

Oh I see. I think I'll make them all yellow then. :)
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 23, 2020
@RalfJung
Copy link
Member Author

Hm I cannot copy-paste the colored one, that's weird.

@RalfJung
Copy link
Member Author

Hm, I cannot figure out how to get the emoji variant into a file.
But I also found some more UB examples in the MaybeUninit docs to add the sign to, so I did that.

@bors r=shepmaster

@bors
Copy link
Contributor

bors commented May 23, 2020

📌 Commit 1c9b96b has been approved by shepmaster

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 23, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 23, 2020
add warning sign to UB examples

Just to make it less likely that people miss the fact that these are examples for how to *not* do it.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 23, 2020
add warning sign to UB examples

Just to make it less likely that people miss the fact that these are examples for how to *not* do it.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 23, 2020
add warning sign to UB examples

Just to make it less likely that people miss the fact that these are examples for how to *not* do it.
This was referenced May 23, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#72292 (Replace obligation construction with deref_steps())
 - rust-lang#72431 (add warning sign to UB examples)
 - rust-lang#72446 (Impl Ord for proc_macro::LineColumn)
 - rust-lang#72492 (Add some regression tests)
 - rust-lang#72496 (Correct small typo: 'not' -> 'note')

Failed merges:

r? @ghost
@bors bors merged commit d5e3009 into rust-lang:master May 23, 2020
@RalfJung RalfJung deleted the ub-warning branch May 24, 2020 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants