about summary refs log tree commit diff
path: root/src/test/compile-fail/unboxed-closures-wrong-trait.rs
AgeCommit message (Collapse)AuthorLines
2015-02-03Update compile-fail tests to use the expected type to force theNiko Matsakis-23/+0
closure kind, thereby detecting what happens if there are mismatches. Simply removing the `:` annotations caused most of these tests to pass or produce other errors, because the inference would convert the closure into a more appropriate kind. (The ability to override the inference by using the expected type is an important backdoor partly for this reason.)
2015-01-28Update test files; mostly the problem is that they were using theNiko Matsakis-0/+1
explicit form `Fn<A,B>` and now should use `Fn(A) -> B` or `Fn<A,Output=B>`, but in some cases we get duplicate error reports. This is mildly annoying and arises because of the main error and another error from the projection. Might be worth squashing those, but seems like a separate problem.
2015-01-08Update compile fail tests to use isize.Huon Wilson-3/+3
2014-11-05Correct tests that were supposed to fail but now pass due to the fn trait ↵Niko Matsakis-2/+2
hierarchy.
2014-09-18librustc: Implement the syntax in the RFC for unboxed closure sugar.Patrick Walton-1/+1
Part of issue #16640. I am leaving this issue open to handle parsing of higher-rank lifetimes in traits. This change breaks code that used unboxed closures: * Instead of `F:|&: int| -> int`, write `F:Fn(int) -> int`. * Instead of `F:|&mut: int| -> int`, write `F:FnMut(int) -> int`. * Instead of `F:|: int| -> int`, write `F:FnOnce(int) -> int`. [breaking-change]
2014-09-15Update error messages in compile-fail testsNiko Matsakis-1/+1
2014-08-14librustc: Tie up loose ends in unboxed closures.Patrick Walton-0/+22
This patch primarily does two things: (1) it prevents lifetimes from leaking out of unboxed closures; (2) it allows unboxed closure type notation, call notation, and construction notation to construct closures matching any of the three traits. This breaks code that looked like: let mut f; { let x = &5i; f = |&mut:| *x + 10; } Change this code to avoid having a reference escape. For example: { let x = &5i; let mut f; // <-- move here to avoid dangling reference f = |&mut:| *x + 10; } I believe this is enough to consider unboxed closures essentially implemented. Further issues (for example, higher-rank lifetimes) should be filed as followups. Closes #14449. [breaking-change]