Commit Graph

2101 Commits

Author SHA1 Message Date
Wesley Wiser 93ddee6cee Change some instances of .connect() to .join() 2015-07-10 19:40:46 -04:00
Nick Cameron f28f79b796 Fix a span bug for qualified paths 2015-07-09 12:24:39 +12:00
Ariel Ben-Yehuda a18d9842ed Make the unused_mut lint smarter with respect to locals.
Fixes #26332
2015-07-01 00:12:12 +03:00
Yongqian Li f21682ba2d fix minor indentation issues 2015-06-22 15:30:56 -07:00
bors b5b3a99f84 Auto merge of #26190 - Veedrac:no-iter, r=alexcrichton
Pull request for #26188.
2015-06-11 18:10:08 +00:00
Joshua Landau ca7418b846 Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
Steve Klabnik 2c75256c15 Exise 'unsafe pointer' in favor of 'raw pointer'
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-06-09 16:49:24 -04:00
bors 61c43b4733 Auto merge of #26091 - chellmuth:pub-struct-field-span, r=nrc
Issue: #26083 

Re-submitting https://github.com/rust-lang/rust/pull/26084

r? @nrc
2015-06-08 14:35:27 +00:00
Chris Hellmuth a72283832d StructField span should include pub 2015-06-07 16:34:03 -06:00
Marcus Klaas 0000d4c62a Fix span for ExprPath variants 2015-06-04 02:40:12 +02:00
Nick Hamann d8d4a6a842 Fix typo. 2015-05-26 15:12:52 -05:00
Niko Matsakis 82ded3cd03 Two more small fixes. 2015-05-22 08:45:05 -04:00
Niko Matsakis df93deab10 Make various fixes:
- add feature gate
- add basic tests
- adjust parser to eliminate conflict between `const fn` and associated
constants
- allow `const fn` in traits/trait-impls, but forbid later in type check
- correct some merge conflicts
2015-05-21 11:47:30 -04:00
Eduard Burtescu af3795721c syntax: parse const fn for free functions and inherent methods. 2015-05-21 11:47:30 -04:00
bors c23a9d42ea Auto merge of #25387 - eddyb:syn-file-loader, r=nikomatsakis
This allows compiling entire crates from memory or preprocessing source files before they are tokenized.

Minor API refactoring included, which is a [breaking-change] for libsyntax users:
* `ParseSess::{next_node_id, reserve_node_ids}` moved to rustc's `Session`
* `new_parse_sess` -> `ParseSess::new`
* `new_parse_sess_special_handler` -> `ParseSess::with_span_handler`
* `mk_span_handler` -> `SpanHandler::new`
* `default_handler` -> `Handler::new`
* `mk_handler` -> `Handler::with_emitter`
* `string_to_filemap(sess source, path)` -> `sess.codemap().new_filemap(path, source)`
2015-05-17 00:05:34 +00:00
bors 8fdb3a4ad9 Auto merge of #25487 - P1start:extern-crate-unexpected-error, r=huonw
Closes #25468.
2015-05-16 10:53:25 +00:00
P1start dadac15477 Clarify the error message for malformed extern crate statements
Closes #25468.
2015-05-16 22:35:59 +12:00
P1start 5a1b336a01 Fix the spans of move closures
Closes #24986.
2015-05-16 11:24:06 +12:00
bors b948d81c44 Auto merge of #25219 - Eljay:fix-comment-parsing, r=alexcrichton
Fixes #25182, parser didn't account for \r\n in regular comments, only doc-comments.
2015-05-15 16:53:53 +00:00
Erick Tryzelaar 7b00658413 syntax: Add unquoting ast::{Generics,WhereClause} 2015-05-15 08:01:55 -07:00
Lee Jeffery 2dcc200be0 Fix stupid mistake from previous commit 2015-05-14 18:28:28 +01:00
Lee Jeffery 93af5f9b44 Make BytePos calculation same as original 2015-05-14 18:19:51 +01:00
Eduard Burtescu 07d4f77790 syntax: abstract over the file loading mechanism. 2015-05-14 01:47:56 +03:00
Eduard Burtescu 0d50b043f7 syntax::parse: optimize file_to_filemap to read a string directly. 2015-05-14 01:47:56 +03:00
Eduard Burtescu 6a59d1824d syntax: replace sess.span_diagnostic.cm with sess.codemap(). 2015-05-14 01:47:56 +03:00
Eduard Burtescu f786437bd2 syntax: refactor (Span)Handler and ParseSess constructors to be methods. 2015-05-14 01:47:56 +03:00
Eduard Burtescu 6a045b9d1c Move tracking of the next NodeId from syntax's ParseSess to rustc's Session. 2015-05-14 01:47:56 +03:00
Lee Jeffery 4f82c3151b Added test to check that newlines are stripped from comments 2015-05-13 22:06:26 +01:00
Lee Jeffery aef0581513 Fix byte offset and error message inconsistencies 2015-05-13 22:05:01 +01:00
bors 0ad202671f Auto merge of #25171 - quantheory:associated_time_long_paths, r=nikomatsakis
It is currently broken to use syntax such as `<T as Foo>::U::static_method()` where `<T as Foo>::U` is an associated type. I was able to fix this and simplify the parser a bit at the same time.

This also fixes the corresponding issue with associated types (#22139), but that's somewhat irrelevant because #22519 is still open, so this syntax still causes an error in type checking.

Similarly, although this fix applies to associated consts, #25046 forbids associated constants from using type parameters or `Self`, while #19559 means that associated types have to always have one of those two. Therefore, I think that you can't use an associated const from an associated type anyway.
2015-05-12 13:04:14 +00:00
Lee Jeffery a76244fcef Fix CRLF line-ending parsing for comments. 2015-05-08 20:33:58 +01:00
Barosl Lee ff332b6467 Squeeze the last bits of tasks in documentation in favor of thread
An automated script was run against the `.rs` and `.md` files,
subsituting every occurrence of `task` with `thread`. In the `.rs`
files, only the texts in the comment blocks were affected.
2015-05-09 02:24:18 +09:00
Sean Patrick Santos efb3872a49 Fix use of UFCS syntax to call methods on associated types. 2015-05-07 01:57:54 -06:00
Tamir Duberstein 5cfa713a1c Use empty() instead of a special const 2015-05-05 22:03:45 -04:00
Manish Goregaokar 70020aa066 Rollup merge of #24981 - carols10cents:remove-more-priv, r=alexcrichton
Hi! While researching stuff for the reference and the grammar, I came across a few mentions of using the `priv` keyword that was removed in 0.11.0 (#13547, #8122, rust-lang/rfcs#26, [RFC 0026](https://github.com/rust-lang/rfcs/blob/master/text/0026-remove-priv.md)).

One occurrence is a mention in the reference, a few are in comments, and a few are marking test functions. I left the test that makes sure you can't name an ident `priv` since it's still a reserved keyword. I did a little grepping around for `priv `, priv in backticks, `Private` etc and I think the remaining instances are fine, but if anyone knows anywhere in particular I should check for any other lingering mentions of `priv`, please let me know and I would be happy to! 🍂 🌊
2015-05-01 20:20:18 +05:30
Carol Nichols 31b7001b49 Remove mention of 'priv'; visibility is either PUB or nothing 2015-04-29 22:47:10 -04:00
Tamir Duberstein 8c58fe1739 Fallout 2015-04-29 08:55:31 -07:00
bors 857ef6e272 Auto merge of #23606 - quantheory:associated_const, r=nikomatsakis
Closes #17841.

The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough.

There is still some significant functionality missing from this commit:

 - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~
 - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet.
 - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865.
 - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~

Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
2015-04-27 16:45:21 +00:00
Geoffry Song 2d9831dea5 Interpolate AST nodes in quasiquote.
This changes the `ToTokens` implementations for expressions, statements,
etc. with almost-trivial ones that produce `Interpolated(*Nt(...))`
pseudo-tokens. In this way, quasiquote now works the same way as macros
do: already-parsed AST fragments are used as-is, not reparsed.

The `ToSource` trait is removed. Quasiquote no longer involves
pretty-printing at all, which removes the need for the
`encode_with_hygiene` hack. All associated machinery is removed.

A new `Nonterminal` is added, NtArm, which the parser now interpolates.
This is just for quasiquote, not macros (although it could be in the
future).

`ToTokens` is no longer implemented for `Arg` (although this could be
added again) and `Generics` (which I don't think makes sense).

This breaks any compiler extensions that relied on the ability of
`ToTokens` to turn AST fragments back into inspectable token trees. For
this reason, this closes #16987.

As such, this is a [breaking-change].

Fixes #16472.
Fixes #15962.
Fixes #17397.
Fixes #16617.
2015-04-25 21:42:10 -04:00
bors 00c48d3779 Auto merge of #24547 - bombless:comma, r=pnkfelix
Closes #20616 
It breaks code such as <https://github.com/rust-lang/rust/blob/c64feb63418fd05bd6e5adc6f9ad763aa6a594b1/src/librustc_typeck/check/method/suggest.rs#L367>, so this is a [breaking-change], you have to add missing comma after the last lifetime arguement now.
2015-04-25 21:44:50 +00:00
York Xiang 0ad48e41c1 Fix #20616 2015-04-25 11:29:28 +08:00
Johannes Oertel 07cc7d9960 Change name of unit test sub-module to "tests".
Changes the style guidelines regarding unit tests to recommend using a
sub-module named "tests" instead of "test" for unit tests as "test"
might clash with imports of libtest.
2015-04-24 23:06:41 +02:00
Sean Patrick Santos 29eb550ee6 Get associated consts working in match patterns. 2015-04-23 21:02:29 -06:00
Sean Patrick Santos 7129e8815e Functional changes for associated constants. Cross-crate usage of associated constants is not yet working. 2015-04-23 21:02:26 -06:00
Nick Cameron 17934e5c29 Do not include attributes in trait item spans.
(And other kinds of items).
2015-04-24 08:45:32 +12:00
bors 6b29a7d564 Auto merge of #24683 - P1start:help-suggestions, r=nrc
This PR uses the inline error suggestions introduced in #24242 to modify a few existing `help` messages. The new errors look like this:

    foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`,
                                not `&'static Copy` [E0178]
    foobar.rs:5     let x: &'static Copy + 'static;
                           ^~~~~~~~~~~~~
    foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438):
    foobar.rs:      let x: &'static (Copy + 'static);


    foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy`
    foobar.rs:2     let x = &1 as Copy;
                            ^~~~~~~~~~
    foobar.rs:2:19: 2:23 help: try casting to a reference instead:
    foobar.rs:      let x = &1 as &Copy;


    foobar.rs:7:24: 7:25 error: expected expression, found `;`
    foobar.rs:7     let x = box (1 + 1);
                                       ^
    foobar.rs:7:13: 7:16 help: try using `box()` instead:
    foobar.rs:      let x = box() (1 + 1);

This also modifies compiletest to give the ability to directly test suggestions given by error messages.
2015-04-23 02:45:06 +00:00
bors e9e9279d87 Auto merge of #24685 - nrc:span-pred, r=huonw 2015-04-22 08:47:09 +00:00
Nick Cameron 8456dba4e6 Fix spans for predicates in where clauses 2015-04-22 18:29:54 +12:00
Alex Crichton a1dd5ac787 rollup merge of #24636: alexcrichton/remove-deprecated
Conflicts:
	src/libcore/result.rs
2015-04-21 15:28:53 -07:00
Alex Crichton eeb94886ad std: Remove deprecated/unstable num functionality
This commit removes all the old casting/generic traits from `std::num` that are
no longer in use by the standard library. This additionally removes the old
`strconv` module which has not seen much use in quite a long time. All generic
functionality has been supplanted with traits in the `num` crate and the
`strconv` module is supplanted with the [rust-strconv crate][rust-strconv].

[rust-strconv]: https://github.com/lifthrasiir/rust-strconv

This is a breaking change due to the removal of these deprecated crates, and the
alternative crates are listed above.

[breaking-change]
2015-04-21 11:37:43 -07:00