Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that trait is exported or public before adding hint #62696

Merged
merged 2 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/librustc/traits/specialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,13 @@ 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);
if let Some(id) = tcx.hir().as_local_hir_id(impl_def_id) {
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 {
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/coherence/coherence-overlap-upstream.old.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/coherence/coherence-overlap-upstream.re.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/issues/issue-48728.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/specialization/issue-52050.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down