Skip to content

Commit 3ea2491

Browse files
committed
Auto merge of #50893 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests Successful merges: - #50531 (Cleanup uses of TypeIdHasher and replace them with StableHasher) - #50819 (Fix potential divide by zero) - #50827 (Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97) - #50829 (CheckLoopVisitor: also visit break expressions) - #50854 (in which the unused shorthand field pattern debacle/saga continues) - #50858 (Reorder description for snippets in rustdoc documentation) - #50883 (Fix warning when building stage0 libcore) - #50889 (Update clippy) Failed merges:
2 parents a308575 + ada5fee commit 3ea2491

File tree

19 files changed

+271
-308
lines changed

19 files changed

+271
-308
lines changed

src/Cargo.lock

+25-3
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ dependencies = [
288288

289289
[[package]]
290290
name = "clippy"
291-
version = "0.0.200"
291+
version = "0.0.202"
292292
dependencies = [
293293
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
294294
"cargo_metadata 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
295295
"clippy-mini-macro-test 0.2.0",
296-
"clippy_lints 0.0.200",
296+
"clippy_lints 0.0.202",
297297
"compiletest_rs 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
298298
"derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
299299
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -311,6 +311,27 @@ version = "0.2.0"
311311
[[package]]
312312
name = "clippy_lints"
313313
version = "0.0.200"
314+
source = "registry+https://github.com/rust-lang/crates.io-index"
315+
dependencies = [
316+
"cargo_metadata 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
317+
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
318+
"itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
319+
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
320+
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
321+
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
322+
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
323+
"regex-syntax 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
324+
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
325+
"serde 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
326+
"serde_derive 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
327+
"toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
328+
"unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
329+
"url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
330+
]
331+
332+
[[package]]
333+
name = "clippy_lints"
334+
version = "0.0.202"
314335
dependencies = [
315336
"cargo_metadata 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
316337
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1624,7 +1645,7 @@ version = "0.128.0"
16241645
dependencies = [
16251646
"cargo 0.29.0",
16261647
"cargo_metadata 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
1627-
"clippy_lints 0.0.200",
1648+
"clippy_lints 0.0.200 (registry+https://github.com/rust-lang/crates.io-index)",
16281649
"env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
16291650
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
16301651
"json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2978,6 +2999,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
29782999
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
29793000
"checksum chrono 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ba5f60682a4c264e7f8d77b82e7788938a76befdf949d4a98026d19099c9d873"
29803001
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
3002+
"checksum clippy_lints 0.0.200 (registry+https://github.com/rust-lang/crates.io-index)" = "d2432663f6bdb90255dcf9df5ca504f99b575bb471281591138f62f9d31f863b"
29813003
"checksum cmake 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5cf678ceebedde428000cb3a34465cf3606d1a48da17014948a916deac39da7c"
29823004
"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
29833005
"checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"

src/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ cargo = { path = "tools/cargo" }
6464
# RLS depends on `rustfmt` from crates.io, so we put this in a `[patch]` section
6565
# for crates.io
6666
rustfmt-nightly = { path = "tools/rustfmt" }
67-
clippy_lints = { path = "tools/clippy/clippy_lints" }

src/doc/rustdoc/src/documentation-tests.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,10 @@ not actually pass as a test.
268268
# fn foo() {}
269269
```
270270

271-
`compile_fail` tells `rustdoc` that the compilation should fail. If it
272-
compiles, then the test will fail. However please note that code failing
273-
with the current Rust release may work in a future release, as new features
274-
are added.
271+
The `no_run` attribute will compile your code, but not run it. This is
272+
important for examples such as "Here's how to retrieve a web page,"
273+
which you would want to ensure compiles, but might be run in a test
274+
environment that has no network access.
275275

276276
```text
277277
/// ```compile_fail
@@ -280,7 +280,7 @@ are added.
280280
/// ```
281281
```
282282

283-
The `no_run` attribute will compile your code, but not run it. This is
284-
important for examples such as "Here's how to retrieve a web page,"
285-
which you would want to ensure compiles, but might be run in a test
286-
environment that has no network access.
283+
`compile_fail` tells `rustdoc` that the compilation should fail. If it
284+
compiles, then the test will fail. However please note that code failing
285+
with the current Rust release may work in a future release, as new features
286+
are added.

src/libcore/slice/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,7 @@ impl<T> [T] {
16981698
}
16991699

17001700
/// Function to calculate lenghts of the middle and trailing slice for `align_to{,_mut}`.
1701+
#[cfg(not(stage0))]
17011702
fn align_to_offsets<U>(&self) -> (usize, usize) {
17021703
// What we gonna do about `rest` is figure out what multiple of `U`s we can put in a
17031704
// lowest number of `T`s. And how many `T`s we need for each such "multiple".

src/librustc/ich/impls_ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ for ty::RegionKind {
132132
ty::ReLateBound(..) |
133133
ty::ReVar(..) |
134134
ty::ReSkolemized(..) => {
135-
bug!("TypeIdHasher: unexpected region {:?}", *self)
135+
bug!("StableHasher: unexpected region {:?}", *self)
136136
}
137137
}
138138
}

src/librustc/middle/liveness.rs

+50-56
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ use std::io::prelude::*;
117117
use std::io;
118118
use std::rc::Rc;
119119
use syntax::ast::{self, NodeId};
120+
use syntax::ptr::P;
120121
use syntax::symbol::keywords;
121122
use syntax_pos::Span;
122123

@@ -398,72 +399,65 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>,
398399
lsets.warn_about_unused_args(body, entry_ln);
399400
}
400401

401-
fn visit_local<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, local: &'tcx hir::Local) {
402-
local.pat.each_binding(|_, p_id, sp, path1| {
403-
debug!("adding local variable {}", p_id);
402+
fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, pat: &P<hir::Pat>) {
403+
// For struct patterns, take note of which fields used shorthand
404+
// (`x` rather than `x: x`).
405+
//
406+
// FIXME: according to the rust-lang-nursery/rustc-guide book, `NodeId`s are to be
407+
// phased out in favor of `HirId`s; however, we need to match the signature of
408+
// `each_binding`, which uses `NodeIds`.
409+
let mut shorthand_field_ids = NodeSet();
410+
let mut pats = VecDeque::new();
411+
pats.push_back(pat);
412+
while let Some(pat) = pats.pop_front() {
413+
use hir::PatKind::*;
414+
match pat.node {
415+
Binding(_, _, _, ref inner_pat) => {
416+
pats.extend(inner_pat.iter());
417+
}
418+
Struct(_, ref fields, _) => {
419+
for field in fields {
420+
if field.node.is_shorthand {
421+
shorthand_field_ids.insert(field.node.pat.id);
422+
}
423+
}
424+
}
425+
Ref(ref inner_pat, _) |
426+
Box(ref inner_pat) => {
427+
pats.push_back(inner_pat);
428+
}
429+
TupleStruct(_, ref inner_pats, _) |
430+
Tuple(ref inner_pats, _) => {
431+
pats.extend(inner_pats.iter());
432+
}
433+
Slice(ref pre_pats, ref inner_pat, ref post_pats) => {
434+
pats.extend(pre_pats.iter());
435+
pats.extend(inner_pat.iter());
436+
pats.extend(post_pats.iter());
437+
}
438+
_ => {}
439+
}
440+
}
441+
442+
pat.each_binding(|_bm, p_id, _sp, path1| {
404443
let name = path1.node;
405-
ir.add_live_node_for_node(p_id, VarDefNode(sp));
444+
ir.add_live_node_for_node(p_id, VarDefNode(path1.span));
406445
ir.add_variable(Local(LocalInfo {
407446
id: p_id,
408447
name,
409-
is_shorthand: false,
448+
is_shorthand: shorthand_field_ids.contains(&p_id)
410449
}));
411450
});
451+
}
452+
453+
fn visit_local<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, local: &'tcx hir::Local) {
454+
add_from_pat(ir, &local.pat);
412455
intravisit::walk_local(ir, local);
413456
}
414457

415458
fn visit_arm<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, arm: &'tcx hir::Arm) {
416-
for mut pat in &arm.pats {
417-
// For struct patterns, take note of which fields used shorthand
418-
// (`x` rather than `x: x`).
419-
//
420-
// FIXME: according to the rust-lang-nursery/rustc-guide book, `NodeId`s are to be
421-
// phased out in favor of `HirId`s; however, we need to match the signature of
422-
// `each_binding`, which uses `NodeIds`.
423-
let mut shorthand_field_ids = NodeSet();
424-
let mut pats = VecDeque::new();
425-
pats.push_back(pat);
426-
while let Some(pat) = pats.pop_front() {
427-
use hir::PatKind::*;
428-
match pat.node {
429-
Binding(_, _, _, ref inner_pat) => {
430-
pats.extend(inner_pat.iter());
431-
}
432-
Struct(_, ref fields, _) => {
433-
for field in fields {
434-
if field.node.is_shorthand {
435-
shorthand_field_ids.insert(field.node.pat.id);
436-
}
437-
}
438-
}
439-
Ref(ref inner_pat, _) |
440-
Box(ref inner_pat) => {
441-
pats.push_back(inner_pat);
442-
}
443-
TupleStruct(_, ref inner_pats, _) |
444-
Tuple(ref inner_pats, _) => {
445-
pats.extend(inner_pats.iter());
446-
}
447-
Slice(ref pre_pats, ref inner_pat, ref post_pats) => {
448-
pats.extend(pre_pats.iter());
449-
pats.extend(inner_pat.iter());
450-
pats.extend(post_pats.iter());
451-
}
452-
_ => {}
453-
}
454-
}
455-
456-
pat.each_binding(|bm, p_id, _sp, path1| {
457-
debug!("adding local variable {} from match with bm {:?}",
458-
p_id, bm);
459-
let name = path1.node;
460-
ir.add_live_node_for_node(p_id, VarDefNode(path1.span));
461-
ir.add_variable(Local(LocalInfo {
462-
id: p_id,
463-
name: name,
464-
is_shorthand: shorthand_field_ids.contains(&p_id)
465-
}));
466-
})
459+
for pat in &arm.pats {
460+
add_from_pat(ir, pat);
467461
}
468462
intravisit::walk_arm(ir, arm);
469463
}

0 commit comments

Comments
 (0)