Skip to content

Commit 9fd7da9

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

26 files changed

+215
-83
lines changed

src/Cargo.lock

+35-1
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

-7
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

-6
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

+1-1
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

+9-7
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

+2-2
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

-8
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

+8-1
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

+2-2
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

+7-2
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

src/librustc_typeck/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ This API is completely unstable and subject to change.
7575
#![feature(advanced_slice_patterns)]
7676
#![feature(box_patterns)]
7777
#![feature(box_syntax)]
78-
#![feature(crate_visibility_modifier)]
7978
#![feature(conservative_impl_trait)]
8079
#![feature(copy_closures, clone_closures)]
80+
#![feature(crate_visibility_modifier)]
8181
#![feature(from_ref)]
8282
#![feature(match_default_bindings)]
8383
#![feature(never_type)]
84+
#![feature(option_filter)]
8485
#![feature(quote)]
8586
#![feature(refcell_replace_swap)]
8687
#![feature(rustc_diagnostic_macros)]

src/librustdoc/html/static/themes/main.css

+4
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ a.test-arrow {
189189
.stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
190190
.stab.portability { background: #C4ECFF; border-color: #7BA5DB; }
191191

192+
.module-item .stab {
193+
color: #000;
194+
}
195+
192196
#help > div {
193197
background: #e9e9e9;
194198
border-color: #bfbfbf;

src/test/compile-fail/E0522.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#![feature(lang_items)]
1212

1313
#[lang = "cookie"]
14-
fn cookie() -> ! { //~ E0522
14+
fn cookie() -> ! {
15+
//~^^ ERROR definition of an unknown language item: `cookie` [E0522]
1516
loop {}
1617
}

src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs renamed to src/test/run-pass/nll/mutating_references.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,17 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Z borrowck=mir -Z nll
12-
13-
// This example comes from the NLL RFC.
11+
#![feature(nll)]
1412

1513
struct List<T> {
1614
value: T,
1715
next: Option<Box<List<T>>>,
1816
}
1917

20-
fn to_refs<T>(list: &mut List<T>) -> Vec<&mut T> {
21-
let mut list = list;
18+
fn to_refs<T>(mut list: &mut List<T>) -> Vec<&mut T> {
2219
let mut result = vec![];
2320
loop {
2421
result.push(&mut list.value);
@@ -31,4 +28,7 @@ fn to_refs<T>(list: &mut List<T>) -> Vec<&mut T> {
3128
}
3229

3330
fn main() {
31+
let mut list = List { value: 1, next: None };
32+
let vec = to_refs(&mut list);
33+
assert_eq!(vec![&mut 1], vec);
3434
}

src/test/ui/impl-trait/no-method-suggested-traits.stderr

+4-8
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,8 @@ error[E0599]: no method named `method` found for type `Foo` in the current scope
9595
= note: the following traits define an item `method`, perhaps you need to implement one of them:
9696
candidate #1: `foo::Bar`
9797
candidate #2: `no_method_suggested_traits::foo::PubPub`
98-
candidate #3: `no_method_suggested_traits::bar::PubPriv`
99-
candidate #4: `no_method_suggested_traits::qux::PrivPub`
100-
candidate #5: `no_method_suggested_traits::quz::PrivPriv`
101-
candidate #6: `no_method_suggested_traits::Reexported`
98+
candidate #3: `no_method_suggested_traits::qux::PrivPub`
99+
candidate #4: `no_method_suggested_traits::Reexported`
102100

103101
error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope
104102
--> $DIR/no-method-suggested-traits.rs:52:43
@@ -110,10 +108,8 @@ error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::box
110108
= note: the following traits define an item `method`, perhaps you need to implement one of them:
111109
candidate #1: `foo::Bar`
112110
candidate #2: `no_method_suggested_traits::foo::PubPub`
113-
candidate #3: `no_method_suggested_traits::bar::PubPriv`
114-
candidate #4: `no_method_suggested_traits::qux::PrivPub`
115-
candidate #5: `no_method_suggested_traits::quz::PrivPriv`
116-
candidate #6: `no_method_suggested_traits::Reexported`
111+
candidate #3: `no_method_suggested_traits::qux::PrivPub`
112+
candidate #4: `no_method_suggested_traits::Reexported`
117113

118114
error[E0599]: no method named `method2` found for type `u64` in the current scope
119115
--> $DIR/no-method-suggested-traits.rs:55:10

src/test/ui/method-call-err-msg.stderr

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ error[E0599]: no method named `take` found for type `Foo` in the current scope
3838
`&mut Foo : std::iter::Iterator`
3939
= help: items from traits can only be used if the trait is implemented and in scope
4040
= note: the following traits define an item `take`, perhaps you need to implement one of them:
41-
candidate #1: `std::collections::hash::Recover`
42-
candidate #2: `std::io::Read`
43-
candidate #3: `std::iter::Iterator`
44-
candidate #4: `alloc::btree::Recover`
41+
candidate #1: `std::io::Read`
42+
candidate #2: `std::iter::Iterator`
4543

4644
error: aborting due to 4 previous errors
4745

src/test/ui/owl-import-generates-unused-import-lint.stderr

-14
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,15 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(use_nested_groups)]
12-
#![deny(unused_imports)]
13-
14-
mod foo {
15-
pub enum Bar {}
16-
}
17-
18-
use foo::{*, *}; //~ ERROR unused import: `*`
11+
struct T;
1912

2013
fn main() {
21-
let _: Bar;
14+
T::new();
15+
//~^ ERROR no function or associated item named `new` found for type `T` in the current scope
2216
}

0 commit comments

Comments
 (0)