-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new rules for merging expected/supplied types in closure signatures
Also, fix numbering in mir-opt tests. We are now anonymizing more consistently, I think, and hence some of the `TyAnon` indices shifted.
- Loading branch information
1 parent
ea4db35
commit 053383d
Showing
18 changed files
with
646 additions
and
68 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
See `src/test/run-pass/closure-expected-type`. |
49 changes: 49 additions & 0 deletions
49
src/test/compile-fail/closure-expected-type/expect-fn-supply-fn-multiple.rs
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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. | ||
|
||
// must-compile-successfully | ||
|
||
#![feature(underscore_lifetimes)] | ||
#![allow(warnings)] | ||
|
||
type Different<'a, 'b> = &'a mut (&'a (), &'b ()); | ||
type Same<'a> = Different<'a, 'a>; | ||
|
||
fn with_closure_expecting_different<F>(_: F) | ||
where F: for<'a, 'b> FnOnce(Different<'a, 'b>) | ||
{ | ||
} | ||
|
||
fn with_closure_expecting_different_anon<F>(_: F) | ||
where F: FnOnce(Different<'_, '_>) | ||
{ | ||
} | ||
|
||
fn supplying_nothing_expecting_anon() { | ||
with_closure_expecting_different_anon(|x: Different| { | ||
}) | ||
} | ||
|
||
fn supplying_nothing_expecting_named() { | ||
with_closure_expecting_different(|x: Different| { | ||
}) | ||
} | ||
|
||
fn supplying_underscore_expecting_anon() { | ||
with_closure_expecting_different_anon(|x: Different<'_, '_>| { | ||
}) | ||
} | ||
|
||
fn supplying_underscore_expecting_named() { | ||
with_closure_expecting_different(|x: Different<'_, '_>| { | ||
}) | ||
} | ||
|
||
fn main() { } |
Oops, something went wrong.