about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2015-02-04Implement `..` syntax for RangeFull as expressionUlrik Sverdrup-19/+14
Allows the expression `..` (without either endpoint) in general, can be used in slicing syntax `&expr[..]` where we previously wrote `&expr[]`. The old syntax &expr[] is not yet removed or warned for.
2015-02-03rollup merge of #21899: nikomatsakis/closure-unify-anyhowAlex Crichton-29/+38
This *almost* completes the job for #16440. The idea is that even if we do not know whether some closure type `C` implements `Fn` or `FnMut` (etc), we still know its argument and return types. So if we see an obligation `C : Fn(_0)`, we can unify `_0` with those argument types while still considering the obligation ambiguous and unsatisfied. This helps to make a lot of progress with type inference even before closure kind inference is done. As part of this PR, the explicit `:` syntax is removed from the AST and completely ignored. We still infer the closure kind based on the expected type if that is available. There are several reasons for this. First, deciding the closure kind earlier is always better, as it allows us to make more progress. Second, this retains a (admittedly obscure) way for users to manually specify the closure kind, which is useful for writing tests if nothing else. Finally, there are still some cases where inference can fail, so it may be useful to have this manual override. (The expectation is that we will eventually revisit an explicit syntax for specifying the closure kind, but it will not be `:` and may be some sort of generalization of the `||` syntax to handle other traits as well.) This commit does not *quite* fix #16640 because a snapshot is still needed to enable the obsolete syntax errors for explicit `&mut:` and friends. r? @eddyb as he reviewed the prior patch in this direction
2015-02-04Replace `be` with `become`Andrea Canciani-1/+1
As per rust-lang/rfcs#601, replace `be` with `become` as reserved keyword for tail call optimization.
2015-02-03Rename std::path to std::old_pathAaron Turon-1/+1
As part of [RFC 474](https://github.com/rust-lang/rfcs/pull/474), this commit renames `std::path` to `std::old_path`, leaving the existing path API in place to ease migration to the new one. Updating should be as simple as adjusting imports, and the prelude still maps to the old path APIs for now. [breaking-change]
2015-02-03Update for new snapshot after rebasing.Niko Matsakis-1/+1
2015-02-03Remove the explicit closure kind syntax from the parser and AST;Niko Matsakis-29/+38
upgrade the inference based on expected type so that it is able to infer the fn kind in isolation even if the full signature is not available (and we could perhaps do better still in some cases, such as extracting just the types of the arguments but not the return value).
2015-02-02rollup merge of #21845: Potpourri/import-syntaxAlex Crichton-3/+8
syntax like `use foo::bar::;` and `use foo:: as bar;` should be rejected, see issue #21629
2015-02-02rollup merge of #21842: alexcrichton/issue-21839Alex Crichton-2/+2
Now that associated types are fully implemented the iterator adaptors only need type parameters which are associated with actual storage. All other type parameters can either be derived from these (e.g. they are an associated type) or can be bare on the `impl` block itself. This is a breaking change due to the removal of type parameters on these iterator adaptors, but code can fairly easily migrate by just deleting the relevant type parameters for each adaptor. Other behavior should not be affected. Closes #21839 [breaking-change]
2015-02-02rollup merge of #21830: japaric/for-cleanupAlex Crichton-7/+7
Conflicts: src/librustc/metadata/filesearch.rs src/librustc_back/target/mod.rs src/libstd/os.rs src/libstd/sys/windows/os.rs src/libsyntax/ext/tt/macro_parser.rs src/libsyntax/print/pprust.rs src/test/compile-fail/issue-2149.rs
2015-02-02rollup merge of #21825: kmcallister/ttdelim-spanAlex Crichton-1/+24
2015-02-02rollup merge of #21710: alfie/libsyntaxAlex Crichton-29/+29
Conflicts: src/libsyntax/parse/parser.rs
2015-02-02`for x in xs.into_iter()` -> `for x in xs`Jorge Aparicio-1/+1
Also `for x in option.into_iter()` -> `if let Some(x) = option`
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-6/+6
2015-02-02Omit integer suffix when unnecessaryAlfie John-29/+29
See PR # 21378 for context
2015-02-02Tweak some ‘expected…’ error messagesP1start-60/+68
Fixes #21153.
2015-02-01std: Remove extra type params on iter adaptorsAlex Crichton-2/+2
Now that associated types are fully implemented the iterator adaptors only need type parameters which are associated with actual storage. All other type parameters can either be derived from these (e.g. they are an associated type) or can be bare on the `impl` block itself. This is a breaking change due to the removal of type parameters on these iterator adaptors, but code can fairly easily migrate by just deleting the relevant type parameters for each adaptor. Other behavior should not be affected. Closes #21839 [breaking-change]
2015-02-01Reject syntax like `use foo::bar::;` and `use foo:: as bar;` and keywords in ↵Potpourri-3/+8
view path idents
2015-01-31Fix end of TtDelimited spanKeegan McAllister-1/+24
2015-01-31Kill more `isize`sTobias Bucher-1/+1
2015-01-30std: Stabilize FromStr and parseAlex Crichton-8/+8
This commits adds an associated type to the `FromStr` trait representing an error payload for parses which do not succeed. The previous return value, `Option<Self>` did not allow for this form of payload. After the associated type was added, the following attributes were applied: * `FromStr` is now stable * `FromStr::Err` is now stable * `FromStr::from_str` is now stable * `StrExt::parse` is now stable * `FromStr for bool` is now stable * `FromStr for $float` is now stable * `FromStr for $integral` is now stable * Errors returned from stable `FromStr` implementations are stable * Errors implement `Display` and `Error` (both impl blocks being `#[stable]`) Closes #15138
2015-01-30Change from core::ops::RangeFull to std::opsNick Cameron-1/+1
2015-01-30Rename FullRange to RangeFullNick Cameron-3/+3
2015-01-30Use absolute path to FullRange, rather than assuming it is in the preludeNick Cameron-53/+65
Closes #21263 [breaking-change] If you are using `core::ops::FullRange` you should change to using `core::ops::RangeFull`
2015-01-29Auto merge of #21677 - japaric:no-range, r=alexcrichtonbors-13/+13
Note: Do not merge until we get a newer snapshot that includes #21374 There was some type inference fallout (see 4th commit) because type inference with `a..b` is not as good as with `range(a, b)` (see #21672). r? @alexcrichton
2015-01-29s/Show/Debug/gJorge Aparicio-7/+7
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-6/+6
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29Rollup merge of 21662 - oli-obk:hashmap_enum_json, r=alexcrichtonManish Goregaokar-1/+1
2015-01-28Move return type an associated type of the `Fn*` traits. Mostly this ↵Niko Matsakis-1/+6
involves tweaking things in the compiler that assumed two input types to assume two ouputs; we also have to teach `project.rs` to project `Output` from the unboxed closure and fn traits.
2015-01-27Merge remote-tracking branch 'rust-lang/master'Brian Anderson-6/+6
Conflicts: src/libcore/cell.rs src/librustc_driver/test.rs src/libstd/old_io/net/tcp.rs src/libstd/old_io/process.rs
2015-01-26Make '-A warnings' apply to all warnings, including feature gate warningsBrian Anderson-1/+1
2015-01-26Fallout of io => old_ioAlex Crichton-5/+5
2015-01-26falloutOliver Schneider-1/+1
2015-01-26Adjust most comments and messages to not use "unboxed".Eduard Burtescu-1/+1
2015-01-26Remove "unboxed" attribute in code referring to new closures.Eduard Burtescu-18/+15
2015-01-25Tweak chained comparison errors.Huon Wilson-3/+4
Lower case and give a more precise span: from operator to operator, not just the last one.
2015-01-25Add the span of the operator itself to ast::BinOp.Huon Wilson-6/+8
2015-01-22Fix some grammar inconsistencies for the '..' range notation.Daniel Grunwald-17/+37
Grammar changes: * allow 'for _ in 1..i {}' (fixes #20241) * allow 'for _ in 1.. {}' as infinite loop * prevent use of range notation in contexts where only operators of high precedence are expected (fixes #20811) Parser code cleanup: * remove RESTRICTION_NO_DOTS * make AS_PREC const and follow naming convention * make min_prec inclusive
2015-01-21More test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-21rollup merge of #20179: eddyb/blind-itemsAlex Crichton-327/+129
Conflicts: src/librustc/diagnostics.rs src/librustdoc/clean/mod.rs src/librustdoc/html/format.rs src/libsyntax/parse/parser.rs
2015-01-21rollup merge of #21258: aturon/stab-3-indexAlex Crichton-4/+4
Conflicts: src/libcore/ops.rs src/librustc_typeck/astconv.rs src/libstd/io/mem.rs src/libsyntax/parse/lexer/mod.rs
2015-01-21tests: fix fallout of merging ast::ViewItem into ast::Item.Eduard Burtescu-8/+8
2015-01-21rollup merge of #21463: sanxiyn/demutAlex Crichton-17/+17
2015-01-21rollup merge of #21457: alexcrichton/issue-21436Alex Crichton-9/+9
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2015-01-21rollup merge of #21411: P1start/help-tweaksAlex Crichton-1/+1
Conflicts: src/librustc_typeck/check/closure.rs
2015-01-21rollup merge of #21396: japaric/no-parens-in-rangeAlex Crichton-2/+2
Conflicts: src/libsyntax/parse/lexer/comments.rs
2015-01-21rollup merge of #21340: pshc/libsyntax-no-more-intsAlex Crichton-101/+101
Collaboration with @rylev! I didn't change `int` in the [quasi-quoter](https://github.com/pshc/rust/blob/99ae1a30f3ca28c0f7e431620560d30e44627124/src/libsyntax/ext/quote.rs#L328), because I'm not sure if there will be adverse effects. Addresses #21095.
2015-01-21Fallout from stabilization.Aaron Turon-4/+4
2015-01-21syntax: fix fallout of merging ast::ViewItem into ast::Item.Eduard Burtescu-12/+10
2015-01-21syntax: merge ast::ViewItem into ast::Item.Eduard Burtescu-315/+119
2015-01-21De-mut the parserSeo Sanghyeon-17/+17