Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
51b51b51d7931da85280382a81c4dd80c73ca754
rust/tests/ui/issues/issue-17897.rs

9 lines
160 B
Rust
Raw Normal View History

[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ run-pass
Update run-pass test suite to use dyn
2019-05-28 14:47:21 -04:00
fn action(mut cb: Box<dyn FnMut(usize) -> usize>) -> usize {
Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an alias for `Box<FnBox()>`. I found the alias was still handy because it is shorter than the fully written type. This is a [breaking-change]: convert code using `Invoke` to use `FnBox`, which is usually pretty straight-forward. Code using thunk mostly works if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to `foo(arg)`.
2015-04-01 11:12:30 -04:00
cb(1)
Add tests for E-needstest issues
2014-12-07 15:22:06 +00:00
}
pub fn main() {
Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an alias for `Box<FnBox()>`. I found the alias was still handy because it is shorter than the fully written type. This is a [breaking-change]: convert code using `Invoke` to use `FnBox`, which is usually pretty straight-forward. Code using thunk mostly works if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to `foo(arg)`.
2015-04-01 11:12:30 -04:00
println!("num: {}", action(Box::new(move |u| u)));
Add tests for E-needstest issues
2014-12-07 15:22:06 +00:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 4738ms Template: 10ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API