summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-11-02syntax: Use UFCS instead of `secret_*` fns in expansion of `format_args!`Jorge Aparicio-18/+19
2014-11-02Convert some notes to help messagesP1start-8/+17
Closes #18126.
2014-11-01collections: Remove all collections traitsAlex Crichton-14/+14
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
2014-10-31DSTify HashJorge Aparicio-7/+7
- The signature of the `*_equiv` methods of `HashMap` and similar structures have changed, and now require one less level of indirection. Change your code from: ``` hashmap.find_equiv(&"Hello"); hashmap.find_equiv(&&[0u8, 1, 2]); ``` to: ``` hashmap.find_equiv("Hello"); hashmap.find_equiv(&[0u8, 1, 2]); ``` - The generic parameter `T` of the `Hasher::hash<T>` method have become `Sized?`. Downstream code must add `Sized?` to that method in their implementations. For example: ``` impl Hasher<FnvState> for FnvHasher { fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } } ``` must be changed to: ``` impl Hasher<FnvState> for FnvHasher { fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 { /* .. */ } // ^^^^^^ } ``` [breaking-change]
2014-10-30rustc: Implement -l and include! tweaksAlex Crichton-21/+37
This is an implementation of the rustc bits of [RFC 403][rfc]. This adds a new flag to the compiler, `-l`, as well as tweaking the `include!` macro (and related source-centric macros). The compiler's new `-l` flag is used to link libraries in from the command line. This flag stacks with `#[link]` directives already found in the program. The purpose of this flag, also stated in the RFC, is to ease linking against native libraries which have wildly different requirements across platforms and even within distributions of one platform. This flag accepts a string of the form `NAME[:KIND]` where `KIND` is optional or one of dylib, static, or framework. This is roughly equivalent to if the equivalent `#[link]` directive were just written in the program. The `include!` macro has been modified to recursively expand macros to allow usage of `concat!` as an argument, for example. The use case spelled out in RFC 403 was for `env!` to be used as well to include compile-time generated files. The macro also received a bit of tweaking to allow it to expand to either an expression or a series of items, depending on what context it's used in. [rfc]: https://github.com/rust-lang/rfcs/pull/403
2014-10-30Test fixes and rebase conflictsAlex Crichton-8/+8
2014-10-30rollup merge of #18445 : alexcrichton/index-mutAlex Crichton-25/+22
Conflicts: src/libcollections/vec.rs
2014-10-30rollup merge of #18430 : bjz/tokenAlex Crichton-364/+360
Conflicts: src/libsyntax/parse/parser.rs
2014-10-30rollup merge of #18398 : aturon/lint-conventions-2Alex Crichton-8/+8
Conflicts: src/libcollections/slice.rs src/libcore/failure.rs src/libsyntax/parse/token.rs src/test/debuginfo/basic-types-mut-globals.rs src/test/debuginfo/simple-struct.rs src/test/debuginfo/trait-pointers.rs
2014-10-30rollup merge of #18417 : P1start/lint-fixesAlex Crichton-0/+24
2014-10-30rollup merge of #18409 : gamazeps/issue15273Alex Crichton-0/+7
2014-10-30collections: Enable IndexMut for some collectionsAlex Crichton-25/+22
This commit enables implementations of IndexMut for a number of collections, including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same time this deprecates the `get_mut` methods on vectors in favor of using the indexing notation. cc #18424
2014-10-30Add a message for when a `.` follows a macro invocationP1start-0/+10
2014-10-30Improve the error message for parenthesised box expressionsP1start-0/+14
Closes #15386.
2014-10-30Formatting fixesBrendan Zabarauskas-13/+21
2014-10-30Remove Token::get_close_delimiterBrendan Zabarauskas-58/+33
We can simplify these usages due to the new delimiter representation. `Parser::expect_open_delim` has been added for convenience.
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-302/+315
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-29Rename fail! to panic!Steve Klabnik-89/+89
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-29Diagnostic: resolve bare fn in expected closuregamazeps-0/+7
Closes #15273 (I did not find how to get the identifier in the message :/) Also creates the span_help! macro associated with #18126
2014-10-28Update code with new lint namesAaron Turon-8/+8
2014-10-28Move token-to-string functions into print::pprustBrendan Zabarauskas-106/+108
2014-10-28Use an enum rather than a bool in token::IdentBrendan Zabarauskas-55/+93
2014-10-28Convert some token functions into methodsBrendan Zabarauskas-299/+293
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-987/+1029
2014-10-27rollup merge of #18362 : kevinmehall/pprint-struct-pat-shorthandAlex Crichton-3/+5
2014-10-27rollup merge of #18332 : jbcrail/fix-commentsAlex Crichton-1/+1
2014-10-27rollup merge of #18326 : sfackler/cfg-finalAlex Crichton-17/+5
2014-10-27rollup merge of #18303 : cgaebel/make-vec-match-sliceAlex Crichton-1/+1
2014-10-27rollup merge of #18256 : SimonSapin/view_item_to_stringAlex Crichton-0/+4
2014-10-27Preserve struct field pattern shorthand in the prettyprinter.Kevin Mehall-3/+5
Use the `is_shorthand` field introduced by #17813 (ead6c4b) to make the prettyprinter output the shorthand form. Fixes a few places that set `is_shorthand: true` when the pattern is not a PatIdent with the same name as the field.
2014-10-25Fix spelling mistakes in comments.Joseph Crail-1/+1
2014-10-26Update parse::test::string_to_tts_1 testBrendan Zabarauskas-113/+100
2014-10-25Finish cfg syntax transitionSteven Fackler-17/+5
2014-10-26Add a KleeneOp enum for clarityBrendan Zabarauskas-30/+42
2014-10-26Reduce the size of the TokenTreeBrendan Zabarauskas-22/+34
2014-10-26Use standard capitalisation for TokenTree variantsBrendan Zabarauskas-91/+91
2014-10-26Prevent some vector reallocationsBrendan Zabarauskas-11/+10
2014-10-26Rename TokenTree variants for clarityBrendan Zabarauskas-91/+94
This should be clearer, and fits in better with the `TTNonterminal` variant. Renames: - `TTTok` -> `TTToken` - `TTDelim` -> `TTDelimited` - `TTSeq` -> `TTSequence`
2014-10-26Add Span and separate open/close delims to TTDelimBrendan Zabarauskas-88/+135
This came up when working [on the gl-rs generator extension](https://github.com/bjz/gl-rs/blob/990383de801bd2e233159d5be07c9b5622827620/src/gl_generator/lib.rs#L135-L146). The new definition of `TTDelim` adds an associated `Span` that covers the whole token tree and enforces the invariant that a delimited sequence of token trees must have an opening and closing delimiter. A `get_span` method has also been added to `TokenTree` type to make it easier to implement better error messages for syntax extensions.
2014-10-24Make the Vec data structure layout match raw::Slice.Clark Gaebel-1/+1
Fixes #18302 r? @thestinger
2014-10-24Add a lint for not using field pattern shorthandsP1start-29/+44
Closes #17792.
2014-10-23Add syntax::print::pprint::view_item_to_stringSimon Sapin-0/+4
… similar to the existing `item_to_string`. There may be more missing like this.
2014-10-22auto merge of #18141 : phildawes/rust/master, r=brsonbors-3/+49
Hello! I noticed spans are wrong for the PatIdents of self args. (I use spans a lot in racer)
2014-10-21Change method lookup infrastructure to use the trait methods. InsteadNiko Matsakis-0/+8
of tracking individual candidates per impl, we just track one candidate for the extension trait itself, and let the trait resolution handle walking the individual impls and so forth. Also change the interface to report back a richer notion of error.
2014-10-20auto merge of #18070 : alexcrichton/rust/spring-cleaning, r=aturonbors-411/+209
This is a large spring-cleaning commit now that the 0.12.0 release has passed removing an amount of deprecated functionality. This removes a number of deprecated crates (all still available as cargo packages in the rust-lang organization) as well as a slew of deprecated functions. All `#[crate_id]` support has also been removed. I tried to avoid anything that was recently deprecated, but I may have missed something! The major pain points of this commit is the fact that rustc/syntax have `#[allow(deprecated)]`, but I've removed that annotation so moving forward they should be cleaned up as we go.
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-411/+209
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-19fix printing signed literal in print_literalAleksandr Koshlo-1/+10
2014-10-18Parser: Fix spans of explicit self arg identsPhil Dawes-3/+49
2014-10-18auto merge of #18099 : jakub-/rust/fixed-issues, r=alexcrichtonbors-1/+1
Closes #9249. Closes #13105. Closes #13837. Closes #13847. Closes #15207. Closes #15261. Closes #16048. Closes #16098. Closes #16256. Closes #16562. Closes #16596. Closes #16709. Closes #16747. Closes #17025. Closes #17121. Closes #17450. Closes #17636.
2014-10-17auto merge of #16855 : P1start/rust/help-messages, r=brsonbors-11/+31
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message. They look like this: ``` match.rs:10:13: 10:14 error: unreachable pattern [E0001] match.rs:10 1 => {}, ^ match.rs:3:1: 3:38 note: in expansion of foo! match.rs:7:5: 20:2 note: expansion site match.rs:10:13: 10:14 help: pass `--explain E0001` to see a detailed explanation ``` (`help` is coloured cyan.) Adding these errors on a separate line stops the lines from being too long, as discussed in #16619.