diff options
author | Florian Hahn <flo@fhahn.com> | 2016-01-28 00:58:15 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2016-02-04 16:00:09 +0100 |
commit | dfdbcabc2e9803a1beb975af8c3aa37331476f85 (patch) | |
tree | 5ee88933118bfa47d0b18c110489c7c05852bf31 /tests/compiletest/plugin/compile-fail/str_to_string.rs | |
parent | 46b3eb653579a40632f91497a3d48f1d7fbd40cc (diff) | |
download | servo-dfdbcabc2e9803a1beb975af8c3aa37331476f85.tar.gz servo-dfdbcabc2e9803a1beb975af8c3aa37331476f85.zip |
Add infrastructure for compiletests
Also adds compilefail tests for some lints, closes #5646.
Diffstat (limited to 'tests/compiletest/plugin/compile-fail/str_to_string.rs')
-rw-r--r-- | tests/compiletest/plugin/compile-fail/str_to_string.rs | 16 |
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() +} |