Skip to content

Commit cf9cf7c

Browse files
committed
Auto merge of rust-lang#78904 - Dylan-DPC:rollup-8d2w3vu, r=Dylan-DPC
Rollup of 12 pull requests Successful merges: - rust-lang#74754 (Add `#[cfg(panic = '...')]`) - rust-lang#76468 (Improve lifetime name annotations for closures & async functions) - rust-lang#77016 (Test clippy on PR CI on changes) - rust-lang#78480 (BTreeMap: fix pointer provenance rules) - rust-lang#78502 (Update Chalk to 0.36.0) - rust-lang#78513 (Infer the default host target from the host toolchain if possible) - rust-lang#78566 (Enable LLVM Polly via llvm-args.) - rust-lang#78580 (inliner: Break inlining cycles) - rust-lang#78710 (rustc_ast: Do not panic by default when visiting macro calls) - rust-lang#78746 (Demote i686-unknown-freebsd to tier 2 compiler target) - rust-lang#78830 (fix `super_visit_with` for `Terminator`) - rust-lang#78844 (Monomorphize a type argument of size-of operation during codegen) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 25f6938 + c150b93 commit cf9cf7c

File tree

72 files changed

+1465
-935
lines changed

Some content is hidden

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

72 files changed

+1465
-935
lines changed

.github/workflows/ci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ jobs:
183183
- name: dist-i586-gnu-i586-i686-musl
184184
os: ubuntu-latest-xl
185185
env: {}
186-
- name: dist-i686-freebsd
187-
os: ubuntu-latest-xl
188-
env: {}
189186
- name: dist-i686-linux
190187
os: ubuntu-latest-xl
191188
env: {}

Cargo.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
460460

461461
[[package]]
462462
name = "chalk-derive"
463-
version = "0.32.0"
463+
version = "0.36.0"
464464
source = "registry+https://github.com/rust-lang/crates.io-index"
465-
checksum = "2d072b2ba723f0bada7c515d8b3725224bc4f5052d2a92dcbeb0b118ff37084a"
465+
checksum = "9f88ce4deae1dace71e49b7611cfae2d5489de3530d6daba5758043c47ac3a10"
466466
dependencies = [
467467
"proc-macro2",
468468
"quote",
@@ -472,9 +472,9 @@ dependencies = [
472472

473473
[[package]]
474474
name = "chalk-engine"
475-
version = "0.32.0"
475+
version = "0.36.0"
476476
source = "registry+https://github.com/rust-lang/crates.io-index"
477-
checksum = "6fb5475f6083d6d6c509e1c335c4f69ad04144ac090faa1afb134a53c3695841"
477+
checksum = "0e34c9b1b10616782143d7f49490f91ae94afaf2202de3ab0b2835e78b4f0ccc"
478478
dependencies = [
479479
"chalk-derive",
480480
"chalk-ir",
@@ -485,19 +485,19 @@ dependencies = [
485485

486486
[[package]]
487487
name = "chalk-ir"
488-
version = "0.32.0"
488+
version = "0.36.0"
489489
source = "registry+https://github.com/rust-lang/crates.io-index"
490-
checksum = "f60cdb0e18c5455cb6a85e8464aad3622b70476018edfa8845691df66f7e9a05"
490+
checksum = "63362c629c2014ab639b04029070763fb8224df136d1363d30e9ece4c8877da3"
491491
dependencies = [
492492
"chalk-derive",
493493
"lazy_static",
494494
]
495495

496496
[[package]]
497497
name = "chalk-solve"
498-
version = "0.32.0"
498+
version = "0.36.0"
499499
source = "registry+https://github.com/rust-lang/crates.io-index"
500-
checksum = "981534d499a8476ecc0b520be4d3864757f96211826a75360fbf2cb6fae362ab"
500+
checksum = "cac338a67af52a7f50bb2f8232e730a3518ce432dbe303246acfe525ddd838c7"
501501
dependencies = [
502502
"chalk-derive",
503503
"chalk-ir",

compiler/rustc_ast/src/mut_visit.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,8 @@ pub trait MutVisitor: Sized {
210210
noop_visit_local(l, self);
211211
}
212212

213-
fn visit_mac(&mut self, _mac: &mut MacCall) {
214-
panic!("visit_mac disabled by default");
215-
// N.B., see note about macros above. If you really want a visitor that
216-
// works on macros, use this definition in your trait impl:
217-
// mut_visit::noop_visit_mac(_mac, self);
213+
fn visit_mac_call(&mut self, mac: &mut MacCall) {
214+
noop_visit_mac(mac, self);
218215
}
219216

220217
fn visit_macro_def(&mut self, def: &mut MacroDef) {
@@ -494,7 +491,7 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
494491
vis.visit_id(id);
495492
visit_vec(bounds, |bound| vis.visit_param_bound(bound));
496493
}
497-
TyKind::MacCall(mac) => vis.visit_mac(mac),
494+
TyKind::MacCall(mac) => vis.visit_mac_call(mac),
498495
}
499496
vis.visit_span(span);
500497
visit_lazy_tts(tokens, vis);
@@ -962,7 +959,7 @@ pub fn noop_visit_item_kind<T: MutVisitor>(kind: &mut ItemKind, vis: &mut T) {
962959
vis.visit_generics(generics);
963960
visit_bounds(bounds, vis);
964961
}
965-
ItemKind::MacCall(m) => vis.visit_mac(m),
962+
ItemKind::MacCall(m) => vis.visit_mac_call(m),
966963
ItemKind::MacroDef(def) => vis.visit_macro_def(def),
967964
}
968965
}
@@ -991,7 +988,7 @@ pub fn noop_flat_map_assoc_item<T: MutVisitor>(
991988
visit_bounds(bounds, visitor);
992989
visit_opt(ty, |ty| visitor.visit_ty(ty));
993990
}
994-
AssocItemKind::MacCall(mac) => visitor.visit_mac(mac),
991+
AssocItemKind::MacCall(mac) => visitor.visit_mac_call(mac),
995992
}
996993
visitor.visit_span(span);
997994
visit_lazy_tts(tokens, visitor);
@@ -1081,7 +1078,7 @@ pub fn noop_flat_map_foreign_item<T: MutVisitor>(
10811078
visit_bounds(bounds, visitor);
10821079
visit_opt(ty, |ty| visitor.visit_ty(ty));
10831080
}
1084-
ForeignItemKind::MacCall(mac) => visitor.visit_mac(mac),
1081+
ForeignItemKind::MacCall(mac) => visitor.visit_mac_call(mac),
10851082
}
10861083
visitor.visit_span(span);
10871084
visit_lazy_tts(tokens, visitor);
@@ -1121,7 +1118,7 @@ pub fn noop_visit_pat<T: MutVisitor>(pat: &mut P<Pat>, vis: &mut T) {
11211118
visit_vec(elems, |elem| vis.visit_pat(elem))
11221119
}
11231120
PatKind::Paren(inner) => vis.visit_pat(inner),
1124-
PatKind::MacCall(mac) => vis.visit_mac(mac),
1121+
PatKind::MacCall(mac) => vis.visit_mac_call(mac),
11251122
}
11261123
vis.visit_span(span);
11271124
visit_lazy_tts(tokens, vis);
@@ -1287,7 +1284,7 @@ pub fn noop_visit_expr<T: MutVisitor>(
12871284
}
12881285
visit_vec(inputs, |(_c, expr)| vis.visit_expr(expr));
12891286
}
1290-
ExprKind::MacCall(mac) => vis.visit_mac(mac),
1287+
ExprKind::MacCall(mac) => vis.visit_mac_call(mac),
12911288
ExprKind::Struct(path, fields, expr) => {
12921289
vis.visit_path(path);
12931290
fields.flat_map_in_place(|field| vis.flat_map_field(field));
@@ -1350,7 +1347,7 @@ pub fn noop_flat_map_stmt_kind<T: MutVisitor>(
13501347
StmtKind::Empty => smallvec![StmtKind::Empty],
13511348
StmtKind::MacCall(mut mac) => {
13521349
let MacCallStmt { mac: mac_, style: _, attrs } = mac.deref_mut();
1353-
vis.visit_mac(mac_);
1350+
vis.visit_mac_call(mac_);
13541351
visit_thin_attrs(attrs, vis);
13551352
smallvec![StmtKind::MacCall(mac)]
13561353
}

compiler/rustc_ast/src/visit.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,8 @@ pub trait Visitor<'ast>: Sized {
176176
fn visit_lifetime(&mut self, lifetime: &'ast Lifetime) {
177177
walk_lifetime(self, lifetime)
178178
}
179-
fn visit_mac(&mut self, _mac: &'ast MacCall) {
180-
panic!("visit_mac disabled by default");
181-
// N.B., see note about macros above.
182-
// if you really want a visitor that
183-
// works on macros, use this
184-
// definition in your trait impl:
185-
// visit::walk_mac(self, _mac)
179+
fn visit_mac_call(&mut self, mac: &'ast MacCall) {
180+
walk_mac(self, mac)
186181
}
187182
fn visit_mac_def(&mut self, _mac: &'ast MacroDef, _id: NodeId) {
188183
// Nothing to do
@@ -346,7 +341,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
346341
visitor.visit_generics(generics);
347342
walk_list!(visitor, visit_param_bound, bounds);
348343
}
349-
ItemKind::MacCall(ref mac) => visitor.visit_mac(mac),
344+
ItemKind::MacCall(ref mac) => visitor.visit_mac_call(mac),
350345
ItemKind::MacroDef(ref ts) => visitor.visit_mac_def(ts, item.id),
351346
}
352347
walk_list!(visitor, visit_attribute, &item.attrs);
@@ -414,7 +409,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
414409
}
415410
TyKind::Typeof(ref expression) => visitor.visit_anon_const(expression),
416411
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err => {}
417-
TyKind::MacCall(ref mac) => visitor.visit_mac(mac),
412+
TyKind::MacCall(ref mac) => visitor.visit_mac_call(mac),
418413
TyKind::Never | TyKind::CVarArgs => {}
419414
}
420415
}
@@ -532,7 +527,7 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) {
532527
PatKind::Tuple(ref elems) | PatKind::Slice(ref elems) | PatKind::Or(ref elems) => {
533528
walk_list!(visitor, visit_pat, elems);
534529
}
535-
PatKind::MacCall(ref mac) => visitor.visit_mac(mac),
530+
PatKind::MacCall(ref mac) => visitor.visit_mac_call(mac),
536531
}
537532
}
538533

@@ -557,7 +552,7 @@ pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a ForeignI
557552
walk_list!(visitor, visit_ty, ty);
558553
}
559554
ForeignItemKind::MacCall(mac) => {
560-
visitor.visit_mac(mac);
555+
visitor.visit_mac_call(mac);
561556
}
562557
}
563558
}
@@ -662,7 +657,7 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem,
662657
walk_list!(visitor, visit_ty, ty);
663658
}
664659
AssocItemKind::MacCall(mac) => {
665-
visitor.visit_mac(mac);
660+
visitor.visit_mac_call(mac);
666661
}
667662
}
668663
}
@@ -692,7 +687,7 @@ pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) {
692687
StmtKind::Empty => {}
693688
StmtKind::MacCall(ref mac) => {
694689
let MacCallStmt { ref mac, style: _, ref attrs } = **mac;
695-
visitor.visit_mac(mac);
690+
visitor.visit_mac_call(mac);
696691
for attr in attrs.iter() {
697692
visitor.visit_attribute(attr);
698693
}
@@ -823,7 +818,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
823818
ExprKind::Ret(ref optional_expression) => {
824819
walk_list!(visitor, visit_expr, optional_expression);
825820
}
826-
ExprKind::MacCall(ref mac) => visitor.visit_mac(mac),
821+
ExprKind::MacCall(ref mac) => visitor.visit_mac_call(mac),
827822
ExprKind::Paren(ref subexpression) => visitor.visit_expr(subexpression),
828823
ExprKind::InlineAsm(ref ia) => {
829824
for (op, _) in &ia.operands {

compiler/rustc_ast_passes/src/node_count.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ impl<'ast> Visitor<'ast> for NodeCounter {
114114
self.count += 1;
115115
walk_lifetime(self, lifetime)
116116
}
117-
fn visit_mac(&mut self, _mac: &MacCall) {
117+
fn visit_mac_call(&mut self, mac: &MacCall) {
118118
self.count += 1;
119-
walk_mac(self, _mac)
119+
walk_mac(self, mac)
120120
}
121121
fn visit_path(&mut self, path: &Path, _id: NodeId) {
122122
self.count += 1;

compiler/rustc_ast_passes/src/show_span.rs

-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ impl<'a> Visitor<'a> for ShowSpanVisitor<'a> {
5454
}
5555
visit::walk_ty(self, t);
5656
}
57-
58-
fn visit_mac(&mut self, mac: &'a ast::MacCall) {
59-
visit::walk_mac(self, mac);
60-
}
6157
}
6258

6359
pub fn run(span_diagnostic: &rustc_errors::Handler, mode: &str, krate: &ast::Crate) {

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ fn find_type_parameters(
358358
visit::walk_ty(self, ty)
359359
}
360360

361-
fn visit_mac(&mut self, mac: &ast::MacCall) {
361+
fn visit_mac_call(&mut self, mac: &ast::MacCall) {
362362
self.cx.span_err(mac.span(), "`derive` cannot be used on items with type macros");
363363
}
364364
}

compiler/rustc_builtin_macros/src/proc_macro_harness.rs

-4
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,6 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
344344
visit::walk_item(self, item);
345345
self.in_root = prev_in_root;
346346
}
347-
348-
fn visit_mac(&mut self, mac: &'a ast::MacCall) {
349-
visit::walk_mac(self, mac)
350-
}
351347
}
352348

353349
// Creates a new module which looks like:

compiler/rustc_builtin_macros/src/test_harness.rs

-8
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> {
130130
}
131131
smallvec![P(item)]
132132
}
133-
134-
fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
135-
// Do nothing.
136-
}
137133
}
138134

139135
// Beware, this is duplicated in librustc_passes/entry.rs (with
@@ -201,10 +197,6 @@ impl<'a> MutVisitor for EntryPointCleaner<'a> {
201197

202198
smallvec![item]
203199
}
204-
205-
fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
206-
// Do nothing.
207-
}
208200
}
209201

210202
/// Crawl over the crate, inserting test reexports and the test main function

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+1
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
502502
}
503503

504504
mir::Rvalue::NullaryOp(mir::NullOp::SizeOf, ty) => {
505+
let ty = self.monomorphize(&ty);
505506
assert!(bx.cx().type_is_sized(ty));
506507
let val = bx.cx().const_usize(bx.cx().layout_of(ty).size.bytes());
507508
let tcx = self.cx.tcx();

compiler/rustc_expand/src/config.rs

-5
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,6 @@ impl<'a> MutVisitor for StripUnconfigured<'a> {
547547
noop_flat_map_assoc_item(configure!(self, item), self)
548548
}
549549

550-
fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
551-
// Don't configure interpolated AST (cf. issue #34171).
552-
// Interpolated AST will get configured once the surrounding tokens are parsed.
553-
}
554-
555550
fn visit_pat(&mut self, pat: &mut P<ast::Pat>) {
556551
self.configure_pat(pat);
557552
noop_visit_pat(pat, self)

compiler/rustc_expand/src/expand.rs

-2
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
850850

851851
visit::walk_item(self, item);
852852
}
853-
854-
fn visit_mac(&mut self, _: &'ast ast::MacCall) {}
855853
}
856854

857855
if !self.cx.ecfg.proc_macro_hygiene() {

compiler/rustc_expand/src/mbe/transcribe.rs

-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq, NamedMatch};
55
use rustc_ast::mut_visit::{self, MutVisitor};
66
use rustc_ast::token::{self, NtTT, Token};
77
use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndSpacing};
8-
use rustc_ast::MacCall;
98
use rustc_data_structures::fx::FxHashMap;
109
use rustc_data_structures::sync::Lrc;
1110
use rustc_errors::{pluralize, PResult};
@@ -27,10 +26,6 @@ impl MutVisitor for Marker {
2726
fn visit_span(&mut self, span: &mut Span) {
2827
*span = span.apply_mark(self.0, self.1)
2928
}
30-
31-
fn visit_mac(&mut self, mac: &mut MacCall) {
32-
mut_visit::noop_visit_mac(mac, self)
33-
}
3429
}
3530

3631
/// An iterator over the token trees in a delimited token tree (`{ ... }`) or a sequence (`$(...)`).

compiler/rustc_expand/src/mut_visit/tests.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::tests::{matches_codepattern, string_to_crate};
22

33
use rustc_ast as ast;
4-
use rustc_ast::mut_visit::{self, MutVisitor};
4+
use rustc_ast::mut_visit::MutVisitor;
55
use rustc_ast_pretty::pprust;
66
use rustc_span::symbol::Ident;
77
use rustc_span::with_default_session_globals;
@@ -21,9 +21,6 @@ impl MutVisitor for ToZzIdentMutVisitor {
2121
fn visit_ident(&mut self, ident: &mut Ident) {
2222
*ident = Ident::from_str("zz");
2323
}
24-
fn visit_mac(&mut self, mac: &mut ast::MacCall) {
25-
mut_visit::noop_visit_mac(mac, self)
26-
}
2724
}
2825

2926
// Maybe add to `expand.rs`.

compiler/rustc_expand/src/placeholders.rs

-4
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,4 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> {
385385
|item| !matches!(item.kind, ast::ItemKind::MacCall(_) if !self.cx.ecfg.keep_macs),
386386
);
387387
}
388-
389-
fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
390-
// Do nothing.
391-
}
392388
}

compiler/rustc_feature/src/active.rs

+3
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,9 @@ declare_features! (
613613
/// Allows the use of destructuring assignments.
614614
(active, destructuring_assignment, "1.49.0", Some(71126), None),
615615

616+
/// Enables `#[cfg(panic = "...")]` config key.
617+
(active, cfg_panic, "1.49.0", Some(77443), None),
618+
616619
// -------------------------------------------------------------------------
617620
// feature-group-end: actual feature gates
618621
// -------------------------------------------------------------------------

compiler/rustc_feature/src/builtin_attrs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const GATED_CFGS: &[GatedCfg] = &[
3333
),
3434
(sym::sanitize, sym::cfg_sanitize, cfg_fn!(cfg_sanitize)),
3535
(sym::version, sym::cfg_version, cfg_fn!(cfg_version)),
36+
(sym::panic, sym::cfg_panic, cfg_fn!(cfg_panic)),
3637
];
3738

3839
/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.

compiler/rustc_interface/src/util.rs

-6
Original file line numberDiff line numberDiff line change
@@ -880,12 +880,6 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> {
880880
})
881881
}
882882
}
883-
884-
// in general the pretty printer processes unexpanded code, so
885-
// we override the default `visit_mac` method which panics.
886-
fn visit_mac(&mut self, mac: &mut ast::MacCall) {
887-
noop_visit_mac(mac, self)
888-
}
889883
}
890884

891885
/// Returns a version string such as "rustc 1.46.0 (04488afe3 2020-08-24)"

0 commit comments

Comments
 (0)