Skip to content

Remove uses of set_var #2783

Closed
Closed
@RalfJung

Description

@RalfJung

set_var has a problem and there are plans to make it unsafe. So we should find replacements for our uses of it.

  • env::set_var("RUSTC_LOG_ENTRY_EXIT", "1");

    Needs some way to pass this flag to the rustc logging machinery without an env var.
  • miri/src/bin/miri.rs

    Lines 191 to 198 in d0fd429

    if log::Level::from_str(&var).is_ok() {
    env::set_var(
    "RUSTC_LOG",
    format!("rustc_middle::mir::interpret={var},rustc_const_eval::interpret={var}"),
    );
    } else {
    env::set_var("RUSTC_LOG", &var);
    }

    Needs a way to init rustc logging by giving it the value of the filter expression we want, instead of the name of an env var with the filter.
  • std::env::set_var("MIRI_SYSROOT", &sysroot_dir);

    This one we could already do: find some other way to propagate this information to all parts of the binary, and to all created sub-processes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions