Cleanup cfg check handling in expression store lowering

This commit is contained in:
Lukas Wirth 2025-04-29 10:49:41 +02:00
parent 7d9b839f9c
commit d11dbf648f
17 changed files with 234 additions and 188 deletions

View file

@ -182,10 +182,8 @@ fn with_extra_thread(
thread_intent: stdx::thread::ThreadIntent,
f: impl FnOnce() -> anyhow::Result<()> + Send + 'static,
) -> anyhow::Result<()> {
let handle = stdx::thread::Builder::new(thread_intent)
.name(thread_name.into())
.stack_size(STACK_SIZE)
.spawn(f)?;
let handle =
stdx::thread::Builder::new(thread_intent, thread_name).stack_size(STACK_SIZE).spawn(f)?;
handle.join()?;

View file

@ -15,11 +15,13 @@ impl flags::Diagnostics {
pub fn run(self) -> anyhow::Result<()> {
const STACK_SIZE: usize = 1024 * 1024 * 8;
let handle = stdx::thread::Builder::new(stdx::thread::ThreadIntent::LatencySensitive)
.name("BIG_STACK_THREAD".into())
.stack_size(STACK_SIZE)
.spawn(|| self.run_())
.unwrap();
let handle = stdx::thread::Builder::new(
stdx::thread::ThreadIntent::LatencySensitive,
"BIG_STACK_THREAD",
)
.stack_size(STACK_SIZE)
.spawn(|| self.run_())
.unwrap();
handle.join()
}

View file

@ -15,11 +15,13 @@ impl flags::UnresolvedReferences {
pub fn run(self) -> anyhow::Result<()> {
const STACK_SIZE: usize = 1024 * 1024 * 8;
let handle = stdx::thread::Builder::new(stdx::thread::ThreadIntent::LatencySensitive)
.name("BIG_STACK_THREAD".into())
.stack_size(STACK_SIZE)
.spawn(|| self.run_())
.unwrap();
let handle = stdx::thread::Builder::new(
stdx::thread::ThreadIntent::LatencySensitive,
"BIG_STACK_THREAD",
)
.stack_size(STACK_SIZE)
.spawn(|| self.run_())
.unwrap();
handle.join()
}

View file

@ -148,10 +148,10 @@ impl<T: Sized + Send + 'static> CommandHandle<T> {
let stderr = child.0.stderr().take().unwrap();
let actor = CargoActor::<T>::new(parser, sender, stdout, stderr);
let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)
.name("CommandHandle".to_owned())
.spawn(move || actor.run())
.expect("failed to spawn thread");
let thread =
stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker, "CommandHandle")
.spawn(move || actor.run())
.expect("failed to spawn thread");
Ok(CommandHandle { program, arguments, current_dir, child, thread, _phantom: PhantomData })
}

View file

@ -133,10 +133,10 @@ impl FlycheckHandle {
let actor =
FlycheckActor::new(id, sender, config, sysroot_root, workspace_root, manifest_path);
let (sender, receiver) = unbounded::<StateChange>();
let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)
.name("Flycheck".to_owned())
.spawn(move || actor.run(receiver))
.expect("failed to spawn thread");
let thread =
stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker, format!("Flycheck{id}"))
.spawn(move || actor.run(receiver))
.expect("failed to spawn thread");
FlycheckHandle { id, sender, _thread: thread }
}

View file

@ -298,8 +298,7 @@ impl Server {
) -> Server {
let (connection, client) = Connection::memory();
let _thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)
.name("test server".to_owned())
let _thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker, "test server")
.spawn(move || main_loop(config, connection).unwrap())
.expect("failed to spawn a thread");