diff options
Diffstat (limited to 'compiler/rustc_error_codes')
6 files changed, 28 insertions, 5 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index fef6602b9cc..c669f7fed27 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -464,6 +464,7 @@ E0776: include_str!("./error_codes/E0776.md"), E0777: include_str!("./error_codes/E0777.md"), E0778: include_str!("./error_codes/E0778.md"), E0779: include_str!("./error_codes/E0779.md"), +E0780: include_str!("./error_codes/E0780.md"), ; // E0006, // merged with E0005 // E0008, // cannot bind by-move into a pattern guard diff --git a/compiler/rustc_error_codes/src/error_codes/E0435.md b/compiler/rustc_error_codes/src/error_codes/E0435.md index 424e5ce1e2e..798a20d48b6 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0435.md +++ b/compiler/rustc_error_codes/src/error_codes/E0435.md @@ -7,6 +7,12 @@ let foo = 42; let a: [u8; foo]; // error: attempt to use a non-constant value in a constant ``` +'constant' means 'a compile-time value'. + +More details can be found in the [Variables and Mutability] section of the book. + +[Variables and Mutability]: https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants + To fix this error, please replace the value with a constant. Example: ``` diff --git a/compiler/rustc_error_codes/src/error_codes/E0492.md b/compiler/rustc_error_codes/src/error_codes/E0492.md index 1caa59999ae..79e7c069a91 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0492.md +++ b/compiler/rustc_error_codes/src/error_codes/E0492.md @@ -6,7 +6,7 @@ Erroneous code example: use std::sync::atomic::AtomicUsize; const A: AtomicUsize = AtomicUsize::new(0); -static B: &'static AtomicUsize = &A; +const B: &'static AtomicUsize = &A; // error: cannot borrow a constant which may contain interior mutability, // create a static instead ``` @@ -18,7 +18,7 @@ can't be changed via a shared `&` pointer, but interior mutability would allow it. That is, a constant value could be mutated. On the other hand, a `static` is explicitly a single memory location, which can be mutated at will. -So, in order to solve this error, either use statics which are `Sync`: +So, in order to solve this error, use statics which are `Sync`: ``` use std::sync::atomic::AtomicUsize; diff --git a/compiler/rustc_error_codes/src/error_codes/E0730.md b/compiler/rustc_error_codes/src/error_codes/E0730.md index 016b3f38aa3..56d0e6afa18 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0730.md +++ b/compiler/rustc_error_codes/src/error_codes/E0730.md @@ -3,8 +3,6 @@ An array without a fixed length was pattern-matched. Erroneous code example: ```compile_fail,E0730 -#![feature(const_generics)] - fn is_123<const N: usize>(x: [u32; N]) -> bool { match x { [1, 2, ..] => true, // error: cannot pattern-match on an diff --git a/compiler/rustc_error_codes/src/error_codes/E0770.md b/compiler/rustc_error_codes/src/error_codes/E0770.md index 278bf9b907b..b39163a9de3 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0770.md +++ b/compiler/rustc_error_codes/src/error_codes/E0770.md @@ -10,6 +10,5 @@ fn foo<T, const N: T>() {} // error! To fix this error, use a concrete type for the const parameter: ``` -#![feature(const_generics)] fn foo<T, const N: usize>() {} ``` diff --git a/compiler/rustc_error_codes/src/error_codes/E0780.md b/compiler/rustc_error_codes/src/error_codes/E0780.md new file mode 100644 index 00000000000..704b4ae181b --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0780.md @@ -0,0 +1,19 @@ +Cannot use `doc(inline)` with anonymous imports + +Erroneous code example: + +```ignore (cannot-doctest-multicrate-project) + +#[doc(inline)] // error: invalid doc argument +pub use foo::Foo as _; +``` + +Anonymous imports are always rendered with `#[doc(no_inline)]`. To fix this +error, remove the `#[doc(inline)]` attribute. + +Example: + +```ignore (cannot-doctest-multicrate-project) + +pub use foo::Foo as _; +``` |
