gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Add unsafe checks

Open CohenArthur opened this issue 3 years ago • 4 comments

  • [x] Dereferencing raw pointers #1410
  • [x] Calls to unsafe functions #1427
  • [x] #1569
  • [x] Use of mutable static #1417
  • [x] Use of extern static #1417
  • [x] Access to a union's field #1416
  • [x] Call to functions with #[target(feature)] attribute
  • [ ] Initializing type with rustc_layout_scalar_valid_range attribute
  • [ ] Mutation of layout constrained field
  • [ ] Borrow of layout constrained field

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)

CohenArthur avatar Jul 22 '22 13:07 CohenArthur

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.

bjorn3 avatar Jul 22 '22 13:07 bjorn3

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.

CohenArthur avatar Jul 22 '22 13:07 CohenArthur

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)

bjorn3 avatar Jul 22 '22 13:07 bjorn3

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

CohenArthur avatar Jul 22 '22 13:07 CohenArthur