Skip to content

Commit 9fd7da9

Browse files
committed
Auto merge of #47740 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 10 pull requests - Successful merges: #47534, #47609, #47679, #47691, #47700, #47702, #47717, #47721, #47726, #47729 - Failed merges:
2 parents 4cf26f8 + 89ff122 commit 9fd7da9

26 files changed

+215
-83
lines changed

src/Cargo.lock

Lines changed: 35 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ci/docker/dist-various-2/Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ ENV \
4747
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
4848
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++
4949

50-
# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It can
51-
# automatically pick the right compiler path.
52-
ENV \
53-
AR_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-ar \
54-
CC_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang \
55-
CXX_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang++
56-
5750
ENV TARGETS=x86_64-unknown-fuchsia
5851
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
5952
ENV TARGETS=$TARGETS,sparcv9-sun-solaris

src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-c++
4040
ln -s ../lib/llvm-5.0/bin/lld /usr/bin/${target}-ld
4141
ln -s ../../${target} /usr/lib/llvm-5.0/${target}
4242

43-
# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It
44-
# can make use of ${target}-cc and ${target}-c++, without incorrectly
45-
# assuming it's MSVC.
46-
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang
47-
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang++
48-
4943
# Install the C++ runtime libraries from CloudABI Ports.
5044
echo deb https://nuxi.nl/distfiles/cloudabi-ports/debian/ cloudabi cloudabi > \
5145
/etc/apt/sources.list.d/cloudabi.list

src/doc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ rustdoc reference.md
2929
An overview of how to use the `rustdoc` command is available [in the docs][1].
3030
Further details are available from the command line by with `rustdoc --help`.
3131

32-
[1]: https://github.com/rust-lang/rust/blob/master/src/doc/book/documentation.md
32+
[1]: https://github.com/rust-lang/rust/blob/master/src/doc/rustdoc/src/what-is-rustdoc.md

src/librustc/middle/lang_items.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use util::nodemap::FxHashMap;
2828

2929
use syntax::ast;
3030
use syntax::symbol::Symbol;
31+
use syntax_pos::Span;
3132
use hir::itemlikevisit::ItemLikeVisitor;
3233
use hir;
3334

@@ -104,17 +105,18 @@ struct LanguageItemCollector<'a, 'tcx: 'a> {
104105

105106
impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'a, 'tcx> {
106107
fn visit_item(&mut self, item: &hir::Item) {
107-
if let Some(value) = extract(&item.attrs) {
108+
if let Some((value, span)) = extract(&item.attrs) {
108109
let item_index = self.item_refs.get(&*value.as_str()).cloned();
109110

110111
if let Some(item_index) = item_index {
111112
let def_id = self.tcx.hir.local_def_id(item.id);
112113
self.collect_item(item_index, def_id);
113114
} else {
114-
let span = self.tcx.hir.span(item.id);
115-
span_err!(self.tcx.sess, span, E0522,
116-
"definition of an unknown language item: `{}`.",
117-
value);
115+
let mut err = struct_span_err!(self.tcx.sess, span, E0522,
116+
"definition of an unknown language item: `{}`",
117+
value);
118+
err.span_label(span, format!("definition of unknown language item `{}`", value));
119+
err.emit();
118120
}
119121
}
120122
}
@@ -177,11 +179,11 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
177179
}
178180
}
179181

180-
pub fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
182+
pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
181183
for attribute in attrs {
182184
if attribute.check_name("lang") {
183185
if let Some(value) = attribute.value_str() {
184-
return Some(value)
186+
return Some((value, attribute.span));
185187
}
186188
}
187189
}

src/librustc/middle/weak_lang_items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
5555
}
5656

5757
pub fn link_name(attrs: &[ast::Attribute]) -> Option<Symbol> {
58-
lang_items::extract(attrs).and_then(|name| {
58+
lang_items::extract(attrs).and_then(|(name, _)| {
5959
$(if name == stringify!($name) {
6060
Some(Symbol::intern(stringify!($sym)))
6161
} else)* {
@@ -129,7 +129,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
129129
}
130130

131131
fn visit_foreign_item(&mut self, i: &hir::ForeignItem) {
132-
if let Some(lang_item) = lang_items::extract(&i.attrs) {
132+
if let Some((lang_item, _)) = lang_items::extract(&i.attrs) {
133133
self.register(&lang_item.as_str(), i.span);
134134
}
135135
intravisit::walk_foreign_item(self, i)

src/librustc_driver/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,14 +1273,6 @@ pub fn monitor<F: FnOnce() + Send + 'static>(f: F) {
12731273
&note,
12741274
errors::Level::Note);
12751275
}
1276-
if match env::var_os("RUST_BACKTRACE") {
1277-
Some(val) => &val != "0",
1278-
None => false,
1279-
} {
1280-
handler.emit(&MultiSpan::new(),
1281-
"run with `RUST_BACKTRACE=1` for a backtrace",
1282-
errors::Level::Note);
1283-
}
12841276

12851277
eprintln!("{}", str::from_utf8(&data.lock().unwrap()).unwrap());
12861278
}

src/librustc_resolve/check_unused.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,18 @@ impl<'a, 'b> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b> {
102102
}
103103

104104
if let ast::UseTreeKind::Nested(ref items) = use_tree.kind {
105+
// If it's the parent group, cover the entire use item
106+
let span = if nested {
107+
use_tree.span
108+
} else {
109+
self.item_span
110+
};
111+
105112
if items.len() == 0 {
106113
self.unused_imports
107114
.entry(self.base_id)
108115
.or_insert_with(NodeMap)
109-
.insert(id, self.item_span);
116+
.insert(id, span);
110117
}
111118
} else {
112119
let base_id = self.base_id;

src/librustc_typeck/check/demand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc::infer::InferOk;
1515
use rustc::traits::ObligationCause;
1616

1717
use syntax::ast;
18-
use syntax::util::parser::AssocOp;
18+
use syntax::util::parser::PREC_POSTFIX;
1919
use syntax_pos::{self, Span};
2020
use rustc::hir;
2121
use rustc::hir::print;
@@ -336,7 +336,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
336336
// For now, don't suggest casting with `as`.
337337
let can_cast = false;
338338

339-
let needs_paren = expr.precedence().order() < (AssocOp::As.precedence() as i8);
339+
let needs_paren = expr.precedence().order() < (PREC_POSTFIX as i8);
340340

341341
if let Ok(src) = self.tcx.sess.codemap().span_to_snippet(expr.span) {
342342
let msg = format!("you can cast an `{}` to `{}`", checked_ty, expected_ty);

src/librustc_typeck/check/method/suggest.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
513513
// this isn't perfect (that is, there are cases when
514514
// implementing a trait would be legal but is rejected
515515
// here).
516-
(type_is_local || info.def_id.is_local())
517-
&& self.associated_item(info.def_id, item_name, Namespace::Value).is_some()
516+
(type_is_local || info.def_id.is_local()) &&
517+
self.associated_item(info.def_id, item_name, Namespace::Value)
518+
.filter(|item| {
519+
// We only want to suggest public or local traits (#45781).
520+
item.vis == ty::Visibility::Public || info.def_id.is_local()
521+
})
522+
.is_some()
518523
})
519524
.collect::<Vec<_>>();
520525

0 commit comments

Comments
 (0)