Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
// Function pointers cannot be `const`
self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params);
}
ast::TyKind::Pat(..) => {
gate!(self, pattern_types, ty.span, "pattern types are unstable");
}
ast::TyKind::View(..) => {
gate!(self, view_types, ty.span, "view types are unstable");
}
_ => {}
}
visit::walk_ty(self, ty)
Expand Down Expand Up @@ -469,7 +463,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
gate_all!(unnamed_enum_variants, "unnamed enum variants are experimental");
gate_all!(unsafe_binders, "unsafe binder types are experimental");
gate_all!(unsafe_fields, "`unsafe` fields are experimental");
gate_all!(view_types, "view types are experimental");
gate_all!(where_clause_attrs, "attributes in `where` clause are unstable");
gate_all!(yeet_expr, "`do yeet` expression is experimental");
// tidy-alphabetical-end
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1437,9 +1437,12 @@ impl<'a> State<'a> {
self.word("...");
}
ast::TyKind::Pat(ty, pat) => {
self.word("k#pattern_type");
self.popen();
self.print_type(ty);
self.word(" is ");
self.print_ty_pat(pat);
self.pclose();
}
ast::TyKind::FieldOf(ty, variant, field) => {
self.word("k#field_of");
Expand All @@ -1459,8 +1462,11 @@ impl<'a> State<'a> {
self.pclose();
}
ast::TyKind::View(ty, fields) => {
self.word("k#view_type");
self.popen();
self.print_type(ty);
self.print_view(fields);
self.pclose();
}
ast::TyKind::GcaMacro(expr) => {
self.word_nbsp("core::gca!");
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_pretty/src/pprust/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ fn test_field_view() {
};

let ty_str = ty_to_string(&ty);
assert_eq!(ty_str, "(/*DUMMY*/).{ milhouse, apu }");
assert_eq!(ty_str, "k#view_type((/*DUMMY*/).{ milhouse, apu })");
});
}
4 changes: 3 additions & 1 deletion compiler/rustc_attr_ir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ language_item_table! {
UnsafeUnpin, sym::unsafe_unpin, unsafe_unpin_trait, Target::Trait, GenericRequirement::Exact(0);

FnPtrTrait, sym::fn_ptr_trait, fn_ptr_trait, Target::Trait, GenericRequirement::Exact(0);
FnPtrAsPtr, sym::fn_ptr_as_ptr, fn_ptr_as_ptr, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::None;
FnAddrTrait, sym::fn_addr_trait, fn_addr_trait, Target::Trait, GenericRequirement::Exact(0);
FnAddrAsPtr, sym::fn_addr_as_ptr, fn_addr_as_ptr, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::None;
FnAddrAddrFn, sym::fn_addr_addr_fn, fn_addr_addr_fn, Target::Method(MethodKind::Trait { body: true }), GenericRequirement::None;
FnPtrFromPtr, sym::fn_ptr_from_ptr, fn_ptr_from_ptr, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::None;
Code, sym::code, code, Target::ForeignTy, GenericRequirement::None;

Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ mod global_allocator;
mod iter;
mod log_syntax;
mod offload;
mod pattern_type;
mod rustdoc_skip_body;
mod source_util;
mod test;
mod test_binder_constraints;
mod trace_macros;
mod view_type;

pub mod asm;
pub mod cmdline_attrs;
Expand Down Expand Up @@ -100,13 +98,11 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
module_path: source_util::expand_mod,
naked_asm: asm::expand_naked_asm,
option_env: env::expand_option_env,
pattern_type: pattern_type::expand,
std_panic: edition_panic::expand_panic,
stringify: source_util::expand_stringify,
test_binder_constraints: test_binder_constraints::expand,
trace_macros: trace_macros::expand_trace_macros,
unreachable: edition_panic::expand_unreachable,
view_type: view_type::expand,
// tidy-alphabetical-end
}

Expand Down
75 changes: 0 additions & 75 deletions compiler/rustc_builtin_macros/src/pattern_type.rs

This file was deleted.

47 changes: 0 additions & 47 deletions compiler/rustc_builtin_macros/src/view_type.rs

This file was deleted.

12 changes: 5 additions & 7 deletions compiler/rustc_codegen_cranelift/example/mini_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
extern_types,
decl_macro,
rustc_attrs,
allow_internal_unstable,
forced_keywords,
rustc_private,
transparent_unions,
pattern_types,
auto_traits,
freeze_impls
)]
Expand Down Expand Up @@ -591,12 +592,9 @@ pub trait Deref {
fn deref(&self) -> &Self::Target;
}

#[rustc_builtin_macro(pattern_type)]
#[macro_export]
macro_rules! pattern_type {
($($arg:tt)*) => {
/* compiler built-in */
};
#[allow_internal_unstable(internal_syntax)]
pub macro pattern_type($($arg:tt)*) {
k#pattern_type($($arg)*)
}

impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<pattern_type!(*const U is !null)> for pattern_type!(*const T is !null) where
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
#![feature(
no_core,
lang_items,
extern_types,
thread_local,
repr_simd,
pattern_types,
rustc_private
)]
#![feature(no_core, lang_items, extern_types, thread_local, repr_simd, rustc_private)]
#![cfg_attr(not(any(jit, target_vendor = "apple", windows)), feature(linkage))]
#![no_core]
#![allow(dead_code, non_camel_case_types, internal_features)]
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_gcc/build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ fn mini_tests(env: &Env, args: &TestArg) -> Result<(), String> {
&"mini_core",
&"--crate-type",
&crate_types,
&"--edition",
&"2024",
&"--target",
&args.config_info.target_triple,
]);
Expand Down
28 changes: 13 additions & 15 deletions compiler/rustc_codegen_gcc/example/mini_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
extern_types,
decl_macro,
rustc_attrs,
allow_internal_unstable,
forced_keywords,
transparent_unions,
auto_traits,
freeze_impls,
pattern_types,
thread_local,
rustc_private
)]
Expand Down Expand Up @@ -40,9 +41,9 @@ unsafe extern "C" {
type VTable;
}

#[no_mangle]
#[unsafe(no_mangle)]
unsafe extern "C" fn _Unwind_Resume() {
intrinsics::unreachable();
unsafe { intrinsics::unreachable(); }
}

#[lang = "pointee_sized"]
Expand Down Expand Up @@ -607,12 +608,9 @@ impl Allocator for Global {}
#[rustc_nonnull_optimization_guaranteed]
pub struct NonNull<T: PointeeSized>(pub pattern_type!(*const T is !null));

#[rustc_builtin_macro(pattern_type)]
#[macro_export]
macro_rules! pattern_type {
($($arg:tt)*) => {
/* compiler built-in */
};
#[allow_internal_unstable(internal_syntax)]
pub macro pattern_type($($arg:tt)*) {
k#pattern_type($($arg)*)
}

impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<pattern_type!(*const U is !null)> for pattern_type!(*const T is !null) where
Expand Down Expand Up @@ -703,19 +701,19 @@ pub mod intrinsics {
#[rustc_intrinsic]
pub const fn size_of<T>() -> usize;
#[rustc_intrinsic]
pub unsafe fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
pub unsafe fn size_of_val<T: ?crate::Sized>(val: *const T) -> usize;
#[rustc_intrinsic]
pub const fn align_of<T>() -> usize;
#[rustc_intrinsic]
pub unsafe fn align_of_val<T: ?::Sized>(val: *const T) -> usize;
pub unsafe fn align_of_val<T: ?crate::Sized>(val: *const T) -> usize;
#[rustc_intrinsic]
pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize);
#[rustc_intrinsic]
pub unsafe fn transmute<T, U>(e: T) -> U;
#[rustc_intrinsic]
pub unsafe fn ctlz_nonzero<T>(x: T) -> u32;
#[rustc_intrinsic]
pub const fn needs_drop<T: ?::Sized>() -> bool;
pub const fn needs_drop<T: ?crate::Sized>() -> bool;
#[rustc_intrinsic]
pub fn bitreverse<T>(x: T) -> T;
#[rustc_intrinsic]
Expand All @@ -728,7 +726,7 @@ pub mod intrinsics {

pub mod libc {
#[link(name = "c")]
extern "C" {
unsafe extern "C" {
pub fn puts(s: *const u8) -> i32;
pub fn printf(format: *const i8, ...) -> i32;
pub fn malloc(size: usize) -> *mut u8;
Expand Down Expand Up @@ -783,7 +781,7 @@ impl<T> Index<usize> for [T] {
}
}

extern "C" {
unsafe extern "C" {
type VaListImpl;
}

Expand Down Expand Up @@ -824,7 +822,7 @@ struct PanicLocation {
column: u32,
}

#[no_mangle]
#[unsafe(no_mangle)]
pub fn get_tls() -> u8 {
#[thread_local]
static A: u8 = 42;
Expand Down
Loading
Loading