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

Avoid cloning ast::CrateConfig #12048

Merged
merged 2 commits into from
Feb 6, 2014
Merged

Avoid cloning ast::CrateConfig #12048

merged 2 commits into from
Feb 6, 2014

Conversation

sanxiyn
Copy link
Member

@sanxiyn sanxiyn commented Feb 5, 2014

No description provided.

@flaper87
Copy link
Contributor

flaper87 commented Feb 5, 2014

LGTM

@brson
Copy link
Contributor

brson commented Feb 5, 2014

Nice cleanup.

@bors bors closed this Feb 6, 2014
@bors bors merged commit 5719ff7 into rust-lang:master Feb 6, 2014
@sanxiyn sanxiyn deleted the crate-config branch February 7, 2014 05:56
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 11, 2024
Don't look for safety comments in doc tests

Fixes rust-lang#12048.

What happened in the linked issue is that the lint checks for lines that start with `//` and have `SAFETY:` somewhere in it above the function item.
This works for regular comments, but when the `//` is the start of a doc comment (e.g. `/// // SAFETY: ...`) and it's part of a doc test (i.e. within \`\`\`), we probably shouldn't lint that, since the user most likely meant to refer to a different node than the one currently being checked. For example in the linked issue, the safety comment refers to `unsafe { *five_pointer }`, but the lint believes it's part of the function item.

We also can't really easily test whether the `// SAFETY:` comment within a doc comment is necessary or not, since I think that would require creating a new compiler session to re-parse the contents of the doc comment. We already do this for one of the doc markdown lints, to look for a main function in doc tests, but I don't know how to feel about doing that in more places, so probably best to just ignore them?

changelog: [`unnecessary_safety_comment`]: don't look for safety comments in doc tests
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.

5 participants