Skip to content

Commit 394c406

Browse files
committedSep 12, 2024
Auto merge of #130269 - Zalathar:rollup-coxzt2t, r=Zalathar
Rollup of 8 pull requests Successful merges: - #125060 (Expand documentation of PathBuf, discussing lack of sanitization) - #129367 (Fix default/minimum deployment target for Aarch64 simulator targets) - #130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd) - #130160 (Fix `slice::first_mut` docs) - #130235 (Simplify some nested `if` statements) - #130250 (Fix `clippy::useless_conversion`) - #130252 (Properly report error on `const gen fn`) - #130256 (Re-run coverage tests if `coverage-dump` was modified) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f753bc7 + 458a57a commit 394c406

File tree

90 files changed

+740
-761
lines changed

Some content is hidden

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

90 files changed

+740
-761
lines changed
 

‎compiler/rustc_ast/src/ast.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,12 +2602,12 @@ impl CoroutineKind {
26022602
}
26032603
}
26042604

2605-
pub fn is_async(self) -> bool {
2606-
matches!(self, CoroutineKind::Async { .. })
2607-
}
2608-
2609-
pub fn is_gen(self) -> bool {
2610-
matches!(self, CoroutineKind::Gen { .. })
2605+
pub fn as_str(self) -> &'static str {
2606+
match self {
2607+
CoroutineKind::Async { .. } => "async",
2608+
CoroutineKind::Gen { .. } => "gen",
2609+
CoroutineKind::AsyncGen { .. } => "async gen",
2610+
}
26112611
}
26122612

26132613
pub fn closure_id(self) -> NodeId {
@@ -3486,7 +3486,7 @@ impl From<ForeignItemKind> for ItemKind {
34863486
fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
34873487
match foreign_item_kind {
34883488
ForeignItemKind::Static(box static_foreign_item) => {
3489-
ItemKind::Static(Box::new(static_foreign_item.into()))
3489+
ItemKind::Static(Box::new(static_foreign_item))
34903490
}
34913491
ForeignItemKind::Fn(fn_kind) => ItemKind::Fn(fn_kind),
34923492
ForeignItemKind::TyAlias(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
@@ -3500,9 +3500,7 @@ impl TryFrom<ItemKind> for ForeignItemKind {
35003500

35013501
fn try_from(item_kind: ItemKind) -> Result<ForeignItemKind, ItemKind> {
35023502
Ok(match item_kind {
3503-
ItemKind::Static(box static_item) => {
3504-
ForeignItemKind::Static(Box::new(static_item.into()))
3505-
}
3503+
ItemKind::Static(box static_item) => ForeignItemKind::Static(Box::new(static_item)),
35063504
ItemKind::Fn(fn_kind) => ForeignItemKind::Fn(fn_kind),
35073505
ItemKind::TyAlias(ty_alias_kind) => ForeignItemKind::TyAlias(ty_alias_kind),
35083506
ItemKind::MacCall(a) => ForeignItemKind::MacCall(a),

‎compiler/rustc_ast/src/entry.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,16 @@ pub fn entry_point_type(
4545
EntryPointType::Start
4646
} else if attr::contains_name(attrs, sym::rustc_main) {
4747
EntryPointType::RustcMainAttr
48-
} else {
49-
if let Some(name) = name
50-
&& name == sym::main
51-
{
52-
if at_root {
53-
// This is a top-level function so it can be `main`.
54-
EntryPointType::MainNamed
55-
} else {
56-
EntryPointType::OtherMain
57-
}
48+
} else if let Some(name) = name
49+
&& name == sym::main
50+
{
51+
if at_root {
52+
// This is a top-level function so it can be `main`.
53+
EntryPointType::MainNamed
5854
} else {
59-
EntryPointType::None
55+
EntryPointType::OtherMain
6056
}
57+
} else {
58+
EntryPointType::None
6159
}
6260
}

0 commit comments

Comments
 (0)
Please sign in to comment.