Skip to content

Commit c9af9c1

Browse files
committed
Auto merge of #151151 - Zalathar:rollup-kAQYrsB, r=Zalathar
Rollup of 2 pull requests Successful merges: - #151150 (Revert "avoid phi node for pointers flowing into Vec appends #130998") - #151145 (Reduce rustdoc GUI flakyness, take 2) r? @ghost
2 parents b6fdaf2 + d87e654 commit c9af9c1

5 files changed

Lines changed: 29 additions & 56 deletions

File tree

compiler/rustc_codegen_llvm/src/attributes.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
517517
to_add.push(llvm::CreateAllocKindAttr(cx.llcx, AllocKindFlags::Free));
518518
// applies to argument place instead of function place
519519
let allocated_pointer = AttributeKind::AllocatedPointer.create_attr(cx.llcx);
520-
let attrs: &[_] = if llvm_util::get_version() >= (21, 0, 0) {
521-
// "Does not capture provenance" means "if the function call stashes the pointer somewhere,
522-
// accessing that pointer after the function returns is UB". That is definitely the case here since
523-
// freeing will destroy the provenance.
524-
let captures_addr = AttributeKind::CapturesAddress.create_attr(cx.llcx);
525-
&[allocated_pointer, captures_addr]
526-
} else {
527-
&[allocated_pointer]
528-
};
529-
attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), attrs);
520+
attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), &[allocated_pointer]);
530521
}
531522
if let Some(align) = codegen_fn_attrs.alignment {
532523
llvm::set_alignment(llfn, align);

library/alloc/src/slice.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,9 @@ impl<T> [T] {
448448
// SAFETY:
449449
// allocated above with the capacity of `s`, and initialize to `s.len()` in
450450
// ptr::copy_to_non_overlapping below.
451-
if s.len() > 0 {
452-
unsafe {
453-
s.as_ptr().copy_to_nonoverlapping(v.as_mut_ptr(), s.len());
454-
v.set_len(s.len());
455-
}
451+
unsafe {
452+
s.as_ptr().copy_to_nonoverlapping(v.as_mut_ptr(), s.len());
453+
v.set_len(s.len());
456454
}
457455
v
458456
}

library/alloc/src/vec/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,11 +2818,7 @@ impl<T, A: Allocator> Vec<T, A> {
28182818
let count = other.len();
28192819
self.reserve(count);
28202820
let len = self.len();
2821-
if count > 0 {
2822-
unsafe {
2823-
ptr::copy_nonoverlapping(other as *const T, self.as_mut_ptr().add(len), count)
2824-
};
2825-
}
2821+
unsafe { ptr::copy_nonoverlapping(other as *const T, self.as_mut_ptr().add(len), count) };
28262822
self.len += count;
28272823
}
28282824

tests/codegen-llvm/lib-optimizations/append-elements.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/rustdoc-gui/utils.goml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,37 @@ define-function: (
2929
"open-settings-menu",
3030
[],
3131
block {
32-
call-function: ("click-settings-button", {})
33-
// Wait for the popover to appear...
34-
wait-for-css: ("#settings", {"display": "block"})
32+
store-count: ("#settings", nb_settings_menu)
33+
if: (|nb_settings_menu| != 0, block {
34+
store-css: ("#settings", {"display": settings_display})
35+
})
36+
else: block {
37+
store-value: (settings_display, "none")
38+
}
39+
if: (|settings_display| != "block", block {
40+
call-function: ("click-settings-button", {})
41+
// Wait for the popover to appear...
42+
wait-for-css: ("#settings", {"display": "block"})
43+
})
3544
}
3645
)
3746

3847
define-function: (
3948
"close-settings-menu",
4049
[],
4150
block {
42-
call-function: ("click-settings-button", {})
43-
// Wait for the popover to disappear...
44-
wait-for-css-false: ("#settings", {"display": "block"})
51+
store-count: ("#settings", nb_settings_menu)
52+
if: (|nb_settings_menu| != 0, block {
53+
store-css: ("#settings", {"display": settings_display})
54+
})
55+
else: block {
56+
store-value: (settings_display, "block")
57+
}
58+
if: (|settings_display| == "block", block {
59+
call-function: ("click-settings-button", {})
60+
// Wait for the popover to disappear...
61+
wait-for-css-false: ("#settings", {"display": "block"})
62+
})
4563
}
4664
)
4765

0 commit comments

Comments
 (0)