about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-70/+63
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-20Test fixes and rebase conflictsAlex Crichton-3/+1
2015-01-21Rollup merge of #21336 - rylev:better-nofile-error, r=brsonBarosl LEE-2/+3
Contribution from @look! Addresses https://github.com/rust-lang/rust/issues/21329
2015-01-21Rollup merge of #20998 - estsauver:20984, r=steveklabnikBarosl LEE-22/+22
There are a large number of places that incorrectly refer to deriving in comments, instead of derives. If someone could look at src/etc/generate-deriving-span-tests.py, I'm not sure how those tests were passing before/if they were.
2015-01-20Auto merge of #21364 - cmr:fix-ttseq-ice, r=alexcrichtonbors-10/+13
Closes #21350
2015-01-20Auto merge of #21257 - alexcrichton:issue-20064, r=pnkfelixbors-0/+14
These two attributes are used to change the entry point into a Rust program, but for now they're being put behind feature gates until we have a chance to think about them a little more. The #[start] attribute specifically may have its signature changed. This is a breaking change to due the usage of these attributes generating errors by default now. If your crate is using these attributes, add this to your crate root: #![feature(start)] // if you're using the #[start] attribute #![feature(main)] // if you're using the #[main] attribute cc #20064
2015-01-19Auto merge of #21278 - thchittenden:issue-21033-struct-var-pattern-fix, ↵bors-25/+34
r=alexcrichton Closes #21033. The new strategy for parsing a field pattern is to look 1 token ahead and if it's a colon, parse as "fieldname: pat", otherwise parse the shorthand form "(box) (ref) (mut) fieldname)". The previous strategy was to parse "(ref) (mut) fieldname" then if we encounter a colon, throw an error if either "ref" or "mut" were encountered.
2015-01-19Fixes #21033 with accompanying test.Tom Chittenden-25/+34
2015-01-19Auto merge of #21099 - sanxiyn:opt-return-ty, r=alexcrichtonbors-63/+27
This avoids having ast::Ty nodes which have no counterpart in the source.
2015-01-18syntax: allow bare sequences in lhs for follow checkingCorey Richardson-10/+13
Closes #21350
2015-01-18Make output type in ast::FnDecl optionalSeo Sanghyeon-63/+27
2015-01-18auto merge of #20901 : dgrunwald/rust/update-token-can-begin-expr, r=sanxiynbors-11/+5
* add `Token::AndAnd` (double borrow) * add `Token::DotDot` (range notation) * remove `Token::Pound` and `Token::At` This fixes a syntax error when parsing `fn f() -> RangeTo<i32> { return ..1; }`. Also, remove `fn_expr_lookahead`. It's from the `fn~` days and seems to no longer be necessary.
2015-01-17Set allow(unstable) in crates that use unstable featuresBrian Anderson-0/+1
Lets them build with the -dev, -nightly, or snapshot compiler
2015-01-17Register new snapshots.Eduard Burtescu-8/+0
2015-01-18Improve the error message when source file cannot be readRyan Levick-2/+3
Contribution from @look!
2015-01-17s/deriving/derives in Comments/DocsEarl St Sauver-22/+22
There are a large number of places that incorrectly refer to deriving in comments, instead of derives. Fixes #20984
2015-01-17std: Move the bitflags! macro to a gated crateAlex Crichton-0/+1
In accordance with [collections reform part 2][rfc] this macro has been moved to an external [bitflags crate][crate] which is [available though crates.io][cratesio]. Inside the standard distribution the macro has been moved to a crate called `rustc_bitflags` for current users to continue using. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0509-collections-reform-part-2.md [crate]: https://github.com/rust-lang/bitflags [cratesio]: http://crates.io/crates/bitflags The major user of `bitflags!` in terms of a public-facing possibly-stable API today is the `FilePermissions` structure inside of `std::io`. This user, however, will likely no longer use `bitflags!` after I/O reform has landed. To prevent breaking APIs today, this structure remains as-is. Current users of the `bitflags!` macro should add this to their `Cargo.toml`: bitflags = "0.1" and this to their crate root: #[macro_use] extern crate bitflags; Due to the removal of a public macro, this is a: [breaking-change]
2015-01-17auto merge of #21233 : huonw/rust/simd-size, r=Aatchbors-0/+4
This stops the compiler ICEing on the use of SIMD types in FFI signatures. It emits correct code for LLVM intrinsics, but I am quite unsure about the ABI handling in general so I've added a new feature gate `simd_ffi` to try to ensure people don't use it without realising there's a non-trivial risk of codegen brokenness. Closes #20043.
2015-01-17Feature gate SIMD in FFI, due to unknown ABIs.Huon Wilson-0/+4
I don't know if this handling of SIMD types is correct for the C ABI on all platforms, so lets add an even finer feature gate than just the `simd` one. The `simd` one can be used with (relatively) little risk of complete nonsense, the reason for it is that it is likely that things will change. Using the types in FFI with an incorrect ABI will at best give absolute nonsense results, but possibly cause serious breakage too, so this is a step up in badness, hence a new feature gate.
2015-01-16syntax: Feature gate #[start] and #[main]Alex Crichton-0/+14
These two attributes are used to change the entry point into a Rust program, but for now they're being put behind feature gates until we have a chance to think about them a little more. The #[start] attribute specifically may have its signature changed. This is a breaking change to due the usage of these attributes generating errors by default now. If your crate is using these attributes, add this to your crate root: #![feature(start)] // if you're using the #[start] attribute #![feature(main)] // if you're using the #[main] attribute cc #20064
2015-01-16auto merge of #21008 : huonw/rust/trait-suggestions, r=nikomatsakisbors-0/+3
For a call like `foo.bar()` where the method `bar` can't be resolved, the compiler will search for traits that have methods with name `bar` to give a more informative error, providing a list of possibilities. Closes #7643.
2015-01-16auto merge of #21162 : apasel422/rust/issue-16530, r=huonwbors-6/+2
This fixes #16530 by hashing nullary structs [the same way as the empty tuple] (https://github.com/rust-lang/rust/blob/master/src/libcore/hash/mod.rs#L185). Other approaches are possible, but this was the simplest.
2015-01-15Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-15rollup merge of #21199: dotdash/decode_lambaAlex Crichton-4/+3
Currently, we build a closure that does nothing but pass its argument through to another function, this is rather wasteful and creates lots of unnecessary closures.
2015-01-15rollup merge of #21161: japaric/ufcs-hashAlex Crichton-2/+12
expansion now uses `::std::hash::Hash::hash(&*__self_0_0, __arg_0)` instead of `(*__self_0_0).hash(__arg_0)` closes #21160 r? @alexcrichton
2015-01-15rollup merge of #21144: nagisa/asm-str-fixAlex Crichton-0/+6
Fixes #21045
2015-01-15rollup merge of #21127: erickt/opt-stackAlex Crichton-174/+252
libsyntax compiled without optimization uses a lot of stack, which can cause it to run out of stack space. This PR factors out some arm handlers from `print_expr` as well as converts `advance_left` into a loop. This helps to cut down on the stack usage.
2015-01-15rollup merge of #21088: aochagavia/obsoleteAlex Crichton-168/+4
Only the most recent changes (since November 2014) get a special error. Fixes #20599
2015-01-15rollup merge of #21052: nick29581/methods-extAlex Crichton-116/+363
Allows modifiers to be used on methods, associated types, etc. r? @sfackler
2015-01-15rollup merge of #21005: huonw/deriving-docsAlex Crichton-25/+28
Syntax and a few fixed bugs etc.
2015-01-15syntax: parse fully qualified UFCS expressions.Eduard Burtescu-7/+37
2015-01-15syntax: add fully qualified UFCS expressions.Eduard Burtescu-14/+42
2015-01-15Avoid unnecessary closures when deriving RustcDecodableBjörn Steinbrink-4/+3
Currently, we build a closure that does nothing but pass its argument through to another function, this is rather wasteful and creates lots of unnecessary closures.
2015-01-15support deriving `Hash` for nullary structsAndrew Paseltiner-6/+2
fixes #16530
2015-01-14use better spanJorge Aparicio-11/+11
2015-01-14use UFCS in `#[deriving(Hash)]`Jorge Aparicio-2/+12
expansion now uses `::std::hash::Hash::hash(&*__self_0_0, __arg_0)` instead of `(*__self_0_0).hash(__arg_0)` closes #21160
2015-01-14Remove old obsolete syntax errorsAdolfo Ochagavía-168/+4
2015-01-15Syntax extensions on trait and impl items.Nick Cameron-116/+363
Allows modifiers to be used on methods, associated types, etc.
2015-01-14Disallow a form of invalid asm! macroSimonas Kazlauskas-0/+6
Fixes #21045
2015-01-13syntax: factor out print_expr arms to reduce non-optimized stack usageErick Tryzelaar-78/+138
2015-01-13syntax: Rewrite pp advance_left to use a constant stack sizeErick Tryzelaar-31/+37
2015-01-13syntax: Don't import the pp.rs enum variants into the namespaceErick Tryzelaar-70/+82
2015-01-14auto merge of #21061 : japaric/rust/range, r=nick29581bors-3/+3
2015-01-14Implement suggestions for traits to import.Huon Wilson-0/+3
For a call like `foo.bar()` where the method `bar` can't be resolved, the compiler will search for traits that have methods with name `bar` to give a more informative error, providing a list of possibilities. Closes #7643.
2015-01-12cleanup: `&foo[0..a]` -> `&foo[..a]`Jorge Aparicio-3/+3
2015-01-13Add view items to the ast mapNick Cameron-0/+35
2015-01-13Update #[deriving] documentation.Huon Wilson-25/+28
Syntax and a few fixed bugs etc.
2015-01-12auto merge of #20889 : Manishearth/rust/trait-error, r=nikomatsakisbors-0/+5
fixes #20783 r? @nikomatsakis
2015-01-12Feature gate #[rustc_on_unimplemented]Manish Goregaokar-0/+5
2015-01-11Update Token::can_begin_expr() to make it consistent with the grammar:Daniel Grunwald-11/+5
* add Token::AndAnd (double borrow) * add Token::DotDot (range notation) * remove Token::Pound and Token::At Fixes a syntax error when parsing "fn f() -> RangeTo<i32> { return ..1; }". Also, remove "fn_expr_lookahead". It's from the fn~ days and seems to no longer be necessary.