Don't record adjustments twice in note_source_of_type_mismatch_constraint
This commit is contained in:
parent
397641f3bd
commit
696cd98e6b
5 changed files with 93 additions and 7 deletions
|
|
@ -0,0 +1,29 @@
|
|||
pub trait NSWindow: Sized {
|
||||
fn frame(self) -> () {
|
||||
unimplemented!()
|
||||
}
|
||||
fn setFrame_display_(self, display: ()) {}
|
||||
}
|
||||
impl NSWindow for () {}
|
||||
|
||||
pub struct NSRect {}
|
||||
|
||||
use std::ops::Deref;
|
||||
struct MainThreadSafe<T = ()>(T);
|
||||
impl<T> Deref for MainThreadSafe<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &T {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|| {
|
||||
let ns_window = MainThreadSafe(());
|
||||
// Don't record adjustments twice for `*ns_window`
|
||||
(*ns_window).frame();
|
||||
ns_window.setFrame_display_(0);
|
||||
//~^ ERROR mismatched types
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/dont-record-adjustments-when-pointing-at-arg.rs:26:37
|
||||
|
|
||||
LL | ns_window.setFrame_display_(0);
|
||||
| ----------------- ^ expected `()`, found integer
|
||||
| |
|
||||
| arguments to this method are incorrect
|
||||
|
|
||||
note: method defined here
|
||||
--> $DIR/dont-record-adjustments-when-pointing-at-arg.rs:5:8
|
||||
|
|
||||
LL | fn setFrame_display_(self, display: ()) {}
|
||||
| ^^^^^^^^^^^^^^^^^ -----------
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue