Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

ndiddy1 pts0 comments

all of rust codebase: This codebase fails even the most basic miri checks, allows for UB in safe rust · Issue #30719 · oven-sh/bun · GitHub

//voltron/issues_fragments/issue_layout" data-turbo-transient="true" />

src/main.rs:97:18 | 97 | unsafe { core::slice::from_raw_parts(ptr as *const u8, self.len()) } ...">

src/main.rs:97:18 | 97 | unsafe { core::slice::from_ra..." /> src/main.rs:97:18 | 97 | unsafe { core::slice::from_ra..." />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

//voltron/issues_fragments/issue_layout;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

oven-sh

bun

Public

Notifications<br>You must be signed in to change notification settings

Fork<br>4.5k

Star<br>90.5k

all of rust codebase: This codebase fails even the most basic miri checks, allows for UB in safe rust #30719

New issue<br>Copy link

New issue<br>Copy link

Open<br>#30728

Open<br>all of rust codebase: This codebase fails even the most basic miri checks, allows for UB in safe rust#30719<br>#30728

Copy link

Description

AwesomeQubic<br>opened on May 14, 2026

Issue body actions

src/main.rs:97:18<br>97 | unsafe { core::slice::from_raw_parts(ptr as *const u8, self.len()) }<br>| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here<br>= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior<br>= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information<br>= note: stack backtrace:<br>0: PathString::slice<br>at src/main.rs:97:18: 97:75<br>1: main<br>at src/main.rs:130:22: 130:34">error: Undefined Behavior: constructing invalid value of type &[u8]: encountered a dangling reference (0x20933[noalloc] has no provenance)<br>--> src/main.rs:97:18<br>97 | unsafe { core::slice::from_raw_parts(ptr as *const u8, self.len()) }<br>| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here<br>= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior<br>= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information<br>= note: stack backtrace:<br>0: PathString::slice<br>at src/main.rs:97:18: 97:75<br>1: main<br>at src/main.rs:130:22: 130:34

code:

fn main() {<br>let test = Box::new(*b"Hello World");<br>let init = PathString::init(&*test);<br>drop(test);

println!("{:?}", init.slice());

Please consider not vibe coding rust as AIs are not good at writing Rust and also hire a real rust dev

Reactions are currently unavailable

Metadata<br>Metadata<br>Assignees

No one assigned

Labels

No labelsNo labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You can’t perform that action at this time.

rust main slice codebase undefined behavior

Related Articles