Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Regression test for #154568
//@ compile-flags: -Znext-solver=globally

trait Role {
type Inner;
}

struct HandshakeCallback<C>(C);
struct Handshake<R: Role>(R::Inner);

fn main() {
let callback = HandshakeCallback(());
let handshake = Handshake(callback.0.clone());
//~^ ERROR type annotations needed
match &handshake {
hs if (|| {
let borrowed_inner = &hs.0;
borrowed_inner == &callback.0
})() => println!(),
_ => {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error[E0283]: type annotations needed for `Handshake<_>`
--> $DIR/unexpected-pointer-deref-issue-154568.rs:13:9
|
LL | let handshake = Handshake(callback.0.clone());
| ^^^^^^^^^ ----------------------------- type must be known at this point
|
= note: the type must implement `Role`
note: required by a bound in `Handshake`
--> $DIR/unexpected-pointer-deref-issue-154568.rs:9:21
|
LL | struct Handshake<R: Role>(R::Inner);
| ^^^^ required by this bound in `Handshake`
help: consider giving `handshake` an explicit type, where the type for type parameter `R` is specified
|
LL | let handshake: Handshake<R> = Handshake(callback.0.clone());
| ++++++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0283`.
Loading