Turn old edition lints (anonymous-parameters, keyword-idents) into warn-by-default on 2015
This commit is contained in:
parent
c18c0ad2bc
commit
664c3e71b8
14 changed files with 92 additions and 81 deletions
|
@ -857,11 +857,10 @@ declare_lint! {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// This syntax is now a hard error in the 2018 edition. In the 2015
|
/// This syntax is now a hard error in the 2018 edition. In the 2015
|
||||||
/// edition, this lint is "allow" by default, because the old code is
|
/// edition, this lint is "warn" by default. This lint
|
||||||
/// still valid, and warning for all old code can be noisy. This lint
|
|
||||||
/// enables the [`cargo fix`] tool with the `--edition` flag to
|
/// enables the [`cargo fix`] tool with the `--edition` flag to
|
||||||
/// automatically transition old code from the 2015 edition to 2018. The
|
/// automatically transition old code from the 2015 edition to 2018. The
|
||||||
/// tool will switch this lint to "warn" and will automatically apply the
|
/// tool will run this lint and automatically apply the
|
||||||
/// suggested fix from the compiler (which is to add `_` to each
|
/// suggested fix from the compiler (which is to add `_` to each
|
||||||
/// parameter). This provides a completely automated way to update old
|
/// parameter). This provides a completely automated way to update old
|
||||||
/// code for a new edition. See [issue #41686] for more details.
|
/// code for a new edition. See [issue #41686] for more details.
|
||||||
|
@ -869,7 +868,7 @@ declare_lint! {
|
||||||
/// [issue #41686]: https://github.com/rust-lang/rust/issues/41686
|
/// [issue #41686]: https://github.com/rust-lang/rust/issues/41686
|
||||||
/// [`cargo fix`]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html
|
/// [`cargo fix`]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html
|
||||||
pub ANONYMOUS_PARAMETERS,
|
pub ANONYMOUS_PARAMETERS,
|
||||||
Allow,
|
Warn,
|
||||||
"detects anonymous parameters",
|
"detects anonymous parameters",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
|
||||||
|
@ -884,6 +883,10 @@ declare_lint_pass!(
|
||||||
|
|
||||||
impl EarlyLintPass for AnonymousParameters {
|
impl EarlyLintPass for AnonymousParameters {
|
||||||
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
|
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
|
||||||
|
if cx.sess.edition() != Edition::Edition2015 {
|
||||||
|
// This is a hard error in future editions; avoid linting and erroring
|
||||||
|
return;
|
||||||
|
}
|
||||||
if let ast::AssocItemKind::Fn(box FnKind(_, ref sig, _, _)) = it.kind {
|
if let ast::AssocItemKind::Fn(box FnKind(_, ref sig, _, _)) = it.kind {
|
||||||
for arg in sig.decl.inputs.iter() {
|
for arg in sig.decl.inputs.iter() {
|
||||||
if let ast::PatKind::Ident(_, ident, None) = arg.pat.kind {
|
if let ast::PatKind::Ident(_, ident, None) = arg.pat.kind {
|
||||||
|
|
|
@ -1768,6 +1768,7 @@ mod super_keyword {}
|
||||||
/// In the 2015 edition the parameters pattern was not needed for traits:
|
/// In the 2015 edition the parameters pattern was not needed for traits:
|
||||||
///
|
///
|
||||||
/// ```rust,edition2015
|
/// ```rust,edition2015
|
||||||
|
/// # #![allow(anonymous_parameters)]
|
||||||
/// trait Tr {
|
/// trait Tr {
|
||||||
/// fn f(i32);
|
/// fn f(i32);
|
||||||
/// }
|
/// }
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
// aux-build:anon-params-edition-hygiene.rs
|
// aux-build:anon-params-edition-hygiene.rs
|
||||||
|
|
||||||
|
// This warning is still surfaced
|
||||||
|
#![allow(anonymous_parameters)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate anon_params_edition_hygiene;
|
extern crate anon_params_edition_hygiene;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ trait NonObjectSafe3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
trait NonObjectSafe4 {
|
trait NonObjectSafe4 {
|
||||||
fn foo(&self, &Self);
|
fn foo(&self, s: &Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
|
fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
|
||||||
|
|
|
@ -57,12 +57,12 @@ LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
|
||||||
|
|
|
|
||||||
= help: consider moving `foo` to another trait
|
= help: consider moving `foo` to another trait
|
||||||
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||||
--> $DIR/feature-gate-object_safe_for_dispatch.rs:15:19
|
--> $DIR/feature-gate-object_safe_for_dispatch.rs:15:22
|
||||||
|
|
|
|
||||||
LL | trait NonObjectSafe4 {
|
LL | trait NonObjectSafe4 {
|
||||||
| -------------- this trait cannot be made into an object...
|
| -------------- this trait cannot be made into an object...
|
||||||
LL | fn foo(&self, &Self);
|
LL | fn foo(&self, s: &Self);
|
||||||
| ^^^^^ ...because method `foo` references the `Self` type in this parameter
|
| ^^^^^ ...because method `foo` references the `Self` type in this parameter
|
||||||
|
|
||||||
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
|
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
|
||||||
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16
|
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16
|
||||||
|
|
|
@ -4,7 +4,7 @@ fn server() -> impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
trait FilterBase2 {
|
trait FilterBase2 {
|
||||||
fn map2<F>(self, F) -> Map2<F> {}
|
fn map2<F>(self, f: F) -> Map2<F> {}
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~^^ ERROR the size for values of type `Self` cannot be known at compilation time
|
//~^^ ERROR the size for values of type `Self` cannot be known at compilation time
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,10 @@ LL | struct Map2<Segment2, F> {
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/issue-78720.rs:7:36
|
--> $DIR/issue-78720.rs:7:39
|
||||||
|
|
|
|
||||||
LL | fn map2<F>(self, F) -> Map2<F> {}
|
LL | fn map2<F>(self, f: F) -> Map2<F> {}
|
||||||
| ^^ expected struct `Map2`, found `()`
|
| ^^ expected struct `Map2`, found `()`
|
||||||
|
|
|
|
||||||
= note: expected struct `Map2<F>`
|
= note: expected struct `Map2<F>`
|
||||||
found unit type `()`
|
found unit type `()`
|
||||||
|
@ -36,17 +36,17 @@ LL | fn map2<F>(self, F) -> Map2<F> {}
|
||||||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||||
--> $DIR/issue-78720.rs:7:16
|
--> $DIR/issue-78720.rs:7:16
|
||||||
|
|
|
|
||||||
LL | fn map2<F>(self, F) -> Map2<F> {}
|
LL | fn map2<F>(self, f: F) -> Map2<F> {}
|
||||||
| ^^^^ doesn't have a size known at compile-time
|
| ^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
|
||||||
= help: unsized fn params are gated as an unstable feature
|
= help: unsized fn params are gated as an unstable feature
|
||||||
help: consider further restricting `Self`
|
help: consider further restricting `Self`
|
||||||
|
|
|
|
||||||
LL | fn map2<F>(self, F) -> Map2<F> where Self: Sized {}
|
LL | fn map2<F>(self, f: F) -> Map2<F> where Self: Sized {}
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
help: function arguments must have a statically known size, borrowed types always have a known size
|
help: function arguments must have a statically known size, borrowed types always have a known size
|
||||||
|
|
|
|
||||||
LL | fn map2<F>(&self, F) -> Map2<F> {}
|
LL | fn map2<F>(&self, f: F) -> Map2<F> {}
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#![feature(c_variadic)]
|
#![feature(c_variadic)]
|
||||||
|
#![allow(anonymous_parameters)]
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
||||||
|
|
|
@ -1,203 +1,203 @@
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:5:19
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:6:19
|
||||||
|
|
|
|
||||||
LL | fn f1_1(x: isize, ...) {}
|
LL | fn f1_1(x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: C-variadic function must be declared with at least one named argument
|
error: C-variadic function must be declared with at least one named argument
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:8:9
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:9:9
|
||||||
|
|
|
|
||||||
LL | fn f1_2(...) {}
|
LL | fn f1_2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:8:9
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:9:9
|
||||||
|
|
|
|
||||||
LL | fn f1_2(...) {}
|
LL | fn f1_2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:12:30
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:13:30
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f2_1(x: isize, ...) {}
|
LL | extern "C" fn f2_1(x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: C-variadic function must be declared with at least one named argument
|
error: C-variadic function must be declared with at least one named argument
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:16:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f2_2(...) {}
|
LL | extern "C" fn f2_2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:16:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f2_2(...) {}
|
LL | extern "C" fn f2_2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: `...` must be the last argument of a C-variadic function
|
error: `...` must be the last argument of a C-variadic function
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:19:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:20:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f2_3(..., x: isize) {}
|
LL | extern "C" fn f2_3(..., x: isize) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:19:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:20:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f2_3(..., x: isize) {}
|
LL | extern "C" fn f2_3(..., x: isize) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:23:30
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:24:30
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f3_1(x: isize, ...) {}
|
LL | extern "C" fn f3_1(x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: C-variadic function must be declared with at least one named argument
|
error: C-variadic function must be declared with at least one named argument
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:26:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:27:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f3_2(...) {}
|
LL | extern "C" fn f3_2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:26:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:27:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f3_2(...) {}
|
LL | extern "C" fn f3_2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: `...` must be the last argument of a C-variadic function
|
error: `...` must be the last argument of a C-variadic function
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:30:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:31:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f3_3(..., x: isize) {}
|
LL | extern "C" fn f3_3(..., x: isize) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:30:20
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:31:20
|
||||||
|
|
|
|
||||||
LL | extern "C" fn f3_3(..., x: isize) {}
|
LL | extern "C" fn f3_3(..., x: isize) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: C-variadic function must be declared with at least one named argument
|
error: C-variadic function must be declared with at least one named argument
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:35:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:36:13
|
||||||
|
|
|
|
||||||
LL | fn e_f1(...);
|
LL | fn e_f1(...);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: `...` must be the last argument of a C-variadic function
|
error: `...` must be the last argument of a C-variadic function
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:37:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:38:13
|
||||||
|
|
|
|
||||||
LL | fn e_f2(..., x: isize);
|
LL | fn e_f2(..., x: isize);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:44:23
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:45:23
|
||||||
|
|
|
|
||||||
LL | fn i_f1(x: isize, ...) {}
|
LL | fn i_f1(x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: C-variadic function must be declared with at least one named argument
|
error: C-variadic function must be declared with at least one named argument
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:46:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:47:13
|
||||||
|
|
|
|
||||||
LL | fn i_f2(...) {}
|
LL | fn i_f2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:46:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:47:13
|
||||||
|
|
|
|
||||||
LL | fn i_f2(...) {}
|
LL | fn i_f2(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: `...` must be the last argument of a C-variadic function
|
error: `...` must be the last argument of a C-variadic function
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:49:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
|
||||||
|
|
|
|
||||||
LL | fn i_f3(..., x: isize, ...) {}
|
LL | fn i_f3(..., x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:49:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
|
||||||
|
|
|
|
||||||
LL | fn i_f3(..., x: isize, ...) {}
|
LL | fn i_f3(..., x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:49:28
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:50:28
|
||||||
|
|
|
|
||||||
LL | fn i_f3(..., x: isize, ...) {}
|
LL | fn i_f3(..., x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: `...` must be the last argument of a C-variadic function
|
error: `...` must be the last argument of a C-variadic function
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:53:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:54:13
|
||||||
|
|
|
|
||||||
LL | fn i_f4(..., x: isize, ...) {}
|
LL | fn i_f4(..., x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:53:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:54:13
|
||||||
|
|
|
|
||||||
LL | fn i_f4(..., x: isize, ...) {}
|
LL | fn i_f4(..., x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:53:28
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:54:28
|
||||||
|
|
|
|
||||||
LL | fn i_f4(..., x: isize, ...) {}
|
LL | fn i_f4(..., x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:60:23
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:61:23
|
||||||
|
|
|
|
||||||
LL | fn t_f1(x: isize, ...) {}
|
LL | fn t_f1(x: isize, ...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:62:23
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:63:23
|
||||||
|
|
|
|
||||||
LL | fn t_f2(x: isize, ...);
|
LL | fn t_f2(x: isize, ...);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: C-variadic function must be declared with at least one named argument
|
error: C-variadic function must be declared with at least one named argument
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
|
||||||
|
|
|
|
||||||
LL | fn t_f3(...) {}
|
LL | fn t_f3(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
|
||||||
|
|
|
|
||||||
LL | fn t_f3(...) {}
|
LL | fn t_f3(...) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: C-variadic function must be declared with at least one named argument
|
error: C-variadic function must be declared with at least one named argument
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:68:13
|
||||||
|
|
|
|
||||||
LL | fn t_f4(...);
|
LL | fn t_f4(...);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:68:13
|
||||||
|
|
|
|
||||||
LL | fn t_f4(...);
|
LL | fn t_f4(...);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: `...` must be the last argument of a C-variadic function
|
error: `...` must be the last argument of a C-variadic function
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:70:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:71:13
|
||||||
|
|
|
|
||||||
LL | fn t_f5(..., x: isize) {}
|
LL | fn t_f5(..., x: isize) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:70:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:71:13
|
||||||
|
|
|
|
||||||
LL | fn t_f5(..., x: isize) {}
|
LL | fn t_f5(..., x: isize) {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: `...` must be the last argument of a C-variadic function
|
error: `...` must be the last argument of a C-variadic function
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:73:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:74:13
|
||||||
|
|
|
|
||||||
LL | fn t_f6(..., x: isize);
|
LL | fn t_f6(..., x: isize);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
error: only foreign or `unsafe extern "C" functions may be C-variadic
|
||||||
--> $DIR/variadic-ffi-semantic-restrictions.rs:73:13
|
--> $DIR/variadic-ffi-semantic-restrictions.rs:74:13
|
||||||
|
|
|
|
||||||
LL | fn t_f6(..., x: isize);
|
LL | fn t_f6(..., x: isize);
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
// check-pass
|
// check-pass
|
||||||
// aux-build:test-macros.rs
|
// aux-build:test-macros.rs
|
||||||
|
|
||||||
|
#![allow(anonymous_parameters)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate test_macros;
|
extern crate test_macros;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// aux-build:ident-mac.rs
|
// aux-build:ident-mac.rs
|
||||||
|
|
||||||
#![feature(c_variadic)]
|
#![feature(c_variadic)]
|
||||||
|
#![allow(anonymous_parameters)]
|
||||||
|
|
||||||
extern crate ident_mac;
|
extern crate ident_mac;
|
||||||
use ident_mac::id;
|
use ident_mac::id;
|
||||||
|
|
|
@ -1,173 +1,173 @@
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:10:23
|
--> $DIR/proc-macro-cannot-be-used.rs:11:23
|
||||||
|
|
|
|
||||||
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:10:40
|
--> $DIR/proc-macro-cannot-be-used.rs:11:40
|
||||||
|
|
|
|
||||||
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:14:40
|
--> $DIR/proc-macro-cannot-be-used.rs:15:40
|
||||||
|
|
|
|
||||||
LL | unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
|
LL | unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:17:30
|
--> $DIR/proc-macro-cannot-be-used.rs:18:30
|
||||||
|
|
|
|
||||||
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:17:40
|
--> $DIR/proc-macro-cannot-be-used.rs:18:40
|
||||||
|
|
|
|
||||||
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:21:11
|
--> $DIR/proc-macro-cannot-be-used.rs:22:11
|
||||||
|
|
|
|
||||||
LL | fn free(#[id] arg1: u8) {
|
LL | fn free(#[id] arg1: u8) {
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:23:18
|
--> $DIR/proc-macro-cannot-be-used.rs:24:18
|
||||||
|
|
|
|
||||||
LL | let lam = |#[id] W(x), #[id] y: usize| ();
|
LL | let lam = |#[id] W(x), #[id] y: usize| ();
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:23:30
|
--> $DIR/proc-macro-cannot-be-used.rs:24:30
|
||||||
|
|
|
|
||||||
LL | let lam = |#[id] W(x), #[id] y: usize| ();
|
LL | let lam = |#[id] W(x), #[id] y: usize| ();
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:29:20
|
--> $DIR/proc-macro-cannot-be-used.rs:30:20
|
||||||
|
|
|
|
||||||
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:29:32
|
--> $DIR/proc-macro-cannot-be-used.rs:30:32
|
||||||
|
|
|
|
||||||
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:32:20
|
--> $DIR/proc-macro-cannot-be-used.rs:33:20
|
||||||
|
|
|
|
||||||
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:32:33
|
--> $DIR/proc-macro-cannot-be-used.rs:33:33
|
||||||
|
|
|
|
||||||
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:35:24
|
--> $DIR/proc-macro-cannot-be-used.rs:36:24
|
||||||
|
|
|
|
||||||
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:35:44
|
--> $DIR/proc-macro-cannot-be-used.rs:36:44
|
||||||
|
|
|
|
||||||
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:38:24
|
--> $DIR/proc-macro-cannot-be-used.rs:39:24
|
||||||
|
|
|
|
||||||
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:38:47
|
--> $DIR/proc-macro-cannot-be-used.rs:39:47
|
||||||
|
|
|
|
||||||
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:41:40
|
--> $DIR/proc-macro-cannot-be-used.rs:42:40
|
||||||
|
|
|
|
||||||
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {}
|
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:41:56
|
--> $DIR/proc-macro-cannot-be-used.rs:42:56
|
||||||
|
|
|
|
||||||
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {}
|
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {}
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:47:17
|
--> $DIR/proc-macro-cannot-be-used.rs:48:17
|
||||||
|
|
|
|
||||||
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:47:29
|
--> $DIR/proc-macro-cannot-be-used.rs:48:29
|
||||||
|
|
|
|
||||||
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:50:17
|
--> $DIR/proc-macro-cannot-be-used.rs:51:17
|
||||||
|
|
|
|
||||||
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:50:30
|
--> $DIR/proc-macro-cannot-be-used.rs:51:30
|
||||||
|
|
|
|
||||||
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:53:21
|
--> $DIR/proc-macro-cannot-be-used.rs:54:21
|
||||||
|
|
|
|
||||||
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:53:41
|
--> $DIR/proc-macro-cannot-be-used.rs:54:41
|
||||||
|
|
|
|
||||||
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:56:21
|
--> $DIR/proc-macro-cannot-be-used.rs:57:21
|
||||||
|
|
|
|
||||||
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:56:44
|
--> $DIR/proc-macro-cannot-be-used.rs:57:44
|
||||||
|
|
|
|
||||||
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:56:60
|
--> $DIR/proc-macro-cannot-be-used.rs:57:60
|
||||||
|
|
|
|
||||||
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:60:40
|
--> $DIR/proc-macro-cannot-be-used.rs:61:40
|
||||||
|
|
|
|
||||||
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8);
|
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
||||||
error: expected non-macro attribute, found attribute macro `id`
|
error: expected non-macro attribute, found attribute macro `id`
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:60:56
|
--> $DIR/proc-macro-cannot-be-used.rs:61:56
|
||||||
|
|
|
|
||||||
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8);
|
LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8);
|
||||||
| ^^ not a non-macro attribute
|
| ^^ not a non-macro attribute
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl FromA<u8> for u16 {
|
||||||
}
|
}
|
||||||
|
|
||||||
trait FromA<T> {
|
trait FromA<T> {
|
||||||
fn from(T) -> Self;
|
fn from(t: T) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: A, U: A + FromA<T>> FromA<T> for U {
|
impl<T: A, U: A + FromA<T>> FromA<T> for U {
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub unsafe trait Array {
|
||||||
|
|
||||||
pub trait Index : PartialEq + Copy {
|
pub trait Index : PartialEq + Copy {
|
||||||
fn to_usize(self) -> usize;
|
fn to_usize(self) -> usize;
|
||||||
fn from(usize) -> Self;
|
fn from(i: usize) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Index for usize {
|
impl Index for usize {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue