Fix panic when assigning value to $env (#7894)

This commit is contained in:
Jakub Žádník
2023-01-28 21:17:32 +02:00
committed by GitHub
parent 3c6b10c6b2
commit 2a39332d51
3 changed files with 25 additions and 0 deletions

View File

@ -365,6 +365,20 @@ Either make sure {0} is a string, or add a 'to_string' entry for it in ENV_CONVE
)]
AutomaticEnvVarSetManually(String, #[label("cannot set '{0}' manually")] Span),
/// It is not possible to replace the entire environment at once
///
/// ## Resolution
///
/// Setting the entire environment is not allowed. Change environment variables individually
/// instead.
#[error("Cannot replace environment.")]
#[diagnostic(
code(nu::shell::cannot_replace_env),
url(docsrs),
help(r#"Assigning a value to $env is not allowed."#)
)]
CannotReplaceEnv(#[label("setting $env not allowed")] Span),
/// Division by zero is not a thing.
///
/// ## Resolution