1
Fork 0

Demonstrate next-solver missing diagnostic

This commit is contained in:
Oli Scherer 2025-03-17 08:58:08 +00:00
parent 9c67cecd12
commit 055d31c7a5
4 changed files with 33 additions and 12 deletions

View file

@ -1,16 +1,17 @@
//@ run-rustfix
//@[current] run-rustfix
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
#![allow(unused_variables, dead_code)]
use std::collections::BTreeMap;
use std::collections::HashSet;
use std::collections::{BTreeMap, HashSet};
#[derive(Debug,Eq,PartialEq,Hash)]
#[derive(Debug, Eq, PartialEq, Hash)]
#[derive(Clone)]
enum Day {
Mon,
}
struct Class {
days: BTreeMap<u32, HashSet<Day>>
days: BTreeMap<u32, HashSet<Day>>,
}
impl Class {

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:18:39
--> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
|
LL | let mut x: HashSet<Day> = v.clone();
| ------------ ^^^^^^^^^ expected `HashSet<Day>`, found `&HashSet<Day>`
@ -9,7 +9,7 @@ LL | let mut x: HashSet<Day> = v.clone();
= note: expected struct `HashSet<_>`
found reference `&HashSet<_>`
note: `HashSet<Day>` does not implement `Clone`, so `&HashSet<Day>` was cloned instead
--> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:18:39
--> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
|
LL | let mut x: HashSet<Day> = v.clone();
| ^

View file

@ -0,0 +1,19 @@
error[E0308]: mismatched types
--> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
|
LL | let mut x: HashSet<Day> = v.clone();
| ------------ ^^^^^^^^^ expected `HashSet<Day>`, found `&HashSet<Day>`
| |
| expected due to this
|
= note: expected struct `HashSet<_>`
found reference `&HashSet<_>`
note: `HashSet<Day>` does not implement `Clone`, so `&HashSet<Day>` was cloned instead
--> $DIR/assignment-of-clone-call-on-ref-due-to-missing-bound.rs:19:39
|
LL | let mut x: HashSet<Day> = v.clone();
| ^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -1,15 +1,16 @@
//@ run-rustfix
//@[current] run-rustfix
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
#![allow(unused_variables, dead_code)]
use std::collections::BTreeMap;
use std::collections::HashSet;
use std::collections::{BTreeMap, HashSet};
#[derive(Debug,Eq,PartialEq,Hash)]
#[derive(Debug, Eq, PartialEq, Hash)]
enum Day {
Mon,
}
struct Class {
days: BTreeMap<u32, HashSet<Day>>
days: BTreeMap<u32, HashSet<Day>>,
}
impl Class {