summaryrefslogtreecommitdiffstats
path: root/src/test/ui/suggestions/into-convert.rs
blob: 1c9a9e0aaf561e8596d83edc39adce4776cfe452 (plain)
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
use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicU32;
use std::sync::Arc;

fn main() {
    let x: A = B;
    //~^ ERROR mismatched types
    //~| HELP call `Into::into` on this expression to convert `B` into `A`

    let y: Arc<Path> = PathBuf::new();
    //~^ ERROR mismatched types
    //~| HELP call `Into::into` on this expression to convert `PathBuf` into `Arc<Path>`

    let z: AtomicU32 = 1;
    //~^ ERROR mismatched types
    //~| HELP call `Into::into` on this expression to convert `{integer}` into `AtomicU32`
}

struct A;
struct B;

impl From<B> for A {
    fn from(_: B) -> Self {
        A
    }
}