File: bad-resolve.rs

package info (click to toggle)
rustc 1.87.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 925,564 kB
  • sloc: xml: 158,127; python: 36,039; javascript: 19,761; sh: 19,737; cpp: 18,981; ansic: 13,133; asm: 4,376; makefile: 710; perl: 29; lisp: 28; ruby: 19; sql: 11
file content (46 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#![feature(fn_delegation)]
#![allow(incomplete_features)]

trait Trait {
    const C: u32 = 0;
    type Type;
    fn bar() {}
    fn foo(&self, x: i32) -> i32 { x }
}

struct F;
impl Trait for F {
    type Type = i32;
}

impl F {
    fn foo(&self, x: i32) -> i32 { x }
}

struct S(F);

impl Trait for S {
//~^ ERROR not all trait items implemented, missing: `Type`
    reuse <F as Trait>::C;
    //~^ ERROR item `C` is an associated method, which doesn't match its trait `Trait`
    //~| ERROR expected function, found associated constant `Trait::C`
    reuse <F as Trait>::Type;
    //~^ ERROR item `Type` is an associated method, which doesn't match its trait `Trait`
    //~| ERROR expected method or associated constant, found associated type `Trait::Type`
    reuse <F as Trait>::baz;
    //~^ ERROR method `baz` is not a member of trait `Trait`
    //~| ERROR cannot find method or associated constant `baz` in trait `Trait`
    reuse <F as Trait>::bar;

    reuse foo { &self.0 }
    //~^ ERROR cannot find function `foo` in this scope
    reuse Trait::foo2 { self.0 }
    //~^ ERROR cannot find function `foo2` in trait `Trait`
    //~| ERROR method `foo2` is not a member of trait `Trait`
}

mod prefix {}
reuse unresolved_prefix::{a, b, c}; //~ ERROR use of unresolved module or unlinked crate
reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position

fn main() {}