nixos-hardware icon indicating copy to clipboard operation
nixos-hardware copied to clipboard

Kernel Rustc Compile Error with "microsoft-surface-common" Import

Open Brad-Hesson opened this issue 2 months ago • 1 comments

After an update attempt, the kernel no longer builds due to a rustc error.

This is the end of the derivation log for /nix/store/jxw2bls17ziwppg9ac3v41g1kbycvfcq-linux-6.12.19.drv:

  RUSTC L rust/core.o
error[E0658]: `let` expressions in this position are unstable
   --> /core/src/slice/index.rs:363:12
    |
363 |         if let Some(new_len) = usize::checked_sub(self.end, self.start)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
    = help: add `#![feature(let_chains)]` to the crate attributes to enable
    = note: this compiler was built on 2025-08-04; consider upgrading it if it is out of date

error[E0658]: `let` expressions in this position are unstable
   --> /core/src/slice/index.rs:375:12
    |
375 |         if let Some(new_len) = usize::checked_sub(self.end, self.start)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
    = help: add `#![feature(let_chains)]` to the crate attributes to enable
    = note: this compiler was built on 2025-08-04; consider upgrading it if it is out of date

error[E0658]: `let` expressions in this position are unstable
    --> /core/src/slice/iter.rs:1384:12
     |
1384 |         if let Some(rest) = self.v.get(n..)
     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
     = help: add `#![feature(let_chains)]` to the crate attributes to enable
     = note: this compiler was built on 2025-08-04; consider upgrading it if it is out of date

error[E0658]: `let` expressions in this position are unstable
    --> /core/src/slice/iter.rs:1385:16
     |
1385 |             && let Some(nth) = rest.get(..size)
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
     = help: add `#![feature(let_chains)]` to the crate attributes to enable
     = note: this compiler was built on 2025-08-04; consider upgrading it if it is out of date

error[E0658]: `let` expressions in this position are unstable
  --> /core/src/str/iter.rs:59:20
   |
59 |                 && let Some(chunk) = chunks.next()
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
   = help: add `#![feature(let_chains)]` to the crate attributes to enable
   = note: this compiler was built on 2025-08-04; consider upgrading it if it is out of date

error[E0700]: hidden type for `impl fmt::Display` captures lifetime that does not appear in bounds
   --> /core/src/ffi/c_str.rs:659:9
    |
658 |     pub fn display(&self) -> impl fmt::Display {
    |                    -----     ----------------- opaque type defined here
    |                    |
    |                    hidden type `&ByteStr` captures the anonymous lifetime defined here
659 |         crate::bstr::ByteStr::from_bytes(self.to_bytes())
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: add a `use<...>` bound to explicitly capture `'_`
    |
658 |     pub fn display(&self) -> impl fmt::Display + use<'_> {
    |                                                +++++++++

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0658, E0700.
For more information about an error, try `rustc --explain E0658`.
make[3]: *** [../rust/Makefile:413: rust/core.o] Error 1
make[2]: *** [/build/linux-6.12.19/Makefile:1222: prepare] Error 2
make[1]: *** [/build/linux-6.12.19/Makefile:224: __sub-make] Error 2
make[1]: Leaving directory '/build/linux-6.12.19/build'
make: *** [Makefile:224: __sub-make] Error 2

Minimal reproduction flake (run nixos-rebuild build --flake .#system-name):

{
  description = "Minimal Reproduction";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixos-hardware.url = "github:NixOS/nixos-hardware/master";
  };

  outputs = inputs: {
    nixosConfigurations.system-name = inputs.nixpkgs.lib.nixosSystem {
      specialArgs = { inherit inputs; };
      modules = [
        ({ lib, inputs, ... }: {
          # commenting out this import fixes the build
          imports = [ inputs.nixos-hardware.nixosModules.microsoft-surface-common ];
          # ------------------------------------------
          boot.loader.systemd-boot.enable = true;
          fileSystems."/" = {
            device = "/dev/disk/by-uuid/DCD8-B91C";
            fsType = "vfat";
          };
          nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
          system.stateVersion = "24.11";
        })
      ];
    };
  };
}

flake.lock

{
  "nodes": {
    "nixos-hardware": {
      "locked": {
        "lastModified": 1756750488,
        "narHash": "sha256-e4ZAu2sjOtGpvbdS5zo+Va5FUUkAnizl4wb0/JlIL2I=",
        "owner": "NixOS",
        "repo": "nixos-hardware",
        "rev": "47eb4856cfd01eaeaa7bb5944a0f27db8fb9b94a",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "master",
        "repo": "nixos-hardware",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1756542300,
        "narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "d7600c775f877cd87b4f5a831c28aa94137377aa",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nixos-hardware": "nixos-hardware",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

Brad-Hesson avatar Sep 03 '25 01:09 Brad-Hesson