File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,16 @@ LLL | unsafe { ptr::read(ptr) }
140140
141141The process of verifying whether a tag is absent is referred to as tag discharge.
142142
143+ Note that it's allowed to discharge tags of unsafe callees onto the unsafe caller for unsafe
144+ encapsulation:
145+
146+ ``` rust
147+ #[clippy:: safety { ValidPtr , Aligned , Initialized }] // ✅
148+ unsafe fn constructor <T >() -> T {
149+ unsafe { read (... ) }
150+ }
151+ ```
152+
143153## Safety Tags as Ordinary Items
144154
145155Before tagging a function, we must declare them as ordinary items with ` #[clippy::safety::tag] ` such
@@ -209,7 +219,7 @@ Currently, safety tags requires the following unstable features
209219Since the safety-tag mechanism is implemented primarily in Clippy and rust-analyzer, no additional
210220support is required from rustc.
211221
212- But We ask the libs team to adopt safety tags for all public ` unsafe ` APIs in libstd, along with
222+ But we ask the libs team to adopt safety tags for all public ` unsafe ` APIs in libstd, along with
213223their call sites. To enable experimentation, a nightly-only library feature
214224` #![feature(safety_tags)] ` should be introduced and remain unstable until the design is finalized.
215225
You can’t perform that action at this time.
0 commit comments