Skip to content

Unsafe lint will also check for unsafe functions, traits, and implementations #22542

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

Merged
merged 1 commit into from
Feb 22, 2015
Merged

Unsafe lint will also check for unsafe functions, traits, and implementations #22542

merged 1 commit into from
Feb 22, 2015

Conversation

ipetkov
Copy link
Contributor

@ipetkov ipetkov commented Feb 19, 2015

This allows warning or forbidding all uses of unsafe code, whereas
previously only unsafe blocks were caught by the lint.

The lint has been renamed from unsafe-blocks to unsafe-code to
reflect its new purpose.

This is a minor [breaking-change]

Closes #22430

@rust-highfive
Copy link
Contributor

r? @huonw

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

@huonw
Copy link
Member

huonw commented Feb 19, 2015

Looks great.

Could you add a test for an unsafe fn methods? E.g.

impl Foo {
     unsafe fn method(&self) {}
}

Allow,
"usage of an `unsafe` block"
"usage of an `unsafe` code"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: drop the article an

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, totally missed that, thanks for the catch!

Checks include declaration/implementation of unsafe functions, traits,
and methods.

This allows warning or forbidding all uses of unsafe code, whereas
previously only unsafe blocks were caught by the lint.

The lint has been renamed from `unsafe-blocks` to `unsafe-code` to
reflect its new purpose.

This is a minor [breaking-change]

Closes #22430
@ipetkov
Copy link
Contributor Author

ipetkov commented Feb 20, 2015

@huonw I added tests for (both declaring and implementing) unsafe methods of traits. My previous implementation of the lint didn't catch these, so I refactored the code to catch them as well!

@huonw
Copy link
Member

huonw commented Feb 20, 2015

@bors r+ be0d

Thanks!

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 21, 2015
 This allows warning or forbidding all uses of unsafe code, whereas
previously only unsafe blocks were caught by the lint.

The lint has been renamed from `unsafe-blocks` to `unsafe-code` to
reflect its new purpose.

This is a minor [breaking-change]

Closes rust-lang#22430
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 21, 2015
@Manishearth
Copy link
Member

Needs Manishearth@bf13792 to work.

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 21, 2015
 This allows warning or forbidding all uses of unsafe code, whereas
previously only unsafe blocks were caught by the lint.

The lint has been renamed from `unsafe-blocks` to `unsafe-code` to
reflect its new purpose.

This is a minor [breaking-change]

Closes rust-lang#22430
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 21, 2015
@huonw huonw merged commit be0dc49 into rust-lang:master Feb 22, 2015
@ipetkov
Copy link
Contributor Author

ipetkov commented Feb 22, 2015

Thank you for the fix @Manishearth!

@ipetkov ipetkov deleted the unsafe-lint branch February 22, 2015 17:54
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.

unsafe-blocks lint should forbid unsafe impl
5 participants