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

Rollup of 7 pull requests #44139

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c7168d3
Add hints when intercrate ambiguity causes overlap.
qnighy Jul 23, 2017
eeb16a1
Slightly modify hint messages.
qnighy Jul 25, 2017
c18c1d5
Add tests for intercrate ambiguity hints.
qnighy Jul 25, 2017
51e92bb
Fix a very subtle mistake in a ui test.
qnighy Jul 25, 2017
2cc7286
Unify intercrate ambiguity emitters into a function.
qnighy Jul 25, 2017
24abea9
Print more detailed trait-ref for intercrate ambiguity.
qnighy Aug 1, 2017
ca684a6
Add downstream tests for intercrate ambiguity hints.
qnighy Aug 1, 2017
59cff34
Fix misdetection of upstream intercrate ambiguity.
qnighy Aug 1, 2017
8cd4cac
include Cargo.{toml,lock} in rust-src tarball
RalfJung Aug 24, 2017
bd24325
Do not include the src/Cargo.toml
RalfJung Aug 26, 2017
45d31ac
bootstrap: remove unneeded extern crate
ishitatsuyuki Aug 28, 2017
cc5ea04
un-regress behavior of `unused_results` lint for booleans
zackmdavis Aug 28, 2017
2bffa31
compiletest: Change Config comments to doc comments
Aug 28, 2017
10bd39e
Rewrite `std::net::ToSocketAddrs` doc examples.
frewsxcv Aug 27, 2017
f50bf86
Fix invalid linker position
GuillaumeGomez Aug 28, 2017
5c28740
factor out helper method
nikomatsakis Aug 28, 2017
f0b2bf6
Rollup merge of #43426 - qnighy:intercrate-ambiguity-hints, r=nikomat…
frewsxcv Aug 29, 2017
770a6e6
Rollup merge of #44076 - RalfJung:src, r=alexcrichton
frewsxcv Aug 29, 2017
e73c354
Rollup merge of #44117 - frewsxcv:frewsxcv-to-socket-addrs-examples, …
frewsxcv Aug 29, 2017
d8cfac2
Rollup merge of #44121 - ishitatsuyuki:bootstrap-deps-purge, r=Mark-S…
frewsxcv Aug 29, 2017
5e39ead
Rollup merge of #44122 - zackmdavis:booleans_were_not_unused_results,…
frewsxcv Aug 29, 2017
54ddb61
Rollup merge of #44126 - laumann:config-doc-comments, r=nikomatsakis
frewsxcv Aug 29, 2017
a5559ee
Rollup merge of #44135 - GuillaumeGomez:fix-css-links, r=QuietMisdreavus
frewsxcv Aug 29, 2017
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
Prev Previous commit
Next Next commit
Unify intercrate ambiguity emitters into a function.
  • Loading branch information
qnighy committed Jul 25, 2017
commit 2cc72866eadf7928aab42c4f2ec527d7dcd17679
20 changes: 20 additions & 0 deletions src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ pub enum IntercrateAmbiguityCause {
UpstreamCrateUpdate(DefId),
}

impl IntercrateAmbiguityCause {
/// Emits notes when the overlap is caused by complex intercrate ambiguities.
/// See #23980 for details.
pub fn add_intercrate_ambiguity_hint<'a, 'tcx>(&self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
err: &mut ::errors::DiagnosticBuilder) {
match self {
&IntercrateAmbiguityCause::DownstreamCrate(def_id) => {
err.note(&format!("downstream crates may implement `{}`",
tcx.item_path_str(def_id)));
}
&IntercrateAmbiguityCause::UpstreamCrateUpdate(def_id) => {
err.note(&format!("upstream crates may add new impl for `{}` \
in future versions",
tcx.item_path_str(def_id)));
}
}
}
}

// A stack that walks back up the stack frame.
struct TraitObligationStack<'prev, 'tcx: 'prev> {
obligation: &'prev TraitObligation<'tcx>,
Expand Down
12 changes: 1 addition & 11 deletions src/librustc/traits/specialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,7 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
}

for cause in &overlap.intercrate_ambiguity_causes {
match cause {
&IntercrateAmbiguityCause::DownstreamCrate(def_id) => {
err.note(&format!("downstream crates may implement `{}`",
tcx.item_path_str(def_id)));
}
&IntercrateAmbiguityCause::UpstreamCrateUpdate(def_id) => {
err.note(&format!("upstream crates may add new impl for `{}` \
in future versions",
tcx.item_path_str(def_id)));
}
}
cause.add_intercrate_ambiguity_hint(tcx, &mut err);
}

err.emit();
Expand Down
13 changes: 1 addition & 12 deletions src/librustc_typeck/coherence/inherent_impls_overlap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::hir;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::traits;
use rustc::traits::IntercrateAmbiguityCause;
use rustc::ty::{self, TyCtxt};

pub fn crate_inherent_impls_overlap_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
Expand Down Expand Up @@ -64,17 +63,7 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
format!("other definition for `{}`", name));

for cause in &overlap.intercrate_ambiguity_causes {
match cause {
&IntercrateAmbiguityCause::DownstreamCrate(def_id) => {
err.note(&format!("downstream crates may implement `{}`",
self.tcx.item_path_str(def_id)));
}
&IntercrateAmbiguityCause::UpstreamCrateUpdate(def_id) => {
err.note(&format!("upstream crates may add new impl for `{}` \
in future versions",
self.tcx.item_path_str(def_id)));
}
}
cause.add_intercrate_ambiguity_hint(self.tcx, &mut err);
}

err.emit();
Expand Down