aboutsummaryrefslogtreecommitdiffstats
path: root/tests/compiletest/plugin/compile-fail/str_to_string.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compiletest/plugin/compile-fail/str_to_string.rs')
-rw-r--r--tests/compiletest/plugin/compile-fail/str_to_string.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/compiletest/plugin/compile-fail/str_to_string.rs b/tests/compiletest/plugin/compile-fail/str_to_string.rs
new file mode 100644
index 00000000000..ee45ee39b96
--- /dev/null
+++ b/tests/compiletest/plugin/compile-fail/str_to_string.rs
@@ -0,0 +1,16 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#![feature(plugin)]
+#![plugin(plugins)]
+
+
+fn main() {
+ let x = "foo".to_string();
+ //~^ ERROR str.to_owned() is more efficient than str.to_string()
+
+ let x = &x[..];
+ x.to_string();
+ //~^ ERROR str.to_owned() is more efficient than str.to_string()
+}