Skip to content

Commit 7bea8c6

Browse files
Auto merge of #150848 - cuviper:beta-next, r=cuviper
[beta] backports - Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer" #149657 - Don't lint on interior mutable `const` item coming from derefs #150166 - stdarch subtree update #150639 (partial) - Update bors configuration #150308 - Update bors e-mail lookup #150783 - Make verify-channel.sh script compatible with new bors #150759 r? cuviper
2 parents 72b6488 + 4dc996f commit 7bea8c6

File tree

18 files changed

+225
-68
lines changed

18 files changed

+225
-68
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- try
1616
- try-perf
1717
- automation/bors/try
18+
- automation/bors/auto
1819
pull_request:
1920
branches:
2021
- "**"
@@ -56,7 +57,7 @@ jobs:
5657
- name: Test citool
5758
# Only test citool on the auto branch, to reduce latency of the calculate matrix job
5859
# on PR/try builds.
59-
if: ${{ github.ref == 'refs/heads/auto' }}
60+
if: ${{ github.ref == 'refs/heads/auto' || github.ref == 'refs/heads/automation/bors/auto' }}
6061
run: |
6162
cd src/ci/citool
6263
CARGO_INCREMENTAL=0 cargo test
@@ -79,7 +80,7 @@ jobs:
7980
# access the environment.
8081
#
8182
# We only enable the environment for the rust-lang/rust repository, so that CI works on forks.
82-
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try' || github.ref == 'refs/heads/auto')) && 'bors') || '' }}
83+
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try' || github.ref == 'refs/heads/auto' || github.ref == 'refs/heads/automation/bors/auto')) && 'bors') || '' }}
8384
env:
8485
CI_JOB_NAME: ${{ matrix.name }}
8586
CI_JOB_DOC_URL: ${{ matrix.doc_url }}
@@ -313,7 +314,7 @@ jobs:
313314
needs: [ calculate_matrix, job ]
314315
# !cancelled() executes the job regardless of whether the previous jobs passed or failed
315316
if: ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }}
316-
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try' || github.ref == 'refs/heads/auto')) && 'bors') || '' }}
317+
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try' || github.ref == 'refs/heads/auto' || github.ref == 'refs/heads/automation/bors/auto')) && 'bors') || '' }}
317318
steps:
318319
- name: checkout the source code
319320
uses: actions/checkout@v5

.github/workflows/post-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
sleep 60
3030
3131
# Get closest bors merge commit
32-
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
32+
PARENT_COMMIT=`git rev-list --author='122020455+rust-bors\[bot\]@users.noreply.github.com' -n1 --first-parent HEAD^1`
3333
echo "Parent: ${PARENT_COMMIT}"
3434
3535
# Find PR for the current commit

compiler/rustc_lint/src/interior_mutable_consts.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use rustc_hir::attrs::AttributeKind;
22
use rustc_hir::def::{DefKind, Res};
33
use rustc_hir::{Expr, ExprKind, ItemKind, Node, find_attr};
4+
use rustc_middle::ty::adjustment::Adjust;
45
use rustc_session::{declare_lint, declare_lint_pass};
56

67
use crate::lints::{ConstItemInteriorMutationsDiag, ConstItemInteriorMutationsSuggestionStatic};
@@ -77,6 +78,13 @@ impl<'tcx> LateLintPass<'tcx> for InteriorMutableConsts {
7778
if let ExprKind::Path(qpath) = &receiver.kind
7879
&& let Res::Def(DefKind::Const | DefKind::AssocConst, const_did) =
7980
typeck.qpath_res(qpath, receiver.hir_id)
81+
// Don't consider derefs as those can do arbitrary things
82+
// like using thread local (see rust-lang/rust#150157)
83+
&& !cx
84+
.typeck_results()
85+
.expr_adjustments(receiver)
86+
.into_iter()
87+
.any(|adj| matches!(adj.kind, Adjust::Deref(_)))
8088
// Let's do the attribute check after the other checks for perf reasons
8189
&& find_attr!(
8290
cx.tcx.get_all_attrs(method_did),

compiler/rustc_mir_transform/src/liveness.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ pub(crate) fn check_liveness<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Den
7575
return DenseBitSet::new_empty(0);
7676
}
7777

78-
// Don't run unused pass for items generated by foreign macros
79-
if tcx.def_span(parent).in_external_macro(tcx.sess.source_map()) {
80-
return DenseBitSet::new_empty(0);
81-
}
82-
8378
let mut body = &*tcx.mir_promoted(def_id).0.borrow();
8479
let mut body_mem;
8580

library/stdarch/crates/core_arch/src/x86/avx2.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,12 +1754,19 @@ pub fn _mm256_inserti128_si256<const IMM1: i32>(a: __m256i, b: __m128i) -> __m25
17541754
#[cfg_attr(test, assert_instr(vpmaddwd))]
17551755
#[stable(feature = "simd_x86", since = "1.27.0")]
17561756
pub fn _mm256_madd_epi16(a: __m256i, b: __m256i) -> __m256i {
1757-
unsafe {
1758-
let r: i32x16 = simd_mul(simd_cast(a.as_i16x16()), simd_cast(b.as_i16x16()));
1759-
let even: i32x8 = simd_shuffle!(r, r, [0, 2, 4, 6, 8, 10, 12, 14]);
1760-
let odd: i32x8 = simd_shuffle!(r, r, [1, 3, 5, 7, 9, 11, 13, 15]);
1761-
simd_add(even, odd).as_m256i()
1762-
}
1757+
// It's a trick used in the Adler-32 algorithm to perform a widening addition.
1758+
//
1759+
// ```rust
1760+
// #[target_feature(enable = "avx2")]
1761+
// unsafe fn widening_add(mad: __m256i) -> __m256i {
1762+
// _mm256_madd_epi16(mad, _mm256_set1_epi16(1))
1763+
// }
1764+
// ```
1765+
//
1766+
// If we implement this using generic vector intrinsics, the optimizer
1767+
// will eliminate this pattern, and `vpmaddwd` will no longer be emitted.
1768+
// For this reason, we use x86 intrinsics.
1769+
unsafe { transmute(pmaddwd(a.as_i16x16(), b.as_i16x16())) }
17631770
}
17641771

17651772
/// Vertically multiplies each unsigned 8-bit integer from `a` with the
@@ -3701,6 +3708,8 @@ unsafe extern "C" {
37013708
fn phaddsw(a: i16x16, b: i16x16) -> i16x16;
37023709
#[link_name = "llvm.x86.avx2.phsub.sw"]
37033710
fn phsubsw(a: i16x16, b: i16x16) -> i16x16;
3711+
#[link_name = "llvm.x86.avx2.pmadd.wd"]
3712+
fn pmaddwd(a: i16x16, b: i16x16) -> i32x8;
37043713
#[link_name = "llvm.x86.avx2.pmadd.ub.sw"]
37053714
fn pmaddubsw(a: u8x32, b: i8x32) -> i16x16;
37063715
#[link_name = "llvm.x86.avx2.mpsadbw"]

library/stdarch/crates/core_arch/src/x86/avx512bw.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5847,20 +5847,19 @@ pub unsafe fn _mm_mask_storeu_epi8(mem_addr: *mut i8, mask: __mmask16, a: __m128
58475847
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
58485848
#[cfg_attr(test, assert_instr(vpmaddwd))]
58495849
pub fn _mm512_madd_epi16(a: __m512i, b: __m512i) -> __m512i {
5850-
unsafe {
5851-
let r: i32x32 = simd_mul(simd_cast(a.as_i16x32()), simd_cast(b.as_i16x32()));
5852-
let even: i32x16 = simd_shuffle!(
5853-
r,
5854-
r,
5855-
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]
5856-
);
5857-
let odd: i32x16 = simd_shuffle!(
5858-
r,
5859-
r,
5860-
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]
5861-
);
5862-
simd_add(even, odd).as_m512i()
5863-
}
5850+
// It's a trick used in the Adler-32 algorithm to perform a widening addition.
5851+
//
5852+
// ```rust
5853+
// #[target_feature(enable = "avx512bw")]
5854+
// unsafe fn widening_add(mad: __m512i) -> __m512i {
5855+
// _mm512_madd_epi16(mad, _mm512_set1_epi16(1))
5856+
// }
5857+
// ```
5858+
//
5859+
// If we implement this using generic vector intrinsics, the optimizer
5860+
// will eliminate this pattern, and `vpmaddwd` will no longer be emitted.
5861+
// For this reason, we use x86 intrinsics.
5862+
unsafe { transmute(vpmaddwd(a.as_i16x32(), b.as_i16x32())) }
58645863
}
58655864

58665865
/// Multiply packed signed 16-bit integers in a and b, producing intermediate signed 32-bit integers. Horizontally add adjacent pairs of intermediate 32-bit integers, and pack the results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set).
@@ -11687,6 +11686,8 @@ unsafe extern "C" {
1168711686
#[link_name = "llvm.x86.avx512.pmul.hr.sw.512"]
1168811687
fn vpmulhrsw(a: i16x32, b: i16x32) -> i16x32;
1168911688

11689+
#[link_name = "llvm.x86.avx512.pmaddw.d.512"]
11690+
fn vpmaddwd(a: i16x32, b: i16x32) -> i32x16;
1169011691
#[link_name = "llvm.x86.avx512.pmaddubs.w.512"]
1169111692
fn vpmaddubsw(a: u8x64, b: i8x64) -> i16x32;
1169211693

library/stdarch/crates/core_arch/src/x86/sse2.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,19 @@ pub fn _mm_avg_epu16(a: __m128i, b: __m128i) -> __m128i {
201201
#[cfg_attr(test, assert_instr(pmaddwd))]
202202
#[stable(feature = "simd_x86", since = "1.27.0")]
203203
pub fn _mm_madd_epi16(a: __m128i, b: __m128i) -> __m128i {
204-
unsafe {
205-
let r: i32x8 = simd_mul(simd_cast(a.as_i16x8()), simd_cast(b.as_i16x8()));
206-
let even: i32x4 = simd_shuffle!(r, r, [0, 2, 4, 6]);
207-
let odd: i32x4 = simd_shuffle!(r, r, [1, 3, 5, 7]);
208-
simd_add(even, odd).as_m128i()
209-
}
204+
// It's a trick used in the Adler-32 algorithm to perform a widening addition.
205+
//
206+
// ```rust
207+
// #[target_feature(enable = "sse2")]
208+
// unsafe fn widening_add(mad: __m128i) -> __m128i {
209+
// _mm_madd_epi16(mad, _mm_set1_epi16(1))
210+
// }
211+
// ```
212+
//
213+
// If we implement this using generic vector intrinsics, the optimizer
214+
// will eliminate this pattern, and `pmaddwd` will no longer be emitted.
215+
// For this reason, we use x86 intrinsics.
216+
unsafe { transmute(pmaddwd(a.as_i16x8(), b.as_i16x8())) }
210217
}
211218

212219
/// Compares packed 16-bit integers in `a` and `b`, and returns the packed
@@ -3054,6 +3061,8 @@ unsafe extern "C" {
30543061
fn lfence();
30553062
#[link_name = "llvm.x86.sse2.mfence"]
30563063
fn mfence();
3064+
#[link_name = "llvm.x86.sse2.pmadd.wd"]
3065+
fn pmaddwd(a: i16x8, b: i16x8) -> i32x4;
30573066
#[link_name = "llvm.x86.sse2.psad.bw"]
30583067
fn psadbw(a: u8x16, b: u8x16) -> u64x2;
30593068
#[link_name = "llvm.x86.sse2.psll.w"]

rust-bors.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,42 @@ labels_blocking_approval = [
2525
"S-waiting-on-t-rustdoc-frontend",
2626
"S-waiting-on-t-clippy"
2727
]
28+
29+
# If CI runs quicker than this duration, consider it to be a failure
30+
min_ci_time = 600
31+
32+
[labels]
33+
approved = [
34+
"+S-waiting-on-bors",
35+
"-S-blocked",
36+
"-S-waiting-on-author",
37+
"-S-waiting-on-crater",
38+
"-S-waiting-on-review",
39+
"-S-waiting-on-team"
40+
]
41+
unapproved = [
42+
"+S-waiting-on-author",
43+
"-S-blocked",
44+
"-S-waiting-on-bors",
45+
"-S-waiting-on-crater",
46+
"-S-waiting-on-review",
47+
"-S-waiting-on-team"
48+
]
49+
try_failed = [
50+
"+S-waiting-on-author",
51+
"-S-waiting-on-review",
52+
"-S-waiting-on-crater"
53+
]
54+
auto_build_succeeded = ["+merged-by-bors"]
55+
auto_build_failed = [
56+
"+S-waiting-on-review",
57+
"-S-blocked",
58+
"-S-waiting-on-bors",
59+
"-S-waiting-on-author",
60+
"-S-waiting-on-crater",
61+
"-S-waiting-on-team"
62+
]
63+
64+
# Flip this two once new bors is used for actual merges on this repository
65+
merge_queue_enabled = false
66+
report_merge_conflicts = true

src/build_helper/src/git.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ pub fn has_changed_since(git_dir: &Path, base: &str, paths: &[&str]) -> bool {
152152
})
153153
}
154154

155+
const LEGACY_BORS_EMAIL: &str = "bors@rust-lang.org";
156+
157+
/// Escape characters from the git user e-mail, so that git commands do not interpret it as regex
158+
/// special characters.
159+
fn escape_email_git_regex(text: &str) -> String {
160+
text.replace("[", "\\[").replace("]", "\\]").replace(".", "\\.")
161+
}
162+
155163
/// Returns the latest upstream commit that modified `target_paths`, or `None` if no such commit
156164
/// was found.
157165
fn get_latest_upstream_commit_that_modified_files(
@@ -182,9 +190,15 @@ fn get_latest_upstream_commit_that_modified_files(
182190
"-n1",
183191
&upstream,
184192
"--author",
185-
git_config.git_merge_commit_email,
193+
&escape_email_git_regex(git_config.git_merge_commit_email),
186194
]);
187195

196+
// Also search for legacy bors account, before we accrue enough commits to
197+
// have changes to all relevant file paths done by new bors.
198+
if git_config.git_merge_commit_email != LEGACY_BORS_EMAIL {
199+
git.args(["--author", LEGACY_BORS_EMAIL]);
200+
}
201+
188202
if !target_paths.is_empty() {
189203
git.arg("--").args(target_paths);
190204
}
@@ -229,11 +243,17 @@ pub fn get_closest_upstream_commit(
229243
git.args([
230244
"rev-list",
231245
"--author-date-order",
232-
&format!("--author={}", config.git_merge_commit_email),
246+
&format!("--author={}", &escape_email_git_regex(config.git_merge_commit_email),),
233247
"-n1",
234248
base,
235249
]);
236250

251+
// Also search for legacy bors account, before we accrue enough commits to
252+
// have changes to all relevant file paths done by new bors.
253+
if config.git_merge_commit_email != LEGACY_BORS_EMAIL {
254+
git.args(["--author", LEGACY_BORS_EMAIL]);
255+
}
256+
237257
let output = output_result(&mut git)?.trim().to_owned();
238258
if output.is_empty() { Ok(None) } else { Ok(Some(output)) }
239259
}

src/ci/citool/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ impl GitHubContext {
4646
let patterns = if !patterns.is_empty() { Some(patterns) } else { None };
4747
Some(RunType::TryJob { job_patterns: patterns })
4848
}
49-
("push", "refs/heads/auto") => Some(RunType::AutoJob),
49+
("push", "refs/heads/auto" | "refs/heads/automation/bors/auto") => {
50+
Some(RunType::AutoJob)
51+
}
5052
("push", "refs/heads/main") => Some(RunType::MainJob),
5153
_ => None,
5254
}

0 commit comments

Comments
 (0)