Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include rust-version field in package to avoid cryptic errors #1609

Closed
ryancerium opened this issue Mar 16, 2022 · 3 comments · Fixed by #1636
Closed

Include rust-version field in package to avoid cryptic errors #1609

ryancerium opened this issue Mar 16, 2022 · 3 comments · Fixed by #1636
Labels
enhancement New feature or request

Comments

@ryancerium
Copy link
Contributor

Which crate is this about?

windows

Crate version

0.34.0

Summary

Windows\Win32\System\Diagnostics\Debug\mod.rs won't compile. Full cargo check output is below.

PS C:\Users\rphelps\code\ryancerium\grist> cargo check
    Blocking waiting for file lock on build directory
    Checking windows v0.34.0
error: type parameters must be declared prior to const parameters
    --> C:\Users\rphelps\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.34.0\src\Windows\Win32\System\Diagnostics\Debug\mod.rs:9888:68
     |
9888 | ...iptTextAttributes<'a, const PARAM1: usize, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>>(&self, pszcode: &[u16; PAR...
     |                     --------------------------^^^^^^---------------------------------------------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>, const PARAM1: usize>`

error: type parameters must be declared prior to const parameters
    --> C:\Users\rphelps\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.34.0\src\Windows\Win32\System\Diagnostics\Debug\mod.rs:9892:71
     |
9892 | ...letTextAttributes<'a, const PARAM1: usize, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>>(&self, pszcode: &[u16; PAR...
     |                     --------------------------^^^^^^---------------------------------------------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>, const PARAM1: usize>`

error: type parameters must be declared prior to const parameters
     --> C:\Users\rphelps\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.34.0\src\Windows\Win32\System\Diagnostics\Debug\mod.rs:10075:68
      |
10075 | ...iptTextAttributes<'a, const PARAM1: usize, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>>(&self, pstrcode: &[u16; PA...
      |                     --------------------------^^^^^^---------------------------------------------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>, const PARAM1: usize>`

error: type parameters must be declared prior to const parameters
     --> C:\Users\rphelps\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.34.0\src\Windows\Win32\System\Diagnostics\Debug\mod.rs:10079:71
      |
10079 | ...letTextAttributes<'a, const PARAM1: usize, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>>(&self, pstrcode: &[u16; PA...
      |                     --------------------------^^^^^^---------------------------------------------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>, const PARAM1: usize>`

error: type parameters must be declared prior to const parameters
     --> C:\Users\rphelps\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.34.0\src\Windows\Win32\System\Diagnostics\Debug\mod.rs:10141:68
      |
10141 | ...iptTextAttributes<'a, const PARAM1: usize, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>>(&self, pstrcode: &[u16; PA...
      |                     --------------------------^^^^^^---------------------------------------------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>, const PARAM1: usize>`

error: type parameters must be declared prior to const parameters
     --> C:\Users\rphelps\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.34.0\src\Windows\Win32\System\Diagnostics\Debug\mod.rs:10145:71
      |
10145 | ...letTextAttributes<'a, const PARAM1: usize, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>>(&self, pstrcode: &[u16; PA...
      |                     --------------------------^^^^^^---------------------------------------------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>, const PARAM1: usize>`

error: type parameters must be declared prior to const parameters
     --> C:\Users\rphelps\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.34.0\src\Windows\Win32\System\Diagnostics\Debug\mod.rs:28628:68
      |
28628 | ...iptTextAttributes<'a, const PARAM1: usize, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>>(&self, pstrcode: &[u16; PA...
      |                     --------------------------^^^^^^---------------------------------------------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::PCWSTR>, const PARAM1: usize>`

error: could not compile `windows` due to 7 previous errors

Toolchain version/configuration

PS C:\Users\rphelps\code\ryancerium\grist> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\rphelps\.rustup

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc

active toolchain
----------------

stable-x86_64-pc-windows-msvc (default)
rustc 1.57.0 (f1edd0429 2021-11-29)

Reproducible example

fn main() {
    println!("Hello, world!");
}

Crate manifest

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[dependencies.windows]
version = "0.34.0"
features = [
    "Win32_System_Diagnostics_Debug"
]

Expected behavior

I thought it would compile.

Actual behavior

It did not compile.

Additional comments

I love the good work and community involvement on this crate!

@ryancerium ryancerium added the bug Something isn't working label Mar 16, 2022
@ryancerium ryancerium changed the title Bug: Build Errors in Bug: Build Errors in Win32_System_Diagnostics_Debug Mar 16, 2022
@kennykerr
Copy link
Collaborator

kennykerr commented Mar 16, 2022

Hi Ryan, can you try the latest version of the Rust compiler e.g. rustup update? I think this was fixed in Rust 1.59.

More info: https://blog.rust-lang.org/2022/02/24/Rust-1.59.0.html#const-generics-defaults-and-interleaving

@ryancerium
Copy link
Contributor Author

Yup, that was it.

Can you specify the MSRV in Cargo.toml? So far I can't find any Cargo documentation on it.

rust-lang/rfcs#2495

@kennykerr
Copy link
Collaborator

kennykerr commented Mar 16, 2022

That's a good idea - should provide a more debug-able error message. Will reopen to track this.

https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field

@kennykerr kennykerr reopened this Mar 16, 2022
@kennykerr kennykerr added enhancement New feature or request and removed bug Something isn't working labels Mar 16, 2022
@kennykerr kennykerr changed the title Bug: Build Errors in Win32_System_Diagnostics_Debug Include rust-version field in package to void cryptic errors Mar 16, 2022
@kennykerr kennykerr changed the title Include rust-version field in package to void cryptic errors Include rust-version field in package to avoid cryptic errors Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants