Keep span of type in builtin derive macros expansions

This commit is contained in:
Esteban Küber
2026-01-18 20:40:29 +00:00
parent 085da0cee4
commit aebf1fdcf9
55 changed files with 356 additions and 272 deletions
@@ -791,7 +791,8 @@ fn create_derived_impl(
.collect();
// Create the type of `self`.
let path = cx.path_all(self.span, false, vec![type_ident], self_params);
let path =
cx.path_all(type_ident.span.with_ctxt(ctxt), false, vec![type_ident], self_params);
let self_type = cx.ty_path(path);
let rustc_const_unstable =
cx.path_ident(self.span, Ident::new(sym::rustc_const_unstable, self.span));
+3 -3
View File
@@ -34,11 +34,11 @@ pub trait Column: Expression {}
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
pub enum ColumnInsertValue<Col, Expr> where
//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
Col: Column,
Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
//~^ ERROR the trait bound `<Col as Expression>::SqlType: IntoNullable` is not satisfied
+37 -10
View File
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:40:1
--> $DIR/issue-38821.rs:37:1
|
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
@@ -82,10 +82,13 @@ LL | impl<T: NotNull> IntoNullable for T {
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
--> $DIR/issue-38821.rs:37:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
| ----- in this derive macro expansion
...
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
@@ -98,7 +101,13 @@ note: required for `ColumnInsertValue<Col, Expr>` to implement `Debug`
--> $DIR/issue-38821.rs:23:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
...
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^
...
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ------------------------------------------------
@@ -127,10 +136,13 @@ LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Co
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:17
--> $DIR/issue-38821.rs:37:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
| ---- in this derive macro expansion
...
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
@@ -143,7 +155,13 @@ note: required for `ColumnInsertValue<Col, Expr>` to implement `Copy`
--> $DIR/issue-38821.rs:23:17
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
...
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^
...
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ------------------------------------------------
@@ -201,10 +219,13 @@ LL | impl<T: NotNull> IntoNullable for T {
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
--> $DIR/issue-38821.rs:37:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
| ----- in this derive macro expansion
...
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
@@ -217,7 +238,13 @@ note: required for `ColumnInsertValue<Col, Expr>` to implement `Clone`
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
...
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^
...
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ------------------------------------------------
@@ -8,10 +8,10 @@
struct CantParam(NotParam);
impl std::marker::ConstParamTy_ for CantParam {}
//~^ error: the trait `ConstParamTy_` cannot be implemented for this type
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
//~^ error: the trait `ConstParamTy_` cannot be implemented for this type
struct CantParamDerive(NotParam);
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
fn main() {}
@@ -8,13 +8,12 @@ LL | impl std::marker::ConstParamTy_ for CantParam {}
| ^^^^^^^^^
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/const_param_ty_impl_bad_field.rs:13:10
--> $DIR/const_param_ty_impl_bad_field.rs:14:8
|
LL | #[derive(std::marker::ConstParamTy, Eq, PartialEq)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
| ------------------------- in this derive macro expansion
LL | struct CantParamDerive(NotParam);
| -------- this field does not implement `ConstParamTy_`
| ^^^^^^^^^^^^^^^ -------- this field does not implement `ConstParamTy_`
error: aborting due to 2 previous errors
@@ -8,13 +8,13 @@ impl std::marker::ConstParamTy_ for ImplementsConstParamTy {}
struct CantParam(ImplementsConstParamTy);
impl std::marker::ConstParamTy_ for CantParam {}
//~^ error: the type `CantParam` does not `#[derive(PartialEq)]`
//~| ERROR the trait bound `CantParam: Eq` is not satisfied
//~^ ERROR: the type `CantParam` does not `#[derive(PartialEq)]`
//~| ERROR: the trait bound `CantParam: Eq` is not satisfied
#[derive(std::marker::ConstParamTy)]
//~^ error: the type `CantParamDerive` does not `#[derive(PartialEq)]`
//~| ERROR the trait bound `CantParamDerive: Eq` is not satisfied
struct CantParamDerive(ImplementsConstParamTy);
//~^ ERROR: the type `CantParamDerive` does not `#[derive(PartialEq)]`
//~| ERROR: the trait bound `CantParamDerive: Eq` is not satisfied
fn check<T: std::marker::ConstParamTy_>() {}
@@ -27,10 +27,12 @@ note: required by a bound in `ConstParamTy_`
--> $SRC_DIR/core/src/marker.rs:LL:COL
error[E0277]: the trait bound `CantParamDerive: Eq` is not satisfied
--> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
--> $DIR/const_param_ty_impl_no_structural_eq.rs:15:8
|
LL | #[derive(std::marker::ConstParamTy)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `CantParamDerive`
| ------------------------- in this derive macro expansion
LL | struct CantParamDerive(ImplementsConstParamTy);
| ^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `CantParamDerive`
|
note: required by a bound in `ConstParamTy_`
--> $SRC_DIR/core/src/marker.rs:LL:COL
@@ -41,13 +43,15 @@ LL | struct CantParamDerive(ImplementsConstParamTy);
|
error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]`
--> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
--> $DIR/const_param_ty_impl_no_structural_eq.rs:15:8
|
LL | #[derive(std::marker::ConstParamTy)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
| ------------------------- in this derive macro expansion
LL | struct CantParamDerive(ImplementsConstParamTy);
| ^^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the nightly-only, unstable trait `StructuralPartialEq` is not implemented for `CantParamDerive`
--> $DIR/const_param_ty_impl_no_structural_eq.rs:17:1
--> $DIR/const_param_ty_impl_no_structural_eq.rs:15:1
|
LL | struct CantParamDerive(ImplementsConstParamTy);
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -4,15 +4,15 @@
use std::marker::ConstParamTy;
#[derive(ConstParamTy)]
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
struct Foo([*const u8; 1]);
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
#[derive(ConstParamTy)]
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
struct Foo2([*mut u8; 1]);
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
#[derive(ConstParamTy)]
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
struct Foo3([fn(); 1]);
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
fn main() {}
@@ -1,44 +1,41 @@
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/nested_bad_const_param_ty.rs:6:10
--> $DIR/nested_bad_const_param_ty.rs:7:8
|
LL | #[derive(ConstParamTy)]
| ^^^^^^^^^^^^
LL |
| ------------ in this derive macro expansion
LL | struct Foo([*const u8; 1]);
| -------------- this field does not implement `ConstParamTy_`
| ^^^ -------------- this field does not implement `ConstParamTy_`
|
note: the `ConstParamTy_` impl for `[*const u8; 1]` requires that `*const u8: ConstParamTy_`
--> $DIR/nested_bad_const_param_ty.rs:8:12
--> $DIR/nested_bad_const_param_ty.rs:7:12
|
LL | struct Foo([*const u8; 1]);
| ^^^^^^^^^^^^^^
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/nested_bad_const_param_ty.rs:10:10
--> $DIR/nested_bad_const_param_ty.rs:11:8
|
LL | #[derive(ConstParamTy)]
| ^^^^^^^^^^^^
LL |
| ------------ in this derive macro expansion
LL | struct Foo2([*mut u8; 1]);
| ------------ this field does not implement `ConstParamTy_`
| ^^^^ ------------ this field does not implement `ConstParamTy_`
|
note: the `ConstParamTy_` impl for `[*mut u8; 1]` requires that `*mut u8: ConstParamTy_`
--> $DIR/nested_bad_const_param_ty.rs:12:13
--> $DIR/nested_bad_const_param_ty.rs:11:13
|
LL | struct Foo2([*mut u8; 1]);
| ^^^^^^^^^^^^
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/nested_bad_const_param_ty.rs:14:10
--> $DIR/nested_bad_const_param_ty.rs:15:8
|
LL | #[derive(ConstParamTy)]
| ^^^^^^^^^^^^
LL |
| ------------ in this derive macro expansion
LL | struct Foo3([fn(); 1]);
| --------- this field does not implement `ConstParamTy_`
| ^^^^ --------- this field does not implement `ConstParamTy_`
|
note: the `ConstParamTy_` impl for `[fn(); 1]` requires that `fn(): ConstParamTy_`
--> $DIR/nested_bad_const_param_ty.rs:16:13
--> $DIR/nested_bad_const_param_ty.rs:15:13
|
LL | struct Foo3([fn(); 1]);
| ^^^^^^^^^
@@ -6,18 +6,18 @@
use std::marker::ConstParamTy;
#[derive(ConstParamTy, Eq, PartialEq)]
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
struct A([u8]);
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
#[derive(ConstParamTy, Eq, PartialEq)]
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
struct B(&'static [u8]);
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
#[derive(ConstParamTy, Eq, PartialEq)]
struct C(unsized_const_param::Foo);
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
fn main() {}
@@ -1,44 +1,41 @@
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/unsized_field-1.rs:8:10
--> $DIR/unsized_field-1.rs:9:8
|
LL | #[derive(ConstParamTy, Eq, PartialEq)]
| ^^^^^^^^^^^^
LL |
| ------------ in this derive macro expansion
LL | struct A([u8]);
| ---- this field does not implement `ConstParamTy_`
| ^ ---- this field does not implement `ConstParamTy_`
|
note: the `ConstParamTy_` impl for `[u8]` requires that `feature(unsized_const_params) is enabled`
--> $DIR/unsized_field-1.rs:10:10
--> $DIR/unsized_field-1.rs:9:10
|
LL | struct A([u8]);
| ^^^^
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/unsized_field-1.rs:12:10
--> $DIR/unsized_field-1.rs:13:8
|
LL | #[derive(ConstParamTy, Eq, PartialEq)]
| ^^^^^^^^^^^^
LL |
| ------------ in this derive macro expansion
LL | struct B(&'static [u8]);
| ------------- this field does not implement `ConstParamTy_`
| ^ ------------- this field does not implement `ConstParamTy_`
|
note: the `ConstParamTy_` impl for `&'static [u8]` requires that `feature(unsized_const_params) is enabled`
--> $DIR/unsized_field-1.rs:14:10
--> $DIR/unsized_field-1.rs:13:10
|
LL | struct B(&'static [u8]);
| ^^^^^^^^^^^^^
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/unsized_field-1.rs:19:10
--> $DIR/unsized_field-1.rs:20:8
|
LL | #[derive(std::marker::ConstParamTy, Eq, PartialEq)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
| ------------------------- in this derive macro expansion
LL | struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
| ---------------------------------------------------------- this field does not implement `ConstParamTy_`
| ^ ---------------------------------------------------------- this field does not implement `ConstParamTy_`
|
note: the `ConstParamTy_` impl for `GenericNotUnsizedParam<&'static [u8]>` requires that `feature(unsized_const_params) is enabled`
--> $DIR/unsized_field-1.rs:21:10
--> $DIR/unsized_field-1.rs:20:10
|
LL | struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -6,8 +6,8 @@
use std::marker::ConstParamTy;
#[derive(Debug, PartialEq, Eq, ConstParamTy)]
//~^ ERROR the trait `ConstParamTy_`
struct Foo {
//~^ ERROR the trait `ConstParamTy_`
nested: &'static Bar<dyn std::fmt::Debug>,
//~^ ERROR the size for values
//~| ERROR the size for values
@@ -19,11 +19,13 @@ LL | struct Bar<T>(T);
| this could be changed to `T: ?Sized`...
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
--> $DIR/unsizing-wfcheck-issue-126272.rs:8:32
--> $DIR/unsizing-wfcheck-issue-126272.rs:9:8
|
LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)]
| ^^^^^^^^^^^^
...
| ------------ in this derive macro expansion
LL | struct Foo {
| ^^^
LL |
LL | nested: &'static Bar<dyn std::fmt::Debug>,
| ----------------------------------------- this field does not implement `ConstParamTy_`
|
@@ -62,9 +64,12 @@ note: required for `Bar<(dyn Debug + 'static)>` to implement `Debug`
--> $DIR/unsizing-wfcheck-issue-126272.rs:19:10
|
LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct Bar<T>(T);
| -
| ^^^ -
= help: consider manually implementing `Debug` to avoid undesired bounds
= note: 2 redundant requirements hidden
= note: required for `&&'static Bar<(dyn Debug + 'static)>` to implement `Debug`
@@ -97,9 +102,12 @@ note: required for `Bar<dyn Debug>` to implement `Eq`
--> $DIR/unsizing-wfcheck-issue-126272.rs:19:28
|
LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)]
| ^^ unsatisfied trait bound introduced in this `derive` macro
| ^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct Bar<T>(T);
| - would need to be `Eq`
| ^^^ - would need to be `Eq`
= help: consider manually implementing `Eq` to avoid undesired bounds
= note: 1 redundant requirement hidden
= note: required for `&'static Bar<dyn Debug>` to implement `Eq`
@@ -8,9 +8,12 @@ note: required for `Foo<String>` to implement `Copy`
--> $DIR/trait-error.rs:1:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct Foo<T>(T);
| - would need to be `Copy`
| ^^^ - would need to be `Copy`
= help: consider manually implementing `Copy` to avoid undesired bounds
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: create an inline `const` block
@@ -1,14 +1,14 @@
//! Regression test for issue #20126: Copy and Drop traits are mutually exclusive
#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented
struct Foo;
#[derive(Copy, Clone)]
struct Foo; //~ ERROR the trait `Copy` cannot be implemented
impl Drop for Foo {
fn drop(&mut self) {}
}
#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented
struct Bar<T>(::std::marker::PhantomData<T>);
#[derive(Copy, Clone)]
struct Bar<T>(::std::marker::PhantomData<T>); //~ ERROR the trait `Copy` cannot be implemented
impl<T> Drop for Bar<T> {
fn drop(&mut self) {}
@@ -1,14 +1,18 @@
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/copy-drop-mutually-exclusive.rs:3:10
--> $DIR/copy-drop-mutually-exclusive.rs:4:8
|
LL | #[derive(Copy, Clone)]
| ^^^^ `Copy` not allowed on types with destructors
| ---- in this derive macro expansion
LL | struct Foo;
| ^^^ `Copy` not allowed on types with destructors
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/copy-drop-mutually-exclusive.rs:10:10
--> $DIR/copy-drop-mutually-exclusive.rs:11:8
|
LL | #[derive(Copy, Clone)]
| ^^^^ `Copy` not allowed on types with destructors
| ---- in this derive macro expansion
LL | struct Bar<T>(::std::marker::PhantomData<T>);
| ^^^ `Copy` not allowed on types with destructors
error: aborting due to 2 previous errors
+15 -6
View File
@@ -10,9 +10,12 @@ note: required for `B<C>` to implement `Copy`
--> $DIR/deriving-copyclone.rs:9:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct B<T> {
| - would need to be `Copy`
| ^ - would need to be `Copy`
= help: consider manually implementing `Copy` to avoid undesired bounds
note: required by a bound in `is_copy`
--> $DIR/deriving-copyclone.rs:18:15
@@ -36,9 +39,12 @@ note: required for `B<C>` to implement `Clone`
--> $DIR/deriving-copyclone.rs:9:16
|
LL | #[derive(Copy, Clone)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct B<T> {
| - would need to be `Clone`
| ^ - would need to be `Clone`
= help: consider manually implementing `Clone` to avoid undesired bounds
note: required by a bound in `is_clone`
--> $DIR/deriving-copyclone.rs:19:16
@@ -62,9 +68,12 @@ note: required for `B<D>` to implement `Copy`
--> $DIR/deriving-copyclone.rs:9:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct B<T> {
| - would need to be `Copy`
| ^ - would need to be `Copy`
= help: consider manually implementing `Copy` to avoid undesired bounds
note: required by a bound in `is_copy`
--> $DIR/deriving-copyclone.rs:18:15
+4 -5
View File
@@ -2,12 +2,11 @@ error[E0109]: type arguments are not allowed on type parameter `Irrelevant`
--> $DIR/issue-97343.rs:4:23
|
LL | #[derive(Debug)]
| -----
| |
| not allowed on type parameter `Irrelevant`
| in this derive macro expansion
| ----- in this derive macro expansion
LL | pub struct Irrelevant<Irrelevant> {
| ^^^^^^^^^^ type argument not allowed
| ---------- ^^^^^^^^^^ type argument not allowed
| |
| not allowed on type parameter `Irrelevant`
|
note: type parameter `Irrelevant` defined here
--> $DIR/issue-97343.rs:4:23
@@ -3,12 +3,12 @@
struct NonGeneric {}
#[derive(Default)]
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^^ ERROR struct takes 0 generic arguments but 1 generic argument was supplied
//~^^^^ ERROR struct takes 0 generic arguments but 1 generic argument was supplied
//~^ ERROR: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR: struct takes 0 generic arguments but 1 generic argument was supplied
struct NonGeneric<'a, const N: usize> {}
//~^ ERROR lifetime parameter `'a` is never used
//~^^ ERROR the name `NonGeneric` is defined multiple times
//~^ ERROR: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR: struct takes 0 generic arguments but 1 generic argument was supplied
//~| ERROR: lifetime parameter `'a` is never used
//~| ERROR: the name `NonGeneric` is defined multiple times
pub fn main() {}
@@ -1,5 +1,5 @@
error[E0428]: the name `NonGeneric` is defined multiple times
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:10:1
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:8:1
|
LL | struct NonGeneric {}
| ----------------- previous definition of the type `NonGeneric` here
@@ -37,7 +37,7 @@ LL | struct NonGeneric {}
| ^^^^^^^^^^
error[E0392]: lifetime parameter `'a` is never used
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:10:19
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:8:19
|
LL | struct NonGeneric<'a, const N: usize> {}
| ^^ unused lifetime parameter
@@ -45,29 +45,26 @@ LL | struct NonGeneric<'a, const N: usize> {}
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:5:10
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:8:8
|
LL | #[derive(Default)]
| ^^^^^^^ expected 0 lifetime arguments
...
LL | struct NonGeneric<'a, const N: usize> {}
| -- help: remove the lifetime argument
| ^^^^^^^^^^ -- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
|
note: struct defined here, with 0 lifetime parameters
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8
|
LL | struct NonGeneric {}
| ^^^^^^^^^^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:5:10
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:8:8
|
LL | #[derive(Default)]
| ^^^^^^^ expected 0 generic arguments
...
LL | struct NonGeneric<'a, const N: usize> {}
| - help: remove the unnecessary generic argument
| ^^^^^^^^^^ - help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8
@@ -8,12 +8,12 @@
struct NotSM;
#[derive(PartialEq, Eq)]
//~^ ERROR struct takes 0 generic arguments
//~| ERROR struct takes 0 generic arguments
//~| ERROR struct takes 0 generic arguments
//~| ERROR struct takes 0 generic arguments
//~^ ERROR: struct takes 0 generic arguments
struct NotSM<T>(T);
//~^ ERROR the name `NotSM` is defined multiple times
//~| ERROR no field `0`
//~^ ERROR: struct takes 0 generic arguments
//~| ERROR: struct takes 0 generic arguments
//~| ERROR: struct takes 0 generic arguments
//~| ERROR: the name `NotSM` is defined multiple times
//~| ERROR: no field `0`
fn main() {}
@@ -1,5 +1,5 @@
error[E0428]: the name `NotSM` is defined multiple times
--> $DIR/multiple-types-with-same-name-and-derive.rs:15:1
--> $DIR/multiple-types-with-same-name-and-derive.rs:12:1
|
LL | struct NotSM;
| ------------- previous definition of the type `NotSM` here
@@ -10,10 +10,10 @@ LL | struct NotSM<T>(T);
= note: `NotSM` must be defined only once in the type namespace of this module
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive.rs:10:10
--> $DIR/multiple-types-with-same-name-and-derive.rs:12:8
|
LL | #[derive(PartialEq, Eq)]
| ^^^^^^^^^ expected 0 generic arguments
LL | struct NotSM<T>(T);
| ^^^^^ expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive.rs:8:8
@@ -30,27 +30,27 @@ LL | #[derive(PartialEq, Eq)]
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive.rs:8:8
|
LL | struct NotSM;
| ^^^^^
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive.rs:12:8
|
LL | struct NotSM<T>(T);
| ^^^^^ expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive.rs:8:8
|
LL | struct NotSM;
| ^^^^^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive.rs:10:21
--> $DIR/multiple-types-with-same-name-and-derive.rs:12:8
|
LL | #[derive(PartialEq, Eq)]
| ^^ expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive.rs:8:8
|
LL | struct NotSM;
| ^^^^^
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/multiple-types-with-same-name-and-derive.rs:10:10
|
LL | #[derive(PartialEq, Eq)]
| ^^^^^^^^^ expected 0 generic arguments
LL | struct NotSM<T>(T);
| ^^^^^ expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> $DIR/multiple-types-with-same-name-and-derive.rs:8:8
@@ -60,7 +60,7 @@ LL | struct NotSM;
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0609]: no field `0` on type `&NotSM`
--> $DIR/multiple-types-with-same-name-and-derive.rs:15:17
--> $DIR/multiple-types-with-same-name-and-derive.rs:12:17
|
LL | struct NotSM<T>(T);
| ^ unknown field
+2 -2
View File
@@ -1,5 +1,5 @@
#[derive(Copy)] //~ ERROR E0184
struct Foo;
#[derive(Copy)]
struct Foo; //~ ERROR E0184
impl Drop for Foo {
fn drop(&mut self) {
+4 -2
View File
@@ -1,8 +1,10 @@
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/E0184.rs:1:10
--> $DIR/E0184.rs:2:8
|
LL | #[derive(Copy)]
| ^^^^ `Copy` not allowed on types with destructors
| ---- in this derive macro expansion
LL | struct Foo;
| ^^^ `Copy` not allowed on types with destructors
error: aborting due to 1 previous error
@@ -32,9 +32,12 @@ note: required for `Fooy<T>` to implement `Copy`
--> $DIR/impl_bounds.rs:10:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct Fooy<T>(T);
| - would need to be `Copy`
| ^^^^ - would need to be `Copy`
= help: consider manually implementing `Copy` to avoid undesired bounds
note: the requirement `Fooy<T>: Copy` appears on the `impl`'s associated type `C` but not on the corresponding trait's associated type
--> $DIR/impl_bounds.rs:6:10
@@ -59,9 +62,12 @@ note: required for `Fooy<T>` to implement `Copy`
--> $DIR/impl_bounds.rs:10:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | struct Fooy<T>(T);
| - would need to be `Copy`
| ^^^^ - would need to be `Copy`
= help: consider manually implementing `Copy` to avoid undesired bounds
note: the requirement `Fooy<T>: Copy` appears on the `impl`'s associated function `d` but not on the corresponding trait's associated function
--> $DIR/impl_bounds.rs:7:8
+2 -2
View File
@@ -1,7 +1,7 @@
struct Foo;
#[derive(Copy, Clone)]
//~^ ERROR the trait `Copy` cannot be implemented for this type
struct Bar(Foo);
//~^ ERROR `Foo: Clone` is not satisfied
//~^ ERROR: the trait `Copy` cannot be implemented for this type
//~| ERROR: `Foo: Clone` is not satisfied
fn main() {}
+4 -6
View File
@@ -1,18 +1,16 @@
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/issue-27340.rs:2:10
--> $DIR/issue-27340.rs:3:8
|
LL | #[derive(Copy, Clone)]
| ^^^^
LL |
| ---- in this derive macro expansion
LL | struct Bar(Foo);
| --- this field does not implement `Copy`
| ^^^ --- this field does not implement `Copy`
error[E0277]: the trait bound `Foo: Clone` is not satisfied
--> $DIR/issue-27340.rs:4:12
--> $DIR/issue-27340.rs:3:12
|
LL | #[derive(Copy, Clone)]
| ----- in this derive macro expansion
LL |
LL | struct Bar(Foo);
| ^^^ the trait `Clone` is not implemented for `Foo`
|
+5 -5
View File
@@ -1,14 +1,14 @@
#[derive(Copy(Bad))]
//~^ ERROR traits in `#[derive(...)]` don't accept arguments
//~| ERROR the trait bound
//~^ ERROR: traits in `#[derive(...)]` don't accept arguments
struct Test1;
//~^ ERROR: the trait bound
#[derive(Copy="bad")]
//~^ ERROR traits in `#[derive(...)]` don't accept values
//~| ERROR the trait bound
//~^ ERROR: traits in `#[derive(...)]` don't accept values
struct Test2;
//~^ ERROR: the trait bound
#[derive] //~ ERROR malformed `derive` attribute input
#[derive] //~ ERROR: malformed `derive` attribute input
struct Test4;
fn main() {}
@@ -17,10 +17,13 @@ LL | #[derive]
| ^^^^^^^^^ help: must be of the form: `#[derive(Trait1, Trait2, ...)]`
error[E0277]: the trait bound `Test1: Clone` is not satisfied
--> $DIR/malformed-derive-entry.rs:1:10
--> $DIR/malformed-derive-entry.rs:3:8
|
LL | #[derive(Copy(Bad))]
| ^^^^ the trait `Clone` is not implemented for `Test1`
| ---- in this derive macro expansion
LL |
LL | struct Test1;
| ^^^^^ the trait `Clone` is not implemented for `Test1`
|
note: required by a bound in `Copy`
--> $SRC_DIR/core/src/marker.rs:LL:COL
@@ -31,10 +34,13 @@ LL | struct Test1;
|
error[E0277]: the trait bound `Test2: Clone` is not satisfied
--> $DIR/malformed-derive-entry.rs:6:10
--> $DIR/malformed-derive-entry.rs:8:8
|
LL | #[derive(Copy="bad")]
| ^^^^ the trait `Clone` is not implemented for `Test2`
| ---- in this derive macro expansion
LL |
LL | struct Test2;
| ^^^^^ the trait `Clone` is not implemented for `Test2`
|
note: required by a bound in `Copy`
--> $SRC_DIR/core/src/marker.rs:LL:COL
@@ -12,12 +12,11 @@ struct PriorityQueueEntry<T> {
}
#[derive(PartialOrd, AddImpl)]
//~^ ERROR can't compare `PriorityQueue<T>` with `PriorityQueue<T>`
//~| ERROR the trait bound `PriorityQueue<T>: Eq` is not satisfied
//~| ERROR can't compare `T` with `T`
//~| ERROR no method named `cmp` found for struct `BinaryHeap<PriorityQueueEntry<T>>`
//~| ERROR no field `height` on type `&PriorityQueue<T>`
//~^ ERROR: the trait bound `PriorityQueue<T>: Eq` is not satisfied
//~| ERROR: can't compare `T` with `T`
//~| ERROR: no method named `cmp` found for struct `BinaryHeap<PriorityQueueEntry<T>>`
//~| ERROR: no field `height` on type `&PriorityQueue<T>`
struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
//~^ ERROR can't compare `BinaryHeap<PriorityQueueEntry<T>>` with `_`
//~^ ERROR: can't compare `PriorityQueue<T>` with `PriorityQueue<T>`
//~| ERROR: can't compare `BinaryHeap<PriorityQueueEntry<T>>` with `_`
fn main() {}
@@ -1,11 +1,14 @@
error[E0277]: can't compare `PriorityQueue<T>` with `PriorityQueue<T>`
--> $DIR/issue-104884-trait-impl-sugg-err.rs:14:10
--> $DIR/issue-104884-trait-impl-sugg-err.rs:19:8
|
LL | #[derive(PartialOrd, AddImpl)]
| ^^^^^^^^^^ no implementation for `PriorityQueue<T> == PriorityQueue<T>`
| ---------- in this derive macro expansion
...
LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
| ^^^^^^^^^^^^^ no implementation for `PriorityQueue<T> == PriorityQueue<T>`
|
help: the trait `PartialEq` is not implemented for `PriorityQueue<T>`
--> $DIR/issue-104884-trait-impl-sugg-err.rs:21:1
--> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1
|
LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -19,7 +22,7 @@ LL | #[derive(PartialOrd, AddImpl)]
| ^^^^^^^ unsatisfied trait bound
|
help: the trait `Eq` is not implemented for `PriorityQueue<T>`
--> $DIR/issue-104884-trait-impl-sugg-err.rs:21:1
--> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1
|
LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -37,16 +40,19 @@ note: required for `PriorityQueue<T>` to implement `PartialOrd`
--> $DIR/issue-104884-trait-impl-sugg-err.rs:14:10
|
LL | #[derive(PartialOrd, AddImpl)]
| ^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
...
LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
| - would need to be `PartialOrd`
| ^^^^^^^^^^^^^ - would need to be `PartialOrd`
= help: consider manually implementing `PartialOrd` to avoid undesired bounds
note: required by a bound in `Ord`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error[E0277]: can't compare `BinaryHeap<PriorityQueueEntry<T>>` with `_`
--> $DIR/issue-104884-trait-impl-sugg-err.rs:21:25
--> $DIR/issue-104884-trait-impl-sugg-err.rs:19:25
|
LL | #[derive(PartialOrd, AddImpl)]
| ---------- in this derive macro expansion
+2 -2
View File
@@ -1,6 +1,6 @@
use std::ops::*;
#[derive(Copy, Clone)] //~ ERROR Copy
struct R(Range<usize>);
#[derive(Copy, Clone)]
struct R(Range<usize>); //~ ERROR Copy
fn main() {}
+3 -3
View File
@@ -1,10 +1,10 @@
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/range_traits-2.rs:3:10
--> $DIR/range_traits-2.rs:4:8
|
LL | #[derive(Copy, Clone)]
| ^^^^
| ---- in this derive macro expansion
LL | struct R(Range<usize>);
| ------------ this field does not implement `Copy`
| ^ ------------ this field does not implement `Copy`
error: aborting due to 1 previous error
+2 -2
View File
@@ -1,6 +1,6 @@
use std::ops::*;
#[derive(Copy, Clone)] //~ ERROR Copy
struct R(RangeFrom<usize>);
#[derive(Copy, Clone)]
struct R(RangeFrom<usize>); //~ ERROR Copy
fn main() {}
+3 -3
View File
@@ -1,10 +1,10 @@
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/range_traits-3.rs:3:10
--> $DIR/range_traits-3.rs:4:8
|
LL | #[derive(Copy, Clone)]
| ^^^^
| ---- in this derive macro expansion
LL | struct R(RangeFrom<usize>);
| ---------------- this field does not implement `Copy`
| ^ ---------------- this field does not implement `Copy`
error: aborting due to 1 previous error
+2 -2
View File
@@ -1,6 +1,6 @@
use std::ops::*;
#[derive(Copy, Clone)] //~ ERROR Copy
struct R(RangeInclusive<usize>);
#[derive(Copy, Clone)]
struct R(RangeInclusive<usize>); //~ ERROR Copy
fn main() {}
+3 -3
View File
@@ -1,10 +1,10 @@
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/range_traits-6.rs:3:10
--> $DIR/range_traits-6.rs:4:8
|
LL | #[derive(Copy, Clone)]
| ^^^^
| ---- in this derive macro expansion
LL | struct R(RangeInclusive<usize>);
| --------------------- this field does not implement `Copy`
| ^ --------------------- this field does not implement `Copy`
error: aborting due to 1 previous error
+4 -4
View File
@@ -4,8 +4,8 @@ struct Foo {
impl Copy for Foo { } //~ ERROR cannot be implemented for this type
#[derive(Copy)] //~ ERROR cannot be implemented for this type
struct Foo2<'a> {
#[derive(Copy)]
struct Foo2<'a> { //~ ERROR cannot be implemented for this type
ty: &'a mut bool,
}
@@ -16,8 +16,8 @@ enum EFoo {
impl Copy for EFoo { } //~ ERROR cannot be implemented for this type
#[derive(Copy)] //~ ERROR cannot be implemented for this type
enum EFoo2<'a> {
#[derive(Copy)]
enum EFoo2<'a> { //~ ERROR cannot be implemented for this type
Bar(&'a mut bool),
Baz,
}
+6 -4
View File
@@ -8,11 +8,12 @@ LL | impl Copy for Foo { }
| ^^^
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/E0204.rs:7:10
--> $DIR/E0204.rs:8:8
|
LL | #[derive(Copy)]
| ^^^^
| ---- in this derive macro expansion
LL | struct Foo2<'a> {
| ^^^^
LL | ty: &'a mut bool,
| ---------------- this field does not implement `Copy`
@@ -26,11 +27,12 @@ LL | impl Copy for EFoo { }
| ^^^^
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/E0204.rs:19:10
--> $DIR/E0204.rs:20:6
|
LL | #[derive(Copy)]
| ^^^^
| ---- in this derive macro expansion
LL | enum EFoo2<'a> {
| ^^^^^
LL | Bar(&'a mut bool),
| ------------ this field does not implement `Copy`
@@ -1,8 +1,8 @@
//@ run-rustfix
// https://github.com/rust-lang/rust/issues/79076
#[derive(Clone, Eq)] //~ ERROR [E0277]
pub struct Struct<T: std::clone::Clone>(T);
#[derive(Clone, Eq)]
pub struct Struct<T: std::clone::Clone>(T); //~ ERROR [E0277]
impl<T: Clone, U> PartialEq<U> for Struct<T>
where
+2 -2
View File
@@ -1,8 +1,8 @@
//@ run-rustfix
// https://github.com/rust-lang/rust/issues/79076
#[derive(Clone, Eq)] //~ ERROR [E0277]
pub struct Struct<T>(T);
#[derive(Clone, Eq)]
pub struct Struct<T>(T); //~ ERROR [E0277]
impl<T: Clone, U> PartialEq<U> for Struct<T>
where
@@ -1,8 +1,10 @@
error[E0277]: the trait bound `T: Clone` is not satisfied
--> $DIR/derive-clone-for-eq.rs:4:17
--> $DIR/derive-clone-for-eq.rs:5:12
|
LL | #[derive(Clone, Eq)]
| ^^ the trait `Clone` is not implemented for `T`
| -- in this derive macro expansion
LL | pub struct Struct<T>(T);
| ^^^^^^ the trait `Clone` is not implemented for `T`
|
note: required for `Struct<T>` to implement `PartialEq`
--> $DIR/derive-clone-for-eq.rs:7:19
@@ -27,9 +27,12 @@ note: required for `Vector2<K>` to implement `Debug`
--> $DIR/missing-bound-in-derive-copy-impl-2.rs:4:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ----
| ^^^^^^^ ----
= help: consider manually implementing `Debug` to avoid undesired bounds
= note: required for the cast from `&Vector2<K>` to `&dyn Debug`
help: consider further restricting type parameter `K` with trait `Copy`
@@ -69,9 +72,12 @@ note: required for `Vector2<K>` to implement `Clone`
--> $DIR/missing-bound-in-derive-copy-impl-2.rs:4:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ----
| ^^^^^^^ ----
= help: consider manually implementing `Clone` to avoid undesired bounds
help: consider further restricting type parameter `K` with trait `Copy`
|
@@ -7,8 +7,8 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}
#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K: Copy + Debug + std::fmt::Debug>{
#[derive(Debug, Copy, Clone)]
pub struct AABB<K: Copy + Debug + std::fmt::Debug> { //~ ERROR the trait `Copy` cannot be implemented for this type
pub loc: Vector2<K>, //~ ERROR `K` doesn't implement `Debug`
//~^ ERROR `K` doesn't implement `Debug`
pub size: Vector2<K> //~ ERROR `K` doesn't implement `Debug`
@@ -7,8 +7,8 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}
#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K: Copy>{
#[derive(Debug, Copy, Clone)]
pub struct AABB<K: Copy> { //~ ERROR the trait `Copy` cannot be implemented for this type
pub loc: Vector2<K>, //~ ERROR `K` doesn't implement `Debug`
//~^ ERROR `K` doesn't implement `Debug`
pub size: Vector2<K> //~ ERROR `K` doesn't implement `Debug`
@@ -1,9 +1,10 @@
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-derive-copy-impl-3.rs:10:17
--> $DIR/missing-bound-in-derive-copy-impl-3.rs:11:12
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^
LL | pub struct AABB<K: Copy>{
| ---- in this derive macro expansion
LL | pub struct AABB<K: Copy> {
| ^^^^
LL | pub loc: Vector2<K>,
| ------------------- this field does not implement `Copy`
|
@@ -14,7 +15,7 @@ LL | pub loc: Vector2<K>,
| ^^^^^^^^^^
help: consider further restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: Copy + Debug>{
LL | pub struct AABB<K: Copy + Debug> {
| +++++++
error[E0277]: `K` doesn't implement `Debug`
@@ -30,7 +31,7 @@ LL | pub struct Vector2<T: Debug + Copy + Clone>{
| ^^^^^ required by this bound in `Vector2`
help: consider further restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
LL | pub struct AABB<K: Copy + std::fmt::Debug> {
| +++++++++++++++++
error[E0277]: `K` doesn't implement `Debug`
@@ -38,13 +39,13 @@ error[E0277]: `K` doesn't implement `Debug`
|
LL | #[derive(Debug, Copy, Clone)]
| ----- in this derive macro expansion
LL | pub struct AABB<K: Copy>{
LL | pub struct AABB<K: Copy> {
LL | pub loc: Vector2<K>,
| ^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `K`
|
help: consider further restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
LL | pub struct AABB<K: Copy + std::fmt::Debug> {
| +++++++++++++++++
error[E0277]: `K` doesn't implement `Debug`
@@ -58,7 +59,7 @@ LL | pub size: Vector2<K>
|
help: consider further restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
LL | pub struct AABB<K: Copy + std::fmt::Debug> {
| +++++++++++++++++
error: aborting due to 4 previous errors
@@ -6,8 +6,8 @@ pub struct Vector2<T: Debug + Copy + Clone> {
pub y: T,
}
#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K> {
#[derive(Debug, Copy, Clone)]
pub struct AABB<K> { //~ ERROR the trait `Copy` cannot be implemented for this type
pub loc: Vector2<K>,
//~^ ERROR doesn't implement `Debug`
//~| ERROR `K: Copy` is not satisfied
@@ -1,9 +1,10 @@
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-derive-copy-impl.rs:9:17
--> $DIR/missing-bound-in-derive-copy-impl.rs:10:12
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^
| ---- in this derive macro expansion
LL | pub struct AABB<K> {
| ^^^^
LL | pub loc: Vector2<K>,
| ------------------- this field does not implement `Copy`
|
@@ -62,9 +63,12 @@ note: required for `Vector2<K>` to implement `Debug`
--> $DIR/missing-bound-in-derive-copy-impl.rs:3:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ----
| ^^^^^^^ ----
= help: consider manually implementing `Debug` to avoid undesired bounds
= note: required for the cast from `&Vector2<K>` to `&dyn Debug`
help: consider restricting type parameter `K` with trait `Copy`
@@ -132,9 +136,12 @@ note: required for `Vector2<K>` to implement `Clone`
--> $DIR/missing-bound-in-derive-copy-impl.rs:3:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ----
| ^^^^^^^ ----
= help: consider manually implementing `Clone` to avoid undesired bounds
help: consider restricting type parameter `K` with trait `Copy`
|
+5 -2
View File
@@ -11,9 +11,12 @@ note: required for `Id<SomeNode>` to implement `PartialEq`
--> $DIR/derive-implicit-bound.rs:5:10
|
LL | #[derive(PartialEq, Eq)]
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
| ^^^^^^^^^
| |
| unsatisfied trait bound introduced in this `derive` macro
| in this derive macro expansion
LL | pub struct Id<T>(PhantomData<T>);
| - would need to be `PartialEq`
| ^^ - would need to be `PartialEq`
= help: consider manually implementing `PartialEq` to avoid undesired bounds
note: required by a bound in `accept_eq`
--> $DIR/derive-implicit-bound.rs:17:23
+3 -5
View File
@@ -1,6 +1,4 @@
#[derive(Clone)]
//~^ ERROR expected a type, found a trait
//~| ERROR expected a type, found a trait
struct Foo;
trait Foo {} //~ ERROR the name `Foo` is defined multiple times
#[derive(Clone)] //~ ERROR: expected a type, found a trait
struct Foo; //~ ERROR: expected a type, found a trait
trait Foo {} //~ ERROR: the name `Foo` is defined multiple times
fn main() {}
+10 -5
View File
@@ -1,5 +1,5 @@
error[E0428]: the name `Foo` is defined multiple times
--> $DIR/issue-106072.rs:5:1
--> $DIR/issue-106072.rs:3:1
|
LL | struct Foo;
| ----------- previous definition of the type `Foo` here
@@ -9,18 +9,23 @@ LL | trait Foo {}
= note: `Foo` must be defined only once in the type namespace of this module
error[E0782]: expected a type, found a trait
--> $DIR/issue-106072.rs:1:10
--> $DIR/issue-106072.rs:2:8
|
LL | #[derive(Clone)]
| ^^^^^
| ----- in this derive macro expansion
LL | struct Foo;
| ^^^
|
help: you can add the `dyn` keyword if you want a trait object
|
LL | struct dyn Foo;
| +++
error[E0782]: expected a type, found a trait
--> $DIR/issue-106072.rs:1:10
|
LL | #[derive(Clone)]
| ^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
+5 -6
View File
@@ -1,18 +1,17 @@
#[derive(Clone, Copy)]
//~^ ERROR the trait `Copy` cannot be implemented for this type
struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
//~^ ERROR cannot find type `NotDefined` in this scope
//~^ ERROR the trait `Copy` cannot be implemented for this type
//~| ERROR cannot find type `NotDefined` in this scope
//~| ERROR cannot find type `NotDefined` in this scope
//~| ERROR cannot find type `N` in this scope
//~| ERROR cannot find type `N` in this scope
//~| ERROR `i32` is not an iterator
//~| ERROR `i32` is not an iterator
#[derive(Clone, Copy)]
//~^ ERROR the trait `Copy` cannot be implemented for this type
//~| ERROR `i32` is not an iterator
#[derive(Clone, Copy)] //~ ERROR `i32` is not an iterator
struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
//~^ ERROR cannot find type `NotDefined` in this scope
//~^ ERROR the trait `Copy` cannot be implemented for this type
//~| ERROR cannot find type `NotDefined` in this scope
//~| ERROR cannot find type `N` in this scope
//~| ERROR `i32` is not an iterator
//~| ERROR `i32` is not an iterator
+16 -19
View File
@@ -1,5 +1,5 @@
error[E0425]: cannot find type `N` in this scope
--> $DIR/issue-50480.rs:3:12
--> $DIR/issue-50480.rs:2:12
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^ not found in this scope
@@ -10,13 +10,13 @@ LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| +++
error[E0425]: cannot find type `NotDefined` in this scope
--> $DIR/issue-50480.rs:3:15
--> $DIR/issue-50480.rs:2:15
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^^^^^^^^ not found in this scope
error[E0425]: cannot find type `N` in this scope
--> $DIR/issue-50480.rs:3:12
--> $DIR/issue-50480.rs:2:12
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^ not found in this scope
@@ -27,7 +27,7 @@ LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| +++
error[E0425]: cannot find type `NotDefined` in this scope
--> $DIR/issue-50480.rs:3:15
--> $DIR/issue-50480.rs:2:15
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^^^^^^^^ not found in this scope
@@ -38,7 +38,7 @@ LL | struct Foo<NotDefined>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, St
| ++++++++++++
error[E0425]: cannot find type `N` in this scope
--> $DIR/issue-50480.rs:14:18
--> $DIR/issue-50480.rs:12:18
|
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| - ^
@@ -56,13 +56,13 @@ LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, Strin
| +++
error[E0425]: cannot find type `NotDefined` in this scope
--> $DIR/issue-50480.rs:14:21
--> $DIR/issue-50480.rs:12:21
|
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^^^^^^^^ not found in this scope
error[E0277]: `i32` is not an iterator
--> $DIR/issue-50480.rs:3:27
--> $DIR/issue-50480.rs:2:27
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
@@ -70,29 +70,27 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
= help: the trait `Iterator` is not implemented for `i32`
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/issue-50480.rs:1:17
--> $DIR/issue-50480.rs:2:8
|
LL | #[derive(Clone, Copy)]
| ^^^^
LL |
| ---- in this derive macro expansion
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| -------- ------ this field does not implement `Copy`
| ^^^ -------- ------ this field does not implement `Copy`
| |
| this field does not implement `Copy`
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/issue-50480.rs:11:17
--> $DIR/issue-50480.rs:12:8
|
LL | #[derive(Clone, Copy)]
| ^^^^
...
| ---- in this derive macro expansion
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| -------- ------ this field does not implement `Copy`
| ^^^ -------- ------ this field does not implement `Copy`
| |
| this field does not implement `Copy`
error[E0277]: `i32` is not an iterator
--> $DIR/issue-50480.rs:14:33
--> $DIR/issue-50480.rs:12:33
|
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
@@ -100,7 +98,7 @@ LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
= help: the trait `Iterator` is not implemented for `i32`
error[E0277]: `i32` is not an iterator
--> $DIR/issue-50480.rs:3:28
--> $DIR/issue-50480.rs:2:28
|
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^ `i32` is not an iterator
@@ -116,11 +114,10 @@ LL | #[derive(Clone, Copy)]
= help: the trait `Iterator` is not implemented for `i32`
error[E0277]: `i32` is not an iterator
--> $DIR/issue-50480.rs:14:33
--> $DIR/issue-50480.rs:12:33
|
LL | #[derive(Clone, Copy)]
| ----- in this derive macro expansion
...
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
|
@@ -12,8 +12,8 @@
// we already face this difficulty, probably. If we need to fix this by reducing the error margin,
// we should improve compiletest.
#[derive(Clone, Eq)] //~ ERROR [E0277]
pub struct Struct<T>(T);
#[derive(Clone, Eq)]
pub struct Struct<T>(T); //~ ERROR [E0277]
impl<T: Clone, U> PartialEq<U> for Struct<T>
where
@@ -1,8 +1,10 @@
error[E0277]: the trait bound `T: Clone` is not satisfied
--> $DIR/global-cache-and-parallel-frontend.rs:15:17
--> $DIR/global-cache-and-parallel-frontend.rs:16:12
|
LL | #[derive(Clone, Eq)]
| ^^ the trait `Clone` is not implemented for `T`
| -- in this derive macro expansion
LL | pub struct Struct<T>(T);
| ^^^^^^ the trait `Clone` is not implemented for `T`
|
note: required for `Struct<T>` to implement `PartialEq`
--> $DIR/global-cache-and-parallel-frontend.rs:18:19