From 044fe0f558aa62926e6de9a76b95e4a74c0b1f99 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 25 Jan 2020 20:03:10 +0100 Subject: Add a resume type parameter to `Generator` --- src/librustc_error_codes/error_codes/E0626.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0626.md b/src/librustc_error_codes/error_codes/E0626.md index db50bd7ac4f..cc6e03d1ca7 100644 --- a/src/librustc_error_codes/error_codes/E0626.md +++ b/src/librustc_error_codes/error_codes/E0626.md @@ -12,7 +12,7 @@ let mut b = || { yield (); // ...is still in scope here, when the yield occurs. println!("{}", a); }; -Pin::new(&mut b).resume(); +Pin::new(&mut b).resume(()); ``` At present, it is not permitted to have a yield that occurs while a @@ -31,7 +31,7 @@ let mut b = || { yield (); println!("{}", a); }; -Pin::new(&mut b).resume(); +Pin::new(&mut b).resume(()); ``` This is a very simple case, of course. In more complex cases, we may @@ -50,7 +50,7 @@ let mut b = || { yield x; // ...when this yield occurs. } }; -Pin::new(&mut b).resume(); +Pin::new(&mut b).resume(()); ``` Such cases can sometimes be resolved by iterating "by value" (or using @@ -66,7 +66,7 @@ let mut b = || { yield x; // <-- Now yield is OK. } }; -Pin::new(&mut b).resume(); +Pin::new(&mut b).resume(()); ``` If taking ownership is not an option, using indices can work too: @@ -83,7 +83,7 @@ let mut b = || { yield x; // <-- Now yield is OK. } }; -Pin::new(&mut b).resume(); +Pin::new(&mut b).resume(()); // (*) -- Unfortunately, these temporaries are currently required. // See . -- cgit 1.4.1-3-g733a5 From 534c3eaf286e612ef9196a2744a211285b2fff83 Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Thu, 6 Feb 2020 15:31:21 +0100 Subject: error code examples: replace some more ignore with compile_fail Now that compile_fail attempts a full build rather than --emit=metadata, these errors should be caught by compile_fail and do not need to be ignored. --- src/librustc_error_codes/error_codes/E0511.md | 2 +- src/librustc_error_codes/error_codes/E0534.md | 2 +- src/librustc_error_codes/error_codes/E0535.md | 2 +- src/librustc_error_codes/error_codes/E0633.md | 4 +++- src/librustc_error_codes/error_codes/E0668.md | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0511.md b/src/librustc_error_codes/error_codes/E0511.md index 2d6ff8241e6..4f6644f3582 100644 --- a/src/librustc_error_codes/error_codes/E0511.md +++ b/src/librustc_error_codes/error_codes/E0511.md @@ -1,7 +1,7 @@ Invalid monomorphization of an intrinsic function was used. Erroneous code example: -```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail) +```compile_fail,E0511 #![feature(platform_intrinsics)] extern "platform-intrinsic" { diff --git a/src/librustc_error_codes/error_codes/E0534.md b/src/librustc_error_codes/error_codes/E0534.md index e50b84764b4..0afa4a8c958 100644 --- a/src/librustc_error_codes/error_codes/E0534.md +++ b/src/librustc_error_codes/error_codes/E0534.md @@ -2,7 +2,7 @@ The `inline` attribute was malformed. Erroneous code example: -```ignore (compile_fail not working here; see Issue #43707) +```compile_fail,E0534 #[inline()] // error: expected one argument pub fn something() {} diff --git a/src/librustc_error_codes/error_codes/E0535.md b/src/librustc_error_codes/error_codes/E0535.md index e9abfe5dda1..035d395b76f 100644 --- a/src/librustc_error_codes/error_codes/E0535.md +++ b/src/librustc_error_codes/error_codes/E0535.md @@ -2,7 +2,7 @@ An unknown argument was given to the `inline` attribute. Erroneous code example: -```ignore (compile_fail not working here; see Issue #43707) +```compile_fail,E0535 #[inline(unknown)] // error: invalid argument pub fn something() {} diff --git a/src/librustc_error_codes/error_codes/E0633.md b/src/librustc_error_codes/error_codes/E0633.md index 65cdf90036a..7f488cde664 100644 --- a/src/librustc_error_codes/error_codes/E0633.md +++ b/src/librustc_error_codes/error_codes/E0633.md @@ -2,7 +2,9 @@ The `unwind` attribute was malformed. Erroneous code example: -```ignore (compile_fail not working here; see Issue #43707) +```compile_fail,E0633 +#![feature(unwind_attributes)] + #[unwind()] // error: expected one argument pub extern fn something() {} diff --git a/src/librustc_error_codes/error_codes/E0668.md b/src/librustc_error_codes/error_codes/E0668.md index 2621a31a9e0..f5d26244fb9 100644 --- a/src/librustc_error_codes/error_codes/E0668.md +++ b/src/librustc_error_codes/error_codes/E0668.md @@ -6,7 +6,7 @@ assembly call. In particular, it can happen if you forgot the closing bracket of a register constraint (see issue #51430): -```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail) +```compile_fail,E0668 #![feature(asm)] fn main() { -- cgit 1.4.1-3-g733a5 From 64450ac765366759af9f0e2769e578e87474cfca Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 6 Feb 2020 23:55:45 +0900 Subject: Update E0565 examples --- src/librustc_error_codes/error_codes/E0565.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0565.md b/src/librustc_error_codes/error_codes/E0565.md index 1faedf45932..d5bba941c1d 100644 --- a/src/librustc_error_codes/error_codes/E0565.md +++ b/src/librustc_error_codes/error_codes/E0565.md @@ -2,9 +2,11 @@ A literal was used in a built-in attribute that doesn't support literals. Erroneous code example: -```ignore (compile_fail not working here; see Issue #43707) -#[inline("always")] // error: unsupported literal -pub fn something() {} +```compile_fail,E0565 +#[repr("C")] // error: meta item in `repr` must be an identifier +struct Repr {} + +fn main() {} ``` Literals in attributes are new and largely unsupported in built-in attributes. @@ -12,6 +14,8 @@ Work to support literals where appropriate is ongoing. Try using an unquoted name instead: ``` -#[inline(always)] -pub fn something() {} +#[repr(C)] // ok! +struct Repr {} + +fn main() {} ``` -- cgit 1.4.1-3-g733a5 From 26020f506338add6fec610ad8c2cb64c28546cbe Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 7 Feb 2020 13:23:33 +0100 Subject: clean up E0276 explanation --- src/librustc_error_codes/error_codes/E0276.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0276.md b/src/librustc_error_codes/error_codes/E0276.md index 0e3a613bf9c..ad76968c589 100644 --- a/src/librustc_error_codes/error_codes/E0276.md +++ b/src/librustc_error_codes/error_codes/E0276.md @@ -1,5 +1,6 @@ -This error occurs when a bound in an implementation of a trait does not match -the bounds specified in the original trait. For example: +A trait implementation has stricter requirements than the trait definition. + +Erroneous code example: ```compile_fail,E0276 trait Foo { -- cgit 1.4.1-3-g733a5