Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions src/bun_core/env_var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ pub(crate) mod kind {
};
match cached {
StoredType::Unknown => {
crate::hint::cold();
core::hint::cold_path();
CacheOutput::Unknown
}
StoredType::NotSet => CacheOutput::NotSet,
Expand Down Expand Up @@ -567,7 +567,7 @@ pub(crate) mod kind {
pub(crate) fn get_cached(&self) -> Output {
match self.value.load(Ordering::Relaxed) {
UNKNOWN_SENTINEL => {
crate::hint::cold();
core::hint::cold_path();
CacheOutput::Unknown
}
NOT_SET_SENTINEL => CacheOutput::NotSet,
Expand Down Expand Up @@ -708,7 +708,7 @@ macro_rules! platform_specific_new {
// Inline the logic from get() without calling assert_platform_supported()
match CACHE.get_cached() {
CacheOutput::Unknown => {
$crate::hint::cold();
::core::hint::cold_path();

let env_var = $crate::getenv_z(k);
let maybe_reloaded = CACHE.deser_and_invalidate(env_var);
Expand Down
20 changes: 0 additions & 20 deletions src/bun_core/hint.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/bun_core/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub mod Global;
pub mod atomic_cell;
pub mod comptime_string_map;
pub mod error;
pub mod hint;
pub mod result;
pub mod thread_id;
pub mod tty;
Expand Down
2 changes: 1 addition & 1 deletion src/bun_core/string/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,7 @@ pub fn percent_encode_write(
remaining = &remaining[j..];
let code_point_len: usize = wtf8_byte_sequence_length_with_invalid(remaining[0]) as usize;
if remaining.len() < code_point_len {
crate::hint::cold();
core::hint::cold_path();
return Err(PercentEncodeError::IncompleteUTF8);
}

Expand Down
4 changes: 2 additions & 2 deletions src/http_jsc/websocket_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ impl Mask {
*mask_buf = Self::generate(global_this);
let skip_mask = u32::from_ne_bytes(*mask_buf) == 0;
if input.is_empty() {
bun_core::hint::cold();
core::hint::cold_path();
return;
}
bun_highway::fill_with_skip_mask(*mask_buf, &mut output[..input.len()], input, skip_mask);
Expand All @@ -2081,7 +2081,7 @@ impl Mask {
*mask_buf = Self::generate(global_this);
let skip_mask = u32::from_ne_bytes(*mask_buf) == 0;
if buf.is_empty() {
bun_core::hint::cold();
core::hint::cold_path();
return;
}
bun_highway::fill_with_skip_mask_inplace(*mask_buf, buf, skip_mask);
Expand Down
2 changes: 1 addition & 1 deletion src/jsc/VirtualMachine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ impl VirtualMachine {

// Check if Module.runMain was patched.
if self.has_patched_run_main {
bun_core::hint::cold();
core::hint::cold_path();
self.pending_internal_promise = None;
self.pending_internal_promise_is_protected = false;
let global_ref = self.global();
Expand Down
2 changes: 1 addition & 1 deletion src/jsc/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ impl EventLoop {
// loop (the recursion check).
if unsafe { (*this).next_immediate_tasks.capacity() } > 0 {
// this would only occur if we were recursively running tickImmediateTasks.
bun_core::hint::cold();
core::hint::cold_path();
// SAFETY: as above.
let next = core::mem::take(unsafe { &mut (*this).next_immediate_tasks });
// SAFETY: as above.
Expand Down
5 changes: 2 additions & 3 deletions src/resolver/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1861,8 +1861,7 @@ impl<'a> Resolver<'a> {

if check_relative {
if let Some(custom_paths) = self.custom_dir_paths {
// @branchHint(.unlikely)
bun_core::hint::cold();
core::hint::cold_path();
Comment thread
claude[bot] marked this conversation as resolved.
for custom_path in custom_paths {
let custom_utf8 = custom_path.to_utf8_without_ref();
match self.check_relative_path(
Expand Down Expand Up @@ -2002,7 +2001,7 @@ impl<'a> Resolver<'a> {
}

if let Some(custom_paths) = self.custom_dir_paths {
bun_core::hint::cold();
core::hint::cold_path();
for custom_path in custom_paths {
let custom_utf8 = custom_path.to_utf8_without_ref();
match self.check_package_path(
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/bake/DevServer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5694,10 +5694,10 @@ impl DevServer {
/// `Cell`-based, so a shared borrow suffices. JS-thread only.
pub(crate) fn inspector(&self) -> Option<&BunFrontendDevServerAgent> {
if let Some(debugger) = self.vm().debugger.as_ref() {
bun_core::hint::cold();
core::hint::cold_path();
let agent = BunFrontendDevServerAgent::from_slot(&debugger.extension_agent);
if agent.is_enabled() {
bun_core::hint::cold();
core::hint::cold_path();
return Some(agent);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/cli/create/SourceFileProjectGenerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ fn find_react_component_export<'r>(bundler: &'r BundleV2<'_>) -> Option<&'r [u8]

let filename = source.path.name().non_unique_name_string_base();
if filename.is_empty() {
bun_core::hint::cold();
core::hint::cold_path();
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ mod json {
json_ipc_data_string_free_cb,
);
if s.tag() == bun_core::Tag::Dead {
bun_core::hint::cold();
core::hint::cold_path();
return Err(IPCDecodeError::Js(JsError::OutOfMemory));
}
s
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/jsc_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4463,7 +4463,7 @@ unsafe fn transpile_file(

// ── force_loader / require.extensions override ──────────────────────────
if let Some(loader_type) = force_loader_type {
// Note: `@branchHint(.unlikely)` dropped (no stable Rust equiv).
core::hint::cold_path();
debug_assert!(!is_commonjs_require);
lr.loader = Some(loader_type);
} else if is_commonjs_require
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/server/server_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,9 @@ impl<const SSL: bool, const DEBUG: bool> NewServer<SSL, DEBUG> {
/// the per-transport `RequestContext` bounds.
pub(super) fn notify_inspector_server_stopped(&mut self) {
if self.inspector_server_id.get() != 0 {
bun_core::hint::cold();
core::hint::cold_path();
if let Some(debugger) = &self.vm().as_mut().debugger {
bun_core::hint::cold();
core::hint::cold_path();
// NOTE (layering): the `HTTPServerAgent.notifyServerStopped`
// wrapper lives in
// `super::http_server_agent` so this crate-tier call doesn't
Expand Down Expand Up @@ -2679,7 +2679,7 @@ where
let addr = match SocketAddress::init(address_bytes, port) {
Ok(a) => a,
Err(_) => {
bun_core::hint::cold();
core::hint::cold_path();
return Ok(JSValue::NULL);
}
};
Expand All @@ -2697,7 +2697,7 @@ where
let addr = match SocketAddress::init(address_bytes, port) {
Ok(a) => a,
Err(_) => {
bun_core::hint::cold();
core::hint::cold_path();
return Ok(JSValue::NULL);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/shell/EnvStr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl EnvStr {
break 'brk 1;
};
if divisor == 0 {
bun_core::hint::cold();
core::hint::cold_path();
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/valkey_jsc/js_valkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ impl JSValkeyClient {
// No reconnecting on a VM that is exiting: its stop phase would only
// have to close the new socket again.
if self.vm().is_shutting_down() {
bun_core::hint::cold();
core::hint::cold_path();
return Ok(());
}

Expand Down Expand Up @@ -1597,7 +1597,7 @@ impl JSValkeyClient {
if self.client.get().status != valkey::Status::NeverConnected {
return;
}
bun_core::hint::cold();
core::hint::cold_path();

match self.connect() {
// The command is queued as for a dial in flight; the deferred
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/valkey_jsc/valkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ impl ValkeyClient {
} else {
// We should rarely reach this point. If we're guaranteed to be handling a subscribe/unsubscribe,
// then this is an unexpected path.
bun_core::hint::cold();
core::hint::cold_path();
self.fail(
b"Push message is not a subscription message.",
RedisError::InvalidResponseType,
Expand Down Expand Up @@ -1164,7 +1164,7 @@ impl ValkeyClient {
return Ok(());
}
} else {
bun_core::hint::cold();
core::hint::cold_path();
self.fail(
b"Unexpected push message kind without promise",
RedisError::InvalidResponseType,
Expand Down
2 changes: 1 addition & 1 deletion src/sql_jsc/mysql/MySQLRequestQueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl MySQLRequestQueue {
.get()
.unwrap_or(false)
{
// @branchHint(.unlikely) — no stable Rust equivalent; left as plain branch.
core::hint::cold_path();
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/sql_jsc/postgres/DataCell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ fn parse_array(

// postgres dont really support arrays with more than 2^31 elements, 2ˆ32 is the max we support, but users should never reach this branch
if !reached_end || array.len() > u32::MAX as usize {
bun_core::hint::cold();
core::hint::cold_path();
return Err(AnyPostgresError::UnsupportedArrayFormat);
}

Expand Down
2 changes: 1 addition & 1 deletion src/sql_jsc/postgres/PostgresSQLConnection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ impl PostgresSQLConnection {
.get()
.unwrap_or(false)
{
bun_core::hint::cold();
core::hint::cold_path();
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions test/internal/source-lints/port-era-markers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const banned: { pattern: RegExp; reason: string }[] = [
pattern: /\bun-gated\b/i,
reason: "'un-gated' is port-era progress narrative, not useful documentation",
},
{
pattern: /@branchHint\b/i,
reason: "'@branchHint' notes describe a hint the port dropped; the Rust spelling is core::hint::cold_path()",
},
];

const rustSources = globAllSources().rust.filter(p => p.endsWith(".rs"));
Expand Down
Loading