-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make functional record update/struct update syntax works inside closu…
…res when feature capture_disjoint_fields is enabled
- Loading branch information
1 parent
180fdff
commit e94cf57
Showing
4 changed files
with
51 additions
and
5 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
30 changes: 30 additions & 0 deletions
30
src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.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,30 @@ | ||
// run-pass | ||
|
||
// Test that functional record update/struct update syntax works inside | ||
// a closure when the feature `capture_disjoint_fields` is enabled. | ||
|
||
#![feature(capture_disjoint_fields)] | ||
//~^ WARNING: the feature `capture_disjoint_fields` is incomplete | ||
//~| NOTE: `#[warn(incomplete_features)]` on by default | ||
//~| NOTE: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> | ||
|
||
struct S { | ||
a: String, | ||
b: String, | ||
} | ||
|
||
fn main() { | ||
let a = String::new(); | ||
let b = String::new(); | ||
let s = S {a, b}; | ||
|
||
let c = || { | ||
let s2 = S { | ||
a: format!("New a"), | ||
..s | ||
}; | ||
println!("{} {}", s2.a, s2.b); | ||
}; | ||
|
||
c(); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr
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,11 @@ | ||
warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/fru_syntax.rs:6:12 | ||
| | ||
LL | #![feature(capture_disjoint_fields)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
= note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information | ||
|
||
warning: 1 warning emitted | ||
|