Skip to content

Commit 134b5c4

Browse files
committed
Auto merge of #161905 - JonathanBrouwer:rollup-HgmRlVv, r=<try>
Rollup of 21 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple-1 try-job: aarch64-apple-2 try-job: x86_64-mingw-1 try-job: i686-msvc-1 try-job: i686-msvc-2
2 parents d0f2ef5 + ef67a60 commit 134b5c4

198 files changed

Lines changed: 2272 additions & 667 deletions

File tree

Some content is hidden

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

compiler/rustc_attr_ir/src/data_structures.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -70,42 +70,6 @@ pub enum CguFields {
7070
ExpectedCguReuse { cfg: Symbol, module: Symbol, kind: CguKind },
7171
}
7272

73-
#[derive(Copy, Clone, PartialEq, Debug, PrintAttribute)]
74-
#[derive(StableHash, Encodable, Decodable)]
75-
pub enum DivergingFallbackBehavior {
76-
/// Always fallback to `()` (aka "always spontaneous decay")
77-
ToUnit,
78-
/// Always fallback to `!` (which should be equivalent to never falling back + not making
79-
/// never-to-any coercions unless necessary)
80-
ToNever,
81-
/// Don't fallback at all
82-
NoFallback,
83-
}
84-
85-
#[derive(Copy, Clone, PartialEq, Debug, PrintAttribute, Default)]
86-
#[derive(StableHash, Encodable, Decodable)]
87-
pub enum DivergingBlockBehavior {
88-
/// This is the current stable behavior:
89-
///
90-
/// ```rust
91-
/// {
92-
/// return;
93-
/// } // block has type = !, even though we are supposedly dropping it with `;`
94-
/// ```
95-
#[default]
96-
Never,
97-
98-
/// Alternative behavior:
99-
///
100-
/// ```ignore (very-unstable-new-attribute)
101-
/// #![rustc_never_type_options(diverging_block_default = "unit")]
102-
/// {
103-
/// return;
104-
/// } // block has type = (), since we are dropping `!` from `return` with `;`
105-
/// ```
106-
Unit,
107-
}
108-
10973
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, StableHash, PrintAttribute)]
11074
pub enum InlineAttr {
11175
None,
@@ -1367,12 +1331,6 @@ pub enum AttributeKind {
13671331
/// Represents `#[rustc_never_returns_null_ptr]`
13681332
RustcNeverReturnsNullPtr,
13691333

1370-
/// Represents `#[rustc_never_type_options]`.
1371-
RustcNeverTypeOptions {
1372-
fallback: Option<DivergingFallbackBehavior>,
1373-
diverging_block_default: Option<DivergingBlockBehavior>,
1374-
},
1375-
13761334
/// Represents `#[rustc_no_implicit_autorefs]`
13771335
RustcNoImplicitAutorefs,
13781336

compiler/rustc_attr_ir/src/encode_cross_crate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ impl AttributeKind {
165165
RustcMustImplementOneOf { .. } => No,
166166
RustcMustMatchExhaustively(..) => Yes,
167167
RustcNeverReturnsNullPtr => Yes,
168-
RustcNeverTypeOptions { .. } => No,
169168
RustcNoImplicitAutorefs => Yes,
170169
RustcNoImplicitBounds => No,
171170
RustcNoMirInline => Yes,

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use rustc_ast::{LitIntType, LitKind, MetaItemLit};
44
use rustc_attr_ir::lang_items::LangItem;
55
use rustc_attr_ir::target::GenericParamKind;
66
use rustc_attr_ir::{
7-
BorrowckGraphvizFormatKind, CguFields, CguKind, DivergingBlockBehavior,
8-
DivergingFallbackBehavior, RustcCleanAttribute, RustcCleanQueries, RustcMirKind,
7+
BorrowckGraphvizFormatKind, CguFields, CguKind, RustcCleanAttribute, RustcCleanQueries,
8+
RustcMirKind,
99
};
1010
use rustc_data_structures::fx::FxHashMap;
1111
use rustc_feature::AttributeStability;
@@ -397,79 +397,6 @@ impl NoArgsAttributeParser for RustcCaptureAnalysisParser {
397397
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcCaptureAnalysis;
398398
}
399399

400-
pub(crate) struct RustcNeverTypeOptionsParser;
401-
402-
impl SingleAttributeParser for RustcNeverTypeOptionsParser {
403-
const PATH: &[Symbol] = &[sym::rustc_never_type_options];
404-
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
405-
const TEMPLATE: AttributeTemplate = template!(List: &[
406-
r#"fallback = "unit", "never", "no""#,
407-
r#"diverging_block_default = "unit", "never""#,
408-
]);
409-
const STABILITY: AttributeStability = unstable!(
410-
rustc_attrs,
411-
"`rustc_never_type_options` is used to experiment with never type fallback and work on never type stabilization"
412-
);
413-
414-
fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
415-
let list = cx.expect_list(args, cx.attr_span)?;
416-
417-
let mut fallback = None::<Ident>;
418-
let mut diverging_block_default = None::<Ident>;
419-
420-
for arg in list.mixed() {
421-
let Some((ident, arg)) = cx.expect_name_value(arg, arg.span(), None) else {
422-
continue;
423-
};
424-
425-
let res = match ident.name {
426-
sym::fallback => &mut fallback,
427-
sym::diverging_block_default => &mut diverging_block_default,
428-
_ => {
429-
cx.adcx().expected_specific_argument(
430-
ident.span,
431-
&[sym::fallback, sym::diverging_block_default],
432-
);
433-
continue;
434-
}
435-
};
436-
437-
let field = cx.expect_string_literal(arg)?;
438-
439-
if res.is_some() {
440-
cx.adcx().duplicate_key(ident.span, ident.name);
441-
continue;
442-
}
443-
444-
*res = Some(Ident { name: field, span: arg.value_span });
445-
}
446-
447-
let fallback = match fallback {
448-
None => None,
449-
Some(Ident { name: sym::unit, .. }) => Some(DivergingFallbackBehavior::ToUnit),
450-
Some(Ident { name: sym::never, .. }) => Some(DivergingFallbackBehavior::ToNever),
451-
Some(Ident { name: sym::no, .. }) => Some(DivergingFallbackBehavior::NoFallback),
452-
Some(Ident { span, .. }) => {
453-
cx.adcx()
454-
.expected_specific_argument_strings(span, &[sym::unit, sym::never, sym::no]);
455-
return None;
456-
}
457-
};
458-
459-
let diverging_block_default = match diverging_block_default {
460-
None => None,
461-
Some(Ident { name: sym::unit, .. }) => Some(DivergingBlockBehavior::Unit),
462-
Some(Ident { name: sym::never, .. }) => Some(DivergingBlockBehavior::Never),
463-
Some(Ident { span, .. }) => {
464-
cx.adcx().expected_specific_argument_strings(span, &[sym::unit, sym::no]);
465-
return None;
466-
}
467-
};
468-
469-
Some(AttributeKind::RustcNeverTypeOptions { fallback, diverging_block_default })
470-
}
471-
}
472-
473400
pub(crate) struct RustcTrivialFieldReadsParser;
474401

475402
impl NoArgsAttributeParser for RustcTrivialFieldReadsParser {

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ attribute_parsers!(
246246
Single<RustcLintOptDenyFieldAccessParser>,
247247
Single<RustcMacroTransparencyParser>,
248248
Single<RustcMustImplementOneOfParser>,
249-
Single<RustcNeverTypeOptionsParser>,
250249
Single<RustcObjcClassParser>,
251250
Single<RustcObjcSelectorParser>,
252251
Single<RustcScalableVectorParser>,

0 commit comments

Comments
 (0)