Skip to content

Commit

Permalink
Auto merge of #47740 - GuillaumeGomez:rollup, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

- Successful merges: #47534, #47609, #47679, #47691, #47700, #47702, #47717, #47721, #47726, #47729
- Failed merges:
  • Loading branch information
bors committed Jan 25, 2018
2 parents 4cf26f8 + 89ff122 commit 9fd7da9
Show file tree
Hide file tree
Showing 26 changed files with 215 additions and 83 deletions.
36 changes: 35 additions & 1 deletion src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions src/ci/docker/dist-various-2/Dockerfile
Expand Up @@ -47,13 +47,6 @@ ENV \
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++

# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It can
# automatically pick the right compiler path.
ENV \
AR_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-ar \
CC_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang \
CXX_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang++

ENV TARGETS=x86_64-unknown-fuchsia
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
Expand Down
6 changes: 0 additions & 6 deletions src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh
Expand Up @@ -40,12 +40,6 @@ ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-c++
ln -s ../lib/llvm-5.0/bin/lld /usr/bin/${target}-ld
ln -s ../../${target} /usr/lib/llvm-5.0/${target}

# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It
# can make use of ${target}-cc and ${target}-c++, without incorrectly
# assuming it's MSVC.
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang++

# Install the C++ runtime libraries from CloudABI Ports.
echo deb https://nuxi.nl/distfiles/cloudabi-ports/debian/ cloudabi cloudabi > \
/etc/apt/sources.list.d/cloudabi.list
Expand Down
2 changes: 1 addition & 1 deletion src/doc/README.md
Expand Up @@ -29,4 +29,4 @@ rustdoc reference.md
An overview of how to use the `rustdoc` command is available [in the docs][1].
Further details are available from the command line by with `rustdoc --help`.

[1]: https://github.com/rust-lang/rust/blob/master/src/doc/book/documentation.md
[1]: https://github.com/rust-lang/rust/blob/master/src/doc/rustdoc/src/what-is-rustdoc.md
16 changes: 9 additions & 7 deletions src/librustc/middle/lang_items.rs
Expand Up @@ -28,6 +28,7 @@ use util::nodemap::FxHashMap;

use syntax::ast;
use syntax::symbol::Symbol;
use syntax_pos::Span;
use hir::itemlikevisit::ItemLikeVisitor;
use hir;

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

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

if let Some(item_index) = item_index {
let def_id = self.tcx.hir.local_def_id(item.id);
self.collect_item(item_index, def_id);
} else {
let span = self.tcx.hir.span(item.id);
span_err!(self.tcx.sess, span, E0522,
"definition of an unknown language item: `{}`.",
value);
let mut err = struct_span_err!(self.tcx.sess, span, E0522,
"definition of an unknown language item: `{}`",
value);
err.span_label(span, format!("definition of unknown language item `{}`", value));
err.emit();
}
}
}
Expand Down Expand Up @@ -177,11 +179,11 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
}
}

pub fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
for attribute in attrs {
if attribute.check_name("lang") {
if let Some(value) = attribute.value_str() {
return Some(value)
return Some((value, attribute.span));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/weak_lang_items.rs
Expand Up @@ -55,7 +55,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}

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

fn visit_foreign_item(&mut self, i: &hir::ForeignItem) {
if let Some(lang_item) = lang_items::extract(&i.attrs) {
if let Some((lang_item, _)) = lang_items::extract(&i.attrs) {
self.register(&lang_item.as_str(), i.span);
}
intravisit::walk_foreign_item(self, i)
Expand Down
8 changes: 0 additions & 8 deletions src/librustc_driver/lib.rs
Expand Up @@ -1273,14 +1273,6 @@ pub fn monitor<F: FnOnce() + Send + 'static>(f: F) {
&note,
errors::Level::Note);
}
if match env::var_os("RUST_BACKTRACE") {
Some(val) => &val != "0",
None => false,
} {
handler.emit(&MultiSpan::new(),
"run with `RUST_BACKTRACE=1` for a backtrace",
errors::Level::Note);
}

eprintln!("{}", str::from_utf8(&data.lock().unwrap()).unwrap());
}
Expand Down
9 changes: 8 additions & 1 deletion src/librustc_resolve/check_unused.rs
Expand Up @@ -102,11 +102,18 @@ impl<'a, 'b> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b> {
}

if let ast::UseTreeKind::Nested(ref items) = use_tree.kind {
// If it's the parent group, cover the entire use item
let span = if nested {
use_tree.span
} else {
self.item_span
};

if items.len() == 0 {
self.unused_imports
.entry(self.base_id)
.or_insert_with(NodeMap)
.insert(id, self.item_span);
.insert(id, span);
}
} else {
let base_id = self.base_id;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/demand.rs
Expand Up @@ -15,7 +15,7 @@ use rustc::infer::InferOk;
use rustc::traits::ObligationCause;

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

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

if let Ok(src) = self.tcx.sess.codemap().span_to_snippet(expr.span) {
let msg = format!("you can cast an `{}` to `{}`", checked_ty, expected_ty);
Expand Down
9 changes: 7 additions & 2 deletions src/librustc_typeck/check/method/suggest.rs
Expand Up @@ -513,8 +513,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// this isn't perfect (that is, there are cases when
// implementing a trait would be legal but is rejected
// here).
(type_is_local || info.def_id.is_local())
&& self.associated_item(info.def_id, item_name, Namespace::Value).is_some()
(type_is_local || info.def_id.is_local()) &&
self.associated_item(info.def_id, item_name, Namespace::Value)
.filter(|item| {
// We only want to suggest public or local traits (#45781).
item.vis == ty::Visibility::Public || info.def_id.is_local()
})
.is_some()
})
.collect::<Vec<_>>();

Expand Down
3 changes: 2 additions & 1 deletion src/librustc_typeck/lib.rs
Expand Up @@ -75,12 +75,13 @@ This API is completely unstable and subject to change.
#![feature(advanced_slice_patterns)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
#![feature(conservative_impl_trait)]
#![feature(copy_closures, clone_closures)]
#![feature(crate_visibility_modifier)]
#![feature(from_ref)]
#![feature(match_default_bindings)]
#![feature(never_type)]
#![feature(option_filter)]
#![feature(quote)]
#![feature(refcell_replace_swap)]
#![feature(rustc_diagnostic_macros)]
Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/themes/main.css
Expand Up @@ -189,6 +189,10 @@ a.test-arrow {
.stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
.stab.portability { background: #C4ECFF; border-color: #7BA5DB; }

.module-item .stab {
color: #000;
}

#help > div {
background: #e9e9e9;
border-color: #bfbfbf;
Expand Down
3 changes: 2 additions & 1 deletion src/test/compile-fail/E0522.rs
Expand Up @@ -11,6 +11,7 @@
#![feature(lang_items)]

#[lang = "cookie"]
fn cookie() -> ! { //~ E0522
fn cookie() -> ! {
//~^^ ERROR definition of an unknown language item: `cookie` [E0522]
loop {}
}
@@ -1,4 +1,4 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -8,17 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z borrowck=mir -Z nll

// This example comes from the NLL RFC.
#![feature(nll)]

struct List<T> {
value: T,
next: Option<Box<List<T>>>,
}

fn to_refs<T>(list: &mut List<T>) -> Vec<&mut T> {
let mut list = list;
fn to_refs<T>(mut list: &mut List<T>) -> Vec<&mut T> {
let mut result = vec![];
loop {
result.push(&mut list.value);
Expand All @@ -31,4 +28,7 @@ fn to_refs<T>(list: &mut List<T>) -> Vec<&mut T> {
}

fn main() {
let mut list = List { value: 1, next: None };
let vec = to_refs(&mut list);
assert_eq!(vec![&mut 1], vec);
}
12 changes: 4 additions & 8 deletions src/test/ui/impl-trait/no-method-suggested-traits.stderr
Expand Up @@ -95,10 +95,8 @@ error[E0599]: no method named `method` found for type `Foo` in the current scope
= note: the following traits define an item `method`, perhaps you need to implement one of them:
candidate #1: `foo::Bar`
candidate #2: `no_method_suggested_traits::foo::PubPub`
candidate #3: `no_method_suggested_traits::bar::PubPriv`
candidate #4: `no_method_suggested_traits::qux::PrivPub`
candidate #5: `no_method_suggested_traits::quz::PrivPriv`
candidate #6: `no_method_suggested_traits::Reexported`
candidate #3: `no_method_suggested_traits::qux::PrivPub`
candidate #4: `no_method_suggested_traits::Reexported`

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

error[E0599]: no method named `method2` found for type `u64` in the current scope
--> $DIR/no-method-suggested-traits.rs:55:10
Expand Down
6 changes: 2 additions & 4 deletions src/test/ui/method-call-err-msg.stderr
Expand Up @@ -38,10 +38,8 @@ error[E0599]: no method named `take` found for type `Foo` in the current scope
`&mut Foo : std::iter::Iterator`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `take`, perhaps you need to implement one of them:
candidate #1: `std::collections::hash::Recover`
candidate #2: `std::io::Read`
candidate #3: `std::iter::Iterator`
candidate #4: `alloc::btree::Recover`
candidate #1: `std::io::Read`
candidate #2: `std::iter::Iterator`

error: aborting due to 4 previous errors

14 changes: 0 additions & 14 deletions src/test/ui/owl-import-generates-unused-import-lint.stderr

This file was deleted.

@@ -1,4 +1,4 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -8,15 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(use_nested_groups)]
#![deny(unused_imports)]

mod foo {
pub enum Bar {}
}

use foo::{*, *}; //~ ERROR unused import: `*`
struct T;

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

0 comments on commit 9fd7da9

Please sign in to comment.