Skip to content

Commit ca8ce44

Browse files
authored
Unrolled build for #152300
Rollup merge of #152300 - jdonszelmann:port-rustc-regions, r=JonathanBrouwer Port `rustc_regions` to the new attribute parser r? @JonathanBrouwer
2 parents c7f5f3e + cf1a784 commit ca8ce44

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,22 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcLintQueryInstabilityParser {
219219
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcLintQueryInstability;
220220
}
221221

222+
pub(crate) struct RustcRegionsParser;
223+
224+
impl<S: Stage> NoArgsAttributeParser<S> for RustcRegionsParser {
225+
const PATH: &[Symbol] = &[sym::rustc_regions];
226+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
227+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
228+
Allow(Target::Fn),
229+
Allow(Target::Method(MethodKind::Inherent)),
230+
Allow(Target::Method(MethodKind::Trait { body: false })),
231+
Allow(Target::Method(MethodKind::Trait { body: true })),
232+
Allow(Target::Method(MethodKind::TraitImpl)),
233+
]);
234+
235+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcRegions;
236+
}
237+
222238
pub(crate) struct RustcLintUntrackedQueryInformationParser;
223239

224240
impl<S: Stage> NoArgsAttributeParser<S> for RustcLintUntrackedQueryInformationParser {

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ attribute_parsers!(
278278
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
279279
Single<WithoutArgs<RustcPreserveUbChecksParser>>,
280280
Single<WithoutArgs<RustcReallocatorParser>>,
281+
Single<WithoutArgs<RustcRegionsParser>>,
281282
Single<WithoutArgs<RustcShouldNotBeCalledOnConstItems>>,
282283
Single<WithoutArgs<RustcVarianceOfOpaquesParser>>,
283284
Single<WithoutArgs<RustcVarianceParser>>,

compiler/rustc_borrowck/src/nll.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use std::str::FromStr;
77

88
use polonius_engine::{Algorithm, AllFacts, Output};
99
use rustc_data_structures::frozen::Frozen;
10+
use rustc_hir::attrs::AttributeKind;
11+
use rustc_hir::find_attr;
1012
use rustc_index::IndexSlice;
1113
use rustc_middle::mir::pretty::PrettyPrintMirOptions;
1214
use rustc_middle::mir::{Body, MirDumper, PassWhere, Promoted};
@@ -15,7 +17,6 @@ use rustc_middle::ty::{self, TyCtxt};
1517
use rustc_mir_dataflow::move_paths::MoveData;
1618
use rustc_mir_dataflow::points::DenseLocationMap;
1719
use rustc_session::config::MirIncludeSpans;
18-
use rustc_span::sym;
1920
use tracing::{debug, instrument};
2021

2122
use crate::borrow_set::BorrowSet;
@@ -295,7 +296,7 @@ pub(super) fn dump_annotation<'tcx, 'infcx>(
295296
) {
296297
let tcx = infcx.tcx;
297298
let base_def_id = tcx.typeck_root_def_id(body.source.def_id());
298-
if !tcx.has_attr(base_def_id, sym::rustc_regions) {
299+
if !find_attr!(tcx.get_all_attrs(base_def_id), AttributeKind::RustcRegions) {
299300
return;
300301
}
301302

compiler/rustc_hir/src/attrs/data_structures.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,9 @@ pub enum AttributeKind {
12041204
/// Represents `#[rustc_reallocator]`
12051205
RustcReallocator,
12061206

1207+
/// Represents `#[rustc_regions]`
1208+
RustcRegions,
1209+
12071210
/// Represents `#[rustc_scalable_vector(N)]`
12081211
RustcScalableVector {
12091212
/// The base multiple of lanes that are in a scalable vector, if provided. `element_count`

compiler/rustc_hir/src/attrs/encode_cross_crate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ impl AttributeKind {
146146
RustcPreserveUbChecks => No,
147147
RustcPubTransparent(..) => Yes,
148148
RustcReallocator => No,
149+
RustcRegions => No,
149150
RustcScalableVector { .. } => Yes,
150151
RustcShouldNotBeCalledOnConstItems(..) => Yes,
151152
RustcSimdMonomorphizeLaneLimit(..) => Yes, // Affects layout computation, which needs to work cross-crate

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
337337
| AttributeKind::RustcPassIndirectlyInNonRusticAbis(..)
338338
| AttributeKind::RustcPreserveUbChecks
339339
| AttributeKind::RustcReallocator
340+
| AttributeKind::RustcRegions
340341
| AttributeKind::RustcScalableVector { .. }
341342
| AttributeKind::RustcShouldNotBeCalledOnConstItems(..)
342343
| AttributeKind::RustcSimdMonomorphizeLaneLimit(..)
@@ -401,7 +402,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
401402
| sym::rustc_never_type_options
402403
| sym::rustc_autodiff
403404
| sym::rustc_capture_analysis
404-
| sym::rustc_regions
405405
| sym::rustc_strict_coherence
406406
| sym::rustc_mir
407407
| sym::rustc_outlives

0 commit comments

Comments
 (0)