]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/negative-impls/rely-on-negative-impl-in-coherence.rs
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk
[rust.git] / src / test / ui / traits / negative-impls / rely-on-negative-impl-in-coherence.rs
1 // check-pass
2
3 #![feature(negative_impls)]
4
5 // aux-build: foreign_trait.rs
6
7 // Test that we cannot implement `LocalTrait` for `String`,
8 // even though there is a `String: !ForeignTrait` impl.
9 //
10 // This may not be the behavior we want long term, but it's the
11 // current semantics that we implemented so as to land `!Foo` impls
12 // quickly. See internals thread:
13 //
14 // https://internals.rust-lang.org/t/foo/11587/
15
16 extern crate foreign_trait;
17 use foreign_trait::ForeignTrait;
18
19 trait LocalTrait { }
20 impl<T: ForeignTrait> LocalTrait for T { }
21 impl LocalTrait for String { }
22
23 fn main() { }