Skip to content

Commit 133798f

Browse files
committed
Auto merge of #144502 - matthiaskrgr:rollup-o81uk9m, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #144331 (Disable non_exhaustive_omitted_patterns within matches! macro) - #144376 (Suggest unwrapping when private method name is available in inner type) - #144421 (Call `is_parsed_attribute` rather than keeping track of a list of parsed attributes manually) - #144424 (Allow setting `release-blog-post` label with rustbot) - #144427 (rename ext_tool_checks to extra_checks and use mod.rs) - #144435 (rustc-dev-guide subtree update) - #144448 (Limit defaultness query to impl of trait) - #144462 (Allow pretty printing paths with `-Zself-profile-events=args`) - #144463 (change_tracker: fix a typo) - #144468 (resolve: Do not create `NameResolutions` on access unless necessary) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8708f3c + 429cc9a commit 133798f

Some content is hidden

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

42 files changed

+193
-156
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4255,6 +4255,7 @@ dependencies = [
42554255
"rustc-literal-escaper",
42564256
"rustc_ast",
42574257
"rustc_ast_pretty",
4258+
"rustc_attr_parsing",
42584259
"rustc_data_structures",
42594260
"rustc_errors",
42604261
"rustc_feature",

compiler/rustc_data_structures/src/profiling.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@ impl SelfProfilerRef {
551551
pub fn get_self_profiler(&self) -> Option<Arc<SelfProfiler>> {
552552
self.profiler.clone()
553553
}
554+
555+
/// Is expensive recording of query keys and/or function arguments enabled?
556+
pub fn is_args_recording_enabled(&self) -> bool {
557+
self.enabled() && self.event_filter_mask.intersects(EventFilter::ARGS)
558+
}
554559
}
555560

556561
/// A helper for recording costly arguments to self-profiling events. Used with

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
264264
err.span_label(within_macro_span, "due to this macro variable");
265265
}
266266
self.suggest_valid_traits(&mut err, item_name, out_of_scope_traits, true);
267+
self.suggest_unwrapping_inner_self(&mut err, source, rcvr_ty, item_name);
267268
err.emit()
268269
}
269270

compiler/rustc_lint/src/levels.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
933933
fn check_gated_lint(&self, lint_id: LintId, span: Span, lint_from_cli: bool) -> bool {
934934
let feature = if let Some(feature) = lint_id.lint.feature_gate
935935
&& !self.features.enabled(feature)
936+
&& !span.allows_unstable(feature)
936937
{
937938
// Lint is behind a feature that is not enabled; eventually return false.
938939
feature

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,11 +2124,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
21242124
};
21252125
let def_id = id.owner_id.to_def_id();
21262126

2127-
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
2128-
21292127
if of_trait && let Some(header) = tcx.impl_trait_header(def_id) {
21302128
record!(self.tables.impl_trait_header[def_id] <- header);
21312129

2130+
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
2131+
21322132
let trait_ref = header.trait_ref.instantiate_identity();
21332133
let simplified_self_ty = fast_reject::simplify_type(
21342134
self.tcx,

compiler/rustc_parse/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ bitflags = "2.4.1"
99
rustc-literal-escaper = "0.0.5"
1010
rustc_ast = { path = "../rustc_ast" }
1111
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
12+
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
1213
rustc_data_structures = { path = "../rustc_data_structures" }
1314
rustc_errors = { path = "../rustc_errors" }
1415
rustc_feature = { path = "../rustc_feature" }

compiler/rustc_parse/src/validate_attr.rs

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
//! Meta-syntax validation logic of attributes for post-expansion.
22
3+
use std::slice;
4+
35
use rustc_ast::token::Delimiter;
46
use rustc_ast::tokenstream::DelimSpan;
57
use rustc_ast::{
68
self as ast, AttrArgs, Attribute, DelimArgs, MetaItem, MetaItemInner, MetaItemKind, NodeId,
79
Path, Safety,
810
};
11+
use rustc_attr_parsing::{AttributeParser, Late};
912
use rustc_errors::{Applicability, DiagCtxtHandle, FatalError, PResult};
1013
use rustc_feature::{AttributeSafety, AttributeTemplate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute};
1114
use rustc_session::errors::report_lit_error;
@@ -266,67 +269,7 @@ pub fn check_builtin_meta_item(
266269
) {
267270
if !is_attr_template_compatible(&template, &meta.kind) {
268271
// attrs with new parsers are locally validated so excluded here
269-
if matches!(
270-
name,
271-
sym::inline
272-
| sym::export_stable
273-
| sym::ffi_const
274-
| sym::ffi_pure
275-
| sym::rustc_std_internal_symbol
276-
| sym::may_dangle
277-
| sym::rustc_as_ptr
278-
| sym::rustc_pub_transparent
279-
| sym::rustc_const_stable_indirect
280-
| sym::rustc_force_inline
281-
| sym::rustc_confusables
282-
| sym::rustc_skip_during_method_dispatch
283-
| sym::rustc_pass_by_value
284-
| sym::rustc_deny_explicit_impl
285-
| sym::rustc_do_not_implement_via_object
286-
| sym::rustc_coinductive
287-
| sym::const_trait
288-
| sym::stable
289-
| sym::unstable
290-
| sym::rustc_allowed_through_unstable_modules
291-
| sym::rustc_specialization_trait
292-
| sym::rustc_unsafe_specialization_marker
293-
| sym::rustc_allow_incoherent_impl
294-
| sym::rustc_coherence_is_core
295-
| sym::marker
296-
| sym::fundamental
297-
| sym::rustc_paren_sugar
298-
| sym::type_const
299-
| sym::repr
300-
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres
301-
// ambiguity
302-
| sym::rustc_align
303-
| sym::deprecated
304-
| sym::optimize
305-
| sym::pointee
306-
| sym::cold
307-
| sym::target_feature
308-
| sym::rustc_allow_const_fn_unstable
309-
| sym::macro_use
310-
| sym::macro_escape
311-
| sym::naked
312-
| sym::no_mangle
313-
| sym::non_exhaustive
314-
| sym::omit_gdb_pretty_printer_section
315-
| sym::path
316-
| sym::ignore
317-
| sym::must_use
318-
| sym::track_caller
319-
| sym::link_name
320-
| sym::link_ordinal
321-
| sym::export_name
322-
| sym::rustc_macro_transparency
323-
| sym::link_section
324-
| sym::rustc_layout_scalar_valid_range_start
325-
| sym::rustc_layout_scalar_valid_range_end
326-
| sym::no_implicit_prelude
327-
| sym::automatically_derived
328-
| sym::coverage
329-
) {
272+
if AttributeParser::<Late>::is_parsed_attribute(slice::from_ref(&name)) {
330273
return;
331274
}
332275
emit_malformed_attribute(psess, style, meta.span, name, template);

compiler/rustc_resolve/src/build_reduced_graph.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,10 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
452452
self.r.per_ns(|this, ns| {
453453
if !type_ns_only || ns == TypeNS {
454454
let key = BindingKey::new(target, ns);
455-
let mut resolution = this.resolution(current_module, key).borrow_mut();
456-
resolution.single_imports.insert(import);
455+
this.resolution_or_default(current_module, key)
456+
.borrow_mut()
457+
.single_imports
458+
.insert(import);
457459
}
458460
});
459461
}

compiler/rustc_resolve/src/check_unused.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,7 @@ impl Resolver<'_, '_> {
509509
let mut check_redundant_imports = FxIndexSet::default();
510510
for module in self.arenas.local_modules().iter() {
511511
for (_key, resolution) in self.resolutions(*module).borrow().iter() {
512-
let resolution = resolution.borrow();
513-
514-
if let Some(binding) = resolution.best_binding()
512+
if let Some(binding) = resolution.borrow().best_binding()
515513
&& let NameBindingKind::Import { import, .. } = binding.kind
516514
&& let ImportKind::Single { id, .. } = import.kind
517515
{

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,10 +2659,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26592659
return None;
26602660
}
26612661

2662-
let resolutions = self.resolutions(crate_module).borrow();
26632662
let binding_key = BindingKey::new(ident, MacroNS);
2664-
let resolution = resolutions.get(&binding_key)?;
2665-
let binding = resolution.borrow().binding()?;
2663+
let binding = self.resolution(crate_module, binding_key)?.binding()?;
26662664
let Res::Def(DefKind::Macro(MacroKind::Bang), _) = binding.res() else {
26672665
return None;
26682666
};

0 commit comments

Comments
 (0)