Skip to content

Commit fc91fdc

Browse files
committed
nightly and stable disagree on usage of unsafe
``` error: unnecessary `unsafe` block 492 --> curve25519-dalek/src/backend/vector/avx2/field.rs:479:28 493 | 494 479 | let c9_19: u32x8 = unsafe { 495 | ^^^^^^ unnecessary `unsafe` block ``` This would only happen on nightly.
1 parent fbf1fb5 commit fc91fdc

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

curve25519-dalek-derive/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,7 @@ to build out more elaborate abstractions it starts to become painful to use.
8181
This crate exposes an `#[unsafe_target_feature]` macro which works just like `#[target_feature]` except
8282
it moves the `unsafe` from the function prototype into the macro name, and can be used on safe functions.
8383

84-
```rust,compile_fail
85-
// ERROR: `#[target_feature(..)]` can only be applied to `unsafe` functions
86-
#[target_feature(enable = "avx2")]
87-
fn func() {}
88-
```
89-
9084
```rust
91-
// It works, but must be `unsafe`
9285
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
9386
#[target_feature(enable = "avx2")]
9487
unsafe fn func() {}

curve25519-dalek/src/backend/vector/avx2/field.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
// - isis agora lovecruft <isis@patternsinthevoid.net>
1010
// - Henry de Valence <hdevalence@hdevalence.ca>
1111

12+
// Nightly and stable currently disagree on the requirement of unsafe blocks when `unsafe_target_feature`
13+
// gets used.
14+
// See: https://github.com/rust-lang/rust/issues/132856
15+
#![allow(unused_unsafe)]
16+
1217
//! An implementation of 4-way vectorized 32bit field arithmetic using
1318
//! AVX2.
1419
//!

curve25519-dalek/src/backend/vector/ifma/field.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// - isis agora lovecruft <isis@patternsinthevoid.net>
1010
// - Henry de Valence <hdevalence@hdevalence.ca>
1111

12+
// Nightly and stable currently disagree on the requirement of unsafe blocks when `unsafe_target_feature`
13+
// gets used.
14+
// See: https://github.com/rust-lang/rust/issues/132856
15+
#![allow(unused_unsafe)]
1216
#![allow(non_snake_case)]
1317

1418
use crate::backend::vector::packed_simd::u64x4;

curve25519-dalek/src/backend/vector/packed_simd.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
// This file is part of curve25519-dalek.
44
// See LICENSE for licensing information.
55

6+
// Nightly and stable currently disagree on the requirement of unsafe blocks when `unsafe_target_feature`
7+
// gets used.
8+
// See: https://github.com/rust-lang/rust/issues/132856
9+
#![allow(unused_unsafe)]
10+
611
//! This module defines wrappers over platform-specific SIMD types to make them
712
//! more convenient to use.
813
//!

0 commit comments

Comments
 (0)