-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Stabilize unsafe_op_in_unsafe_fn
lint
#79208
Merged
bors
merged 1 commit into
rust-lang:master
from
LeSeulArtichaut:stable-unsafe_op_in_unsafe_fn
Mar 10, 2021
Merged
Stabilize unsafe_op_in_unsafe_fn
lint
#79208
bors
merged 1 commit into
rust-lang:master
from
LeSeulArtichaut:stable-unsafe_op_in_unsafe_fn
Mar 10, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LeSeulArtichaut
added
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
needs-fcp
This change is insta-stable, so needs a completed FCP to proceed.
F-unsafe-block-in-unsafe-fn
RFC #2585
labels
Nov 19, 2020
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Nov 19, 2020
5 tasks
RalfJung
reviewed
Nov 19, 2020
LeSeulArtichaut
force-pushed
the
stable-unsafe_op_in_unsafe_fn
branch
3 times, most recently
from
November 19, 2020 20:50
45cb433
to
16182c4
Compare
LeSeulArtichaut
commented
Nov 28, 2020
crlf0710
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Dec 18, 2020
Triage: there's merge conflicts now. |
@LeSeulArtichaut Ping from triage. Any updates here? |
crlf0710
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Jan 15, 2021
Opened #81110, marking as blocked on that |
LeSeulArtichaut
added
the
S-blocked
Status: Marked as blocked ❌ on something else such as an RFC or other implementation work.
label
Jan 17, 2021
LeSeulArtichaut
force-pushed
the
stable-unsafe_op_in_unsafe_fn
branch
from
January 17, 2021 19:44
16182c4
to
9bf78eb
Compare
LeSeulArtichaut
removed
the
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
label
Jan 17, 2021
LeSeulArtichaut
force-pushed
the
stable-unsafe_op_in_unsafe_fn
branch
2 times, most recently
from
January 17, 2021 19:51
452b1e1
to
91ea97d
Compare
This comment has been minimized.
This comment has been minimized.
LeSeulArtichaut
force-pushed
the
stable-unsafe_op_in_unsafe_fn
branch
from
January 17, 2021 19:57
91ea97d
to
35a59ae
Compare
This comment has been minimized.
This comment has been minimized.
LeSeulArtichaut
force-pushed
the
stable-unsafe_op_in_unsafe_fn
branch
from
January 17, 2021 20:13
35a59ae
to
b90be3b
Compare
m-ou-se
added a commit
to m-ou-se/rust
that referenced
this pull request
Jan 18, 2021
…abel, r=RalfJung Fix `unused_unsafe` label with `unsafe_block_in_unsafe_fn Previously, the following code: ```rust #![feature(unsafe_block_in_unsafe_fn)] unsafe fn foo() { unsafe { unsf() } } unsafe fn unsf() {} ``` Would give the following warning: ``` warning: unnecessary `unsafe` block --> src/lib.rs:4:5 | 4 | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | = note: `#[warn(unused_unsafe)]` on by default ``` which doesn't point out that the block is in an `unsafe fn`. Tracking issue: rust-lang#71668 cc rust-lang#79208
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 19, 2021
…el, r=RalfJung Fix `unused_unsafe` label with `unsafe_block_in_unsafe_fn Previously, the following code: ```rust #![feature(unsafe_block_in_unsafe_fn)] unsafe fn foo() { unsafe { unsf() } } unsafe fn unsf() {} ``` Would give the following warning: ``` warning: unnecessary `unsafe` block --> src/lib.rs:4:5 | 4 | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | = note: `#[warn(unused_unsafe)]` on by default ``` which doesn't point out that the block is in an `unsafe fn`. Tracking issue: rust-lang#71668 cc rust-lang#79208
@bors r+ |
📌 Commit ec20993 has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
S-waiting-on-team
Status: Awaiting decision from the relevant subteam (see the T-<team> label).
labels
Mar 9, 2021
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Mar 9, 2021
…_unsafe_fn, r=nikomatsakis Stabilize `unsafe_op_in_unsafe_fn` lint This makes it possible to override the level of the `unsafe_op_in_unsafe_fn`, as proposed in rust-lang#71668 (comment). Tracking issue: rust-lang#71668 r? `@nikomatsakis` cc `@SimonSapin` `@RalfJung` # Stabilization report This is a stabilization report for `#![feature(unsafe_block_in_unsafe_fn)]`. ## Summary Currently, the body of unsafe functions is an unsafe block, i.e. you can perform unsafe operations inside. The `unsafe_op_in_unsafe_fn` lint, stabilized here, can be used to change this behavior, so performing unsafe operations in unsafe functions requires an unsafe block. For now, the lint is allow-by-default, which means that this PR does not change anything without overriding the lint level. For more information, see [RFC 2585](https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md) ### Example ```rust // An `unsafe fn` for demonstration purposes. // Calling this is an unsafe operation. unsafe fn unsf() {} // #[allow(unsafe_op_in_unsafe_fn)] by default, // the behavior of `unsafe fn` is unchanged unsafe fn allowed() { // Here, no `unsafe` block is needed to // perform unsafe operations... unsf(); // ...and any `unsafe` block is considered // unused and is warned on by the compiler. unsafe { unsf(); } } #[warn(unsafe_op_in_unsafe_fn)] unsafe fn warned() { // Removing this `unsafe` block will // cause the compiler to emit a warning. // (Also, no "unused unsafe" warning will be emitted here.) unsafe { unsf(); } } #[deny(unsafe_op_in_unsafe_fn)] unsafe fn denied() { // Removing this `unsafe` block will // cause a compilation error. // (Also, no "unused unsafe" warning will be emitted here.) unsafe { unsf(); } } ```
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Mar 9, 2021
…_unsafe_fn, r=nikomatsakis Stabilize `unsafe_op_in_unsafe_fn` lint This makes it possible to override the level of the `unsafe_op_in_unsafe_fn`, as proposed in rust-lang#71668 (comment). Tracking issue: rust-lang#71668 r? ``@nikomatsakis`` cc ``@SimonSapin`` ``@RalfJung`` # Stabilization report This is a stabilization report for `#![feature(unsafe_block_in_unsafe_fn)]`. ## Summary Currently, the body of unsafe functions is an unsafe block, i.e. you can perform unsafe operations inside. The `unsafe_op_in_unsafe_fn` lint, stabilized here, can be used to change this behavior, so performing unsafe operations in unsafe functions requires an unsafe block. For now, the lint is allow-by-default, which means that this PR does not change anything without overriding the lint level. For more information, see [RFC 2585](https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md) ### Example ```rust // An `unsafe fn` for demonstration purposes. // Calling this is an unsafe operation. unsafe fn unsf() {} // #[allow(unsafe_op_in_unsafe_fn)] by default, // the behavior of `unsafe fn` is unchanged unsafe fn allowed() { // Here, no `unsafe` block is needed to // perform unsafe operations... unsf(); // ...and any `unsafe` block is considered // unused and is warned on by the compiler. unsafe { unsf(); } } #[warn(unsafe_op_in_unsafe_fn)] unsafe fn warned() { // Removing this `unsafe` block will // cause the compiler to emit a warning. // (Also, no "unused unsafe" warning will be emitted here.) unsafe { unsf(); } } #[deny(unsafe_op_in_unsafe_fn)] unsafe fn denied() { // Removing this `unsafe` block will // cause a compilation error. // (Also, no "unused unsafe" warning will be emitted here.) unsafe { unsf(); } } ```
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 10, 2021
Rollup of 10 pull requests Successful merges: - rust-lang#77511 (Add StatementKind::CopyNonOverlapping) - rust-lang#79208 (Stabilize `unsafe_op_in_unsafe_fn` lint) - rust-lang#82411 (Fixes to ExitStatus and its docs) - rust-lang#82733 (Add powerpc-unknown-openbsd target) - rust-lang#82802 (Build rustdoc for run-make tests, not just run-make-fulldeps) - rust-lang#82849 (Add Option::get_or_default) - rust-lang#82908 (:arrow_up: rust-analyzer) - rust-lang#82937 (Update README.md to use the correct cmake version number) - rust-lang#82938 (Bump tracing-tree dependency) - rust-lang#82942 (Don't hardcode the `v1` prelude in diagnostics, to allow for new preludes.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 15, 2021
…RalfJung Update docs for unsafe_op_in_unsafe_fn stability. The unsafe_op_in_unsafe_fn lint was stabilized in rust-lang#79208, but the bottom of this documentation wasn't updated. I'm just guessing at the reason here, hopefully it is close to correct. The only discussion I found is rust-lang#71668 (comment) which didn't really explain the thought process behind the decision.
wip-sync
pushed a commit
to NetBSD/pkgsrc-wip
that referenced
this pull request
May 9, 2021
Package changes: * bump bootstraps to 1.51.0. * adjust patches and cargo checksums as required * 1.51 failed to build natively on 32-bit armv7, there is hope that this is fixed with 1.52. (1.51 can be built with netbsd32 emulation on a aarch64 system). Upsteream changes: Version 1.52.0 (2021-05-06) ============================ Language -------- - [Added the `unsafe_op_in_unsafe_fn` lint, which checks whether the unsafe code in an `unsafe fn` is wrapped in a `unsafe` block.][79208] This lint is allowed by default, and may become a warning or hard error in a future edition. - [You can now cast mutable references to arrays to a pointer of the same type as the element.][81479] Compiler -------- - [Upgraded the default LLVM to LLVM 12.][81451] Added tier 3\* support for the following targets. - [`s390x-unknown-linux-musl`][82166] - [`riscv32gc-unknown-linux-musl` & `riscv64gc-unknown-linux-musl`][82202] - [`powerpc-unknown-openbsd`][82733] \* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. Libraries --------- - [`OsString` now implements `Extend` and `FromIterator`.][82121] - [`cmp::Reverse` now has `#[repr(transparent)]` representation.][81879] - [`Arc<impl Error>` now implements `error::Error`.][80553] - [All integer division and remainder operations are now `const`.][80962] Stabilised APIs ------------- - [`Arguments::as_str`] - [`char::MAX`] - [`char::REPLACEMENT_CHARACTER`] - [`char::UNICODE_VERSION`] - [`char::decode_utf16`] - [`char::from_digit`] - [`char::from_u32_unchecked`] - [`char::from_u32`] - [`slice::partition_point`] - [`str::rsplit_once`] - [`str::split_once`] The following previously stable APIs are now `const`. - [`char::len_utf8`] - [`char::len_utf16`] - [`char::to_ascii_uppercase`] - [`char::to_ascii_lowercase`] - [`char::eq_ignore_ascii_case`] - [`u8::to_ascii_uppercase`] - [`u8::to_ascii_lowercase`] - [`u8::eq_ignore_ascii_case`] Rustdoc ------- - [Rustdoc lints are now treated as a tool lint, meaning that lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527] Using the old style is still allowed, and will become a warning in a future release. - [Rustdoc now supports argument files.][82261] - [Rustdoc now generates smart punctuation for documentation.][79423] - [You can now use "task lists" in Rustdoc Markdown.][81766] E.g. ```markdown - [x] Complete - [ ] Todo ``` Misc ---- - [You can now pass multiple filters to tests.][81356] E.g. `cargo test -- foo bar` will run all tests that match `foo` and `bar`. - [Rustup now distributes PDB symbols for the `std` library on Windows, allowing you to see `std` symbols when debugging.][82218] Internal Only ------------- These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools. - [Check the result cache before the DepGraph when ensuring queries][81855] - [Try fast_reject::simplify_type in coherence before doing full check][81744] - [Only store a LocalDefId in some HIR nodes][81611] - [Store HIR attributes in a side table][79519] Compatibility Notes ------------------- - [Cargo build scripts are now forbidden from setting `RUSTC_BOOTSTRAP`.] [cargo/9181] - [Removed support for the `x86_64-rumprun-netbsd` target.][82594] - [Deprecated the `x86_64-sun-solaris` target in favor of `x86_64-pc-solaris`.] [82216] - [Rustdoc now only accepts `,`, ` `, and `\t` as delimiters for specifying languages in code blocks.][78429] - [Rustc now catches more cases of `pub_use_of_private_extern_crate`][80763] - [Changes in how proc macros handle whitespace may lead to panics when used with older `proc-macro-hack` versions. A `cargo update` should be sufficient to fix this in all cases.][84136] [84136]: rust-lang/rust#84136 [80763]: rust-lang/rust#80763 [82166]: rust-lang/rust#82166 [82121]: rust-lang/rust#82121 [81879]: rust-lang/rust#81879 [82261]: rust-lang/rust#82261 [82218]: rust-lang/rust#82218 [82216]: rust-lang/rust#82216 [82202]: rust-lang/rust#82202 [81855]: rust-lang/rust#81855 [81766]: rust-lang/rust#81766 [81744]: rust-lang/rust#81744 [81611]: rust-lang/rust#81611 [81479]: rust-lang/rust#81479 [81451]: rust-lang/rust#81451 [81356]: rust-lang/rust#81356 [80962]: rust-lang/rust#80962 [80553]: rust-lang/rust#80553 [80527]: rust-lang/rust#80527 [79519]: rust-lang/rust#79519 [79423]: rust-lang/rust#79423 [79208]: rust-lang/rust#79208 [78429]: rust-lang/rust#78429 [82733]: rust-lang/rust#82733 [82594]: rust-lang/rust#82594 [cargo/9181]: rust-lang/cargo#9181 [`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX [`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER [`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION [`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16 [`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32 [`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked [`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit [`Peekable::next_if`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if [`Peekable::next_if_eq`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_eq [`Arguments::as_str`]: https://doc.rust-lang.org/stable/std/fmt/struct.Arguments.html#method.as_str [`str::split_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_once [`str::rsplit_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.rsplit_once [`slice::partition_point`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.partition_point [`char::len_utf8`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf8 [`char::len_utf16`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf16 [`char::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_uppercase [`char::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_lowercase [`char::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.eq_ignore_ascii_case [`u8::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_uppercase [`u8::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_lowercase [`u8::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.eq_ignore_ascii_case
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
May 31, 2021
Pkgsrc changes: * Bump bootstrap kit version to 1.51.0. * Adjust patches as needed. * Update checksum adjustments. * Fix syntax error in commands adjusting libserde_derive for Darwin Upstream changes: Version 1.52.1 (2021-05-10) ============================ This release disables incremental compilation, unless the user has explicitly opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable. This is due to the widespread, and frequently occuring, breakage encountered by Rust users due to newly enabled incremental verification in 1.52.0. Notably, Rust users **should** upgrade to 1.52.0 or 1.52.1: the bugs that are detected by newly added incremental verification are still present in past stable versions, and are not yet fixed on any channel. These bugs can lead to miscompilation of Rust binaries. These problems only affect incremental builds, so release builds with Cargo should not be affected unless the user has explicitly opted into incremental. Debug and check builds are affected. See [84970] for more details. [84970]: rust-lang/rust#84970 Version 1.52.0 (2021-05-06) ============================ Language -------- - [Added the `unsafe_op_in_unsafe_fn` lint, which checks whether the unsafe code in an `unsafe fn` is wrapped in a `unsafe` block.][79208] This lint is allowed by default, and may become a warning or hard error in a future edition. - [You can now cast mutable references to arrays to a pointer of the same type as the element.][81479] Compiler -------- - [Upgraded the default LLVM to LLVM 12.][81451] Added tier 3\* support for the following targets. - [`s390x-unknown-linux-musl`][82166] - [`riscv32gc-unknown-linux-musl` & `riscv64gc-unknown-linux-musl`][82202] - [`powerpc-unknown-openbsd`][82733] \* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. Libraries --------- - [`OsString` now implements `Extend` and `FromIterator`.][82121] - [`cmp::Reverse` now has `#[repr(transparent)]` representation.][81879] - [`Arc<impl Error>` now implements `error::Error`.][80553] - [All integer division and remainder operations are now `const`.][80962] Stabilised APIs ------------- - [`Arguments::as_str`] - [`char::MAX`] - [`char::REPLACEMENT_CHARACTER`] - [`char::UNICODE_VERSION`] - [`char::decode_utf16`] - [`char::from_digit`] - [`char::from_u32_unchecked`] - [`char::from_u32`] - [`slice::partition_point`] - [`str::rsplit_once`] - [`str::split_once`] The following previously stable APIs are now `const`. - [`char::len_utf8`] - [`char::len_utf16`] - [`char::to_ascii_uppercase`] - [`char::to_ascii_lowercase`] - [`char::eq_ignore_ascii_case`] - [`u8::to_ascii_uppercase`] - [`u8::to_ascii_lowercase`] - [`u8::eq_ignore_ascii_case`] Rustdoc ------- - [Rustdoc lints are now treated as a tool lint, meaning that lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527] Using the old style is still allowed, and will become a warning in a future release. - [Rustdoc now supports argument files.][82261] - [Rustdoc now generates smart punctuation for documentation.][79423] - [You can now use "task lists" in Rustdoc Markdown.][81766] E.g. ```markdown - [x] Complete - [ ] Todo ``` Misc ---- - [You can now pass multiple filters to tests.][81356] E.g. `cargo test -- foo bar` will run all tests that match `foo` and `bar`. - [Rustup now distributes PDB symbols for the `std` library on Windows, allowing you to see `std` symbols when debugging.][82218] Internal Only ------------- These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools. - [Check the result cache before the DepGraph when ensuring queries][81855] - [Try fast_reject::simplify_type in coherence before doing full check][81744] - [Only store a LocalDefId in some HIR nodes][81611] - [Store HIR attributes in a side table][79519] Compatibility Notes ------------------- - [Cargo build scripts are now forbidden from setting `RUSTC_BOOTSTRAP`.][cargo/9181] - [Removed support for the `x86_64-rumprun-netbsd` target.][82594] - [Deprecated the `x86_64-sun-solaris` target in favor of `x86_64-pc-solaris`.][82216] - [Rustdoc now only accepts `,`, ` `, and `\t` as delimiters for specifying languages in code blocks.][78429] - [Rustc now catches more cases of `pub_use_of_private_extern_crate`][80763] - [Changes in how proc macros handle whitespace may lead to panics when used with older `proc-macro-hack` versions. A `cargo update` should be sufficient to fix this in all cases.][84136] [84136]: rust-lang/rust#84136 [80763]: rust-lang/rust#80763 [82166]: rust-lang/rust#82166 [82121]: rust-lang/rust#82121 [81879]: rust-lang/rust#81879 [82261]: rust-lang/rust#82261 [82218]: rust-lang/rust#82218 [82216]: rust-lang/rust#82216 [82202]: rust-lang/rust#82202 [81855]: rust-lang/rust#81855 [81766]: rust-lang/rust#81766 [81744]: rust-lang/rust#81744 [81611]: rust-lang/rust#81611 [81479]: rust-lang/rust#81479 [81451]: rust-lang/rust#81451 [81356]: rust-lang/rust#81356 [80962]: rust-lang/rust#80962 [80553]: rust-lang/rust#80553 [80527]: rust-lang/rust#80527 [79519]: rust-lang/rust#79519 [79423]: rust-lang/rust#79423 [79208]: rust-lang/rust#79208 [78429]: rust-lang/rust#78429 [82733]: rust-lang/rust#82733 [82594]: rust-lang/rust#82594 [cargo/9181]: rust-lang/cargo#9181 [`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX [`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER [`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION [`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16 [`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32 [`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked [`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit [`Peekable::next_if`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if [`Peekable::next_if_eq`]: https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_eq [`Arguments::as_str`]: https://doc.rust-lang.org/stable/std/fmt/struct.Arguments.html#method.as_str [`str::split_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_once [`str::rsplit_once`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.rsplit_once [`slice::partition_point`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.partition_point [`char::len_utf8`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf8 [`char::len_utf16`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.len_utf16 [`char::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_uppercase [`char::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.to_ascii_lowercase [`char::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.char.html#method.eq_ignore_ascii_case [`u8::to_ascii_uppercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_uppercase [`u8::to_ascii_lowercase`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ascii_lowercase [`u8::eq_ignore_ascii_case`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.eq_ignore_ascii_case
5 tasks
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
disposition-merge
This issue / PR is in PFCP or FCP with a disposition to merge it.
F-unsafe-block-in-unsafe-fn
RFC #2585
finished-final-comment-period
The final comment period is finished for this PR / Issue.
needs-fcp
This change is insta-stable, so needs a completed FCP to proceed.
relnotes
Marks issues that should be documented in the release notes of the next release.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes it possible to override the level of the
unsafe_op_in_unsafe_fn
, as proposed in #71668 (comment).Tracking issue: #71668
r? @nikomatsakis cc @SimonSapin @RalfJung
Stabilization report
This is a stabilization report for
#![feature(unsafe_block_in_unsafe_fn)]
.Summary
Currently, the body of unsafe functions is an unsafe block, i.e. you can perform unsafe operations inside.
The
unsafe_op_in_unsafe_fn
lint, stabilized here, can be used to change this behavior, so performing unsafe operations in unsafe functions requires an unsafe block.For now, the lint is allow-by-default, which means that this PR does not change anything without overriding the lint level.
For more information, see RFC 2585
Example