Skip to content

Commit cc22428

Browse files
committed
Auto merge of #52802 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests Successful merges: - #52702 (Suggest fix when encountering different mutability from impl to trait) - #52703 (Improve a few vectors - calculate capacity or build from iterators) - #52740 (Suggest underscore when using dashes in crate namet push fork) - #52759 (Impl Send & Sync for JoinHandle) - #52760 (rustc_metadata: test loading atoi instead of cos) - #52763 (Omit the vendor component in Fuchsia triple) - #52765 (Remove unused "-Zenable_nonzeroing_move_hints" flag) - #52769 (Incorporate a stray test) - #52777 (Fix doc comment for 'ptr::copy_to' method) - #52779 (revert accidental atty downgrade) - #52781 (Use a slice where a vector is not necessary) Failed merges: r? @ghost
2 parents 0560747 + 59f8422 commit cc22428

File tree

43 files changed

+185
-113
lines changed

Some content is hidden

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

43 files changed

+185
-113
lines changed

src/Cargo.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ dependencies = [
8787

8888
[[package]]
8989
name = "atty"
90-
version = "0.2.10"
90+
version = "0.2.11"
9191
source = "registry+https://github.com/rust-lang/crates.io-index"
9292
dependencies = [
9393
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -187,7 +187,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
187187
name = "cargo"
188188
version = "0.30.0"
189189
dependencies = [
190-
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
190+
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
191191
"bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
192192
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
193193
"core-foundation 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -303,7 +303,7 @@ version = "2.32.0"
303303
source = "registry+https://github.com/rust-lang/crates.io-index"
304304
dependencies = [
305305
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
306-
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
306+
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
307307
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
308308
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
309309
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -622,7 +622,7 @@ name = "env_logger"
622622
version = "0.5.10"
623623
source = "registry+https://github.com/rust-lang/crates.io-index"
624624
dependencies = [
625-
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
625+
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
626626
"humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
627627
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
628628
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1844,7 +1844,7 @@ name = "rustc-ap-rustc_errors"
18441844
version = "182.0.0"
18451845
source = "registry+https://github.com/rust-lang/crates.io-index"
18461846
dependencies = [
1847-
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
1847+
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
18481848
"rustc-ap-rustc_data_structures 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
18491849
"rustc-ap-serialize 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
18501850
"rustc-ap-syntax_pos 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2097,7 +2097,7 @@ dependencies = [
20972097
name = "rustc_errors"
20982098
version = "0.0.0"
20992099
dependencies = [
2100-
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
2100+
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
21012101
"rustc_data_structures 0.0.0",
21022102
"serialize 0.0.0",
21032103
"syntax_pos 0.0.0",
@@ -3056,7 +3056,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
30563056
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
30573057
"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"
30583058
"checksum assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98589b0e465a6c510d95fceebd365bb79bedece7f6e18a480897f2015f85ec51"
3059-
"checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1"
3059+
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
30603060
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
30613061
"checksum backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "bff67d0c06556c0b8e6b5f090f0eac52d950d9dfd1d35ba04e4ca3543eaf6a7e"
30623062
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"

src/ci/docker/dist-various-2/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ COPY scripts/sccache.sh /scripts/
3434
RUN sh /scripts/sccache.sh
3535

3636
ENV \
37-
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
38-
CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \
39-
CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \
40-
AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \
41-
CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \
42-
CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++ \
37+
AR_x86_64_fuchsia=x86_64-fuchsia-ar \
38+
CC_x86_64_fuchsia=x86_64-fuchsia-clang \
39+
CXX_x86_64_fuchsia=x86_64-fuchsia-clang++ \
40+
AR_aarch64_fuchsia=aarch64-fuchsia-ar \
41+
CC_aarch64_fuchsia=aarch64-fuchsia-clang \
42+
CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \
4343
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
4444
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
4545
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
4646
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
4747
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
4848
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++
4949

50-
ENV TARGETS=x86_64-unknown-fuchsia
51-
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
50+
ENV TARGETS=x86_64-fuchsia
51+
ENV TARGETS=$TARGETS,aarch64-fuchsia
5252
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
5353
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
5454
ENV TARGETS=$TARGETS,x86_64-sun-solaris

src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ build() {
3939
esac
4040

4141
hide_output make -j$(getconf _NPROCESSORS_ONLN) $tgt
42-
dst=/usr/local/${arch}-unknown-fuchsia
42+
dst=/usr/local/${arch}-fuchsia
4343
mkdir -p $dst
4444
cp -a build-${tgt}/sysroot/include $dst/
4545
cp -a build-${tgt}/sysroot/lib $dst/
@@ -55,11 +55,11 @@ rm -rf zircon
5555

5656
for arch in x86_64 aarch64; do
5757
for tool in clang clang++; do
58-
cat >/usr/local/bin/${arch}-unknown-fuchsia-${tool} <<EOF
58+
cat >/usr/local/bin/${arch}-fuchsia-${tool} <<EOF
5959
#!/bin/sh
60-
${tool} --target=${arch}-unknown-fuchsia --sysroot=/usr/local/${arch}-unknown-fuchsia "\$@"
60+
${tool} --target=${arch}-fuchsia --sysroot=/usr/local/${arch}-fuchsia "\$@"
6161
EOF
62-
chmod +x /usr/local/bin/${arch}-unknown-fuchsia-${tool}
62+
chmod +x /usr/local/bin/${arch}-fuchsia-${tool}
6363
done
64-
ln -s /usr/local/bin/llvm-ar /usr/local/bin/${arch}-unknown-fuchsia-ar
64+
ln -s /usr/local/bin/llvm-ar /usr/local/bin/${arch}-fuchsia-ar
6565
done

src/liballoc/tests/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#![feature(try_reserve)]
2525
#![feature(unboxed_closures)]
2626
#![feature(exact_chunks)]
27+
#![feature(repeat_generic_slice)]
2728

2829
extern crate alloc_system;
2930
extern crate core;

src/liballoc/tests/slice.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,3 +1529,14 @@ fn panic_safe() {
15291529
}
15301530
}
15311531
}
1532+
1533+
#[test]
1534+
fn repeat_generic_slice() {
1535+
assert_eq!([1, 2].repeat(2), vec![1, 2, 1, 2]);
1536+
assert_eq!([1, 2, 3, 4].repeat(0), vec![]);
1537+
assert_eq!([1, 2, 3, 4].repeat(1), vec![1, 2, 3, 4]);
1538+
assert_eq!(
1539+
[1, 2, 3, 4].repeat(3),
1540+
vec![1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
1541+
);
1542+
}

src/libcore/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,8 @@ impl<T: ?Sized> *const T {
11621162
///
11631163
/// Care must be taken with the ownership of `self` and `dest`.
11641164
/// This method semantically moves the values of `self` into `dest`.
1165-
/// However it does not drop the contents of `self`, or prevent the contents
1166-
/// of `dest` from being dropped or used.
1165+
/// However it does not drop the contents of `dest`, or prevent the contents
1166+
/// of `self` from being dropped or used.
11671167
///
11681168
/// # Examples
11691169
///

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ impl<'a> LoweringContext<'a> {
746746
// This is used to track which lifetimes have already been defined, and
747747
// which are new in-band lifetimes that need to have a definition created
748748
// for them.
749-
fn with_in_scope_lifetime_defs<T, F>(&mut self, params: &Vec<GenericParam>, f: F) -> T
749+
fn with_in_scope_lifetime_defs<T, F>(&mut self, params: &[GenericParam], f: F) -> T
750750
where
751751
F: FnOnce(&mut LoweringContext) -> T,
752752
{
@@ -2237,7 +2237,7 @@ impl<'a> LoweringContext<'a> {
22372237

22382238
fn lower_generic_params(
22392239
&mut self,
2240-
params: &Vec<GenericParam>,
2240+
params: &[GenericParam],
22412241
add_bounds: &NodeMap<Vec<GenericBound>>,
22422242
mut itctx: ImplTraitContext,
22432243
) -> hir::HirVec<hir::GenericParam> {

src/librustc/hir/map/hir_id_validator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> {
105105
.collect();
106106

107107
// Try to map those to something more useful
108-
let mut missing_items = vec![];
108+
let mut missing_items = Vec::with_capacity(missing.len());
109109

110110
for local_id in missing {
111111
let hir_id = HirId {

src/librustc/ich/hcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
396396
pub fn hash_stable_trait_impls<'a, 'gcx, W, R>(
397397
hcx: &mut StableHashingContext<'a>,
398398
hasher: &mut StableHasher<W>,
399-
blanket_impls: &Vec<DefId>,
399+
blanket_impls: &[DefId],
400400
non_blanket_impls: &HashMap<fast_reject::SimplifiedType, Vec<DefId>, R>)
401401
where W: StableHasherResult,
402402
R: std_hash::BuildHasher,

src/librustc/infer/outlives/obligations.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,7 @@ where
505505
}
506506

507507
fn recursive_type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
508-
let mut bounds = vec![];
509-
510-
for subty in ty.walk_shallow() {
511-
bounds.push(self.type_bound(subty));
512-
}
508+
let mut bounds = ty.walk_shallow().map(|subty| self.type_bound(subty)).collect::<Vec<_>>();
513509

514510
let mut regions = ty.regions();
515511
regions.retain(|r| !r.is_late_bound()); // ignore late-bound regions

src/librustc/lint/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl LintStore {
219219
}
220220
}
221221

222-
let mut future_incompatible = vec![];
222+
let mut future_incompatible = Vec::with_capacity(lints.len());
223223
for lint in lints {
224224
future_incompatible.push(lint.id);
225225
self.future_incompatible.insert(lint.id, lint);

src/librustc/session/config.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,8 +1247,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12471247
"for every macro invocation, print its name and arguments"),
12481248
debug_macros: bool = (false, parse_bool, [TRACKED],
12491249
"emit line numbers debug info inside macros"),
1250-
enable_nonzeroing_move_hints: bool = (false, parse_bool, [TRACKED],
1251-
"force nonzeroing move optimization on"),
12521250
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
12531251
"don't clear the hygiene data after analysis"),
12541252
keep_ast: bool = (false, parse_bool, [UNTRACKED],
@@ -3168,10 +3166,6 @@ mod tests {
31683166
opts.debugging_opts.force_overflow_checks = Some(true);
31693167
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
31703168

3171-
opts = reference.clone();
3172-
opts.debugging_opts.enable_nonzeroing_move_hints = true;
3173-
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
3174-
31753169
opts = reference.clone();
31763170
opts.debugging_opts.show_span = Some(String::from("abc"));
31773171
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

src/librustc/session/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,6 @@ impl Session {
624624
pub fn unstable_options(&self) -> bool {
625625
self.opts.debugging_opts.unstable_options
626626
}
627-
pub fn nonzeroing_move_hints(&self) -> bool {
628-
self.opts.debugging_opts.enable_nonzeroing_move_hints
629-
}
630627
pub fn overflow_checks(&self) -> bool {
631628
self.opts
632629
.cg

src/librustc/traits/error_reporting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use syntax_pos::{DUMMY_SP, Span};
4848

4949
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
5050
pub fn report_fulfillment_errors(&self,
51-
errors: &Vec<FulfillmentError<'tcx>>,
51+
errors: &[FulfillmentError<'tcx>],
5252
body_id: Option<hir::BodyId>,
5353
fallback_has_occurred: bool) {
5454
#[derive(Debug)]
@@ -1015,7 +1015,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10151015
) -> DiagnosticBuilder<'tcx> {
10161016
let kind = if is_closure { "closure" } else { "function" };
10171017

1018-
let args_str = |arguments: &Vec<ArgKind>, other: &Vec<ArgKind>| {
1018+
let args_str = |arguments: &[ArgKind], other: &[ArgKind]| {
10191019
let arg_length = arguments.len();
10201020
let distinct = match &other[..] {
10211021
&[ArgKind::Tuple(..)] => true,

src/librustc/traits/object_safety.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
9898
pub fn astconv_object_safety_violations(self, trait_def_id: DefId)
9999
-> Vec<ObjectSafetyViolation>
100100
{
101-
let mut violations = vec![];
102-
103-
for def_id in traits::supertrait_def_ids(self, trait_def_id) {
104-
if self.predicates_reference_self(def_id, true) {
105-
violations.push(ObjectSafetyViolation::SupertraitSelf);
106-
}
107-
}
101+
let violations = traits::supertrait_def_ids(self, trait_def_id)
102+
.filter(|&def_id| self.predicates_reference_self(def_id, true))
103+
.map(|_| ObjectSafetyViolation::SupertraitSelf)
104+
.collect();
108105

109106
debug!("astconv_object_safety_violations(trait_def_id={:?}) = {:?}",
110107
trait_def_id,

src/librustc_borrowck/borrowck/gather_loans/move_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct GroupedMoveErrors<'tcx> {
6868
move_to_places: Vec<MovePlace<'tcx>>
6969
}
7070

71-
fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &Vec<MoveError<'tcx>>) {
71+
fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &[MoveError<'tcx>]) {
7272
let grouped_errors = group_errors_with_same_origin(errors);
7373
for error in &grouped_errors {
7474
let mut err = report_cannot_move_out_of(bccx, error.move_from.clone());
@@ -103,7 +103,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &Vec<Move
103103
}
104104
}
105105

106-
fn group_errors_with_same_origin<'tcx>(errors: &Vec<MoveError<'tcx>>)
106+
fn group_errors_with_same_origin<'tcx>(errors: &[MoveError<'tcx>])
107107
-> Vec<GroupedMoveErrors<'tcx>> {
108108
let mut grouped_errors = Vec::new();
109109
for error in errors {

src/librustc_codegen_llvm/back/link.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use std::env;
4040
use std::fmt;
4141
use std::fs;
4242
use std::io;
43+
use std::iter;
4344
use std::path::{Path, PathBuf};
4445
use std::process::{Output, Stdio};
4546
use std::str;
@@ -885,9 +886,9 @@ fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdir: &
885886
}
886887
let file = tmpdir.join("linker-arguments");
887888
let bytes = if sess.target.target.options.is_like_msvc {
888-
let mut out = vec![];
889+
let mut out = Vec::with_capacity((1 + args.len()) * 2);
889890
// start the stream with a UTF-16 BOM
890-
for c in vec![0xFEFF].into_iter().chain(args.encode_utf16()) {
891+
for c in iter::once(0xFEFF).chain(args.encode_utf16()) {
891892
// encode in little endian
892893
out.push(c as u8);
893894
out.push((c >> 8) as u8);

src/librustc_driver/driver.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ fn generated_output_paths(
13951395

13961396
// Runs `f` on every output file path and returns the first non-None result, or None if `f`
13971397
// returns None for every file path.
1398-
fn check_output<F, T>(output_paths: &Vec<PathBuf>, f: F) -> Option<T>
1398+
fn check_output<F, T>(output_paths: &[PathBuf], f: F) -> Option<T>
13991399
where
14001400
F: Fn(&PathBuf) -> Option<T>,
14011401
{
@@ -1407,7 +1407,7 @@ where
14071407
None
14081408
}
14091409

1410-
pub fn output_contains_path(output_paths: &Vec<PathBuf>, input_path: &PathBuf) -> bool {
1410+
pub fn output_contains_path(output_paths: &[PathBuf], input_path: &PathBuf) -> bool {
14111411
let input_path = input_path.canonicalize().ok();
14121412
if input_path.is_none() {
14131413
return false;
@@ -1422,7 +1422,7 @@ pub fn output_contains_path(output_paths: &Vec<PathBuf>, input_path: &PathBuf) -
14221422
check_output(output_paths, check).is_some()
14231423
}
14241424

1425-
pub fn output_conflicts_with_dir(output_paths: &Vec<PathBuf>) -> Option<PathBuf> {
1425+
pub fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option<PathBuf> {
14261426
let check = |output_path: &PathBuf| {
14271427
if output_path.is_dir() {
14281428
Some(output_path.clone())
@@ -1433,7 +1433,7 @@ pub fn output_conflicts_with_dir(output_paths: &Vec<PathBuf>) -> Option<PathBuf>
14331433
check_output(output_paths, check)
14341434
}
14351435

1436-
fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &Vec<PathBuf>) {
1436+
fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[PathBuf]) {
14371437
// Write out dependency rules to the dep-info file if requested
14381438
if !sess.opts.output_types.contains_key(&OutputType::DepInfo) {
14391439
return;

src/librustc_driver/profile/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct StackFrame {
6262
pub traces: Vec<trace::Rec>,
6363
}
6464

65-
fn total_duration(traces: &Vec<trace::Rec>) -> Duration {
65+
fn total_duration(traces: &[trace::Rec]) -> Duration {
6666
let mut sum : Duration = Duration::new(0,0);
6767
for t in traces.iter() { sum += t.dur_total; }
6868
return sum

src/librustc_driver/profile/trace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn html_of_fraction(frac: f64) -> (String, String) {
107107
else { (format!("< 0.1%", ), css) }
108108
}
109109

110-
fn total_duration(traces: &Vec<Rec>) -> Duration {
110+
fn total_duration(traces: &[Rec]) -> Duration {
111111
let mut sum : Duration = Duration::new(0,0);
112112
for t in traces.iter() {
113113
sum += t.dur_total;
@@ -123,7 +123,7 @@ fn duration_div(nom: Duration, den: Duration) -> f64 {
123123
to_nanos(nom) as f64 / to_nanos(den) as f64
124124
}
125125

126-
fn write_traces_rec(file: &mut File, traces: &Vec<Rec>, total: Duration, depth: usize) {
126+
fn write_traces_rec(file: &mut File, traces: &[Rec], total: Duration, depth: usize) {
127127
for t in traces {
128128
let (eff_text, eff_css_classes) = html_of_effect(&t.effect);
129129
let (dur_text, dur_css_classes) = html_of_duration(&t.start, &t.dur_total);
@@ -149,7 +149,7 @@ fn write_traces_rec(file: &mut File, traces: &Vec<Rec>, total: Duration, depth:
149149
}
150150
}
151151

152-
fn compute_counts_rec(counts: &mut HashMap<String,QueryMetric>, traces: &Vec<Rec>) {
152+
fn compute_counts_rec(counts: &mut HashMap<String,QueryMetric>, traces: &[Rec]) {
153153
for t in traces.iter() {
154154
match t.effect {
155155
Effect::TimeBegin(ref msg) => {
@@ -218,7 +218,7 @@ pub fn write_counts(count_file: &mut File, counts: &mut HashMap<String,QueryMetr
218218
}
219219
}
220220

221-
pub fn write_traces(html_file: &mut File, counts_file: &mut File, traces: &Vec<Rec>) {
221+
pub fn write_traces(html_file: &mut File, counts_file: &mut File, traces: &[Rec]) {
222222
let capacity = traces.iter().fold(0, |acc, t| acc + 1 + t.extent.len());
223223
let mut counts : HashMap<String, QueryMetric> = HashMap::with_capacity(capacity);
224224
compute_counts_rec(&mut counts, traces);

0 commit comments

Comments
 (0)