-
Notifications
You must be signed in to change notification settings - Fork 191
Labels
Milestone
Description
Summary
expected to get E0204 but got E0308 and the actual message is buggy
Reproducer
I tried this code:
#[lang = "sized"]
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
pub trait Clone {
fn clone(&self) -> Self;
}
impl Clone for i32 {
fn clone(&self) -> i32 {
*self
}
}
//#[derive(Clone)]
struct S {
}
#[derive(Clone, Copy)]
struct S2 {
a: i32,
s: S
}
fn main() -> i32 {
0
}
Does the code make use of any (1.49) nightly feature ?
- Nightly
Godbolt link
https://godbolt.org/z/M3sveonGx
Actual behavior
got
<source>:21:3: error: mismatched types, expected '& <tyty::error>' but got '& S' [E0308]
8 | fn clone(&self) -> Self;
| ~
......
21 | #[derive(Clone, Copy)]
| ^~~~~~
Compiler returned: 1
Expected behavior
I expected to see... (rustc)
error[E0204]: the trait `Copy` may not be implemented for this type
--> <source>:23:17
|
23 | #[derive(Clone, Copy)]
| ^^^^
...
26 | s: S
| ---- this field does not implement `Copy`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
GCC Version
master
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done