summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
blob: a63e0a1ee6f70ec6d0e0f9087449ff5208321040 (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
// aux-build: coherence_cross_crate_trait_decl.rs
// This test ensures that adding an `impl SomeTrait for i32` within
// `coherence_cross_crate_trait_decl` is not a breaking change, by
// making sure that even without such an impl this test fails to compile.

#![feature(type_alias_impl_trait)]

extern crate coherence_cross_crate_trait_decl;

use coherence_cross_crate_trait_decl::SomeTrait;

trait OtherTrait {}

type Alias = impl SomeTrait;

fn constrain() -> Alias {
    ()
}

impl OtherTrait for Alias {}
impl OtherTrait for i32 {}
//~^ ERROR: conflicting implementations of trait `OtherTrait` for type `Alias`

fn main() {}