about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2015-04-21syntax: Copy unstable str::char_at into libsyntaxErick Tryzelaar-16/+18
2015-04-21syntax: Remove #[feature(path_ext)]Erick Tryzelaar-2/+3
Replace Path::exists with stable metadata call.
2015-04-21syntax: replace Vec::push_all with stable Vec::extendErick Tryzelaar-9/+14
2015-04-21syntax: Replace String::from_str with the stable String::fromErick Tryzelaar-2/+2
2015-04-21syntax: remove uses of `.into_cow()`Erick Tryzelaar-4/+4
2015-04-21syntax: Remove uses of #[feature(slice_patterns)]Erick Tryzelaar-15/+31
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-6/+6
2015-04-16Omit 'obsolete' note for warning if -AwarningMathijs van de Nes-1/+2
2015-04-16Auto merge of #23682 - tamird:DRY-is-empty, r=alexcrichtonbors-11/+11
r? @alexcrichton
2015-04-16Auto merge of #24485 - brson:is, r=alexcrichtonbors-2/+0
It was an oversight that this was not done in the great int upheaval. [breaking-change]
2015-04-15Forbid is/us suffixes. Fixes #22496Brian Anderson-2/+0
It was an oversight that this was not done in the great int upheaval. [breaking-change]
2015-04-15Rollup merge of #24438 - nrc:tuple-span, r=sfacklerSteve Klabnik-1/+1
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-4/+4
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-7/+7
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-15Fix the span for tuple expressionsNick Cameron-1/+1
2015-04-14rollup merge of #24381: erickt/cleanupAlex Crichton-1/+1
Just some minor patches I've been sitting on.
2015-04-14std: Remove old_io/old_path/rand modulesAlex Crichton-16/+0
This commit entirely removes the old I/O, path, and rand modules. All functionality has been deprecated and unstable for quite some time now!
2015-04-14Auto merge of #24295 - contradictioned:master, r=alexcrichtonbors-1/+7
As i proposed in #24262 (and found acceptance in the IRC channel), added a compiler warning for wrong escaping of curly braces.
2015-04-13syntax: Publically expose printing where clauses, and add attr_to_stringErick Tryzelaar-1/+1
2015-04-13Added a help span which informs the user about the escaping of curly braces ↵Manuel Hoffmann-1/+7
in a format string if a wrongly escaped one is detected in a string.
2015-04-12Fix spans for macrosNick Cameron-9/+11
2015-04-09Fix the span for `for` expressionsNick Cameron-1/+1
2015-04-05Work towards a non-panicing parser (libsyntax)Phil Dawes-1247/+1306
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
2015-04-02Fix parsing of patterns in macrosVadim Petrochenkov-1/+3
2015-04-02syntax: Rewrite parsing of patternsVadim Petrochenkov-225/+127
2015-04-01Fallout in libsyntaxNiko Matsakis-3/+3
2015-03-31rollup merge of #23872: huonw/eager-lexingAlex Crichton-15/+40
Conflicts: src/libsyntax/parse/lexer/mod.rs
2015-03-31Stabilize std::numAaron Turon-9/+9
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-31Lex binary and octal literals more eagerly.Huon Wilson-14/+39
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-28Rollup merge of #23803 - richo:unused-braces, r=ManishearthManish Goregaokar-2/+2
Pretty much what it says on the tin.
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-2/+2
2015-03-27rollup merge of #23786: alexcrichton/less-quotesAlex Crichton-37/+10
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-27rustc: Remove support for hyphens in crate namesAlex Crichton-37/+10
This commit removes parser support for `extern crate "foo" as bar` as the renamed crate is now required to be an identifier. Additionally this commit enables hard errors on crate names that contain hyphens in them, they must now solely contain alphanumeric characters or underscores. If the crate name is inferred from the file name, however, the file name `foo-bar.rs` will have the crate name inferred as `foo_bar`. If a binary is being emitted it will have the name `foo-bar` and a library will have the name `libfoo_bar.rlib`. This commit is a breaking change for a number of reasons: * Old syntax is being removed. This was previously only issuing warnings. * The output for the compiler when input is received on stdin is now `rust_out` instead of `rust-out`. * The crate name for a crate in the file `foo-bar.rs` is now `foo_bar` which can affect infrastructure such as logging. [breaking-change]
2015-03-27rollup merge of #23741: alexcrichton/remove-int-uintAlex Crichton-4/+4
Conflicts: src/librustc/middle/ty.rs src/librustc_trans/trans/adt.rs src/librustc_typeck/check/mod.rs src/libserialize/json.rs src/test/run-pass/spawn-fn.rs
2015-03-27rollup merge of #23740: alexcrichton/remove-deprecated-slicing-syntaxAlex Crichton-44/+5
This syntax has been deprecated for quite some time, and there were only a few remaining uses of it in the codebase anyway.
2015-03-27Prevent ICEs when parsing invalid escapes, closes #23620Florian Hahn-11/+29
2015-03-26Auto merge of #23359 - erickt:quote, r=pnkfelixbors-16/+23
This PR allows the quote macros to unquote trait items, impl items, where clauses, and paths.
2015-03-26syntax: Remove parsing of old slice syntaxAlex Crichton-44/+5
This syntax has been deprecated for quite some time, and there were only a few remaining uses of it in the codebase anyway.
2015-03-25rustc: Remove support for int/uintAlex Crichton-4/+4
This commit removes all parsing, resolve, and compiler support for the old and long-deprecated int/uint types.
2015-03-24rollup merge of #23546: alexcrichton/hyphensAlex Crichton-21/+19
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
2015-03-24rustc: Add support for `extern crate foo as bar`Alex Crichton-21/+19
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
2015-03-24syntax: Allow where strings to be parsed independent from genericsErick Tryzelaar-16/+23
This allows quasiquoting to insert where clauses.
2015-03-25Add trivial cast lints.Nick Cameron-3/+3
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-23rollup merge of #23506: alexcrichton/remove-some-deprecated-thingsAlex Crichton-279/+16
Conflicts: src/test/run-pass/deprecated-no-split-stack.rs
2015-03-23Add generic conversion traitsAaron Turon-2/+2
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-20don't use Result::ok just to be able to use unwrap/unwrap_orOliver Schneider-2/+2
2015-03-19Rollup merge of #23475 - nikomatsakis:closure-ret-syntax, r=acrichtoManish Goregaokar-16/+25
Require braces when a closure has an explicit return type. This is a [breaking-change]: instead of a closure like `|| -> i32 22`, prefer `|| -> i32 { 22 }`. Fixes #23420.
2015-03-18rustc: Remove some long deprecated features:Alex Crichton-279/+16
* no_split_stack was renamed to no_stack_check * deriving was renamed to derive * `use foo::mod` was renamed to `use foo::self`; * legacy lifetime definitions in closures have been replaced with `for` syntax * `fn foo() -> &A + B` has been deprecated for some time (needs parens) * Obsolete `for Sized?` syntax * Obsolete `Sized? Foo` syntax * Obsolete `|T| -> U` syntax
2015-03-18Require braces when a closure has an explicit return type. This is aNiko Matsakis-16/+25
[breaking-change]: instead of a closure like `|| -> i32 22`, prefer `|| -> i32 { 22 }`. Fixes #23420.
2015-03-18Register new snapshotsAlex Crichton-8/+0