Auto merge of #51051 - nikomatsakis:turbofish-impl-trait-method, r=eddyb
prohibit turbofish in `impl Trait` methods Fix #50950
This commit is contained in:
commit
9823cb99c5
5 changed files with 75 additions and 31 deletions
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::any::Any;
|
||||
pub struct EventHandler {
|
||||
}
|
||||
|
||||
impl EventHandler
|
||||
{
|
||||
pub fn handle_event<T: Any>(&mut self, _efunc: impl FnMut(T)) {}
|
||||
}
|
||||
|
||||
struct TestEvent(i32);
|
||||
|
||||
fn main() {
|
||||
let mut evt = EventHandler {};
|
||||
evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| {
|
||||
//~^ ERROR cannot provide explicit type parameters
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
|
||||
--> $DIR/universal-turbofish-in-method-issue-50950.rs:24:9
|
||||
|
|
||||
LL | evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| {
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0632`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue