mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Setup global allocator in the correct crate
It worked before, but was roundabout
This commit is contained in:
parent
deed44a472
commit
9ad41eb908
5 changed files with 6 additions and 10 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1137,7 +1137,6 @@ dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"mimalloc",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"ra_arena",
|
"ra_arena",
|
||||||
]
|
]
|
||||||
|
@ -1362,6 +1361,7 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"lsp-server",
|
"lsp-server",
|
||||||
"lsp-types",
|
"lsp-types",
|
||||||
|
"mimalloc",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"pico-args",
|
"pico-args",
|
||||||
"ra_cfg",
|
"ra_cfg",
|
||||||
|
|
|
@ -13,7 +13,6 @@ doctest = false
|
||||||
ra_arena = { path = "../ra_arena" }
|
ra_arena = { path = "../ra_arena" }
|
||||||
once_cell = "1.3.1"
|
once_cell = "1.3.1"
|
||||||
backtrace = { version = "0.3.44", optional = true }
|
backtrace = { version = "0.3.44", optional = true }
|
||||||
mimalloc = { version = "0.1.19", default-features = false, optional = true }
|
|
||||||
cfg-if = "0.1.10"
|
cfg-if = "0.1.10"
|
||||||
libc = "0.2.73"
|
libc = "0.2.73"
|
||||||
|
|
||||||
|
@ -22,5 +21,4 @@ cpu_profiler = []
|
||||||
|
|
||||||
# Uncomment to enable for the whole crate graph
|
# Uncomment to enable for the whole crate graph
|
||||||
# default = [ "backtrace" ]
|
# default = [ "backtrace" ]
|
||||||
# default = [ "mimalloc" ]
|
|
||||||
# default = [ "cpu_profiler" ]
|
# default = [ "cpu_profiler" ]
|
||||||
|
|
|
@ -13,10 +13,6 @@ pub use crate::{
|
||||||
memory_usage::{Bytes, MemoryUsage},
|
memory_usage::{Bytes, MemoryUsage},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(all(feature = "mimalloc"))]
|
|
||||||
#[global_allocator]
|
|
||||||
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
|
||||||
|
|
||||||
/// Prints backtrace to stderr, useful for debugging.
|
/// Prints backtrace to stderr, useful for debugging.
|
||||||
#[cfg(feature = "backtrace")]
|
#[cfg(feature = "backtrace")]
|
||||||
pub fn print_backtrace() {
|
pub fn print_backtrace() {
|
||||||
|
|
|
@ -29,6 +29,7 @@ serde = { version = "1.0.106", features = ["derive"] }
|
||||||
serde_json = "1.0.48"
|
serde_json = "1.0.48"
|
||||||
threadpool = "1.7.1"
|
threadpool = "1.7.1"
|
||||||
rayon = "1.3.1"
|
rayon = "1.3.1"
|
||||||
|
mimalloc = { version = "0.1.19", default-features = false, optional = true }
|
||||||
|
|
||||||
stdx = { path = "../stdx" }
|
stdx = { path = "../stdx" }
|
||||||
|
|
||||||
|
@ -62,6 +63,3 @@ expect = { path = "../expect" }
|
||||||
test_utils = { path = "../test_utils" }
|
test_utils = { path = "../test_utils" }
|
||||||
mbe = { path = "../ra_mbe", package = "ra_mbe" }
|
mbe = { path = "../ra_mbe", package = "ra_mbe" }
|
||||||
tt = { path = "../ra_tt", package = "ra_tt" }
|
tt = { path = "../ra_tt", package = "ra_tt" }
|
||||||
|
|
||||||
[features]
|
|
||||||
mimalloc = [ "ra_prof/mimalloc" ]
|
|
||||||
|
|
|
@ -16,6 +16,10 @@ use vfs::AbsPathBuf;
|
||||||
|
|
||||||
use crate::args::HelpPrinted;
|
use crate::args::HelpPrinted;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "mimalloc"))]
|
||||||
|
#[global_allocator]
|
||||||
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
setup_logging()?;
|
setup_logging()?;
|
||||||
let args = match args::Args::parse()? {
|
let args = match args::Args::parse()? {
|
||||||
|
|
Loading…
Reference in a new issue