mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-25 06:41:15 -03:00
Remove parser.assert_can_execute
We don't need this; Rust's Send safety means that a Parser never changes its thread.
This commit is contained in:
@@ -278,7 +278,6 @@ pub fn exec_subshell_for_expand(
|
||||
job_group: Option<&JobGroupRef>,
|
||||
outputs: &mut Vec<WString>,
|
||||
) -> Result<(), ErrorCode> {
|
||||
parser.assert_can_execute();
|
||||
let mut break_expand = true;
|
||||
let ret = exec_subshell_internal(
|
||||
cmd,
|
||||
@@ -1452,7 +1451,6 @@ fn exec_subshell_internal(
|
||||
apply_exit_status: bool,
|
||||
is_subcmd: bool,
|
||||
) -> Result<(), ErrorCode> {
|
||||
parser.assert_can_execute();
|
||||
let _scoped = parser.push_scope(|s| {
|
||||
s.is_subshell = true;
|
||||
s.read_limit = if is_subcmd {
|
||||
|
||||
@@ -111,7 +111,6 @@ fn allow_autoload(&self, name: &wstr) -> bool {
|
||||
/// Make sure that if the specified function is a dynamically loaded function, it has been fully
|
||||
/// loaded. Note this executes fish script code.
|
||||
pub fn load(name: &wstr, parser: &Parser) -> bool {
|
||||
parser.assert_can_execute();
|
||||
let mut path_to_autoload: Option<_> = None;
|
||||
// Note we can't autoload while holding the funcset lock.
|
||||
// Lock around a local region.
|
||||
@@ -209,7 +208,6 @@ pub fn get_props(name: &wstr) -> Option<Arc<FunctionProperties>> {
|
||||
|
||||
/// Return the properties for a function, or None, perhaps triggering autoloading.
|
||||
pub fn get_props_autoload(name: &wstr, parser: &Parser) -> Option<Arc<FunctionProperties>> {
|
||||
parser.assert_can_execute();
|
||||
if parser_keywords_is_reserved(name) {
|
||||
return None;
|
||||
}
|
||||
@@ -220,7 +218,6 @@ pub fn get_props_autoload(name: &wstr, parser: &Parser) -> Option<Arc<FunctionPr
|
||||
/// Returns true if the function named `cmd` exists.
|
||||
/// This may autoload.
|
||||
pub fn exists(cmd: &wstr, parser: &Parser) -> bool {
|
||||
parser.assert_can_execute();
|
||||
if !valid_func_name(cmd) {
|
||||
return false;
|
||||
}
|
||||
@@ -287,7 +284,6 @@ fn get_function_body_source(props: &FunctionProperties) -> &wstr {
|
||||
/// Sets the description of the function with the name \c name.
|
||||
/// This triggers autoloading.
|
||||
pub(crate) fn set_desc(name: &wstr, desc: WString, parser: &Parser) {
|
||||
parser.assert_can_execute();
|
||||
load(name, parser);
|
||||
let mut funcset = FUNCTION_SET.lock().unwrap();
|
||||
if let Some(props) = funcset.funcs.get(name) {
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
use crate::parse_tree::{parse_source, LineCounter, ParsedSourceRef};
|
||||
use crate::proc::{job_reap, JobGroupRef, JobList, JobRef, Pid, ProcStatus};
|
||||
use crate::signal::{signal_check_cancel, signal_clear_cancel, Signal};
|
||||
use crate::threads::assert_is_main_thread;
|
||||
use crate::util::get_time;
|
||||
use crate::wait_handle::WaitHandleStore;
|
||||
use crate::wchar::prelude::*;
|
||||
@@ -498,11 +497,6 @@ pub fn is_command_substitution(&self) -> bool {
|
||||
.any(|b| b.typ() == BlockType::subst)
|
||||
}
|
||||
|
||||
/// Assert that this parser is allowed to execute on the current thread.
|
||||
pub fn assert_can_execute(&self) {
|
||||
assert_is_main_thread();
|
||||
}
|
||||
|
||||
pub fn eval(&self, cmd: &wstr, io: &IoChain) -> EvalRes {
|
||||
self.eval_with(cmd, io, None, BlockType::top)
|
||||
}
|
||||
|
||||
@@ -1170,8 +1170,6 @@ pub fn set_job_control_mode(mode: JobControl) {
|
||||
/// If `interactive` is set, allow removing interactive jobs; otherwise skip them.
|
||||
/// Return whether text was printed to stdout.
|
||||
pub fn job_reap(parser: &Parser, interactive: bool) -> bool {
|
||||
parser.assert_can_execute();
|
||||
|
||||
// Early out for the common case that there are no jobs.
|
||||
if parser.jobs().is_empty() {
|
||||
return false;
|
||||
@@ -1386,8 +1384,6 @@ fn reap_disowned_pids() {
|
||||
/// \param block_ok if no reapable processes have exited, block until one is (or until we receive a
|
||||
/// signal).
|
||||
fn process_mark_finished_children(parser: &Parser, block_ok: bool) {
|
||||
parser.assert_can_execute();
|
||||
|
||||
// Get the exit and signal generations of all reapable processes.
|
||||
// The exit generation tells us if we have an exit; the signal generation allows for detecting
|
||||
// SIGHUP and SIGINT.
|
||||
@@ -1730,8 +1726,6 @@ fn save_wait_handle_for_completed_job(job: &Job, store: &mut WaitHandleStore) {
|
||||
/// Remove completed jobs from the job list, printing status messages as appropriate.
|
||||
/// Return whether something was printed.
|
||||
fn process_clean_after_marking(parser: &Parser, interactive: bool) -> bool {
|
||||
parser.assert_can_execute();
|
||||
|
||||
// This function may fire an event handler, we do not want to call ourselves recursively (to
|
||||
// avoid infinite recursion).
|
||||
if parser.scope().is_cleaning_procs {
|
||||
|
||||
@@ -690,7 +690,6 @@ pub fn reader_read(parser: &Parser, fd: RawFd, io: &IoChain) -> Result<(), Error
|
||||
/// Read interactively. Read input from stdin while providing editing facilities.
|
||||
fn read_i(parser: &Parser) {
|
||||
assert_is_main_thread();
|
||||
parser.assert_can_execute();
|
||||
let mut conf = ReaderConfig::default();
|
||||
conf.event = L!("fish_prompt");
|
||||
conf.complete_ok = true;
|
||||
|
||||
Reference in New Issue
Block a user