Skip to content

Commit 989fa05

Browse files
committed
Auto merge of #52245 - GuillaumeGomez:rollup, r=GuillaumeGomez
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
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
}

0 commit comments

Comments
 (0)