1
Fork 0

Cleanup some error code explanations

E0045: Use a stable non-C ABI instead
E0092: Use an atomic intrinsic that actually exists
E0161: Don't use box_syntax
E0579: Format ranges in the rustfmt style
E0622: Use the rustfmt style
E0743: Remove feature gate as it's not needed
This commit is contained in:
nils 2022-10-03 08:06:07 +02:00
parent 607b8296e0
commit 1df0a1890a
6 changed files with 7 additions and 14 deletions

View file

@ -3,9 +3,7 @@ Variadic parameters have been used on a non-C ABI function.
Erroneous code example: Erroneous code example:
```compile_fail,E0045 ```compile_fail,E0045
#![feature(unboxed_closures)] extern "Rust" {
extern "rust-call" {
fn foo(x: u8, ...); // error! fn foo(x: u8, ...); // error!
} }
``` ```

View file

@ -19,6 +19,6 @@ functions are defined in `compiler/rustc_codegen_llvm/src/intrinsic.rs` and in
#![feature(intrinsics)] #![feature(intrinsics)]
extern "rust-intrinsic" { extern "rust-intrinsic" {
fn atomic_fence(); // ok! fn atomic_fence_seqcst(); // ok!
} }
``` ```

View file

@ -3,7 +3,6 @@ A value was moved whose size was not known at compile time.
Erroneous code example: Erroneous code example:
```compile_fail,E0161 ```compile_fail,E0161
#![feature(box_syntax)]
trait Bar { trait Bar {
fn f(self); fn f(self);
} }
@ -13,7 +12,7 @@ impl Bar for i32 {
} }
fn main() { fn main() {
let b: Box<dyn Bar> = box (0 as i32); let b: Box<dyn Bar> = Box::new(0i32);
b.f(); b.f();
// error: cannot move a value of type dyn Bar: the size of dyn Bar cannot // error: cannot move a value of type dyn Bar: the size of dyn Bar cannot
// be statically determined // be statically determined
@ -27,8 +26,6 @@ either `&x` or `&mut x`. Since a reference has a fixed size, this lets you move
it around as usual. Example: it around as usual. Example:
``` ```
#![feature(box_syntax)]
trait Bar { trait Bar {
fn f(&self); fn f(&self);
} }
@ -38,7 +35,7 @@ impl Bar for i32 {
} }
fn main() { fn main() {
let b: Box<dyn Bar> = box (0 as i32); let b: Box<dyn Bar> = Box::new(0i32);
b.f(); b.f();
// ok! // ok!
} }

View file

@ -8,9 +8,9 @@ Erroneous code example:
fn main() { fn main() {
match 5u32 { match 5u32 {
// This range is ok, albeit pointless. // This range is ok, albeit pointless.
1 .. 2 => {} 1..2 => {}
// This range is empty, and the compiler can tell. // This range is empty, and the compiler can tell.
5 .. 5 => {} // error! 5..5 => {} // error!
} }
} }
``` ```

View file

@ -5,7 +5,7 @@ Erroneous code example:
```compile_fail,E0622 ```compile_fail,E0622
#![feature(intrinsics)] #![feature(intrinsics)]
extern "rust-intrinsic" { extern "rust-intrinsic" {
pub static breakpoint : fn(); // error: intrinsic must be a function pub static breakpoint: fn(); // error: intrinsic must be a function
} }
fn main() { unsafe { breakpoint(); } } fn main() { unsafe { breakpoint(); } }

View file

@ -3,8 +3,6 @@ The C-variadic type `...` has been nested inside another type.
Erroneous code example: Erroneous code example:
```compile_fail,E0743 ```compile_fail,E0743
#![feature(c_variadic)]
fn foo2(x: u8, y: &...) {} // error! fn foo2(x: u8, y: &...) {} // error!
``` ```