Skip to content

Commit

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

Successful merges:

 - #51701 (Better docs for copy_from_slice & clone_from_slice)
 - #52231 (Fix typo in error message E0277)
 - #52233 (Improve lint handling in rustdoc)
 - #52238 (Avoid unwrapping in PanicInfo doc example.)
 - #52241 (Fix typo in E0433 docs)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jul 11, 2018
2 parents ae5b629 + 985c5a7 commit 989fa05
Show file tree
Hide file tree
Showing 68 changed files with 187 additions and 168 deletions.
2 changes: 1 addition & 1 deletion src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<T: ?Sized> !Send for *mut T { }
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "sized"]
#[rustc_on_unimplemented(
message="the size for value values of type `{Self}` cannot be known at compilation time",
message="the size for values of type `{Self}` cannot be known at compilation time",
label="doesn't have a size known at compile-time",
note="to learn more, visit <https://doc.rust-lang.org/book/second-edition/\
ch19-04-advanced-types.html#dynamically-sized-types--sized>",
Expand Down
6 changes: 5 additions & 1 deletion src/libcore/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ use fmt;
/// use std::panic;
///
/// panic::set_hook(Box::new(|panic_info| {
/// println!("panic occurred: {:?}", panic_info.payload().downcast_ref::<&str>().unwrap());
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
/// println!("panic occurred: {:?}", s);
/// } else {
/// println!("panic occurred");
/// }
/// }));
///
/// panic!("Normal panic");
Expand Down
6 changes: 6 additions & 0 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,9 @@ impl<T> [T] {
/// let src = [1, 2, 3, 4];
/// let mut dst = [0, 0];
///
/// // Because the slices have to be the same length,
/// // we slice the source slice from four elements
/// // to two. It will panic if we don't do this.
/// dst.clone_from_slice(&src[2..]);
///
/// assert_eq!(src, [1, 2, 3, 4]);
Expand Down Expand Up @@ -1607,6 +1610,9 @@ impl<T> [T] {
/// let src = [1, 2, 3, 4];
/// let mut dst = [0, 0];
///
/// // Because the slices have to be the same length,
/// // we slice the source slice from four elements
/// // to two. It will panic if we don't do this.
/// dst.copy_from_slice(&src[2..]);
///
/// assert_eq!(src, [1, 2, 3, 4]);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ let map = HashMap::new();
```
Please verify you didn't misspell the type/module's name or that you didn't
forgot to import it:
forget to import it:
```
Expand Down
15 changes: 12 additions & 3 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ pub fn run_core(search_paths: SearchPaths,
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
let warnings_lint_name = lint::builtin::WARNINGS.name;
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;

// In addition to those specific lints, we also need to whitelist those given through
// command line, otherwise they'll get ignored and we don't want that.
let mut whitelisted_lints = vec![warnings_lint_name.to_owned(),
intra_link_resolution_failure_name.to_owned(),
missing_docs.to_owned()];

for (lint, _) in &cmd_lints {
whitelisted_lints.push(lint.clone());
}

let lints = lint::builtin::HardwiredLints.get_lints()
.into_iter()
.chain(rustc_lint::SoftLints.get_lints().into_iter())
Expand Down Expand Up @@ -248,9 +259,7 @@ pub fn run_core(search_paths: SearchPaths,
.filter_map(|lint| {
// We don't want to whitelist *all* lints so let's
// ignore those ones.
if lint.name == warnings_lint_name ||
lint.name == intra_link_resolution_failure_name ||
lint.name == missing_docs {
if whitelisted_lints.iter().any(|l| &lint.name == l) {
None
} else {
Some(lint)
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/associated-types-unsized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait Get {
}

fn foo<T:Get>(t: T) {
let x = t.get(); //~ ERROR the size for value values of type
let x = t.get(); //~ ERROR the size for values of type
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/bad-sized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ trait Trait {}
pub fn main() {
let x: Vec<Trait + Sized> = Vec::new();
//~^ ERROR only auto traits can be used as additional traits in a trait object
//~| ERROR the size for value values of type
//~| ERROR the size for value values of type
//~| ERROR the size for values of type
//~| ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-bad-assign-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ pub fn main() {
let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = *z;
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

}
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-bad-assign-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ pub fn main() {
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1`
//~| ERROR the size for value values of type
//~| ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-bad-assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ pub fn main() {
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1`
//~| ERROR the size for value values of type
//~| ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-bad-deep-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pub fn main() {
let f: ([isize; 3],) = ([5, 6, 7],);
let g: &([isize],) = &f;
let h: &(([isize],),) = &(*g,);
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-bad-deep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ pub fn main() {
let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] };
let g: &Fat<[isize]> = &f;
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}
8 changes: 4 additions & 4 deletions src/test/compile-fail/dst-object-from-unsized-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ impl Foo for [u8] {}

fn test1<T: ?Sized + Foo>(t: &T) {
let u: &Foo = t;
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn test2<T: ?Sized + Foo>(t: &T) {
let v: &Foo = t as &Foo;
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn test3() {
let _: &[&Foo] = &["hi"];
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn test4(x: &[u8]) {
let _: &Foo = x as &Foo;
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn main() { }
4 changes: 2 additions & 2 deletions src/test/compile-fail/dst-sized-trait-param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized

impl Foo<[isize]> for usize { }
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

impl Foo<isize> for [usize] { }
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

pub fn main() { }
8 changes: 4 additions & 4 deletions src/test/compile-fail/extern-types-unsized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ fn assert_sized<T>() { }

fn main() {
assert_sized::<A>();
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

assert_sized::<Foo>();
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

assert_sized::<Bar<A>>();
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

assert_sized::<Bar<Bar<A>>>();
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-14366.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

fn main() {
let _x = "test" as &::std::any::Any;
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-15756.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
{
for
&mut something
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
in arg2
{
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-17651.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@

fn main() {
(|| Box::new(*(&[0][..])))();
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-18107.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub trait AbstractRenderer {}

fn _create_render(_: &()) ->
AbstractRenderer
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
{
match 0 {
_ => unimplemented!()
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-18919.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
type FuncType<'f> = Fn(&isize) -> isize + 'f;

fn ho_func(f: Option<FuncType>) {
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-20005.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait From<Src> {
}

trait To {
fn to<Dst>( //~ ERROR the size for value values of type
fn to<Dst>( //~ ERROR the size for values of type
self
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
From::from(self)
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-20433.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ struct The;

impl The {
fn iceman(c: Vec<[i32]>) {}
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-20605.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
for item in *things { *item = 0 }
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-22874.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

struct Table {
rows: [[String]],
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn f(table: &Table) -> &[String] {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-23281.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Struct;

impl Struct {
pub fn function(funs: Vec<Fn() -> ()>) {}
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-24446.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
fn main() {
static foo: Fn() -> u32 = || -> u32 {
//~^ ERROR mismatched types
//~| ERROR the size for value values of type
//~| ERROR the size for values of type
0
};
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-27060-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#[repr(packed)]
pub struct Bad<T: ?Sized> {
data: T, //~ ERROR the size for value values of type
data: T, //~ ERROR the size for values of type
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-27078.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
trait Foo {
const BAR: i32;
fn foo(self) -> &'static i32 {
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
&<Self>::BAR
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-35988.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

enum E {
V([Box<E>]),
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-38954.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
// except according to those terms.

fn _test(ref _p: str) {}
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

fn main() { }
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-41229-ref-str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
// except according to those terms.

pub fn example(ref s: str) {}
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

fn main() {}
4 changes: 2 additions & 2 deletions src/test/compile-fail/issue-42312.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use std::ops::Deref;

pub trait Foo {
fn baz(_: Self::Target) where Self: Deref {}
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

pub fn f(_: ToString) {}
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type

fn main() { }
4 changes: 2 additions & 2 deletions src/test/compile-fail/issue-5883.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ struct Struct {
}

fn new_struct(r: A+'static)
-> Struct { //~^ ERROR the size for value values of type
//~^ ERROR the size for value values of type
-> Struct { //~^ ERROR the size for values of type
//~^ ERROR the size for values of type
Struct { r: r }
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/range-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ pub fn main() {
// Unsized type.
let arr: &[_] = &[1, 2, 3];
let range = *arr..;
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/str-mut-idx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ fn bot<T>() -> T { loop {} }

fn mutate(s: &mut str) {
s[1..2] = bot();
//~^ ERROR the size for value values of type
//~| ERROR the size for value values of type
//~^ ERROR the size for values of type
//~| ERROR the size for values of type
s[1usize] = bot();
//~^ ERROR the type `str` cannot be mutably indexed by `usize`
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/substs-ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ fn foo<'z>() where &'z (): Sized {
//[normal]~| found type `fn() {foo::<'static>}`

<str as Foo<u8>>::bar;
//[verbose]~^ ERROR the size for value values of type
//[normal]~^^ ERROR the size for value values of type
//[verbose]~^ ERROR the size for values of type
//[normal]~^^ ERROR the size for values of type
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait Foo {
// This should emit the less confusing error, not the more confusing one.

fn foo(_x: Foo + Send) {
//~^ ERROR the size for value values of type
//~^ ERROR the size for values of type
}

fn main() { }
Loading

0 comments on commit 989fa05

Please sign in to comment.