From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../internal-lints/default_hash_types.rs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/ui-fulldeps/internal-lints/default_hash_types.rs (limited to 'src/test/ui-fulldeps/internal-lints/default_hash_types.rs') diff --git a/src/test/ui-fulldeps/internal-lints/default_hash_types.rs b/src/test/ui-fulldeps/internal-lints/default_hash_types.rs new file mode 100644 index 000000000..795c7d2dc --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/default_hash_types.rs @@ -0,0 +1,29 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_private)] +#![deny(rustc::default_hash_types)] + +extern crate rustc_data_structures; + +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use std::collections::{HashMap, HashSet}; + +mod foo { + pub struct HashMap; +} + +fn main() { + let _map: HashMap = HashMap::default(); + //~^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance + //~^^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance + let _set: HashSet = HashSet::default(); + //~^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance + //~^^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance + + // test that the lint doesn't also match the Fx variants themselves + let _fx_map: FxHashMap = FxHashMap::default(); + let _fx_set: FxHashSet = FxHashSet::default(); + + // test another struct of the same name + let _ = foo::HashMap; +} -- cgit v1.2.3