Skip to content

Commit 42d2fe0

Browse files
committed
Use the function item name as the intrinsic's name
1 parent 3140f32 commit 42d2fe0

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
792792
"the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe"
793793
),
794794
rustc_attr!(
795-
rustc_intrinsic, Normal, template!(List: "value"), ErrorFollowing,
795+
rustc_intrinsic, Normal, template!(Word), ErrorFollowing,
796796
"the `#[rustc_intrinsic]` attribute is used to declare intrinsics with function bodies",
797797
),
798798

compiler/rustc_middle/src/ty/util.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,15 +1541,9 @@ pub fn is_doc_notable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
15411541
/// Determines whether an item is an intrinsic by Abi.
15421542
pub fn intrinsic(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<Symbol> {
15431543
if matches!(tcx.fn_sig(def_id).skip_binder().abi(), Abi::RustIntrinsic | Abi::PlatformIntrinsic)
1544+
|| tcx.has_attr(def_id, sym::rustc_intrinsic)
15441545
{
15451546
Some(tcx.item_name(def_id.into()))
1546-
} else if let Some(name) = tcx.get_attr(def_id, sym::rustc_intrinsic) {
1547-
Some(
1548-
name.get_normal_item().meta(rustc_span::DUMMY_SP).unwrap().meta_item_list().unwrap()[0]
1549-
.ident()
1550-
.unwrap()
1551-
.name,
1552-
)
15531547
} else {
15541548
None
15551549
}

library/core/src/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2568,7 +2568,7 @@ extern "rust-intrinsic" {
25682568
#[rustc_nounwind]
25692569
#[unstable(feature = "core_intrinsics", issue = "none")]
25702570
#[rustc_const_stable(feature = "is_val_statically_known", since = "0.0.0")]
2571-
#[cfg_attr(not(bootstrap), rustc_intrinsic(is_val_statically_known))]
2571+
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
25722572
pub const unsafe fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
25732573
false
25742574
}

src/doc/unstable-book/src/language-features/intrinsics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ intrinsics without causing any code miscompilations or failures to compile.
1818
```rust
1919
#![feature(core_intrinsics)]
2020

21-
#[rustc_intrinsic(name_of_things)]
22-
fn foo() -> u32 {
21+
#[rustc_intrinsic]
22+
fn some_intrinsic_name() -> u32 {
2323
42
2424
}
2525
```

0 commit comments

Comments
 (0)