summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-26/+26
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwaltonbors-16/+190
This fixes private statics and functions from being usable cross-crates, along with some bad privacy error messages. This is a reopening of #8365 with all the privacy checks in privacy.rs instead of resolve.rs (where they should be anyway). These maps of exported items will hopefully get used for generating documentation by rustdoc Closes #8592
2013-09-24auto merge of #9335 : alexcrichton/rust/issue-7945, r=thestingerbors-0/+61
As documented in issue #7945, these literal identifiers are all accepted by rust today, but they should probably be disallowed (especially `'''`). This changes all escapable sequences to being *required* to be escaped. Closes #7945 I wanted to write the tests with more exact spans, but I think #9308 will be fixing that?
2013-09-24Disallow char literals which should be escapedAlex Crichton-0/+61
As documented in issue #7945, these literal identifiers are all accepted by rust today, but they should probably be disallowed (especially `'''`). This changes all escapable sequences to being *required* to be escaped. Closes #7945
2013-09-24auto merge of #9336 : alexcrichton/rust/issue-7981, r=catamorphismbors-1/+1
Progress on #7981 This doesn't completely close the issue because `struct A;` is still allowed, and it's a much larger change to disallow that. I'm also not entirely sure that we want to disallow that. Regardless, punting that discussion to the issue instead.
2013-09-24Stop accepting 'impl ...;', require {} insteadAlex Crichton-1/+1
Progress on #7981
2013-09-24Correctly encode item visibility in metadataAlex Crichton-16/+190
This fixes private statics and functions from being usable cross-crates, along with some bad privacy error messages. This is a reopening of #8365 with all the privacy checks in privacy.rs instead of resolve.rs (where they should be anyway). These maps of exported items will hopefully get used for generating documentation by rustdoc Closes #8592
2013-09-23test: Fix rustdoc and tests.Patrick Walton-244/+26
2013-09-23librustc: Change fold to use traits instead of `@fn`.Patrick Walton-0/+9
2013-09-20auto merge of #9350 : ↵bors-2/+31
pnkfelix/rust/fsk-issue-4691-catch-bad-fsu-during-compute-moves, r=nikomatsakis Resolves third bullet of #4691: if the functional-struct-update (FSU) expression `{ a: b, ..s }` causes `s` to move and `s` has a destructor, then the expression is illegal. r? @nikomatsakis
2013-09-20auto merge of #9321 : chris-morgan/rust/lowercase-nan-methods, r=brsonbors-2/+2
This is for consistency in naming conventions. - ``std::num::Float::NaN()`` is changed to ``nan()``; - ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and - ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``. Fixes #9319.
2013-09-20auto merge of #9320 : ↵bors-3/+3
chris-morgan/rust/unreachable-macro-part-two-of-two-containing-the-destruction-of-the-unreachable-function, r=alexcrichton This is the second of two parts of #8991, now possible as a new snapshot has been made. (The first part implemented the unreachable!() macro; it was #8992, 6b7b8f2682.) ``std::util::unreachable()`` is removed summarily; any code which used it should now use the ``unreachable!()`` macro. Closes #9312. Closes #8991.
2013-09-19auto merge of #9308 : ben0x539/rust/lexer-error-spans, r=alexcrichtonbors-0/+156
Previously, the lexer calling `rdr.fatal(...)` would report the span of the last complete token, instead of a span within the erroneous token (besides one span fixed in 1ac90bb). This branch adds wrappers around `rdr.fatal(...)` that sets the span explicilty, so that all fatal errors in `libsyntax/parse/lexer.rs` now report the offending code more precisely. A number of tests try to verify that, though the `compile-fail` testing setup can only check that the spans are on the right lines, and the "unterminated string/block comment" errors can't have the line marked at all, so that's incomplete. This closes #9149. Also, the lexer errors now report the offending code in the error message, not just via the span, just like other errors do.
2013-09-19auto merge of #9285 : sfackler/rust/future, r=alexcrichtonbors-0/+19
The `Drop` implementation was used to prevent `Future` from being implicitly copyable. Since `~fn`s are no longer copyable, this is no longer needed. I added a cfail test to make sure that this is actually the case. I method-ized all of the `Future` creation methods and added a new one, `spawn_with`, which is similar to `task::spawn_with`. I also got rid of some unused imports in tests.
2013-09-20fixed another test.Felix S. Klock II-2/+2
2013-09-20Resolves third bullet of #4691, and adds tests for it. Fix #4691.Felix S. Klock II-0/+29
2013-09-19Modernize extra::future APISteven Fackler-2/+2
2013-09-19lexer: further slight improvements to lexer errorsBenjamin Herr-1/+1
2013-09-19Removed future's destructorSteven Fackler-0/+19
It was only there to prevent Future from being copyable, but it's noncopyable anyways since it contains a ~fn.
2013-09-19lexer: show correct span on lexical errorsBenjamin Herr-0/+156
Previously, the lexer calling `rdr.fatal(...)` would report the span of the last complete token, instead of a span within the erroneous token (besides one span fixed in 1ac90bb). This commit adds a wrapper around `rdr.fatal(...)` that sets the span explicilty, so that all fatal errors in `libsyntax/parse/lexer.rs` now report the offending code more precisely. A number of tests try to verify that, though the `compile-fail` testing setup can only check that the spans are on the right lines, and the "unterminated string/block comment" errors can't have the line marked at all, so that's incomplete. Closes #9149.
2013-09-19Rename the NaN and is_NaN methods to lowercase.Chris Morgan-2/+2
This is for consistency in naming conventions. - ``std::num::Float::NaN()`` is changed to ``nan()``; - ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and - ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``. Fixes #9319.
2013-09-19Replace unreachable() calls with unreachable!().Chris Morgan-3/+3
This is the second of two parts of #8991, now possible as a new snapshot has been made. (The first part implemented the unreachable!() macro; it was #8992, 6b7b8f2682.) ``std::util::unreachable()`` is removed summarily; any code which used it should now use the ``unreachable!()`` macro. Closes #9312. Closes #8991.
2013-09-18Renumber the lang items correctlyAlex Crichton-0/+15
Also add a test to help prevent this from getting out of sync again.
2013-09-16switch Drop to `&mut self`Daniel Micay-29/+29
2013-09-15Document all of the format! related macrosAlex Crichton-4/+3
2013-09-15Reduce the amount of complexity in format!Alex Crichton-3/+5
This renames the syntax-extension file to format from ifmt, and it also reduces the amount of complexity inside by defining all other macros in terms of format_args!
2013-09-13Pass a more proper span to the syntax expandersAlex Crichton-0/+13
Closes #5794
2013-09-12rustc: Fix cstack lint for default methods. Closes #8753Brian Anderson-0/+24
2013-09-12Implement a format_args!() macroAlex Crichton-0/+27
The purpose of this macro is to further reduce the number of allocations which occur when dealing with formatting strings. This macro will perform all of the static analysis necessary to validate that a format string is safe, and then it will wrap up the "format string" into an opaque struct which can then be passed around. Two safe functions are added (write/format) which take this opaque argument structure, unwrap it, and then call the unsafe version of write/format (in an unsafe block). Other than these two functions, it is not intended for anyone to ever look inside this opaque struct. The macro looks a bit odd, but mostly because of rvalue lifetimes this is the only way for it to be safe that I know of. Example use-cases of this are: * third-party libraries can use the default formatting syntax without any forced allocations * the fail!() macro can avoid allocating the format string * the logging macros can avoid allocation any strings
2013-09-06Remove even more usage of clownshoes in symbolsAlex Crichton-1/+1
This removes another large chunk of this odd 'clownshoes' identifier showing up in symbol names. These all originated from external crates because the encoded items were encoded independently of the paths calculated in ast_map. The encoding of these paths now uses the helper function in ast_map to calculate the "pretty name" for an impl block. Unfortunately there is still no information about generics in the symbol name, but it's certainly vastly better than before hash::__extensions__::write::_version::v0.8 becomes hash::Writer$SipState::write::hversion::v0.8 This also fixes bugs in which lots of methods would show up as `meth_XXX`, they now only show up as `meth` and throw some extra characters onto the version string.
2013-09-04auto merge of #8875 : alexcrichton/rust/fix-inner-static-library-bug, r=huonwbors-3/+3
These commits fix bugs related to identically named statics in functions of implementations in various situations. The commit messages have most of the information about what bugs are being fixed and why. As a bonus, while I was messing around with name mangling, I improved the backtraces we'll get in gdb by removing `__extensions__` for the trait/type being implemented and by adding the method name as well. Yay!
2013-09-04Improve name mangling for gdbAlex Crichton-3/+3
Remove __extensions__ from method symbols as well as the meth_XXX. The XXX is now used to append a few characters at the end of the name of the symbol. Closes #6602
2013-09-04auto merge of #8944 : alexcrichton/rust/issue-8938, r=huonwbors-0/+3
Otherwise extra stuff after a lone '}' character is simply ignored, which is very bad. Closes #8938
2013-09-04forbid cast as boolDaniel Micay-0/+12
This is currently unsound since `bool` is represented as `i8`. It will become sound when `bool` is stored as `i8` but always used as `i1`. However, the current behaviour will always be identical to `x & 1 != 0`, so there's no need for it. It's also surprising, since `x != 0` is the expected behaviour. Closes #7311
2013-09-03Raise errors on format strings with unmatched `}`Alex Crichton-0/+3
Otherwise extra stuff after a lone '}' character is simply ignored, which is very bad. Closes #8938
2013-09-04Fixed docs and stylesFlaper Fesp-1/+1
2013-09-04Add a safe implementation of MutexArc::access* methodsFlaper Fesp-0/+26
Current access methods are nestable and unsafe. This patch renames current methods implementation - prepends unsafe_ - and implements 2 new methods that are both safe and un-nestable. Fixes #7473
2013-09-04Implement support for indicating the stability of items.Huon Wilson-0/+338
There are 6 new compiler recognised attributes: deprecated, experimental, unstable, stable, frozen, locked (these levels are taken directly from Node's "stability index"[1]). These indicate the stability of the item to which they are attached; e.g. `#[deprecated] fn foo() { .. }` says that `foo` is deprecated. This comes with 3 lints for the first 3 levels (with matching names) that will detect the use of items marked with them (the `unstable` lint includes items with no stability attribute). The attributes can be given a short text note that will be displayed by the lint. An example: #[warn(unstable)]; // `allow` by default #[deprecated="use `bar`"] fn foo() { } #[stable] fn bar() { } fn baz() { } fn main() { foo(); // "warning: use of deprecated item: use `bar`" bar(); // all fine baz(); // "warning: use of unmarked item" } The lints currently only check the "edges" of the AST: i.e. functions, methods[2], structs and enum variants. Any stability attributes on modules, enums, traits and impls are not checked. [1]: http://nodejs.org/api/documentation.html [2]: the method check is currently incorrect and doesn't work.
2013-09-03Tests for fixed issues.Huon Wilson-0/+26
Closes #3794. Closes #4025. Closes #5688. Closes #5708. Closes #7012. Closes #7327.
2013-09-03Un-xfail/move/delete some tests.Huon Wilson-96/+12
2013-08-29Correct the sources of glob importsAlex Crichton-0/+84
Closes #8847
2013-08-28auto merge of #8800 : fhahn/rust/ticket_5239, r=alexcrichtonbors-0/+15
I've added a test for the second example mentioned in #5239. The first example does not compile with a reasonable error message. Should I add a compile-fail test for that example as well? /rust/src/test/run-pass/issue-5239.rs:15:45: 15:51 error: binary operation + cannot be applied to type `&int` rust/src/test/run-pass/issue-5239.rs:15 let _f = |ref x: int| { x += 1}; ^~~~~~ error: aborting due to previous error
2013-08-28auto merge of #8718 : bblum/rust/typeof, r=pcwaltonbors-0/+35
r? anybody
2013-08-28Add tests for ref in closure parameter list, closes #5239Florian Hahn-0/+15
2013-08-27librustc: Fix problem with cross-crate reexported static methods.Patrick Walton-6/+6
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-39/+50
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-27librustc: Remove `&const` and `*const` from the language.Patrick Walton-305/+6
They are still present as part of the borrow check.
2013-08-27auto merge of #8797 : ↵bors-0/+61
nikomatsakis/rust/issue-8625-assign-to-andmut-in-borrowed-loc-2, r=pcwalton Fixes for #8625 to prevent assigning to `&mut` in borrowed or aliasable locations. The old code was insufficient in that it failed to catch bizarre cases like `& &mut &mut`. r? @pnkfelix
2013-08-27Extend aliasability check to uncover `& &mut &mut` and the likeNiko Matsakis-0/+30
2013-08-26auto merge of #8739 : fhahn/rust/ticket_2275, r=brsonbors-0/+450
This is a pull request for #2275 I've created a small python script to generate test files for a list of keywords (as break do else enum extern false fn for if impl let loop match mod mut priv pub ref return self static struct super true trait type unsafe use while), but I'm not really sure where to put it. I've added the created files as well. I did not use fn main() { let $KW = "foo"; //~ error println($KW); //~ error } as template, because for return, self, ref, loop, mut and break this does not raise an error in the ```println``` line, only in the ```let``` line.