about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-03-23Auto merge of #32390 - japaric:untry, r=pnkfelixbors-1531/+1517
convert 99.9% of `try!`s to `?`s The first commit is an automated conversion using the [untry] tool and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [untry]: https://github.com/japaric/untry cc @rust-lang/lang @alexcrichton @brson
2016-03-22fix alignmentJorge Aparicio-138/+133
2016-03-22break long lineJorge Aparicio-1/+2
2016-03-22sprinkle feature gates here and thereJorge Aparicio-0/+1
2016-03-22try! -> ?Jorge Aparicio-1452/+1441
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-22Add testsTicki-1/+1
2016-03-21Add support for naked functionsTicki-0/+6
2016-03-19Rollup merge of #32269 - richo:impl-totokens-p-implitem, r=nikomatsakisEduard-Mihai Burtescu-0/+6
syntax: impl ToTokens for P<ast::ImplItem> I'm working on updating zinc for latest rust, and it appears that I need this impl[0]. More generally, I realise that libsyntax is "Whatever the compiler team needs to build a compiler", but should I just open a PR fleshing this out for all types? https://github.com/hackndev/zinc/blob/master/ioreg/src/builder/setter.rs#L194-L197
2016-03-17Add -Z orbit for forcing MIR for everything, unless #[rustc_no_mir] is used.Eduard Burtescu-4/+8
2016-03-16Auto merge of #31746 - erickt:newline, r=sfacklerbors-1/+2
syntax: Always pretty print a newline after doc comments Before this patch, code that had a doc comment as the first line, as in: ```rust /// Foo struct Foo; ``` Was pretty printed into: ```rust ///Foostruct Foo; ``` This makes sure that that there is always a trailing newline after a doc comment. Closes #31722
2016-03-15syntax: impl ToTokens for P<ast::ImplItem>Richo Healey-0/+6
2016-03-14Add pretty printer output for `default`Aaron Turon-0/+3
2016-03-14Fixes after a rebaseAaron Turon-3/+2
2016-03-14Address basic nits from initial reviewAaron Turon-0/+1
2016-03-14Assorted fixed after rebasingAaron Turon-6/+6
2016-03-14Add feature gateAaron Turon-0/+12
2016-03-14Add `default` as contextual keyword, and parse it for impl items.Aaron Turon-54/+93
2016-03-12Removed integer suffixes in libsyntax cratesrinivasreddy-5/+5
2016-03-09Auto merge of #31631 - jonas-schievink:agoraphobia, r=nrcbors-96/+88
[breaking-batch] Move more uses of `panictry!` out of libsyntax
2016-03-09Auto merge of #32071 - jseyfried:parse_pub, r=nikomatsakisbors-34/+10
Make errors for unnecessary visibility qualifiers consistent This PR refactors away `syntax::parse::parser::ParsePub` so that unnecessary visibility qualifiers on variant fields are reported not by the parser but by `privacy::SanePrivacyVisitor` (thanks to @petrochenkov's drive-by improvements in #31919). r? @nikomatsakis
2016-03-08Auto merge of #31954 - japaric:rfc243, r=nikomatsakisbors-2/+27
implement the `?` operator The `?` postfix operator is sugar equivalent to the try! macro, but is more amenable to chaining: `File::open("foo")?.metadata()?.is_dir()`. `?` is accepted on any *expression* that can return a `Result`, e.g. `x()?`, `y!()?`, `{z}?`, `(w)?`, etc. And binds more tightly than unary operators, e.g. `!x?` is parsed as `!(x?)`. cc #31436 --- cc @aturon @eddyb
2016-03-07Auto merge of #29734 - Ryman:whitespace_consistency, r=Aatchbors-61/+72
libsyntax: be more accepting of whitespace in lexer Fixes #29590. Perhaps this may need more thorough testing? r? @Aatch
2016-03-07implement the `?` operatorJorge Aparicio-2/+27
The `?` postfix operator is sugar equivalent to the try! macro, but is more amenable to chaining: `File::open("foo")?.metadata()?.is_dir()`. `?` is accepted on any *expression* that can return a `Result`, e.g. `x()?`, `y!()?`, `{z}?`, `(w)?`, etc. And binds more tightly than unary operators, e.g. `!x?` is parsed as `!(x?)`. cc #31436
2016-03-07syntax: Always pretty print a newline after doc commentsErick Tryzelaar-1/+2
Before this patch, code that had a doc comment as the first line, as in: ```rust /// Foo struct Foo; ``` Was pretty printed into: ```rust ///Foostruct Foo; ``` This makes sure that that there is always a trailing newline after a doc comment. Closes #31722
2016-03-06Auto merge of #30884 - durka:inclusive-ranges, r=aturonbors-50/+92
This PR implements [RFC 1192](https://github.com/rust-lang/rfcs/blob/master/text/1192-inclusive-ranges.md), which is triple-dot syntax for inclusive range expressions. The new stuff is behind two feature gates (one for the syntax and one for the std::ops types). This replaces the deprecated functionality in std::iter. Along the way I simplified the desugaring for all ranges. This is my first contribution to rust which changes more than one character outside of a test or comment, so please review carefully! Some of the individual commit messages have more of my notes. Also thanks for putting up with my dumb questions in #rust-internals. - For implementing `std::ops::RangeInclusive`, I took @Stebalien's suggestion from https://github.com/rust-lang/rfcs/pull/1192#issuecomment-137864421. It seemed to me to make the implementation easier and increase type safety. If that stands, the RFC should be amended to avoid confusion. - I also kind of like @glaebhoerl's [idea](https://github.com/rust-lang/rfcs/pull/1254#issuecomment-147815299), which is unified inclusive/exclusive range syntax something like `x>..=y`. We can experiment with this while everything is behind a feature gate. - There are a couple of FIXMEs left (see the last commit). I didn't know what to do about `RangeArgument` and I haven't added `Index` impls yet. Those should be discussed/finished before merging. cc @Gankro since you [complained](https://www.reddit.com/r/rust/comments/3xkfro/what_happened_to_inclusive_ranges/cy5j0yq) cc #27777 #30877 rust-lang/rust#1192 rust-lang/rfcs#1254 relevant to #28237 (tracking issue)
2016-03-06Refactor away `ParsePub` and make errors for unnecessary visibility ↵Jeffrey Seyfried-34/+10
qualifiers consistent
2016-03-02Fix the search paths for macro-expanded non-inline modulesJeffrey Seyfried-3/+60
2016-03-02Add `filename` to ParserJeffrey Seyfried-1/+6
2016-03-02Use numeric field `Name`s ("0", "1" etc) for positional fieldsVadim Petrochenkov-1/+1
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-12/+3
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-02-27fix fallout from libsyntax enumpocalypseAlex Burka-3/+3
2016-02-27feature-gate inclusive range syntaxAlex Burka-1/+12
2016-02-27libsyntax: parse inclusive rangesAlex Burka-50/+81
2016-02-25Rollup merge of #31362 - jseyfried:fix_extern_crate_visibility, r=nikomatsakisManish Goregaokar-7/+0
This PR changes the visibility of extern crate declarations to match that of items (fixes #26775). To avoid breakage, the PR makes it a `public_in_private` lint to reexport a private extern crate, and it adds the lint `inaccessible_extern_crate` for uses of an inaccessible extern crate. The lints can be avoided by making the appropriate `extern crate` declaration public.
2016-02-24Fix the visibility of extern crate declarations and stop warning on pub ↵Jeffrey Seyfried-7/+0
extern crate
2016-02-22Use associated functions for libsyntax SepSeq constructors.Corey Farwell-34/+36
2016-02-21rustbuild: Sync some Cargo.toml/lib.rs dependenciesAlex Crichton-2/+1
The standard library doesn't depend on rustc_bitflags, so move it to explicit dependencies on all other crates. Additionally, the arena/fmt_macros deps could be dropped from libsyntax.
2016-02-19Do less panicking in generalJonas Schievink-0/+4
2016-02-18Remove unnecessary explicit lifetime bounds.Corey Farwell-11/+11
These explicit lifetimes can be ommitted because of lifetime elision rules. Instances were found using rust-clippy.
2016-02-17Auto merge of #31707 - GuillaumeGomez:macro_name, r=sfacklerbors-1/+6
I'm wondering if instead of a second help message, a note would be better. I let it up to reviewers.
2016-02-17Auto merge of #31685 - petrochenkov:patrefact2, r=eddybbors-1/+1
And split `PatKind::Enum` into `PatKind::TupleStruct` and `PatKind::Path`. This is the HIR part of https://github.com/rust-lang/rust/pull/31581. This is also kind of a preparation for https://github.com/rust-lang/rfcs/pull/1492. r? @eddyb
2016-02-16Add check on find_best_match_for_name and improve help message for undefined ↵ggomez-1/+6
macro
2016-02-16Auto merge of #31534 - jseyfried:restrict_noninline_mod, r=nikomatsakisbors-7/+17
This PR disallows non-inline modules without path annotations that are either in a block or in an inline module whose containing file is not a directory owner (fixes #29765). This is a [breaking-change]. r? @nikomatsakis
2016-02-16Move more uses of `panictry!` out of libsyntaxJonas Schievink-96/+84
[breaking-change] for syntax extensions
2016-02-16Split PatKind::Enum into PatKind::TupleStruct and PatKind::PathVadim Petrochenkov-1/+1
2016-02-15RebasingNick Cameron-2/+2
2016-02-15Some error recovery in the parserNick Cameron-32/+150
2016-02-15Add some simple error recovery to the parser and fix testsNick Cameron-28/+63
Some tests just add the extra errors, others I fix by doing some simple error recovery. I've tried to avoid doing too much in the hope of doing something more principled later. In general error messages are getting worse at this stage, but I think in the long run they will get better.
2016-02-15error correction for missing or mismatched closing bracketsNick Cameron-28/+40
2016-02-15refactoring: inline some function in the parserNick Cameron-31/+28