-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #5056 - rust-lang:dissasociate-mut-key, r=flip1995
Avoid mut_key on types of unknown layout This fixes #5020 by requiring a known layout for the key type before linting. Edit: This fixes #5043, too. changelog: none
- Loading branch information
Showing
3 changed files
with
45 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
error: mutable key type | ||
--> $DIR/mut_key.rs:27:32 | ||
--> $DIR/mut_key.rs:29:32 | ||
| | ||
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[deny(clippy::mutable_key_type)]` on by default | ||
|
||
error: mutable key type | ||
--> $DIR/mut_key.rs:27:72 | ||
--> $DIR/mut_key.rs:29:72 | ||
| | ||
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> { | ||
| ^^^^^^^^^^^^ | ||
|
||
error: mutable key type | ||
--> $DIR/mut_key.rs:28:5 | ||
--> $DIR/mut_key.rs:30:5 | ||
| | ||
LL | let _other: HashMap<Key, bool> = HashMap::new(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
error: mutable key type | ||
--> $DIR/mut_key.rs:49:22 | ||
| | ||
LL | fn tuples_bad<U>(_m: &mut HashMap<(Key, U), bool>) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 4 previous errors | ||
|