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/borrowck/borrowck-issue-2657-2.fixed

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
198 B
Rust
Raw Normal View History

Account for dereference expressions
2022-12-09 13:01:41 -08:00
//@ run-rustfix
fn main() {
let x: Option<Box<_>> = Some(Box::new(1));
match x {
Some(ref y) => {
More move error suggestions to clone ``` error[E0507]: cannot move out of `val`, a captured variable in an `FnMut` closure --> $DIR/issue-87456-point-to-closure.rs:10:28 | LL | let val = String::new(); | --- captured outer variable LL | LL | take_mut(|| { | -- captured by this `FnMut` closure LL | LL | let _foo: String = val; | ^^^ move occurs because `val` has type `String`, which does not implement the `Copy` trait | help: consider borrowing here | LL | let _foo: String = &val; | + help: consider cloning the value if the performance cost is acceptable | LL | let _foo: String = val.clone(); | ++++++++ ```
2024-03-13 05:26:03 +00:00
let _b = y.clone(); //~ ERROR cannot move out
Account for dereference expressions
2022-12-09 13:01:41 -08:00
}
_ => {}
}
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 747ms Template: 2ms
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