Skip to content

Commit d940e56

Browse files
committed
Auto merge of #151363 - JonathanBrouwer:rollup-yIXELnN, r=JonathanBrouwer
Rollup of 2 pull requests Successful merges: - #151336 (Port rustc codegen attrs) - #151359 (compiler: Temporarily re-export `assert_matches!` to reduce stabilization churn) r? @ghost
2 parents 158ae9e + 4004dd1 commit d940e56

File tree

64 files changed

+108
-86
lines changed

Some content is hidden

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

64 files changed

+108
-86
lines changed

compiler/rustc_abi/src/extern_abi/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::assert_matches::assert_matches;
21
use std::str::FromStr;
32

3+
use rustc_data_structures::assert_matches;
4+
45
use super::*;
56

67
#[allow(non_snake_case)]

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,27 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcHasIncoherentInherentImplsParse
320320
]);
321321
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcHasIncoherentInherentImpls;
322322
}
323+
324+
pub(crate) struct RustcNounwindParser;
325+
326+
impl<S: Stage> NoArgsAttributeParser<S> for RustcNounwindParser {
327+
const PATH: &[Symbol] = &[sym::rustc_nounwind];
328+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
329+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
330+
Allow(Target::Fn),
331+
Allow(Target::ForeignFn),
332+
Allow(Target::Method(MethodKind::Inherent)),
333+
Allow(Target::Method(MethodKind::TraitImpl)),
334+
Allow(Target::Method(MethodKind::Trait { body: true })),
335+
]);
336+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNounwind;
337+
}
338+
339+
pub(crate) struct RustcOffloadKernelParser;
340+
341+
impl<S: Stage> NoArgsAttributeParser<S> for RustcOffloadKernelParser {
342+
const PATH: &[Symbol] = &[sym::rustc_offload_kernel];
343+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
344+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
345+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcOffloadKernel;
346+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ use crate::attributes::rustc_internal::{
7878
RustcLintDiagnosticsParser, RustcLintOptDenyFieldAccessParser, RustcLintOptTyParser,
7979
RustcLintQueryInstabilityParser, RustcLintUntrackedQueryInformationParser, RustcMainParser,
8080
RustcMustImplementOneOfParser, RustcNeverReturnsNullPointerParser,
81-
RustcNoImplicitAutorefsParser, RustcObjectLifetimeDefaultParser, RustcScalableVectorParser,
82-
RustcSimdMonomorphizeLaneLimitParser,
81+
RustcNoImplicitAutorefsParser, RustcNounwindParser, RustcObjectLifetimeDefaultParser,
82+
RustcOffloadKernelParser, RustcScalableVectorParser, RustcSimdMonomorphizeLaneLimitParser,
8383
};
8484
use crate::attributes::semantics::MayDangleParser;
8585
use crate::attributes::stability::{
@@ -296,6 +296,8 @@ attribute_parsers!(
296296
Single<WithoutArgs<RustcMainParser>>,
297297
Single<WithoutArgs<RustcNeverReturnsNullPointerParser>>,
298298
Single<WithoutArgs<RustcNoImplicitAutorefsParser>>,
299+
Single<WithoutArgs<RustcNounwindParser>>,
300+
Single<WithoutArgs<RustcOffloadKernelParser>>,
299301
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
300302
Single<WithoutArgs<RustcReallocatorParser>>,
301303
Single<WithoutArgs<RustcShouldNotBeCalledOnConstItems>>,

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![allow(rustc::untranslatable_diagnostic)]
55

6-
use std::assert_matches::assert_matches;
7-
6+
use rustc_data_structures::assert_matches;
87
use rustc_errors::{Applicability, Diag, EmissionGuarantee};
98
use rustc_hir as hir;
109
use rustc_hir::intravisit::Visitor;

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
88
//! contain revealed `impl Trait` values).
99
10-
use std::assert_matches::assert_matches;
11-
1210
use itertools::Itertools;
11+
use rustc_data_structures::assert_matches;
1312
use rustc_hir as hir;
1413
use rustc_infer::infer::{BoundRegionConversionTime, RegionVariableOrigin};
1514
use rustc_middle::mir::*;

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! The expansion from a test function to the appropriate test struct for libtest
22
//! Ideally, this code would be in libtest but for efficiency and error messages it lives here.
33
4-
use std::assert_matches::assert_matches;
54
use std::iter;
65

76
use rustc_ast::{self as ast, GenericParamKind, HasNodeId, attr, join_path_idents};
87
use rustc_ast_pretty::pprust;
98
use rustc_attr_parsing::AttributeParser;
9+
use rustc_data_structures::assert_matches;
1010
use rustc_errors::{Applicability, Diag, Level};
1111
use rustc_expand::base::*;
1212
use rustc_hir::Attribute;

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use std::assert_matches::assert_matches;
2-
31
use rustc_abi::{BackendRepr, Float, Integer, Primitive, Scalar};
42
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
53
use rustc_codegen_ssa::mir::operand::OperandValue;
64
use rustc_codegen_ssa::traits::*;
5+
use rustc_data_structures::assert_matches;
76
use rustc_data_structures::fx::FxHashMap;
87
use rustc_middle::ty::Instance;
98
use rustc_middle::ty::layout::TyAndLayout;

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use std::assert_matches::assert_matches;
21
use std::sync::Arc;
32

43
use itertools::Itertools;
54
use rustc_abi::Align;
65
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, ConstCodegenMethods};
6+
use rustc_data_structures::assert_matches;
77
use rustc_data_structures::fx::FxIndexMap;
88
use rustc_index::IndexVec;
99
use rustc_middle::ty::TyCtxt;

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::assert_matches::assert_matches;
21
use std::cmp::Ordering;
32
use std::ffi::c_uint;
43
use std::ptr;
@@ -13,6 +12,7 @@ use rustc_codegen_ssa::errors::{ExpectedPointerMutability, InvalidMonomorphizati
1312
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
1413
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
1514
use rustc_codegen_ssa::traits::*;
15+
use rustc_data_structures::assert_matches;
1616
use rustc_hir::def_id::LOCAL_CRATE;
1717
use rustc_hir::{self as hir};
1818
use rustc_middle::mir::BinOp;

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::assert_matches::assert_matches;
21
use std::marker::PhantomData;
32
use std::panic::AssertUnwindSafe;
43
use std::path::{Path, PathBuf};
@@ -8,6 +7,7 @@ use std::{fs, io, mem, str, thread};
87

98
use rustc_abi::Size;
109
use rustc_ast::attr;
10+
use rustc_data_structures::assert_matches;
1111
use rustc_data_structures::fx::FxIndexMap;
1212
use rustc_data_structures::jobserver::{self, Acquired};
1313
use rustc_data_structures::memmap::Mmap;

0 commit comments

Comments
 (0)