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 unsafe checks #1411

Open
6 of 11 tasks
CohenArthur opened this issue Jul 22, 2022 · 4 comments
Open
6 of 11 tasks

Add unsafe checks #1411

CohenArthur opened this issue Jul 22, 2022 · 4 comments
Assignees

Comments

@CohenArthur
Copy link
Member

CohenArthur commented Jul 22, 2022

I believe the last two are related to the Freeze lang item which we do not support yet.

From @bjorn3:

  • Borrow of a packed struct's field (currently back compat lint in rustc, will be a hard error in the future)
@bjorn3
Copy link

bjorn3 commented Jul 22, 2022

Mutation of layout constrained field

What do you mean with a layout constrained field? A field of a packed struct? Or a field of a type with the rustc_layout_scalar_valid_range_start or rustc_layout_scalar_valid_range_end attributes? Neither is related to Freeze.

@CohenArthur
Copy link
Member Author

CohenArthur commented Jul 22, 2022

Mutation of layout constrained field

What do you mean with a layout constrained field? A field of a packed struct? Or a field of a type with the rustc_layout_scalar_valid_range_start or rustc_layout_scalar_valid_range_end attributes? Neither is related to Freeze.

I'm referring to these two unsafe operations which seems to be triggered only in some cases like this one

I didn't look much into it, I had just read your comment on #182 and assumed this had to do with Freeze. I might be completely off the mark, sorry about that.

@bjorn3
Copy link

bjorn3 commented Jul 22, 2022

I'm referring to these two unsafe operations which seems to be triggered only in some cases like this one

I see. In that case I have another item to add to the list:

  • Borrow of a packed struct's field (currently back compat lint in rustc, will be a hard error in the future)

@CohenArthur
Copy link
Member Author

Thank you! Adding it to the list to make sure I don't miss it

bors bot added a commit that referenced this issue Jul 27, 2022
1417: unsafe: check uses of static variables r=CohenArthur a=CohenArthur

Addresses #1411 

Accessing an extern static or a mut static is unsafe and requires an unsafe function or block

Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
bors bot added a commit that referenced this issue Jul 28, 2022
1416: unsafe: Add checks for union field accesses r=CohenArthur a=CohenArthur

Addresses #1411 

Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
bors bot added a commit that referenced this issue Jul 29, 2022
1427: unsafe: Check for unsafe function/method calls r=CohenArthur a=CohenArthur

Addresses #1411 

Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
@philberty philberty added this to To do in GSoC 2022 - Constexpr via automation Aug 3, 2022
@philberty philberty added this to the Const Generics milestone Aug 3, 2022
@philberty philberty removed this from To do in GSoC 2022 - Constexpr Aug 3, 2022
@philberty philberty added this to To do in Const generics and missing features sprint via automation Aug 3, 2022
bors bot added a commit that referenced this issue Jan 5, 2023
1711: unsafe: check use of `target_feature` attribute r=CohenArthur a=snprajwal

The `target_feature` attribute is for conditional compilation and may or may not compile on all platforms. Using it requires an unsafe function or block.

Addresses #1411 

Co-authored-by: Prajwal S N <prajwalnadig21@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

3 participants