Skip to content

Commit 989fa05

Browse files
committed
Auto merge of rust-lang#52245 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - rust-lang#51701 (Better docs for copy_from_slice & clone_from_slice) - rust-lang#52231 (Fix typo in error message E0277) - rust-lang#52233 (Improve lint handling in rustdoc) - rust-lang#52238 (Avoid unwrapping in PanicInfo doc example.) - rust-lang#52241 (Fix typo in E0433 docs) Failed merges: r? @ghost
2 parents ae5b629 + 985c5a7 commit 989fa05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+187
-168
lines changed

src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<T: ?Sized> !Send for *mut T { }
9292
#[stable(feature = "rust1", since = "1.0.0")]
9393
#[lang = "sized"]
9494
#[rustc_on_unimplemented(
95-
message="the size for value values of type `{Self}` cannot be known at compilation time",
95+
message="the size for values of type `{Self}` cannot be known at compilation time",
9696
label="doesn't have a size known at compile-time",
9797
note="to learn more, visit <https://doc.rust-lang.org/book/second-edition/\
9898
ch19-04-advanced-types.html#dynamically-sized-types--sized>",

src/libcore/panic.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ use fmt;
3030
/// use std::panic;
3131
///
3232
/// panic::set_hook(Box::new(|panic_info| {
33-
/// println!("panic occurred: {:?}", panic_info.payload().downcast_ref::<&str>().unwrap());
33+
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
34+
/// println!("panic occurred: {:?}", s);
35+
/// } else {
36+
/// println!("panic occurred");
37+
/// }
3438
/// }));
3539
///
3640
/// panic!("Normal panic");

src/libcore/slice/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,9 @@ impl<T> [T] {
15411541
/// let src = [1, 2, 3, 4];
15421542
/// let mut dst = [0, 0];
15431543
///
1544+
/// // Because the slices have to be the same length,
1545+
/// // we slice the source slice from four elements
1546+
/// // to two. It will panic if we don't do this.
15441547
/// dst.clone_from_slice(&src[2..]);
15451548
///
15461549
/// assert_eq!(src, [1, 2, 3, 4]);
@@ -1607,6 +1610,9 @@ impl<T> [T] {
16071610
/// let src = [1, 2, 3, 4];
16081611
/// let mut dst = [0, 0];
16091612
///
1613+
/// // Because the slices have to be the same length,
1614+
/// // we slice the source slice from four elements
1615+
/// // to two. It will panic if we don't do this.
16101616
/// dst.copy_from_slice(&src[2..]);
16111617
///
16121618
/// assert_eq!(src, [1, 2, 3, 4]);

src/librustc_resolve/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ let map = HashMap::new();
12561256
```
12571257
12581258
Please verify you didn't misspell the type/module's name or that you didn't
1259-
forgot to import it:
1259+
forget to import it:
12601260
12611261
12621262
```

src/librustdoc/core.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ pub fn run_core(search_paths: SearchPaths,
193193
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
194194
let warnings_lint_name = lint::builtin::WARNINGS.name;
195195
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
196+
197+
// In addition to those specific lints, we also need to whitelist those given through
198+
// command line, otherwise they'll get ignored and we don't want that.
199+
let mut whitelisted_lints = vec![warnings_lint_name.to_owned(),
200+
intra_link_resolution_failure_name.to_owned(),
201+
missing_docs.to_owned()];
202+
203+
for (lint, _) in &cmd_lints {
204+
whitelisted_lints.push(lint.clone());
205+
}
206+
196207
let lints = lint::builtin::HardwiredLints.get_lints()
197208
.into_iter()
198209
.chain(rustc_lint::SoftLints.get_lints().into_iter())
@@ -248,9 +259,7 @@ pub fn run_core(search_paths: SearchPaths,
248259
.filter_map(|lint| {
249260
// We don't want to whitelist *all* lints so let's
250261
// ignore those ones.
251-
if lint.name == warnings_lint_name ||
252-
lint.name == intra_link_resolution_failure_name ||
253-
lint.name == missing_docs {
262+
if whitelisted_lints.iter().any(|l| &lint.name == l) {
254263
None
255264
} else {
256265
Some(lint)

src/test/compile-fail/associated-types-unsized.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait Get {
1414
}
1515

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

2020
fn main() {

src/test/compile-fail/bad-sized.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ trait Trait {}
1313
pub fn main() {
1414
let x: Vec<Trait + Sized> = Vec::new();
1515
//~^ ERROR only auto traits can be used as additional traits in a trait object
16-
//~| ERROR the size for value values of type
17-
//~| ERROR the size for value values of type
16+
//~| ERROR the size for values of type
17+
//~| ERROR the size for values of type
1818
}

src/test/compile-fail/dst-bad-assign-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ pub fn main() {
4343
let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
4444
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
4545
f5.ptr = *z;
46-
//~^ ERROR the size for value values of type
46+
//~^ ERROR the size for values of type
4747

4848
}

src/test/compile-fail/dst-bad-assign-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ pub fn main() {
4545
//~| expected type `dyn ToBar`
4646
//~| found type `Bar1`
4747
//~| expected trait ToBar, found struct `Bar1`
48-
//~| ERROR the size for value values of type
48+
//~| ERROR the size for values of type
4949
}

src/test/compile-fail/dst-bad-assign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ pub fn main() {
4747
//~| expected type `dyn ToBar`
4848
//~| found type `Bar1`
4949
//~| expected trait ToBar, found struct `Bar1`
50-
//~| ERROR the size for value values of type
50+
//~| ERROR the size for values of type
5151
}

src/test/compile-fail/dst-bad-deep-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ pub fn main() {
1919
let f: ([isize; 3],) = ([5, 6, 7],);
2020
let g: &([isize],) = &f;
2121
let h: &(([isize],),) = &(*g,);
22-
//~^ ERROR the size for value values of type
22+
//~^ ERROR the size for values of type
2323
}

src/test/compile-fail/dst-bad-deep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ pub fn main() {
2121
let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] };
2222
let g: &Fat<[isize]> = &f;
2323
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
24-
//~^ ERROR the size for value values of type
24+
//~^ ERROR the size for values of type
2525
}

src/test/compile-fail/dst-object-from-unsized-type.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ impl Foo for [u8] {}
1616

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

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

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

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

3737
fn main() { }

src/test/compile-fail/dst-sized-trait-param.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized
1616

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

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

2323
pub fn main() { }

src/test/compile-fail/extern-types-unsized.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ fn assert_sized<T>() { }
3030

3131
fn main() {
3232
assert_sized::<A>();
33-
//~^ ERROR the size for value values of type
33+
//~^ ERROR the size for values of type
3434

3535
assert_sized::<Foo>();
36-
//~^ ERROR the size for value values of type
36+
//~^ ERROR the size for values of type
3737

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

4141
assert_sized::<Bar<Bar<A>>>();
42-
//~^ ERROR the size for value values of type
42+
//~^ ERROR the size for values of type
4343
}

src/test/compile-fail/issue-14366.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn main() {
1212
let _x = "test" as &::std::any::Any;
13-
//~^ ERROR the size for value values of type
13+
//~^ ERROR the size for values of type
1414
}

src/test/compile-fail/issue-15756.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
1515
{
1616
for
1717
&mut something
18-
//~^ ERROR the size for value values of type
18+
//~^ ERROR the size for values of type
1919
in arg2
2020
{
2121
}

src/test/compile-fail/issue-17651.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313

1414
fn main() {
1515
(|| Box::new(*(&[0][..])))();
16-
//~^ ERROR the size for value values of type
16+
//~^ ERROR the size for values of type
1717
}

src/test/compile-fail/issue-18107.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub trait AbstractRenderer {}
1212

1313
fn _create_render(_: &()) ->
1414
AbstractRenderer
15-
//~^ ERROR the size for value values of type
15+
//~^ ERROR the size for values of type
1616
{
1717
match 0 {
1818
_ => unimplemented!()

src/test/compile-fail/issue-18919.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
type FuncType<'f> = Fn(&isize) -> isize + 'f;
1212

1313
fn ho_func(f: Option<FuncType>) {
14-
//~^ ERROR the size for value values of type
14+
//~^ ERROR the size for values of type
1515
}
1616

1717
fn main() {}

src/test/compile-fail/issue-20005.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait From<Src> {
1515
}
1616

1717
trait To {
18-
fn to<Dst>( //~ ERROR the size for value values of type
18+
fn to<Dst>( //~ ERROR the size for values of type
1919
self
2020
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
2121
From::from(self)

src/test/compile-fail/issue-20433.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ struct The;
1414

1515
impl The {
1616
fn iceman(c: Vec<[i32]>) {}
17-
//~^ ERROR the size for value values of type
17+
//~^ ERROR the size for values of type
1818
}

src/test/compile-fail/issue-20605.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

1616
fn main() {}

src/test/compile-fail/issue-22874.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
struct Table {
1212
rows: [[String]],
13-
//~^ ERROR the size for value values of type
13+
//~^ ERROR the size for values of type
1414
}
1515

1616
fn f(table: &Table) -> &[String] {

src/test/compile-fail/issue-23281.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub struct Struct;
1414

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

2020
fn main() {}

src/test/compile-fail/issue-24446.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn main() {
1212
static foo: Fn() -> u32 = || -> u32 {
1313
//~^ ERROR mismatched types
14-
//~| ERROR the size for value values of type
14+
//~| ERROR the size for values of type
1515
0
1616
};
1717
}

src/test/compile-fail/issue-27060-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

1616
fn main() {}

src/test/compile-fail/issue-27078.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
trait Foo {
1414
const BAR: i32;
1515
fn foo(self) -> &'static i32 {
16-
//~^ ERROR the size for value values of type
16+
//~^ ERROR the size for values of type
1717
&<Self>::BAR
1818
}
1919
}

src/test/compile-fail/issue-35988.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
enum E {
1212
V([Box<E>]),
13-
//~^ ERROR the size for value values of type
13+
//~^ ERROR the size for values of type
1414
}
1515

1616
fn main() {}

src/test/compile-fail/issue-38954.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
// except according to those terms.
1010

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

1414
fn main() { }

src/test/compile-fail/issue-41229-ref-str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
// except according to those terms.
1010

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

1414
fn main() {}

src/test/compile-fail/issue-42312.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use std::ops::Deref;
1212

1313
pub trait Foo {
1414
fn baz(_: Self::Target) where Self: Deref {}
15-
//~^ ERROR the size for value values of type
15+
//~^ ERROR the size for values of type
1616
}
1717

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

2121
fn main() { }

src/test/compile-fail/issue-5883.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ struct Struct {
1515
}
1616

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

src/test/compile-fail/range-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ pub fn main() {
2222
// Unsized type.
2323
let arr: &[_] = &[1, 2, 3];
2424
let range = *arr..;
25-
//~^ ERROR the size for value values of type
25+
//~^ ERROR the size for values of type
2626
}

src/test/compile-fail/str-mut-idx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fn bot<T>() -> T { loop {} }
1212

1313
fn mutate(s: &mut str) {
1414
s[1..2] = bot();
15-
//~^ ERROR the size for value values of type
16-
//~| ERROR the size for value values of type
15+
//~^ ERROR the size for values of type
16+
//~| ERROR the size for values of type
1717
s[1usize] = bot();
1818
//~^ ERROR the type `str` cannot be mutably indexed by `usize`
1919
}

src/test/compile-fail/substs-ppaux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ fn foo<'z>() where &'z (): Sized {
5656
//[normal]~| found type `fn() {foo::<'static>}`
5757

5858
<str as Foo<u8>>::bar;
59-
//[verbose]~^ ERROR the size for value values of type
60-
//[normal]~^^ ERROR the size for value values of type
59+
//[verbose]~^ ERROR the size for values of type
60+
//[normal]~^^ ERROR the size for values of type
6161
}

src/test/compile-fail/trait-bounds-not-on-bare-trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait Foo {
1515
// This should emit the less confusing error, not the more confusing one.
1616

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

2121
fn main() { }

0 commit comments

Comments
 (0)