]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/coherence_cross_crate.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / type-alias-impl-trait / coherence_cross_crate.rs
1 // aux-build: coherence_cross_crate_trait_decl.rs
2 // This test ensures that adding an `impl SomeTrait for i32` within
3 // `coherence_cross_crate_trait_decl` is not a breaking change, by
4 // making sure that even without such an impl this test fails to compile.
5
6 #![feature(type_alias_impl_trait)]
7
8 extern crate coherence_cross_crate_trait_decl;
9
10 use coherence_cross_crate_trait_decl::SomeTrait;
11
12 trait OtherTrait {}
13
14 type Alias = impl SomeTrait;
15
16 fn constrain() -> Alias {
17     ()
18 }
19
20 impl OtherTrait for Alias {}
21 impl OtherTrait for i32 {}
22 //~^ ERROR: conflicting implementations of trait `OtherTrait` for type `Alias`
23
24 fn main() {}