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 <github@opprobrio.us>
99
Abhishek Chanda <abhishek.becs@gmail.com> Abhishek Chanda <abhishek@cloudscaling.com>
1010
Abhijeet Bhagat <abhijeet.bhagat@gmx.com>
1111
Abroskin Alexander <arkweid@evilmartians.com>
12-
Adolfo Ochagavía <aochagavia92@gmail.com>
12+
Adolfo Ochagavía <aochagavia92@gmail.com> <github@adolfo.ochagavia.xyz>
1313
Adrian Heine né Lang <mail@adrianheine.de>
1414
Adrien Tétar <adri-from-59@hotmail.fr>
1515
Ahmed Charles <ahmedcharles@gmail.com> <acharles@outlook.com>
@@ -36,6 +36,7 @@ Amanda Stjerna <mail@amandastjerna.se> <albin.stjerna@gmail.com>
3636
Amanda Stjerna <mail@amandastjerna.se> <amanda.stjerna@it.uu.se>
3737
Amanieu d'Antras <amanieu@gmail.com> <amanieu.dantras@huawei.com>
3838
Amos Onn <amosonn@gmail.com>
39+
Amos Wenger <amoswenger@gmail.com> <fasterthanlime@users.noreply.github.com>
3940
Ana-Maria Mihalache <mihalacheana.maria@yahoo.com>
4041
Anatoly Ikorsky <aikorsky@gmail.com>
4142
Andre Bogus <bogusandre@gmail.com>
@@ -276,7 +277,8 @@ Irina Popa <irinagpopa@gmail.com>
276277
Ivan Ivaschenko <defuz.net@gmail.com>
277278
ivan tkachenko <me@ratijas.tk>
278279
J. J. Weber <jjweber@gmail.com>
279-
Jack Huey <jack.huey@umassmed.edu> <jackh726@gmail.com>
280+
Jack Huey <jackh726@gmail.com> <jack.huey@umassmed.edu>
281+
Jack Huey <jackh726@gmail.com> <31162821+jackh726@users.noreply.github.com>
280282
Jacob <jacob.macritchie@gmail.com>
281283
Jacob Hoffman-Andrews <rust@hoffman-andrews.com> <github@hoffman-andrews.com>
282284
Jacob Greenfield <xales@naveria.com>
@@ -292,6 +294,8 @@ Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com>
292294
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
293295
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub@jakub.cc>
294296
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakubw@jakubw.net>
297+
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <ja.wieczorek@student.uw.edu.pl>
298+
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <software@jacobadam.net>
295299
Jakub Beránek <berykubik@gmail.com> <jakub.beranek@vsb.cz>
296300
James [Undefined] <tpzker@thepuzzlemaker.info>
297301
James Deng <cnjamesdeng@gmail.com> <cnJamesDeng@gmail.com>
@@ -303,6 +307,7 @@ Jamie Hill-Daniel <jamie@hill-daniel.co.uk> <clubby789@gmail.com>
303307
Jana Dönszelmann <jana@donsz.nl>
304308
Jana Dönszelmann <jana@donsz.nl> <jonathan@donsz.nl>
305309
Jana Dönszelmann <jana@donsz.nl> <jonabent@gmail.com>
310+
Jane Lusby <jlusby42@gmail.com> <jlusby@yaah.dev>
306311
Jan-Erik Rediger <janerik@fnordig.de> <badboy@archlinux.us>
307312
Jaro Fietz <jaro.fietz@gmx.de>
308313
Jason Fager <jfager@gmail.com>
@@ -313,6 +318,7 @@ Jason Toffaletti <toffaletti@gmail.com> Jason Toffaletti <jason@topsy.com>
313318
Jauhien Piatlicki <jauhien@gentoo.org> Jauhien Piatlicki <jpiatlicki@zertisa.com>
314319
Jay True <glacjay@gmail.com>
315320
Jeremy Letang <letang.jeremy@gmail.com>
321+
Jeremy Soller <jackpot51@gmail.com> <jeremy@system76.com>
316322
Jeremy Sorensen <jeremy.a.sorensen@gmail.com>
317323
Jeremy Stucki <dev@jeremystucki.ch> <stucki.jeremy@gmail.com>
318324
Jeremy Stucki <dev@jeremystucki.ch> <jeremy@myelin.ch>
@@ -336,6 +342,7 @@ John Kåre Alsaker <john.kare.alsaker@gmail.com>
336342
John Kåre Alsaker <john.kare.alsaker@gmail.com> <zoxc32@gmail.com>
337343
John Talling <inrustwetrust@users.noreply.github.com>
338344
John Van Enk <vanenkj@gmail.com>
345+
Jon Gjengset <jon@thesquareplanet.com> <jongje@amazon.com>
339346
Jonas Tepe <jonasprogrammer@gmail.com>
340347
Jonathan Bailey <jbailey@mozilla.com> <jbailey@jbailey-20809.local>
341348
Jonathan Chan Kwan Yin <sofe2038@gmail.com>
@@ -424,7 +431,7 @@ Malo Jaffré <jaffre.malo@gmail.com>
424431
Manish Goregaokar <manishsmail@gmail.com>
425432
Mara Bos <m-ou.se@m-ou.se>
426433
Marcell Pardavi <marcell.pardavi@gmail.com>
427-
Marco Ieni <11428655+MarcoIeni@users.noreply.github.com>
434+
Marco Ieni <marcoieni@rustfoundation.org> <11428655+MarcoIeni@users.noreply.github.com>
428435
Marcus Klaas de Vries <mail@marcusklaas.nl>
429436
Margaret Meyerhofer <mmeyerho@andrew.cmu.edu> <mmeyerho@andrew>
430437
Marijn Schouten <mhkbst@gmail.com> <hkBst@users.noreply.github.com>
@@ -531,6 +538,7 @@ Oliver Scherer <oli-obk@users.noreply.github.com> <oliver.schneider@kit.edu>
531538
Oliver Scherer <oli-obk@users.noreply.github.com> <obk8176014uqher834@olio-obk.de>
532539
Oliver Scherer <oli-obk@users.noreply.github.com> <rustc-contact@oli-obk.de>
533540
Oliver Scherer <oli-obk@users.noreply.github.com>
541+
Onur Özkan <onurozkan.dev@outlook.com> <contact@onurozkan.dev>
534542
Onur Özkan <onurozkan.dev@outlook.com> <work@onurozkan.dev>
535543
Onur Özkan <onurozkan.dev@outlook.com>
536544
Ömer Sinan Ağacan <omeragacan@gmail.com>
@@ -591,6 +599,7 @@ Rusty Blitzerr <rusty.blitzerr@gmail.com>
591599
RustyYato <krishna.sd.2012@gmail.com>
592600
Ruud van Asseldonk <dev@veniogames.com> Ruud van Asseldonk <ruuda@google.com>
593601
Ryan Leung <rleungx@gmail.com>
602+
Ryan Levick <me@ryanlevick.com> <rylev@users.noreply.github.com>
594603
Ryan Scheel <ryan.havvy@gmail.com>
595604
Ryan Sullivant <rsulli55@gmail.com>
596605
Ryan Wiedemann <Ryan1729@gmail.com>
@@ -686,6 +695,8 @@ Weihang Lo <me@weihanglo.tw>
686695
Weihang Lo <me@weihanglo.tw> <weihanglo@users.noreply.github.com>
687696
Wesley Wiser <wwiser@gmail.com> <wesleywiser@microsoft.com>
688697
whitequark <whitequark@whitequark.org>
698+
Will Crichton <crichton.will@gmail.com> <wcrichto@stanford.edu>
699+
Will Crichton <crichton.will@gmail.com> <wcrichto@cs.stanford.edu>
689700
William Ting <io@williamting.com> <william.h.ting@gmail.com>
690701
Wim Looman <wim@nemo157.com> <rust-lang@nemo157.com>
691702
Wim Looman <wim@nemo157.com> <git@nemo157.com>
@@ -695,6 +706,8 @@ Xinye Tao <xy.tao@outlook.com>
695706
Xuefeng Wu <benewu@gmail.com> Xuefeng Wu <xfwu@thoughtworks.com>
696707
Xuefeng Wu <benewu@gmail.com> XuefengWu <benewu@gmail.com>
697708
York Xiang <bombless@126.com>
709+
Yoshua Wuyts <yoshuawuyts@gmail.com> <yoshuawuyts+github@gmail.com>
710+
Yoshua Wuyts <yoshuawuyts@gmail.com> <2467194+yoshuawuyts@users.noreply.github.com>
698711
Yotam Ofek <yotam.ofek@gmail.com> <yotamofek@microsoft.com>
699712
Youngsoo Son <ysson83@gmail.com> <ysoo.son@samsung.com>
700713
Youngsuk Kim <joseph942010@gmail.com>

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)