summaryrefslogtreecommitdiffstats
path: root/src/test/ui/use
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/use')
-rw-r--r--src/test/ui/use/use-after-move-based-on-type.stderr4
-rw-r--r--src/test/ui/use/use-after-move-implicity-coerced-object.stderr8
-rw-r--r--src/test/ui/use/use-crate-self.rs4
-rw-r--r--src/test/ui/use/use-crate-self.stderr8
4 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/use/use-after-move-based-on-type.stderr b/src/test/ui/use/use-after-move-based-on-type.stderr
index 445f14d65..7b4d24549 100644
--- a/src/test/ui/use/use-after-move-based-on-type.stderr
+++ b/src/test/ui/use/use-after-move-based-on-type.stderr
@@ -9,6 +9,10 @@ LL | println!("{}", x);
| ^ value borrowed here after move
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider cloning the value if the performance cost is acceptable
+ |
+LL | let _y = x.clone();
+ | ++++++++
error: aborting due to previous error
diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
index 26804216d..dfa0c0483 100644
--- a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
+++ b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
@@ -9,6 +9,14 @@ LL | l.push(n);
LL |
LL | let x = n.to_string();
| ^^^^^^^^^^^^^ value borrowed here after move
+ |
+note: consider changing this parameter type in method `push` to borrow instead if owning the value isn't necessary
+ --> $DIR/use-after-move-implicity-coerced-object.rs:17:27
+ |
+LL | fn push(&mut self, n: Box<dyn ToString + 'static>) {
+ | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this parameter takes ownership of the value
+ | |
+ | in this method
error: aborting due to previous error
diff --git a/src/test/ui/use/use-crate-self.rs b/src/test/ui/use/use-crate-self.rs
new file mode 100644
index 000000000..65ab94814
--- /dev/null
+++ b/src/test/ui/use/use-crate-self.rs
@@ -0,0 +1,4 @@
+use crate::{self};
+ //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
+
+fn main() {}
diff --git a/src/test/ui/use/use-crate-self.stderr b/src/test/ui/use/use-crate-self.stderr
new file mode 100644
index 000000000..dd4036bff
--- /dev/null
+++ b/src/test/ui/use/use-crate-self.stderr
@@ -0,0 +1,8 @@
+error: crate root imports need to be explicitly named: `use crate as name;`
+ --> $DIR/use-crate-self.rs:1:13
+ |
+LL | use crate::{self};
+ | ^^^^
+
+error: aborting due to previous error
+