Skip to content

Commit 8782f79

Browse files
committed
Clarify unsafe to safe function qualifier change.
1 parent 1351ff7 commit 8782f79

File tree

1 file changed

+9
-33
lines changed

1 file changed

+9
-33
lines changed

src/doc/src/reference/semver.md

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ considered incompatible.
8888
* [Possibly-breaking: introducing a new function type parameter](#fn-generic-new)
8989
* [Minor: generalizing a function to use generics (supporting original type)](#fn-generalize-compatible)
9090
* [Major: generalizing a function to use generics with type mismatch](#fn-generalize-mismatch)
91-
* [Possibly-breaking: making an `unsafe` function safe](#fn-unsafe-safe)
91+
* [Minor: making an `unsafe` function safe](#fn-unsafe-safe)
9292
* Attributes
9393
* [Major: switching from `no_std` support to requiring `std`](#attr-no-std-to-std)
9494
* [Major: adding `non_exhaustive` to an existing enum, variant, or struct with no private fields](#attr-adding-non-exhaustive)
@@ -1082,12 +1082,14 @@ fn main() {
10821082
```
10831083

10841084
<a id="fn-unsafe-safe"></a>
1085-
### Possibly-breaking: making an `unsafe` function safe
1085+
### Minor: making an `unsafe` function safe
10861086

1087-
A previously `unsafe` function can be made safe without breaking code. Note
1088-
however that it will likely cause the [`unused_unsafe`][unused_unsafe] lint
1089-
to trigger as in the example below, which will cause local crates that have
1090-
specified `#![deny(warnings)]` to stop compiling.
1087+
A previously `unsafe` function can be made safe without breaking code.
1088+
1089+
Note however that it may cause the [`unused_unsafe`][unused_unsafe] lint to
1090+
trigger as in the example below, which will cause local crates that have
1091+
specified `#![deny(warnings)]` to stop compiling. Per [introducing new
1092+
lints](#new-lints), it is allowed for updates to introduce new warnings.
10911093

10921094
Going the other way (making a safe function `unsafe`) is a breaking change.
10931095

@@ -1118,33 +1120,7 @@ fn main() {
11181120

11191121
Making a previously `unsafe` associated function or method on structs / enums
11201122
safe is also a minor change, while the same is not true for associated
1121-
function on traits:
1122-
1123-
```rust,ignore
1124-
// MAJOR CHANGE
1125-
1126-
///////////////////////////////////////////////////////////
1127-
// Before
1128-
pub trait Foo {
1129-
unsafe fn foo();
1130-
}
1131-
1132-
///////////////////////////////////////////////////////////
1133-
// After
1134-
pub trait Foo {
1135-
fn foo();
1136-
}
1137-
1138-
///////////////////////////////////////////////////////////
1139-
// Example usage that will break.
1140-
use updated_crate::Foo;
1141-
1142-
struct Bar;
1143-
1144-
impl Foo for Bar {
1145-
unsafe fn foo() {} // Error: method `foo` has an incompatible type for trait
1146-
}
1147-
```
1123+
function on traits (see [any change to trait item signatures](#trait-item-signature)).
11481124

11491125
<a id="attr-no-std-to-std"></a>
11501126
### Major: switching from `no_std` support to requiring `std`

0 commit comments

Comments
 (0)