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
359bfa901b9d8eddbed7b88b6716dbb77b7bfb95
rust/tests/ui/functions-closures/capture-clauses-unboxed-closures.rs

14 lines
249 B
Rust
Raw Normal View History

[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ run-pass
Rehabilitate an unboxed closure test This test works as a regression test for issue #17655. It also exercises mutation of by-ref upvars.
2014-10-02 19:48:07 -07:00
fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
`for x in xs.iter()` -> `for x in &xs`
2015-01-31 12:20:46 -05:00
for val in x {
librustc: Parse, but do not fully turn on, the `ref` keyword for by-reference upvars. This partially implements RFC 38. A snapshot will be needed to turn this on, because stage0 cannot yet parse the keyword. Part of #12381.
2014-07-23 12:43:29 -07:00
f(val)
}
}
fn main() {
Remove integer suffixes where the types in compiled code are identical.
2015-03-03 10:42:26 +02:00
let mut sum = 0;
let elems = [ 1, 2, 3, 4, 5 ];
Mass rename uint/int to usize/isize Now that support has been removed, all lingering use cases are renamed.
2015-03-25 17:06:52 -07:00
each(&elems, |val: &usize| sum += *val);
librustc: Parse, but do not fully turn on, the `ref` keyword for by-reference upvars. This partially implements RFC 38. A snapshot will be needed to turn this on, because stage0 cannot yet parse the keyword. Part of #12381.
2014-07-23 12:43:29 -07:00
assert_eq!(sum, 15);
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 3134ms Template: 4ms
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