forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#81853 - GuillaumeGomez:rollup-xzh1z4v, r=Guil…
…laumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#81526 (btree: use Option's unwrap_unchecked()) - rust-lang#81742 (Add a note about the correctness and the effect on unsafe code to the `ExactSizeIterator` docs) - rust-lang#81830 (Add long error explanation for E0542) - rust-lang#81835 (Improve long explanation for E0546) - rust-lang#81843 (Add regression test for rust-lang#29821) Failed merges: - rust-lang#81836 (Add long explanation for E0547) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
11 changed files
with
96 additions
and
35 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
The `since` value is missing in a stability attribute. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0542 | ||
#![feature(staged_api)] | ||
#![stable(since = "1.0.0", feature = "test")] | ||
#[stable(feature = "_stable_fn")] // invalid | ||
fn _stable_fn() {} | ||
#[rustc_const_stable(feature = "_stable_const_fn")] // invalid | ||
fn _stable_const_fn() {} | ||
#[stable(feature = "_deprecated_fn", since = "0.1.0")] | ||
#[rustc_deprecated( | ||
reason = "explanation for deprecation" | ||
)] // invalid | ||
fn _deprecated_fn() {} | ||
``` | ||
|
||
To fix the issue you need to provide the `since` field. | ||
|
||
``` | ||
#![feature(staged_api)] | ||
#![stable(since = "1.0.0", feature = "test")] | ||
#[stable(feature = "_stable_fn", since = "1.0.0")] // ok! | ||
fn _stable_fn() {} | ||
#[rustc_const_stable(feature = "_stable_const_fn", since = "1.0.0")] // ok! | ||
fn _stable_const_fn() {} | ||
#[stable(feature = "_deprecated_fn", since = "0.1.0")] | ||
#[rustc_deprecated( | ||
since = "1.0.0", | ||
reason = "explanation for deprecation" | ||
)] // ok! | ||
fn _deprecated_fn() {} | ||
``` | ||
|
||
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix | ||
of the Book and the [Stability attributes][stability-attributes] section of the | ||
Rustc Dev Guide for more details. | ||
|
||
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html | ||
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// build-pass | ||
|
||
pub trait Foo { | ||
type FooAssoc; | ||
} | ||
|
||
pub struct Bar<F: Foo> { | ||
id: F::FooAssoc | ||
} | ||
|
||
pub struct Baz; | ||
|
||
impl Foo for Baz { | ||
type FooAssoc = usize; | ||
} | ||
|
||
static mut MY_FOO: Bar<Baz> = Bar { id: 0 }; | ||
|
||
fn main() {} |
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