Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch RcStr from std::sync::Arc to triomphe::Arc #8715

Merged
merged 2 commits into from
Jul 11, 2024
Merged
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
8 changes: 6 additions & 2 deletions crates/turbo-tasks/src/rcstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ use std::{
fmt::{Debug, Display},
ops::Deref,
path::{Path, PathBuf},
sync::Arc,
};

use serde::{Deserialize, Serialize};
use triomphe::Arc;
use turbo_tasks_hash::{DeterministicHash, DeterministicHasher};

use crate::debug::{ValueDebugFormat, ValueDebugFormatString};

/// This type exists to allow swapping out the underlying string type easily.
/// A reference counted [`String`], similar to [`Arc<String>`][std::sync::Arc].
///
/// This type is intentionally opaque to allow for optimizations to the
/// underlying representation. Future implementations may use inline
/// representations or interning.
//
// If you want to change the underlying string type to `Arc<str>`, please ensure that you profile
// performance. The current implementation offers very cheap `String -> RcStr -> String`, meaning we
Expand Down
3 changes: 2 additions & 1 deletion crates/turbopack-ecmascript/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ async fn parse_content(
} else {
None
};
let messages = Some(messages.unwrap_or_else(|| vec![fm.src.clone().into()]));
let messages =
Some(messages.unwrap_or_else(|| vec![String::clone(&fm.src).into()]));
return Ok(ParseResult::Unparseable { messages });
}

Expand Down
Loading