Skip to content

Commit 578c30d

Browse files
committed
Update syntax
1 parent 4315371 commit 578c30d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

text/0000-target-feature-1.1.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ are not marked as `unsafe`:
7373

7474
```rust
7575
// Example 1:
76-
#[target_feature = "sse2"] unsafe fn foo() { } // RFC2045
77-
#[target_feature = "sse2"] fn bar() { } // NEW
76+
#[target_feature(enable = "sse2")] unsafe fn foo() { } // RFC2045
77+
#[target_feature(enable = "sse2")] fn bar() { } // NEW
7878

7979
// This function does not have the "sse2" target feature:
8080
fn meow() {
@@ -84,15 +84,15 @@ fn meow() {
8484
unsafe { bar() }; // OK
8585
}
8686

87-
#[target_feature = "sse2"]
87+
#[target_feature(enable = "sse2")]
8888
fn bark() {
8989
foo(); // ERROR (foo is unsafe: unsafe block required)
9090
unsafe { foo() }; // OK
9191
bar(); // OK (bark is sse2 and bar is safe)
9292
unsafe { bar() }; // OK (as well - warning: unnecessary unsafe block)
9393
}
9494

95-
#[target_feature = "avx"] // avx != sse2
95+
#[target_feature(enable = "avx")] // avx != sse2
9696
fn moo() {
9797
foo(); // ERROR (unsafe block required)
9898
unsafe { foo() }; // OK
@@ -132,7 +132,7 @@ method implementations:
132132
trait Foo { fn foo(); }
133133
struct Fooish();
134134
impl Foo for Fooish {
135-
#[target_feature = "sse2"] fn foo() { }
135+
#[target_feature(enable = "sse2")] fn foo() { }
136136
// ^ ERROR: #[target_feature] on trait method impl requires
137137
// unsafe fn but Foo::foo is safe
138138
// (this is already an error per RFC2045)
@@ -141,7 +141,7 @@ impl Foo for Fooish {
141141
trait Bar { unsafe fn bar(); }
142142
struct Barish();
143143
impl Bar for Barish {
144-
#[target_feature = "sse2"] unsafe fn bar() { } // OK (RFC2045)
144+
#[target_feature(enable = "sse2")] unsafe fn bar() { } // OK (RFC2045)
145145
}
146146
```
147147

@@ -150,7 +150,7 @@ impl Bar for Barish {
150150

151151
```rust
152152
// Example 3
153-
#[target_feature] fn meow() {}
153+
#[target_feature(enable = "avx")] fn meow() {}
154154

155155
static x: fn () -> () = meow;
156156
// ^ ERROR: meow can only be assigned to unsafe fn pointers due to

0 commit comments

Comments
 (0)