diff options
| author | bors <bors@rust-lang.org> | 2021-07-28 22:06:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-28 22:06:51 +0000 |
| commit | 4533be947b011c9bde4871ae93e6553b24cc5ec6 (patch) | |
| tree | d1bd663bae749b9558279f77063a36e0a7c47686 /compiler/rustc_error_codes/src | |
| parent | b70888601af92f6cdc0364abab3446e418b91d36 (diff) | |
| parent | 6c4888a74ec6b3b6dafa9f5ca0ce82628455e423 (diff) | |
| download | rust-4533be947b011c9bde4871ae93e6553b24cc5ec6.tar.gz rust-4533be947b011c9bde4871ae93e6553b24cc5ec6.zip | |
Auto merge of #87569 - JohnTitor:rollup-7ydfetw, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #81050 (Stabilize core::task::ready!) - #81363 (Remove P: Unpin bound on impl Future for Pin) - #86839 (Add doc aliases to fs.rs) - #87435 (fix example code for E0617) - #87451 (Add support for tuple struct field documentation) - #87491 (Integrate context into the memorial to Anna) - #87521 (Add long explanation for E0498) - #87527 (Don't run MIR unsafeck at all when using `-Zthir-unsafeck`) - #87550 (Add `CI_ONLY_WHEN_CHANNEL` and run `x86_64-gnu-stable` only on nightly) - #87565 (Use backticks when referring to `core::future::Ready` in panic message) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0498.md | 22 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0617.md | 11 |
3 files changed, 30 insertions, 5 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index 6f65d386f0d..65999ba707c 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -248,6 +248,7 @@ E0493: include_str!("./error_codes/E0493.md"), E0495: include_str!("./error_codes/E0495.md"), E0496: include_str!("./error_codes/E0496.md"), E0497: include_str!("./error_codes/E0497.md"), +E0498: include_str!("./error_codes/E0498.md"), E0499: include_str!("./error_codes/E0499.md"), E0500: include_str!("./error_codes/E0500.md"), E0501: include_str!("./error_codes/E0501.md"), @@ -604,7 +605,6 @@ E0783: include_str!("./error_codes/E0783.md"), // E0488, // lifetime of variable does not enclose its declaration // E0489, // type/lifetime parameter not in scope here E0490, // a value of type `..` is borrowed for too long - E0498, // malformed plugin attribute E0514, // metadata version mismatch E0519, // local crate and dependency have same (crate-name, disambiguator) // two dependencies have same (crate-name, disambiguator) but different SVH diff --git a/compiler/rustc_error_codes/src/error_codes/E0498.md b/compiler/rustc_error_codes/src/error_codes/E0498.md new file mode 100644 index 00000000000..c9ea4a7947f --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0498.md @@ -0,0 +1,22 @@ +The `plugin` attribute was malformed. + +Erroneous code example: + +```compile_fail,E0498 +#![feature(plugin)] +#![plugin(foo(args))] // error: invalid argument +#![plugin(bar="test")] // error: invalid argument +``` + +The `#[plugin]` attribute should take a single argument: the name of the plugin. + +For example, for the plugin `foo`: + +```ignore (requires external plugin crate) +#![feature(plugin)] +#![plugin(foo)] // ok! +``` + +See the [`plugin` feature] section of the Unstable book for more details. + +[`plugin` feature]: https://doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html diff --git a/compiler/rustc_error_codes/src/error_codes/E0617.md b/compiler/rustc_error_codes/src/error_codes/E0617.md index 1c5d1f87b91..eed384b4959 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0617.md +++ b/compiler/rustc_error_codes/src/error_codes/E0617.md @@ -3,12 +3,13 @@ Attempted to pass an invalid type of variable into a variadic function. Erroneous code example: ```compile_fail,E0617 +# use std::os::raw::{c_char, c_int}; extern "C" { - fn printf(c: *const i8, ...); + fn printf(format: *const c_char, ...) -> c_int; } unsafe { - printf(::std::ptr::null(), 0f32); + printf("%f\n\0".as_ptr() as _, 0f32); // error: cannot pass an `f32` to variadic function, cast to `c_double` } ``` @@ -21,10 +22,12 @@ to import from `std::os::raw`). In this case, `c_double` has the same size as `f64` so we can use it directly: ```no_run +# use std::os::raw::{c_char, c_int}; # extern "C" { -# fn printf(c: *const i8, ...); +# fn printf(format: *const c_char, ...) -> c_int; # } + unsafe { - printf(::std::ptr::null(), 0f64); // ok! + printf("%f\n\0".as_ptr() as _, 0f64); // ok! } ``` |
