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/borrowck/clone-span-on-try-operator.fixed

12 lines
186 B
Rust
Raw Normal View History

[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ run-rustfix
Don't use method span on clone suggestion
2023-06-22 20:40:49 +00:00
#[derive(Clone)]
struct Foo;
impl Foo {
fn foo(self) {}
}
fn main() {
let foo = &Foo;
Suggest `.clone()` in some move errors ``` error[E0507]: cannot move out of `*x` which is behind a shared reference --> $DIR/borrowck-fn-in-const-a.rs:6:16 | LL | return *x | ^^ move occurs because `*x` has type `String`, which does not implement the `Copy` trait | help: consider cloning the value if the performance cost is acceptable | LL - return *x LL + return x.clone() | ```
2024-03-13 03:41:41 +00:00
<Foo as Clone>::clone(&foo.clone()).foo(); //~ ERROR cannot move out
Don't use method span on clone suggestion
2023-06-22 20:40:49 +00:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 528ms 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