]> git.lizzy.rs Git - rust.git/commitdiff
Check that trait is exported or public before adding intercrate ambiguity hint
authorFerdia McKeogh <ferdia@mckeogh.tech>
Mon, 15 Jul 2019 17:45:51 +0000 (19:45 +0200)
committerFerdia McKeogh <ferdia@mckeogh.tech>
Tue, 16 Jul 2019 05:53:30 +0000 (07:53 +0200)
src/librustc/traits/specialize/mod.rs
src/test/ui/coherence/coherence-overlap-upstream.old.stderr
src/test/ui/coherence/coherence-overlap-upstream.re.stderr
src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.old.stderr
src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr
src/test/ui/coherence/coherence_copy_like_err_struct.old.stderr
src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr
src/test/ui/coherence/coherence_copy_like_err_tuple.old.stderr
src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr
src/test/ui/issues/issue-48728.stderr
src/test/ui/specialization/issue-52050.stderr

index f0389bb037ac5b827aeb4e1e5bcc8e07f1d29d5a..9027d330a90f6bf5a964048bcadbc22a5a53bd63 100644 (file)
@@ -366,8 +366,12 @@ pub(super) fn specialization_graph_provider(
                     }
                 }
 
-                for cause in &overlap.intercrate_ambiguity_causes {
-                    cause.add_intercrate_ambiguity_hint(&mut err);
+                let access_levels = tcx.privacy_access_levels(impl_def_id.krate);
+                let id = tcx.hir().as_local_hir_id(impl_def_id).unwrap();
+                if access_levels.is_exported(id) || access_levels.is_public(id) {
+                    for cause in &overlap.intercrate_ambiguity_causes {
+                        cause.add_intercrate_ambiguity_hint(&mut err);
+                    }
                 }
 
                 if overlap.involves_placeholder {
index 6c3484c2d8c4df3ca0ac3d9deee704c982ea70dc..dea948ff8abbb2f3d48439f34e8e8ae342b543ca 100644 (file)
@@ -5,8 +5,6 @@ LL | impl<T> Foo for T where T: Remote {}
    | --------------------------------- first implementation here
 LL | impl Foo for i16 {}
    | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
-   |
-   = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions
 
 error: aborting due to previous error
 
index 6c3484c2d8c4df3ca0ac3d9deee704c982ea70dc..dea948ff8abbb2f3d48439f34e8e8ae342b543ca 100644 (file)
@@ -5,8 +5,6 @@ LL | impl<T> Foo for T where T: Remote {}
    | --------------------------------- first implementation here
 LL | impl Foo for i16 {}
    | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
-   |
-   = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions
 
 error: aborting due to previous error
 
index 12c7a1f977c3fefdd878d8b73309af7ee6b1077a..0ec4f0bb8e74dbb66a598cf1d4a99ca72f671069 100644 (file)
@@ -6,8 +6,6 @@ LL | impl<T: lib::MyCopy> MyTrait for T { }
 ...
 LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>`
-   |
-   = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions
 
 error: aborting due to previous error
 
index 12c7a1f977c3fefdd878d8b73309af7ee6b1077a..0ec4f0bb8e74dbb66a598cf1d4a99ca72f671069 100644 (file)
@@ -6,8 +6,6 @@ LL | impl<T: lib::MyCopy> MyTrait for T { }
 ...
 LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>`
-   |
-   = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions
 
 error: aborting due to previous error
 
index 1b6c62e9bf3a802b7c21b36102200be6eec0d172..e5862fdda7c58ffb08bdd15d35c9c413cc923599 100644 (file)
@@ -6,8 +6,6 @@ LL | impl<T: lib::MyCopy> MyTrait for T { }
 ...
 LL | impl MyTrait for lib::MyStruct<MyType> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct<MyType>`
-   |
-   = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct<MyType>` in future versions
 
 error: aborting due to previous error
 
index 1b6c62e9bf3a802b7c21b36102200be6eec0d172..e5862fdda7c58ffb08bdd15d35c9c413cc923599 100644 (file)
@@ -6,8 +6,6 @@ LL | impl<T: lib::MyCopy> MyTrait for T { }
 ...
 LL | impl MyTrait for lib::MyStruct<MyType> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct<MyType>`
-   |
-   = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct<MyType>` in future versions
 
 error: aborting due to previous error
 
index 11bd788c761530cdedc7182762d1d4414e167a1e..a3c4ef8e105a2cfd62a4e3e89028c5ff64491d96 100644 (file)
@@ -6,8 +6,6 @@ LL | impl<T: lib::MyCopy> MyTrait for T { }
 ...
 LL | impl MyTrait for (MyType,) { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)`
-   |
-   = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions
 
 error: aborting due to previous error
 
index 11bd788c761530cdedc7182762d1d4414e167a1e..a3c4ef8e105a2cfd62a4e3e89028c5ff64491d96 100644 (file)
@@ -6,8 +6,6 @@ LL | impl<T: lib::MyCopy> MyTrait for T { }
 ...
 LL | impl MyTrait for (MyType,) { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)`
-   |
-   = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions
 
 error: aborting due to previous error
 
index 99a9bf9903e25702deef4acc6f25d4550ccf61af..777e1fc9c27ea2f5f3cf263466213ad9464ec8ff 100644 (file)
@@ -6,8 +6,6 @@ LL | #[derive(Clone)]
 ...
 LL | impl<T: Clone + ?Sized> Clone for Node<[T]> {
    | ------------------------------------------- first implementation here
-   |
-   = note: upstream crates may add new impl of trait `std::clone::Clone` for type `[_]` in future versions
 
 error: aborting due to previous error
 
index dcb34f3ad4836518aad8be94b7fd533d51f91a47..583c580d341ba720ac98b2397bc44283f1bfa43d 100644 (file)
@@ -10,8 +10,6 @@ LL | | }
 LL | 
 LL |   impl IntoPyDictPointer for ()
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
-   |
-   = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `()` in future versions
 
 error: aborting due to previous error