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 12 pull requests #47734

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
dbb6519
NLL test for mutating &mut references
ritiek Jan 20, 2018
4121ddb
Do not suggest private traits that have missing method
estebank Jan 18, 2018
5de8e04
Remove broken redundant backtrace hint
etaoins Jan 23, 2018
06d123d
Remove similar test that does not run the result
ritiek Jan 23, 2018
e6af9eb
Point at unknown lang item attribute
estebank Jan 23, 2018
583b382
Remove workarounds for cc 1.0.3.
EdSchouten Jan 24, 2018
65b1e86
Fix into() cast paren check precedence
etaoins Jan 24, 2018
05652d2
fix for documentation error issue 47716
evelynmitchell Jan 24, 2018
e1e991d
Fix experimental text display on default theme
GuillaumeGomez Jan 24, 2018
0847ac0
Fix wrong span for nested empty groups
pietroalbini Jan 24, 2018
15899b0
Update Cargo submodule to master
alexcrichton Jan 25, 2018
147f5ce
Rollup merge of #47534 - estebank:suggest-public-traits, r=petrochenkov
GuillaumeGomez Jan 25, 2018
2afd21d
Rollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakis
GuillaumeGomez Jan 25, 2018
0a1dcd3
Rollup merge of #47679 - etaoins:remove-redundant-backtrace-hint, r=e…
GuillaumeGomez Jan 25, 2018
7550753
Rollup merge of #47691 - estebank:unknown-lang-item-sp, r=rkruppe
GuillaumeGomez Jan 25, 2018
47cb91a
Rollup merge of #47700 - EdSchouten:cc104, r=kennytm
GuillaumeGomez Jan 25, 2018
9d3d9d5
Rollup merge of #47702 - etaoins:fix-into-cast-paren-precedence, r=pe…
GuillaumeGomez Jan 25, 2018
f72d441
Rollup merge of #47717 - evelynmitchell:47716-doc-fix, r=steveklabnik
GuillaumeGomez Jan 25, 2018
a4d31fc
Rollup merge of #47721 - GuillaumeGomez:experimental-color, r=QuietMi…
GuillaumeGomez Jan 25, 2018
5d9ea4b
Rollup merge of #47726 - pietroalbini:fix-nested-empty-groups-span, r…
GuillaumeGomez Jan 25, 2018
e1fd7ca
Rollup merge of #47729 - alexcrichton:update-cargo, r=sfackler
GuillaumeGomez Jan 25, 2018
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
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 {}
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.

Original file line number Diff line number Diff line change
@@ -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
}
Loading