Skip to content

WTF Error Message with `impl<T> Deref for T #28981

@Havvy

Description

@Havvy

Play link: http://is.gd/WYlDGu

use std::ops::Deref;

struct Foo;

impl<Foo> Deref for Foo { }

fn main() {}

Error message:

<anon>:5:1: 5:28 error: type parameter `Foo` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter [E0210]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0210
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `core`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `core`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `collections`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `collections`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `core`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `core`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `alloc`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `alloc`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `collections`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `core`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `alloc`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `collections`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `core`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 error: conflicting implementations for trait `core::ops::Deref` [E0119]
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:1: 5:28 help: see the detailed explanation for E0119
<anon>:5:1: 5:28 note: conflicting implementation in crate `std`
<anon>:5 impl<Foo> Deref for Foo { }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 22 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions