summary refs log tree commit diff
path: root/src/test/parse-fail
AgeCommit message (Collapse)AuthorLines
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-73/+3
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-17Detect confusing unicode characters and show the alternativeRavi Shankar-0/+18
2015-11-09syntax: Merge parsing code for structures and variantsVadim Petrochenkov-25/+0
2015-11-05Improve error message for char literalsSteve Klabnik-2/+2
If you try to put something that's bigger than a char into a char literal, you get an error: fn main() { let c = 'ஶ்ரீ'; } error: unterminated character constant: This is a very compiler-centric message. Yes, it's technically 'unterminated', but that's not what you, the user did wrong. Instead, this commit changes it to error: character literal may only contain one codepoint As this actually tells you what went wrong. Fixes #28851
2015-10-28libsyntax: improve error message when a statement is prefixed with a match ↵Kevin Butler-0/+18
keyword
2015-10-27Add tests for newly introduced syntaxSimonas Kazlauskas-0/+54
Also add some (regression) tests for discovered parser oddities
2015-10-27Generalise associative operator parsingSimonas Kazlauskas-35/+0
This commit generalises parsing of associative operators from left-associative only (with some ugly hacks to support right-associative assignment) to properly left/right-associative operators. Parsing still is not general enough to handle non-associative, non-highest-precedence prefix or non-highest-precedence postfix operators (e.g. `..` range syntax), though. That should be fixed in the future. Lastly, this commit adds support for parsing right-associative `<-` (left arrow) operator with precedence higher than assignment as the operator for placement-in feature.
2015-10-25libsyntax: better error for lifetimes in patternsKevin Butler-0/+16
Previously, if you copied a signature from a trait definition such as: ``` fn foo<'a>(&'a Bar) -> bool {} ``` and moved it into an `impl`, there would be an error message: "unexpected token `'a`" Adding to the error message that a pattern is expected should help users to find the actual problem with using a lifetime here.
2015-10-13Test and gate empty structures and variants betterVadim Petrochenkov-15/+0
2015-10-13Unify structures and enum variants in ASTVadim Petrochenkov-15/+0
2015-09-24Remove the deprecated box(PLACE) syntax.Eduard Burtescu-19/+0
2015-09-18Implement empty struct with braces (RFC 218)Vadim Petrochenkov-96/+0
2015-09-14Auto merge of #28247 - christopherdumas:fix_28243, r=eddybbors-0/+16
as per #28243.
2015-09-14Fix tuple float bug.christopherdumas-0/+16
2015-09-11Remove some remains of virtual structs from the parserVadim Petrochenkov-3/+2
2015-09-03Use consistent terminology for byte string literalsVadim Petrochenkov-4/+4
Avoid confusion with binary integer literals and binary operator expressions in libsyntax
2015-08-15Fix span of invalid metavariable repetitionJonas Schievink-0/+19
2015-08-06Auto merge of #27296 - jroesch:type-macros, r=huonwbors-8/+9
This pull request implements the functionality for [RFC 873](https://github.com/rust-lang/rfcs/blob/master/text/0873-type-macros.md). This is currently just an update of @freebroccolo's branch from January, the corresponding commits are linked in each commit message. @nikomatsakis and I had talked about updating the macro language to support a lifetime fragment specifier, and it is possible to do that work on this branch as well. If so we can (collectively) talk about it next week during the pre-RustCamp work week.
2015-08-06Fix expected parse errorJared Roesch-8/+9
2015-08-03delete some old testsSteve Klabnik-32/+0
These are for syntaxes that haven't existed for a long time.
2015-07-31Fix `impl A .. {}`Seo Sanghyeon-3/+18
2015-07-29Replace illegal with invalid in most diagnosticsSimonas Kazlauskas-31/+31
2015-07-27Turn on `box(PLACE) expr` deprecation warning post-snapshot.Eduard Burtescu-0/+1
2015-07-23Update suggestion from parenthesized-box-expr-message to reflect new output ↵Felix S. Klock II-2/+2
spacing.
2015-07-18Fix doc comment parsing in macros.Lee Jeffery-0/+38
2015-07-13Tell unicode escapes can’t be used as bytes earlier/moreSimonas Kazlauskas-3/+5
2015-07-10Improve incomplete unicode escape reportingSimonas Kazlauskas-1/+1
This improves diagnostic messages when \u escape is used incorrectly and { is missing. Instead of saying “unknown character escape: u”, it will now report that unicode escape sequence is incomplete and suggest what the correct syntax is.
2015-07-01Add netbsd amd64 supportAlex Newman-0/+1
2015-06-13Use `assert_eq!` instead of `assert!` in testspetrochenkov-2/+2
2015-06-12ignore-test cleanupSteve Klabnik-234/+0
Most of these are old, but some specific messages for specific tests: * trait-contravariant-self.rs: failed due to a soundess hole: https://github.com/rust-lang/rust/commit/05e3248a7974f55b64f75a2483b37ff8c001a4ff * process-detatch: https://github.com/rust-lang/rust/commit/15966c3c1f99810ac81053769651776a67181dae says "this test is being ignored until signals are implemented" That's not happening for a long time, and when it is, we'll write tests for it. * deep-vector{,2}.rs: "too big for our poor macro infrastructure", and has been ignored over a year. * borrowck-nested-calls.rs's FIXME #6268 was closed in favor of rust-lang/rfcs#811 * issue-15167.rs works properly now * issue-9737.rs works properly now * match-var-hygiene.rs works properly now Addresses a chunk of #3965
2015-06-09Exise 'unsafe pointer' in favor of 'raw pointer'Steve Klabnik-4/+4
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-05-16Clarify the error message for malformed `extern crate` statementsP1start-1/+12
Closes #25468.
2015-04-27Auto merge of #23606 - quantheory:associated_const, r=nikomatsakisbors-6/+58
Closes #17841. The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough. There is still some significant functionality missing from this commit: - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~ - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet. - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865. - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~ Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
2015-04-25`qquote-2.rs` -> `run-fail/qquote.rs`Tamir Duberstein-63/+0
Re-enables the test.
2015-04-25`qquote-1.rs` -> `compile-fail-fulldeps/qquote.rs`Tamir Duberstein-70/+0
Re-enables the test.
2015-04-23Get associated consts working in match patterns.Sean Patrick Santos-0/+34
2015-04-23Functional changes for associated constants. Cross-crate usage of associated ↵Sean Patrick Santos-6/+24
constants is not yet working.
2015-04-23Auto merge of #24683 - P1start:help-suggestions, r=nrcbors-1/+3
This PR uses the inline error suggestions introduced in #24242 to modify a few existing `help` messages. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
2015-04-21Change a few error messages to give code suggestionsP1start-1/+3
PR #24242 added the ability to the compiler to directly give suggestions about how to modify code to fix an error. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
2015-04-18Return nonzero exit code if there are errors at a stop pointFlorian Hahn-1/+426
2015-04-15Add tests for "ident only path should have been covered"-ICEAndreas Martens-0/+32
2015-04-13Added a help span which informs the user about the escaping of curly braces ↵Manuel Hoffmann-0/+18
in a format string if a wrongly escaped one is detected in a string.
2015-04-04fixing some tests and temporarily disabling others to get Bitrig build ↵Dave Huseby-0/+1
working 100%
2015-04-03Add tests for parsing of patternsVadim Petrochenkov-0/+171
2015-04-02syntax: Rewrite parsing of patternsVadim Petrochenkov-6/+6
2015-03-31Lex binary and octal literals more eagerly.Huon Wilson-1/+36
Previously 0b12 was considered two tokens, 0b1 and 2, as 2 isn't a valid base 2 digit. This patch changes that to collapse them into one (and makes `0b12` etc. an error: 2 isn't a valid base 2 digit). This may break some macro invocations of macros with `tt` (or syntax extensions) that rely on adjacent digits being separate tokens and hence is a [breaking-change] The fix is to separate the tokens, e.g. `0b12` -> `0b1 2`. cc https://github.com/rust-lang/rfcs/pull/879
2015-03-27rollup merge of #23786: alexcrichton/less-quotesAlex Crichton-5/+0
Conflicts: src/test/auxiliary/static-function-pointer-aux.rs src/test/auxiliary/trait_default_method_xc_aux.rs src/test/run-pass/issue-4545.rs
2015-03-27Fix fallout of removing quotes in crate namesAlex Crichton-5/+0
2015-03-27Prevent ICEs when parsing invalid escapes, closes #23620Florian Hahn-1/+49
2015-03-24rustc: Add support for `extern crate foo as bar`Alex Crichton-16/+2
The compiler will now issue a warning for crates that have syntax of the form `extern crate "foo" as bar`, but it will still continue to accept this syntax. Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist in the transition period as well. This patch will land hopefully in tandem with a Cargo patch that will start translating all crate names to have underscores instead of hyphens. cc #23533