Skip to content

Commit 374c63e

Browse files
committed
Auto merge of #61886 - Centril:rollup-3p3m2fu, r=Centril
Rollup of 6 pull requests Successful merges: - #61447 (Add some Vec <-> VecDeque documentation) - #61704 (Pass LLVM linker flags to librustc_llvm build) - #61829 (rustbuild: include llvm-libunwind in dist tarball) - #61832 (update miri) - #61866 (Remove redundant `clone()`s) - #61869 (Cleanup some new active feature gates) Failed merges: r? @ghost
2 parents 0dc9e9c + cd9bb48 commit 374c63e

File tree

21 files changed

+71
-20
lines changed

21 files changed

+71
-20
lines changed

src/bootstrap/compile.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,10 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
775775
cargo.env("CFG_LLVM_ROOT", s);
776776
}
777777
}
778+
// Some LLVM linker flags (-L and -l) may be needed to link librustc_llvm.
779+
if let Some(ref s) = builder.config.llvm_ldflags {
780+
cargo.env("LLVM_LINKER_FLAGS", s);
781+
}
778782
// Building with a static libstdc++ is only supported on linux right now,
779783
// not for MSVC or macOS
780784
if builder.config.llvm_static_stdcpp &&

src/bootstrap/dist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str]
804804

805805
const LLVM_PROJECTS: &[&str] = &[
806806
"llvm-project/clang", "llvm-project\\clang",
807+
"llvm-project/libunwind", "llvm-project\\libunwind",
807808
"llvm-project/lld", "llvm-project\\lld",
808809
"llvm-project/lldb", "llvm-project\\lldb",
809810
"llvm-project/llvm", "llvm-project\\llvm",

src/liballoc/collections/vec_deque.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,11 @@ impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
27092709

27102710
#[stable(feature = "vecdeque_vec_conversions", since = "1.10.0")]
27112711
impl<T> From<Vec<T>> for VecDeque<T> {
2712+
/// Turn a [`Vec<T>`] into a [`VecDeque<T>`].
2713+
///
2714+
/// This avoids reallocating where possible, but the conditions for that are
2715+
/// strict, and subject to change, and so shouldn't be relied upon unless the
2716+
/// `Vec<T>` came from `From<VecDeque<T>>` and hasn't been reallocated.
27122717
fn from(mut other: Vec<T>) -> Self {
27132718
unsafe {
27142719
let other_buf = other.as_mut_ptr();
@@ -2735,6 +2740,32 @@ impl<T> From<Vec<T>> for VecDeque<T> {
27352740

27362741
#[stable(feature = "vecdeque_vec_conversions", since = "1.10.0")]
27372742
impl<T> From<VecDeque<T>> for Vec<T> {
2743+
/// Turn a [`VecDeque<T>`] into a [`Vec<T>`].
2744+
///
2745+
/// This never needs to re-allocate, but does need to do O(n) data movement if
2746+
/// the circular buffer doesn't happen to be at the beginning of the allocation.
2747+
///
2748+
/// # Examples
2749+
///
2750+
/// ```
2751+
/// use std::collections::VecDeque;
2752+
///
2753+
/// // This one is O(1).
2754+
/// let deque: VecDeque<_> = (1..5).collect();
2755+
/// let ptr = deque.as_slices().0.as_ptr();
2756+
/// let vec = Vec::from(deque);
2757+
/// assert_eq!(vec, [1, 2, 3, 4]);
2758+
/// assert_eq!(vec.as_ptr(), ptr);
2759+
///
2760+
/// // This one needs data rearranging.
2761+
/// let mut deque: VecDeque<_> = (1..5).collect();
2762+
/// deque.push_front(9);
2763+
/// deque.push_front(8);
2764+
/// let ptr = deque.as_slices().1.as_ptr();
2765+
/// let vec = Vec::from(deque);
2766+
/// assert_eq!(vec, [8, 9, 1, 2, 3, 4]);
2767+
/// assert_eq!(vec.as_ptr(), ptr);
2768+
/// ```
27382769
fn from(other: VecDeque<T>) -> Self {
27392770
unsafe {
27402771
let buf = other.buf.ptr();

src/librustc/infer/opaque_types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
307307

308308
let required_region_bounds = tcx.required_region_bounds(
309309
opaque_type,
310-
bounds.predicates.clone(),
310+
bounds.predicates,
311311
);
312312
debug_assert!(!required_region_bounds.is_empty());
313313

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
16171617
self.ir.tcx.lint_hir_note(
16181618
lint::builtin::UNUSED_VARIABLES,
16191619
hir_id,
1620-
spans.clone(),
1620+
spans,
16211621
&format!("variable `{}` is assigned to, but never used", name),
16221622
&format!("consider using `_{}` instead", name),
16231623
);

src/librustc_borrowck/borrowck/check_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn owned_ptr_base_path<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> &'a LoanPath<
3636
3737
return match helper(loan_path) {
3838
Some(new_loan_path) => new_loan_path,
39-
None => loan_path.clone()
39+
None => loan_path,
4040
};
4141

4242
fn helper<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> Option<&'a LoanPath<'tcx>> {

src/librustc_codegen_llvm/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ fn fat_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
279279
}
280280
}));
281281
serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| {
282-
(buffer, CString::new(wp.cgu_name.clone()).unwrap())
282+
(buffer, CString::new(wp.cgu_name).unwrap())
283283
}));
284284

285285
// For all serialized bitcode files we parse them and link them in as we did

src/librustc_codegen_llvm/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ impl CodegenCx<'b, 'tcx> {
459459
};
460460
let f = self.declare_cfn(name, fn_ty);
461461
llvm::SetUnnamedAddr(f, false);
462-
self.intrinsics.borrow_mut().insert(name, f.clone());
462+
self.intrinsics.borrow_mut().insert(name, f);
463463
f
464464
}
465465

src/librustc_codegen_llvm/debuginfo/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ impl<'tcx> VariantInfo<'tcx> {
16091609
// with every variant, make each variant name be just the value
16101610
// of the discriminant. The struct name for the variant includes
16111611
// the actual variant description.
1612-
format!("{}", variant_index.as_usize()).to_string()
1612+
format!("{}", variant_index.as_usize())
16131613
}
16141614
}
16151615
}

src/librustc_errors/annotate_snippet_emitter_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl AnnotateSnippetEmitterWriter {
194194
let converter = DiagnosticConverter {
195195
source_map: self.source_map.clone(),
196196
level: level.clone(),
197-
message: message.clone(),
197+
message,
198198
code: code.clone(),
199199
msp: msp.clone(),
200200
children,

0 commit comments

Comments
 (0)