Closed
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e0a6148a3b4952ab3abd1f4bd7784029
use serde::ser::Serialize;
struct BooperDoop;
impl Serialize for *mut BooperDoop {
// ...
}
fn main() {}
The current output is:
Compiling playground v0.0.1 (/playground)
error[[E0117]](https://doc.rust-lang.org/stable/error-index.html#E0117): only traits defined in the current crate can be implemented for arbitrary types
--> src/main.rs:5:1
|
5 | impl Serialize for *mut BooperDoop {
| ^^^^^^^^^^^^^^^^^^^---------------
| | |
| | `*mut BooperDoop` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
For more information about this error, try `rustc --explain E0117`.
error: could not compile `playground` due to previous error
Ideally the output should look like:
Compiling playground v0.0.1 (/playground)
error[[E0117]](https://doc.rust-lang.org/stable/error-index.html#E0117): only traits defined in the current crate can be implemented for arbitrary types
--> src/main.rs:5:1
|
5 | impl Serialize for *mut BooperDoop {
| ^^^^^^^^^^^^^^^^^^^---------------
| | |
| | `*mut BooperDoop` is not defined in the current crate, try implementing on `Booperdoop`
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
For more information about this error, try `rustc --explain E0117`.
error: could not compile `playground` due to previous error