Skip to content

autocfg assumes there is no std #2431

Closed
@youknowone

Description

@youknowone

This code was running ok with previous version of miri, but not today version.

// cargo add indexmap
fn main() {
    let _ = indexmap::IndexMap::<u32, String>::new();
}

error:

error[E0107]: this struct takes 3 generic arguments but 2 generic arguments were supplied
  --> src/main.rs:2:23
   |
2  |     let _ = indexmap::IndexMap::<u32, String>::new();
   |                       ^^^^^^^^   ---  ------ supplied 2 generic arguments
   |                       |
   |                       expected 3 generic arguments
   |
note: struct defined here, with 3 generic parameters: `K`, `V`, `S`
  --> /home/youknowone/.cargo/registry/src/github.com-1ecc6299db9ec823/indexmap-1.9.1/src/map.rs:76:12
   |
76 | pub struct IndexMap<K, V, S> {
   |            ^^^^^^^^ -  -  -
help: add missing generic argument
   |
2  |     let _ = indexmap::IndexMap::<u32, String, S>::new();
   |                                             +++

error: aborting due to previous error

For more information about this error, try `rustc --explain E0107`.
error: test failed, to rerun pass '--bin miritest'

In the indexmap code, I found it is hitting #[cfg(not(has_std))]

#[cfg(has_std)]
pub struct IndexMap<K, V, S = RandomState> {
    pub(crate) core: IndexMapCore<K, V>,
    hash_builder: S,
}
#[cfg(not(has_std))]
pub struct IndexMap<K, V, S> {
    pub(crate) core: IndexMapCore<K, V>,
    hash_builder: S,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargoArea: affects the cargo wrapper (cargo miri)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions