Skip to content

Commit d0dc9ef

Browse files
committed
Auto merge of #105876 - matthiaskrgr:rollup-a9dgzjt, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #96584 (Fix `x setup -h -v` should work) - #105420 (Remove dead code after destination propagation) - #105844 (Make the x tool use the x and x.ps1 scripts) - #105854 (remove redundant clone) - #105858 (Another `as_chunks` example) - #105870 (avoid .into() conversion to identical types) - #105875 (don't destuct references just to reborrow) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 37efc81 + 2237977 commit d0dc9ef

File tree

42 files changed

+287
-131
lines changed

Some content is hidden

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

42 files changed

+287
-131
lines changed

compiler/rustc_builtin_macros/src/global_allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn expand(
3535
(item, true, ecx.with_def_site_ctxt(ty.span))
3636
} else {
3737
ecx.sess.parse_sess.span_diagnostic.span_err(item.span(), "allocators must be statics");
38-
return vec![orig_item.clone()]
38+
return vec![orig_item];
3939
};
4040

4141
// Generate a bunch of new items using the AllocFnFactory

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ pub fn expand_test_or_bench(
239239
cx.attr_nested_word(sym::cfg, sym::test, attr_sp),
240240
// #[rustc_test_marker = "test_case_sort_key"]
241241
cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp),
242-
]
243-
.into(),
242+
],
244243
// const $ident: test::TestDescAndFn =
245244
ast::ItemKind::Const(
246245
ast::Defaultness::Final,

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ fn thin_lto(
425425
info!("going for that thin, thin LTO");
426426

427427
let green_modules: FxHashMap<_, _> =
428-
cached_modules.iter().map(|&(_, ref wp)| (wp.cgu_name.clone(), wp.clone())).collect();
428+
cached_modules.iter().map(|(_, wp)| (wp.cgu_name.clone(), wp.clone())).collect();
429429

430430
let full_scope_len = modules.len() + serialized_modules.len() + cached_modules.len();
431431
let mut thin_buffers = Vec::with_capacity(modules.len());

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ fn link_natively<'a>(
722722

723723
linker::disable_localization(&mut cmd);
724724

725-
for &(ref k, ref v) in sess.target.link_env.as_ref() {
725+
for (k, v) in sess.target.link_env.as_ref() {
726726
cmd.env(k.as_ref(), v.as_ref());
727727
}
728728
for k in sess.target.link_env_remove.as_ref() {

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub fn get_linker<'a>(
108108
if sess.target.is_like_msvc {
109109
if let Some(ref tool) = msvc_tool {
110110
cmd.args(tool.args());
111-
for &(ref k, ref v) in tool.env() {
111+
for (k, v) in tool.env() {
112112
if k == "PATH" {
113113
new_path.extend(env::split_paths(v));
114114
msvc_changed_path = true;

compiler/rustc_const_eval/src/interpret/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
332332
Immediate::new_slice(ptr, length.eval_usize(*self.tcx, self.param_env), self);
333333
self.write_immediate(val, dest)
334334
}
335-
(&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => {
335+
(ty::Dynamic(data_a, ..), ty::Dynamic(data_b, ..)) => {
336336
let val = self.read_immediate(src)?;
337337
if data_a.principal() == data_b.principal() {
338338
// A NOP cast that doesn't actually change anything, should be allowed even with mismatching vtables.

compiler/rustc_const_eval/src/interpret/operand.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub enum Immediate<Prov: Provenance = AllocId> {
3939
impl<Prov: Provenance> From<Scalar<Prov>> for Immediate<Prov> {
4040
#[inline(always)]
4141
fn from(val: Scalar<Prov>) -> Self {
42-
Immediate::Scalar(val.into())
42+
Immediate::Scalar(val)
4343
}
4444
}
4545

@@ -53,15 +53,15 @@ impl<Prov: Provenance> Immediate<Prov> {
5353
}
5454

5555
pub fn new_slice(val: Scalar<Prov>, len: u64, cx: &impl HasDataLayout) -> Self {
56-
Immediate::ScalarPair(val.into(), Scalar::from_machine_usize(len, cx).into())
56+
Immediate::ScalarPair(val, Scalar::from_machine_usize(len, cx))
5757
}
5858

5959
pub fn new_dyn_trait(
6060
val: Scalar<Prov>,
6161
vtable: Pointer<Option<Prov>>,
6262
cx: &impl HasDataLayout,
6363
) -> Self {
64-
Immediate::ScalarPair(val.into(), Scalar::from_maybe_pointer(vtable, cx))
64+
Immediate::ScalarPair(val, Scalar::from_maybe_pointer(vtable, cx))
6565
}
6666

6767
#[inline]
@@ -341,10 +341,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
341341
alloc_range(b_offset, b_size),
342342
/*read_provenance*/ b.is_ptr(),
343343
)?;
344-
Some(ImmTy {
345-
imm: Immediate::ScalarPair(a_val.into(), b_val.into()),
346-
layout: mplace.layout,
347-
})
344+
Some(ImmTy { imm: Immediate::ScalarPair(a_val, b_val), layout: mplace.layout })
348345
}
349346
_ => {
350347
// Neither a scalar nor scalar pair.

compiler/rustc_const_eval/src/interpret/operator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
3636
if let Abi::ScalarPair(..) = dest.layout.abi {
3737
// We can use the optimized path and avoid `place_field` (which might do
3838
// `force_allocation`).
39-
let pair = Immediate::ScalarPair(val.into(), Scalar::from_bool(overflowed).into());
39+
let pair = Immediate::ScalarPair(val, Scalar::from_bool(overflowed));
4040
self.write_immediate(pair, dest)?;
4141
} else {
4242
assert!(self.tcx.sess.opts.unstable_opts.randomize_layout);

compiler/rustc_const_eval/src/interpret/place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<Prov: Provenance> MemPlace<Prov> {
141141
match self.meta {
142142
MemPlaceMeta::None => Immediate::from(Scalar::from_maybe_pointer(self.ptr, cx)),
143143
MemPlaceMeta::Meta(meta) => {
144-
Immediate::ScalarPair(Scalar::from_maybe_pointer(self.ptr, cx).into(), meta.into())
144+
Immediate::ScalarPair(Scalar::from_maybe_pointer(self.ptr, cx), meta)
145145
}
146146
}
147147
}

compiler/rustc_expand/src/mbe/macro_check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ fn check_nested_occurrences(
468468
// We check that the meta-variable is correctly used.
469469
check_occurrences(sess, node_id, tt, macros, binders, ops, valid);
470470
}
471-
(NestedMacroState::MacroName, &TokenTree::Delimited(_, ref del))
471+
(NestedMacroState::MacroName, TokenTree::Delimited(_, del))
472472
if del.delim == Delimiter::Parenthesis =>
473473
{
474474
state = NestedMacroState::MacroNameParen;
@@ -483,7 +483,7 @@ fn check_nested_occurrences(
483483
valid,
484484
);
485485
}
486-
(NestedMacroState::MacroNameParen, &TokenTree::Delimited(_, ref del))
486+
(NestedMacroState::MacroNameParen, TokenTree::Delimited(_, del))
487487
if del.delim == Delimiter::Brace =>
488488
{
489489
state = NestedMacroState::Empty;

0 commit comments

Comments
 (0)