forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#89903 - matthiaskrgr:rollup-s0c69xl, r=matthi…
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#86011 (move implicit `Sized` predicate to end of list) - rust-lang#89821 (Add a strange test for `unsafe_code` lint.) - rust-lang#89859 (add dedicated error variant for writing the discriminant of an uninhabited enum variant) - rust-lang#89870 (Suggest Box::pin when Pin::new is used instead) - rust-lang#89880 (Use non-checking TLS relocation in aarch64 asm! sym test.) - rust-lang#89885 (add long explanation for E0183) - rust-lang#89894 (Remove unused dependencies from rustc_const_eval) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
35 changed files
with
236 additions
and
114 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
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,39 @@ | ||
Manual implemetation of a `Fn*` trait. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0183 | ||
struct MyClosure { | ||
foo: i32 | ||
} | ||
impl FnOnce<()> for MyClosure { // error | ||
type Output = (); | ||
extern "rust-call" fn call_once(self, args: ()) -> Self::Output { | ||
println!("{}", self.foo); | ||
} | ||
} | ||
``` | ||
|
||
Manually implementing `Fn`, `FnMut` or `FnOnce` is unstable | ||
and requires `#![feature(fn_traits, unboxed_closures)]`. | ||
|
||
``` | ||
#![feature(fn_traits, unboxed_closures)] | ||
struct MyClosure { | ||
foo: i32 | ||
} | ||
impl FnOnce<()> for MyClosure { // ok! | ||
type Output = (); | ||
extern "rust-call" fn call_once(self, args: ()) -> Self::Output { | ||
println!("{}", self.foo); | ||
} | ||
} | ||
``` | ||
|
||
The argumements must be a tuple representing the argument list. | ||
For more info, see the [tracking issue][iss29625]: | ||
|
||
[iss29625]: https://github.com/rust-lang/rust/issues/29625 |
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
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
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
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
Oops, something went wrong.