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