summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2014-06-26librustc: Ensure that proc upvars have static lifetime.Patrick Walton-0/+26
Since procs do not have lifetime bounds, we must do this to maintain safety. This can break code that incorrectly captured references in procedure types. Change such code to not do this, perhaps with a trait object instead. A better solution would be to add higher-rank lifetime support to procs. However, this would be a lot of work for a feature we want to remove in favor of unboxed closures. The corresponding "real fix" is #15067. Closes #14036. [breaking-change]
2014-06-26auto merge of #15184 : jbclements/rust/for-loop-hygiene-etc, r=jbclementsbors-0/+21
It turns out that bindings introduced by 'for' loops were not treated hygienically. The fix for this is to make the 'for' expansion more like a macro; rather than expanding sub-pieces and then assembling them, we need to rewrite the for and then call expand again on the whole thing. This PR includes a test and the fix. It also contains a number of other things: - unit tests for other forms of hygiene (currently ignored) - a fix for the isaac.rs macro that (it turned out) was relying on capturing - other miscellaneous cleanup and comments
2014-06-25added compile-fail test for 15167John Clements-0/+21
2014-06-25auto merge of #15171 : pcwalton/rust/remove-cross-borrowing, r=brsonbors-12/+27
This will break code like: fn f(x: &mut int) {} let mut a = box 1i; f(a); Change it to: fn f(x: &mut int) {} let mut a = box 1i; f(&mut *a); RFC 33; issue #10504. [breaking-change] r? @brson
2014-06-24librustc: Don't try to perform the magicalPatrick Walton-0/+31
vector-reference-to-unsafe-pointer-to-element cast if the type to be casted to is not fully specified. This is a conservative change to fix the user-visible symptoms of the issue. A more flexible treatment would delay cast checks to after function typechecking. This can break code that did: let x: *u8 = &([0, 0]) as *_; Change this code to: let x: *u8 = &([0, 0]) as *u8; Closes #14893. [breaking-change]
2014-06-24librustc: Remove cross borrowing from mutable `Box`es to `&mut`.Patrick Walton-12/+27
This will break code like: fn f(x: &mut int) {} let mut a = box 1i; f(a); Change it to: fn f(x: &mut int) {} let mut a = box 1i; f(&mut *a); RFC 33; issue #10504. [breaking-change]
2014-06-24Test fixes from the rollupAlex Crichton-0/+4
Closes #14482 (std: Bring back half of Add on String) Closes #15026 (librustc: Remove the fallback to `int` from typechecking.) Closes #15119 (Add more description to c_str::unwrap().) Closes #15120 (Add tests for #12470 and #14285) Closes #15122 (Remove the cheat sheet.) Closes #15126 (rustc: Always include the morestack library) Closes #15127 (Improve ambiguous pronoun.) Closes #15130 (Fix #15129) Closes #15131 (Add the Guide, add warning to tutorial.) Closes #15134 (Xfailed tests for hygiene, etc.) Closes #15135 (core: Add stability attributes to Clone) Closes #15136 (Some minor improvements to core::bool) Closes #15137 (std: Add stability attributes to primitive numeric modules) Closes #15141 (Fix grammar in tutorial) Closes #15143 (Remove few FIXMEs) Closes #15145 (Avoid unnecessary temporary on assignments) Closes #15147 (Small improvements for metaprogramming) Closes #15153 (librustc: Check function argument patterns for legality of by-move) Closes #15154 (test: Add a test for regions, traits, and variance.) Closes #15159 (rustc: Don't register syntax crates twice) Closes #13816 (Stabilize version output for rustc and rustdoc)
2014-06-24test: Add a test for regions, traits, and variance.Patrick Walton-0/+52
Closes #12470.
2014-06-24librustc: Check function argument patterns for legality of by-movePatrick Walton-0/+21
bindings. This will break code that incorrectly did things like: fn f(a @ box b: Box<String>) {} Fix such code to not rely on undefined behavior. Closes #12534. [breaking-change]
2014-06-24Remove few FIXMEsPiotr Jawniak-11/+4
This commit removes FIXMEs of few closed issues. Closes #13992
2014-06-24Fix #15129Jakub Wieczorek-5/+41
Add support for unit literals to const_eval.
2014-06-24Add tests for #12470 and #14285Edward Wang-0/+67
The #14869 removed `TraitStore` from `ty_trait` and represented trait reference as regular `ty_rptr`. An old bug of the missing constraint upon lifetime parameter of trait reference then is fixed as a side effect. Adds tests for affected bugs and closes them. Closes #12470. Closes #14285.
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-57/+43
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-24Test lint pluginsKeegan McAllister-0/+30
2014-06-24librustc: Remove outdated reference to `~` and `@`Tom Jakubowski-0/+48
Fix #15052
2014-06-23librustc: Feature gate lang items and intrinsics.Patrick Walton-1/+28
If you define lang items in your crate, add `#[feature(lang_items)]`. If you define intrinsics (`extern "rust-intrinsic"`), add `#[feature(intrinsics)]`. Closes #12858. [breaking-change]
2014-06-24auto merge of #14885 : pcwalton/rust/struct-literal-tightening, r=alexcrichtonbors-11/+119
`for...in`. Closes #14803. If you used a structure literal after one of these keywords, surround it in parentheses. [breaking-change] r? @nick29581
2014-06-23libsyntax: Disallow struct literals after `if`, `while`, `match`, andPatrick Walton-11/+119
`for...in`. Closes #14803. If you used a structure literal after one of these keywords, surround it in parentheses. [breaking-change]
2014-06-23auto merge of #14974 : Ryman/rust/non_trait_method, r=alexcrichtonbors-10/+49
Closes #3973.
2014-06-23rustc: catch `impl X for Y` where X is not a trait in resolve.Kevin Butler-5/+40
2014-06-23rustc: catch non-trait methods before typeck.Kevin Butler-7/+11
Closes #3973.
2014-06-23auto merge of #15106 : Sawyer47/rust/rm-duplicated-tests, r=alexcrichtonbors-53/+0
Even if they used to test different things in the past, they are now identical to other files. Closes #11496
2014-06-23auto merge of #15098 : ben0x539/rust/nullary-tuple-struct, r=pcwaltonbors-1/+14
Reject `struct Foo();` to fix #15095.
2014-06-23auto merge of #15083 : edwardw/rust/destructure-trait-ref, r=pcwaltonbors-1/+42
Closes #15031.
2014-06-22libsyntax: don't allow enum structs with no fieldsBenjamin Herr-1/+14
Unit-like structs are written as `struct Foo;`, but we erroneously accepted `struct Foo();` and took it to mean the same thing. Now we don't, so use the `struct Foo;` form! [breaking-change]
2014-06-22Remove duplicated test filesPiotr Jawniak-53/+0
Even if they used to test different things in the past, they are now identical to other files. Closes #11496
2014-06-22Make destructuring trait reference workEdward Wang-1/+42
Closes #15031.
2014-06-21auto merge of #15062 : pcwalton/rust/trailing-plus, r=brsonbors-2/+20
This will break code that looks like `Box<Trait+>`. Change that code to `Box<Trait>` instead. Closes #14925. [breaking-change] r? @brson
2014-06-21auto merge of #15029 : aturon/rust/stability-index, r=brsonbors-66/+82
This commit makes several changes to the stability index infrastructure: * Stability levels are now inherited lexically, i.e., each item's stability level becomes the default for any nested items. * The computed stability level for an item is stored as part of the metadata. When using an item from an external crate, this data is looked up and cached. * The stability lint works from the computed stability level, rather than manual stability attribute annotations. However, the lint still checks only a limited set of item uses (e.g., it does not check every component of a path on import). This will be addressed in a later PR, as part of issue #8962. * The stability lint only applies to items originating from external crates, since the stability index is intended as a promise to downstream crates. * The "experimental" lint is now _allow_ by default. This is because almost all existing crates have been marked "experimental", pending library stabilization. With inheritance in place, this would generate a massive explosion of warnings for every Rust program. The lint should be changed back to deny-by-default after library stabilization is complete. * The "deprecated" lint still warns by default. The net result: we can begin tracking stability index for the standard libraries as we stabilize, without impacting most clients. Closes #13540.
2014-06-21auto merge of #14731 : jakub-/rust/pattern-matching-refactor, r=alexcrichtonbors-45/+141
This PR is changing the error messages for non-exhaustive pattern matching to include a more accurate witness, i.e. a pattern that is not covered by any of the ones provided by the user. Example: ```rust fn main() { match (true, (Some("foo"), [true, true]), Some(42u)) { (false, _, _) => (), (true, (None, [true, _]), None) => (), (true, (None, [false, _]), Some(1u)) => () } } ``` ```sh /tmp/witness.rs:2:2: 6:3 error: non-exhaustive patterns: (true, (core::option::Some(_), _), _) not covered /tmp/witness.rs:2 match (true, (Some("foo"), [true, true]), Some(42u)) { /tmp/witness.rs:3 (false, _, _) => (), /tmp/witness.rs:4 (true, (None, [true, _]), None) => (), /tmp/witness.rs:5 (true, (None, [false, _]), Some(1u)) => () /tmp/witness.rs:6 } ``` As part of that, I refactored some of the relevant code and carried over the changes to fixed vectors from the previous PR. I'm putting it out there for now but the tests will be red.
2014-06-20libsyntax: Stop parsing `+` with no bounds after it.Patrick Walton-2/+20
This will break code that looks like `Box<Trait+>`. Change that code to `Box<Trait>` instead. Closes #14925. [breaking-change]
2014-06-20librustc: Put `#[unsafe_destructor]` behind a feature gate.Patrick Walton-3/+5
Closes #8142. This is not the semantics we want long-term. You can continue to use `#[unsafe_destructor]`, but you'll need to add `#![feature(unsafe_destructor)]` to the crate attributes. [breaking-change]
2014-06-20Address review commentsJakub Wieczorek-14/+88
2014-06-20Add unreachability detection for missized patterns of fixed size vectorsJakub Wieczorek-0/+18
Fixed #13482
2014-06-20Provide a witness pattern for non-exhaustive patternsJakub Wieczorek-15/+33
Fixed #4321
2014-06-20Check pattern refutability the same way exhaustiveness is checkedJakub Wieczorek-32/+18
2014-06-18Add stability inheritanceAaron Turon-66/+82
This commit makes several changes to the stability index infrastructure: * Stability levels are now inherited lexically, i.e., each item's stability level becomes the default for any nested items. * The computed stability level for an item is stored as part of the metadata. When using an item from an external crate, this data is looked up and cached. * The stability lint works from the computed stability level, rather than manual stability attribute annotations. However, the lint still checks only a limited set of item uses (e.g., it does not check every component of a path on import). This will be addressed in a later PR, as part of issue #8962. * The stability lint only applies to items originating from external crates, since the stability index is intended as a promise to downstream crates. * The "experimental" lint is now _allow_ by default. This is because almost all existing crates have been marked "experimental", pending library stabilization. With inheritance in place, this would generate a massive explosion of warnings for every Rust program. The lint should be changed back to deny-by-default after library stabilization is complete. * The "deprecated" lint still warns by default. The net result: we can begin tracking stability index for the standard libraries as we stabilize, without impacting most clients. Closes #13540.
2014-06-19auto merge of #14400 : kballard/rust/lexer_crlf_handling, r=cmrbors-0/+30
The lexer already ignores CRLF in between tokens, but it doesn't properly handle carriage returns inside strings and doc comments. Teach it to treat CRLF as LF inside these tokens, and to disallow carriage returns that are not followed by linefeeds. This includes handling an escaped CRLF inside a regular string token the same way it handles an escaped LF. This is technically a breaking change, as bare carriage returns are no longer allowed, and CRLF sequences are now treated as LF inside strings and doc comments, but it's very unlikely to actually affect any real-world code. This change is necessary to have Rust code compile on Windows the same way it does on Unix. The mozilla/rust repository explicitly sets eol=lf for Rust source files, but other Rust repositories don't. Notably, rust-http cannot be compiled on Windows without converting the CRLF line endings back to LF. [breaking-change]
2014-06-18Handle CRLF properly in the lexerKevin Ballard-0/+30
The lexer already ignores CRLF in between tokens, but it doesn't properly handle carriage returns inside strings and doc comments. Teach it to treat CRLF as LF inside these tokens, and to disallow carriage returns that are not followed by linefeeds. This includes handling an escaped CRLF inside a regular string token the same way it handles an escaped LF. This is technically a breaking change, as bare carriage returns are no longer allowed, and CRLF sequences are now treated as LF inside strings and doc comments, but it's very unlikely to actually affect any real-world code. This change is necessary to have Rust code compile on Windows the same way it does on Unix. The mozilla/rust repository explicitly sets eol=lf for Rust source files, but other Rust repositories don't. Notably, rust-http cannot be compiled on Windows without converting the CRLF line endings back to LF. [breaking-change]
2014-06-18Deprecate the bytes!() macro.Simon Sapin-1/+9
Replace its usage with byte string literals, except in `bytes!()` tests. Also add a new snapshot, to be able to use the new b"foo" syntax. The src/etc/2014-06-rewrite-bytes-macros.py script automatically rewrites `bytes!()` invocations into byte string literals. Pass it filenames as arguments to generate a diff that you can inspect, or `--apply` followed by filenames to apply the changes in place. Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-18Reject double moves out of array elementsCameron Zwarich-0/+21
Fixes #14986.
2014-06-18auto merge of #14854 : jakub-/rust/issue-10991, r=pcwaltonbors-0/+14
Fixes #10991.
2014-06-18auto merge of #14879 : Ryman/rust/resolve_super_hint_cut, r=alexcrichtonbors-57/+71
2014-06-18Adapt test case to match current set of emitted warnings. (or lackFelix S. Klock II-1/+1
thereof.) PR 14739 injected the new message that this removes from one test case: borrowck-vec-pattern-loan-from-mut.rs When reviewing the test case, I was not able to convince myself that the error message was a legitimate thing to start emitting. Niko did not see an obvious reason for it either, so I am going to remove it and wait for someone (maybe Cameron Zwarich) to explain to me why we should be emitting it.
2014-06-18rustc: reduce redundant resolve errors.Kevin Butler-64/+46
2014-06-18Fix expected error message in a test.Simon Sapin-1/+1
The change is a result of the char/string parsing refactor.
2014-06-17Add br##"xx"## raw byte string literals.Simon Sapin-0/+33
2014-06-17Add a b"xx" byte string literal of type &'static [u8].Simon Sapin-0/+24
2014-06-17Add a b'x' byte literal of type u8.Simon Sapin-0/+26
2014-06-17rustc: Add self/super hint for extern crate resolve errors.Kevin Butler-4/+36