Skip to content

Commit

Permalink
Rollup merge of #110058 - gimbles:master, r=Nilstrieb
Browse files Browse the repository at this point in the history
Remove `box_syntax` usage

Fixes #109978
  • Loading branch information
JohnTitor authored Apr 9, 2023
2 parents f8ed97e + f1ded91 commit f001f7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions src/doc/unstable-book/src/language-features/lang-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ and one for deallocation. A freestanding program that uses the `Box`
sugar for dynamic allocations via `malloc` and `free`:

```rust,ignore (libc-is-finicky)
#![feature(lang_items, box_syntax, start, libc, core_intrinsics, rustc_private)]
#![feature(lang_items, start, libc, core_intrinsics, rustc_private, rustc_attrs)]
#![no_std]
use core::intrinsics;
use core::panic::PanicInfo;
use core::ptr::NonNull;
extern crate libc;
struct Unique<T>(*mut T);
struct Unique<T>(NonNull<T>);
#[lang = "owned_box"]
pub struct Box<T>(Unique<T>);
impl<T> Box<T> {
pub fn new(x: T) -> Self {
#[rustc_box]
Box::new(x)
}
}
#[lang = "exchange_malloc"]
unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
let p = libc::malloc(size as libc::size_t) as *mut u8;
Expand All @@ -47,13 +55,13 @@ unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
let _x = box 1;
let _x = Box::new(1);
0
}
#[lang = "eh_personality"] extern fn rust_eh_personality() {}
#[lang = "panic_impl"] extern fn rust_begin_panic(info: &PanicInfo) -> ! { unsafe { intrinsics::abort() } }
#[lang = "panic_impl"] extern fn rust_begin_panic(_info: &PanicInfo) -> ! { intrinsics::abort() }
#[no_mangle] pub extern fn rust_eh_register_frames () {}
#[no_mangle] pub extern fn rust_eh_unregister_frames () {}
```
Expand Down
4 changes: 2 additions & 2 deletions src/doc/unstable-book/src/language-features/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ additional checks for code style, safety, etc. Now let's write a plugin
that warns about any item named `lintme`.

```rust,ignore (requires-stage-2)
#![feature(box_syntax, rustc_private)]
#![feature(rustc_private)]
extern crate rustc_ast;
Expand Down Expand Up @@ -68,7 +68,7 @@ impl EarlyLintPass for Pass {
#[no_mangle]
fn __rustc_plugin_registrar(reg: &mut Registry) {
reg.lint_store.register_lints(&[&TEST_LINT]);
reg.lint_store.register_early_pass(|| box Pass);
reg.lint_store.register_early_pass(|| Box::new(Pass));
}
```

Expand Down

0 comments on commit f001f7b

Please sign in to comment.