Content-Length: 24326 | pFad | https://doc.rust-lang.org/std/pin/../default/../rc/../../../std/../error_codes/./././E0223.html

E0223 - Error codes index

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0223

An attempt was made to retrieve an associated type, but the type was ambiguous.

Erroneous code example:

trait Trait { type X; }

fn main() {
    let foo: Trait::X;
}

The problem here is that we’re attempting to take the associated type of X from Trait. Unfortunately, the type of X is not defined, because it’s only made concrete in implementations of the trait. A working version of this code might look like:

trait Trait { type X; }

struct Struct;
impl Trait for Struct {
    type X = u32;
}

fn main() {
    let foo: <Struct as Trait>::X;
}

This syntax specifies that we want the associated type X from Struct’s implementation of Trait.

Due to internal limitations of the current compiler implementation we cannot simply use Struct::X.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://doc.rust-lang.org/std/pin/../default/../rc/../../../std/../error_codes/./././E0223.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy