Skip to content

Commit 20f1c04

Browse files
committed
Auto merge of #148721 - Zalathar:rollup-398va3y, r=Zalathar
Rollup of 22 pull requests Successful merges: - #128666 (Add `overflow_checks` intrinsic) - #146305 (Add correct suggestion for multi-references for self type in method) - #147179 ([DebugInfo] Fix container types failing to find template args) - #147743 (Show packed field alignment in mir_transform_unaligned_packed_ref) - #148079 (Rename `downcast_[ref|mut]_unchecked` -> `downcast_unchecked_[ref|mut]`) - #148084 (Optimize path components iteration on platforms that don't have prefixes) - #148126 (Fix rust stdlib build failing for VxWorks) - #148204 (Modify contributor email entries in .mailmap) - #148279 (rustc_builtin_macros: rename bench parameter to avoid collisions with user-defined function names) - #148333 (constify result unwrap unchecked) - #148539 (Add Allocator proxy impls for Box, Rc, and Arc) - #148601 (`invalid_atomic_ordering`: also lint `update` & `try_update`) - #148612 (Add note for identifier with attempted hygiene violation) - #148613 (Switch hexagon targets to rust-lld) - #148619 (Enable std locking functions on AIX) - #148644 ([bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`) - #148649 (don't completely reset `HeadUsages`) - #148673 (Remove a remnant of `dyn*` from the parser) - #148675 (Remove eslint-js from npm dependencies) - #148680 (Recover `[T: N]` as `[T; N]`) - #148688 (Remove unused argument `features` from `eval_config_entry`) - #148711 (Use the current lint note id when parsing `cfg!()`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents acda5e9 + 4cf1d39 commit 20f1c04

File tree

108 files changed

+1492
-507
lines changed

Some content is hidden

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

108 files changed

+1492
-507
lines changed

.mailmap

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Aaron Todd <[email protected]>
99
Abhishek Chanda <[email protected]> Abhishek Chanda <[email protected]>
1010
Abhijeet Bhagat <[email protected]>
1111
Abroskin Alexander <[email protected]>
12-
Adolfo Ochagavía <[email protected]>
12+
1313
Adrian Heine né Lang <[email protected]>
1414
Adrien Tétar <[email protected]>
1515
@@ -36,6 +36,7 @@ Amanda Stjerna <[email protected]> <[email protected]>
3636
3737
3838
39+
3940
Ana-Maria Mihalache <[email protected]>
4041
Anatoly Ikorsky <[email protected]>
4142
Andre Bogus <[email protected]>
@@ -276,7 +277,8 @@ Irina Popa <[email protected]>
276277
Ivan Ivaschenko <[email protected]>
277278
ivan tkachenko <[email protected]>
278279
J. J. Weber <[email protected]>
279-
280+
281+
280282
281283
Jacob Hoffman-Andrews <[email protected]> <[email protected]>
282284
Jacob Greenfield <[email protected]>
@@ -292,6 +294,8 @@ Jakub Adam Wieczorek <[email protected]>
292294
Jakub Adam Wieczorek <[email protected]> <[email protected]>
293295
Jakub Adam Wieczorek <[email protected]> <[email protected]>
294296
Jakub Adam Wieczorek <[email protected]> <[email protected]>
297+
Jakub Adam Wieczorek <[email protected]> <[email protected]>
298+
Jakub Adam Wieczorek <[email protected]> <[email protected]>
295299
296300
James [Undefined] <[email protected]>
297301
@@ -303,6 +307,7 @@ Jamie Hill-Daniel <[email protected]> <[email protected]>
303307
Jana Dönszelmann <[email protected]>
304308
305309
310+
306311
307312
Jaro Fietz <[email protected]>
308313
Jason Fager <[email protected]>
@@ -313,6 +318,7 @@ Jason Toffaletti <[email protected]> Jason Toffaletti <[email protected]>
313318
Jauhien Piatlicki <[email protected]> Jauhien Piatlicki <[email protected]>
314319
315320
Jeremy Letang <[email protected]>
321+
316322
Jeremy Sorensen <[email protected]>
317323
318324
@@ -336,6 +342,7 @@ John Kåre Alsaker <[email protected]>
336342
John Kåre Alsaker <[email protected]> <[email protected]>
337343
John Talling <[email protected]>
338344
John Van Enk <[email protected]>
345+
339346
Jonas Tepe <[email protected]>
340347
341348
Jonathan Chan Kwan Yin <[email protected]>
@@ -424,7 +431,7 @@ Malo Jaffré <[email protected]>
424431
Manish Goregaokar <[email protected]>
425432
426433
Marcell Pardavi <[email protected]>
427-
Marco Ieni <[email protected]>
434+
428435
Marcus Klaas de Vries <[email protected]>
429436
Margaret Meyerhofer <[email protected]> <mmeyerho@andrew>
430437
@@ -531,6 +538,7 @@ Oliver Scherer <[email protected]> <[email protected]>
531538
532539
533540
Oliver Scherer <[email protected]>
541+
534542
535543
Onur Özkan <[email protected]>
536544
Ömer Sinan Ağacan <[email protected]>
@@ -591,6 +599,7 @@ Rusty Blitzerr <[email protected]>
591599
RustyYato <[email protected]>
592600
Ruud van Asseldonk <[email protected]> Ruud van Asseldonk <[email protected]>
593601
Ryan Leung <[email protected]>
602+
594603
Ryan Scheel <[email protected]>
595604
Ryan Sullivant <[email protected]>
596605
Ryan Wiedemann <[email protected]>
@@ -686,6 +695,8 @@ Weihang Lo <[email protected]>
686695
687696
688697
whitequark <[email protected]>
698+
699+
689700
690701
691702
@@ -695,6 +706,8 @@ Xinye Tao <[email protected]>
695706
Xuefeng Wu <[email protected]> Xuefeng Wu <[email protected]>
696707
Xuefeng Wu <[email protected]> XuefengWu <[email protected]>
697708
York Xiang <[email protected]>
709+
710+
698711
699712
700713
Youngsuk Kim <[email protected]>

compiler/rustc_ast/src/ast.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,15 @@ impl Pat {
714714
}
715715
}
716716

717+
/// Strip off all reference patterns (`&`, `&mut`) and return the inner pattern.
718+
pub fn peel_refs(&self) -> &Pat {
719+
let mut current = self;
720+
while let PatKind::Ref(inner, _) = &current.kind {
721+
current = inner;
722+
}
723+
current
724+
}
725+
717726
/// Is this a `..` pattern?
718727
pub fn is_rest(&self) -> bool {
719728
matches!(self.kind, PatKind::Rest)

compiler/rustc_attr_parsing/src/attributes/cfg.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,13 @@ pub fn eval_config_entry(
199199
sess: &Session,
200200
cfg_entry: &CfgEntry,
201201
id: NodeId,
202-
features: Option<&Features>,
203202
emit_lints: ShouldEmit,
204203
) -> EvalConfigResult {
205204
match cfg_entry {
206205
CfgEntry::All(subs, ..) => {
207206
let mut all = None;
208207
for sub in subs {
209-
let res = eval_config_entry(sess, sub, id, features, emit_lints);
208+
let res = eval_config_entry(sess, sub, id, emit_lints);
210209
// We cannot short-circuit because `eval_config_entry` emits some lints
211210
if !res.as_bool() {
212211
all.get_or_insert(res);
@@ -217,7 +216,7 @@ pub fn eval_config_entry(
217216
CfgEntry::Any(subs, span) => {
218217
let mut any = None;
219218
for sub in subs {
220-
let res = eval_config_entry(sess, sub, id, features, emit_lints);
219+
let res = eval_config_entry(sess, sub, id, emit_lints);
221220
// We cannot short-circuit because `eval_config_entry` emits some lints
222221
if res.as_bool() {
223222
any.get_or_insert(res);
@@ -229,7 +228,7 @@ pub fn eval_config_entry(
229228
})
230229
}
231230
CfgEntry::Not(sub, span) => {
232-
if eval_config_entry(sess, sub, id, features, emit_lints).as_bool() {
231+
if eval_config_entry(sess, sub, id, emit_lints).as_bool() {
233232
EvalConfigResult::False { reason: cfg_entry.clone(), reason_span: *span }
234233
} else {
235234
EvalConfigResult::True

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,8 +1046,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
10461046
}
10471047
}
10481048

1049-
&Rvalue::NullaryOp(NullOp::ContractChecks, _) => {}
1050-
&Rvalue::NullaryOp(NullOp::UbChecks, _) => {}
1049+
&Rvalue::NullaryOp(NullOp::RuntimeChecks(_), _) => {}
10511050

10521051
Rvalue::ShallowInitBox(_operand, ty) => {
10531052
let trait_ref =

compiler/rustc_builtin_macros/src/cfg.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! current compilation environment.
44
55
use rustc_ast::tokenstream::TokenStream;
6-
use rustc_ast::{AttrStyle, CRATE_NODE_ID, token};
6+
use rustc_ast::{AttrStyle, token};
77
use rustc_attr_parsing as attr;
88
use rustc_attr_parsing::parser::MetaItemOrLitParser;
99
use rustc_attr_parsing::{
@@ -30,7 +30,6 @@ pub(crate) fn expand_cfg(
3030
cx.sess,
3131
&cfg,
3232
cx.current_expansion.lint_node_id,
33-
Some(cx.ecfg.features),
3433
ShouldEmit::ErrorsAndLints,
3534
)
3635
.as_bool();
@@ -57,7 +56,7 @@ fn parse_cfg(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream) -> Result<CfgEntry,
5756
AttrPath { segments: vec![Ident::from_str("cfg")].into_boxed_slice(), span },
5857
ParsedDescription::Macro,
5958
span,
60-
CRATE_NODE_ID,
59+
cx.current_expansion.lint_node_id,
6160
Some(cx.ecfg.features),
6261
ShouldEmit::ErrorsAndLints,
6362
&meta,

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,30 +207,30 @@ pub(crate) fn expand_test_or_bench(
207207
};
208208

209209
let test_fn = if is_bench {
210-
// A simple ident for a lambda
211-
let b = Ident::from_str_and_span("b", attr_sp);
212-
210+
// avoid name collisions by using the function name within the identifier, see bug #148275
211+
let bencher_param =
212+
Ident::from_str_and_span(&format!("__bench_{}", fn_.ident.name), attr_sp);
213213
cx.expr_call(
214214
sp,
215215
cx.expr_path(test_path("StaticBenchFn")),
216216
thin_vec![
217217
// #[coverage(off)]
218-
// |b| self::test::assert_test_result(
218+
// |__bench_fn_name| self::test::assert_test_result(
219219
coverage_off(cx.lambda1(
220220
sp,
221221
cx.expr_call(
222222
sp,
223223
cx.expr_path(test_path("assert_test_result")),
224224
thin_vec![
225-
// super::$test_fn(b)
225+
// super::$test_fn(__bench_fn_name)
226226
cx.expr_call(
227227
ret_ty_sp,
228228
cx.expr_path(cx.path(sp, vec![fn_.ident])),
229-
thin_vec![cx.expr_ident(sp, b)],
229+
thin_vec![cx.expr_ident(sp, bencher_param)],
230230
),
231231
],
232232
),
233-
b,
233+
bencher_param,
234234
)), // )
235235
],
236236
)

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -865,17 +865,8 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
865865
fields.iter(),
866866
)
867867
.bytes(),
868-
NullOp::UbChecks => {
869-
let val = fx.tcx.sess.ub_checks();
870-
let val = CValue::by_val(
871-
fx.bcx.ins().iconst(types::I8, i64::from(val)),
872-
fx.layout_of(fx.tcx.types.bool),
873-
);
874-
lval.write_cvalue(fx, val);
875-
return;
876-
}
877-
NullOp::ContractChecks => {
878-
let val = fx.tcx.sess.contract_checks();
868+
NullOp::RuntimeChecks(kind) => {
869+
let val = kind.value(fx.tcx.sess);
879870
let val = CValue::by_val(
880871
fx.bcx.ins().iconst(types::I8, i64::from(val)),
881872
fx.layout_of(fx.tcx.types.bool),

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,7 @@ fn add_dynamic_crate(cmd: &mut dyn Linker, sess: &Session, cratepath: &Path) {
30363036
fn relevant_lib(sess: &Session, lib: &NativeLib) -> bool {
30373037
match lib.cfg {
30383038
Some(ref cfg) => {
3039-
eval_config_entry(sess, cfg, CRATE_NODE_ID, None, ShouldEmit::ErrorsAndLints).as_bool()
3039+
eval_config_entry(sess, cfg, CRATE_NODE_ID, ShouldEmit::ErrorsAndLints).as_bool()
30403040
}
30413041
None => true,
30423042
}

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -624,12 +624,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
624624
.bytes();
625625
bx.cx().const_usize(val)
626626
}
627-
mir::NullOp::UbChecks => {
628-
let val = bx.tcx().sess.ub_checks();
629-
bx.cx().const_bool(val)
630-
}
631-
mir::NullOp::ContractChecks => {
632-
let val = bx.tcx().sess.contract_checks();
627+
mir::NullOp::RuntimeChecks(kind) => {
628+
let val = kind.value(bx.tcx().sess);
633629
bx.cx().const_bool(val)
634630
}
635631
};

compiler/rustc_const_eval/src/check_consts/check.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
645645

646646
Rvalue::Cast(_, _, _) => {}
647647

648-
Rvalue::NullaryOp(
649-
NullOp::OffsetOf(_) | NullOp::UbChecks | NullOp::ContractChecks,
650-
_,
651-
) => {}
648+
Rvalue::NullaryOp(NullOp::OffsetOf(_) | NullOp::RuntimeChecks(_), _) => {}
652649
Rvalue::ShallowInitBox(_, _) => {}
653650

654651
Rvalue::UnaryOp(op, operand) => {

0 commit comments

Comments
 (0)