Auto merge of #17287 - Veykril:sysroot-encode-empty, r=Veykril · rust-lang/rust@6259991 (original) (raw)

`@@ -65,7 +65,7 @@ impl WorkspaceBuildScripts {

`

65

65

`allowed_features: &FxHashSet,

`

66

66

`manifest_path: &ManifestPath,

`

67

67

`toolchain: Option<&Version>,

`

68

``

`-

sysroot: Option<&Sysroot>,

`

``

68

`+

sysroot: &Sysroot,

`

69

69

`) -> io::Result {

`

70

70

`const RUST_1_75: Version = Version::new(1, 75, 0);

`

71

71

`let mut cmd = match config.run_build_script_command.as_deref() {

`

`@@ -75,7 +75,7 @@ impl WorkspaceBuildScripts {

`

75

75

` cmd

`

76

76

`}

`

77

77

` _ => {

`

78

``

`-

let mut cmd = Sysroot::tool(sysroot, Tool::Cargo);

`

``

78

`+

let mut cmd = sysroot.tool(Tool::Cargo);

`

79

79

``

80

80

` cmd.args(["check", "--quiet", "--workspace", "--message-format=json"]);

`

81

81

` cmd.args(&config.extra_args);

`

`@@ -149,7 +149,7 @@ impl WorkspaceBuildScripts {

`

149

149

`workspace: &CargoWorkspace,

`

150

150

`progress: &dyn Fn(String),

`

151

151

`toolchain: Option<&Version>,

`

152

``

`-

sysroot: Option<&Sysroot>,

`

``

152

`+

sysroot: &Sysroot,

`

153

153

`) -> io::Result {

`

154

154

`let current_dir = match &config.invocation_location {

`

155

155

`InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {

`

`@@ -195,7 +195,7 @@ impl WorkspaceBuildScripts {

`

195

195

`// This is not gonna be used anyways, so just construct a dummy here

`

196

196

`&ManifestPath::try_from(workspace_root.clone()).unwrap(),

`

197

197

`None,

`

198

``

`-

None,

`

``

198

`+

&Sysroot::empty(),

`

199

199

`)?;

`

200

200

`` // NB: Cargo.toml could have been modified between cargo metadata and

``

201

201

`` // cargo check. We shouldn't assume that package ids we see here are

``

`@@ -412,15 +412,15 @@ impl WorkspaceBuildScripts {

`

412

412

`rustc: &CargoWorkspace,

`

413

413

`current_dir: &AbsPath,

`

414

414

`extra_env: &FxHashMap<String, String>,

`

415

``

`-

sysroot: Option<&Sysroot>,

`

``

415

`+

sysroot: &Sysroot,

`

416

416

`) -> Self {

`

417

417

`let mut bs = WorkspaceBuildScripts::default();

`

418

418

`for p in rustc.packages() {

`

419

419

` bs.outputs.insert(p, BuildScriptOutput::default());

`

420

420

`}

`

421

421

`let res = (|| {

`

422

422

`let target_libdir = (|| {

`

423

``

`-

let mut cargo_config = Sysroot::tool(sysroot, Tool::Cargo);

`

``

423

`+

let mut cargo_config = sysroot.tool(Tool::Cargo);

`

424

424

` cargo_config.envs(extra_env);

`

425

425

` cargo_config

`

426

426

`.current_dir(current_dir)

`

`@@ -429,7 +429,7 @@ impl WorkspaceBuildScripts {

`

429

429

`if let Ok(it) = utf8_stdout(cargo_config) {

`

430

430

`return Ok(it);

`

431

431

`}

`

432

``

`-

let mut cmd = Sysroot::tool(sysroot, Tool::Rustc);

`

``

432

`+

let mut cmd = sysroot.tool(Tool::Rustc);

`

433

433

` cmd.envs(extra_env);

`

434

434

` cmd.args(["--print", "target-libdir"]);

`

435

435

`utf8_stdout(cmd)

`