about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-06-16Fix file!(), line!() and column!() macrosSimonas Kazlauskas-72/+72
These used to return wrong results in case they were expanded inside compiler’s iternal syntax sugar (closures, if-let) expansions Fixes #26322
2015-06-14Replaced a comment mentioning a fixed issueMarkus Westerlind-3/+5
Replaced it with a comment mentioning the rationale for checking the discriminants first.
2015-06-14diagnostics: Allow long URLs in error explanations.Michael Sproul-2/+9
2015-06-13Utilize discriminant_value for more efficient derivingMarkus-39/+85
The new code generated for deriving on enums looks something like this: ```rust let __self0_vi = unsafe { std::intrinsics::discriminant_value(&self) } as i32; let __self1_vi = unsafe { std::intrinsics::discriminant_value(&__arg1) } as i32; let __self2_vi = unsafe { std::intrinsics::discriminant_value(&__arg2) } as i32; /// if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... { match (...) { (Variant1, Variant1, ...) => Body1 (Variant2, Variant2, ...) => Body2, ... _ => ::core::intrinsics::unreachable() } } else { ... // catch-all remainder can inspect above variant index values. } ``` This helps massively for C-like enums since they will be compiled as a single comparison giving observed speedups of up to 8x. For more complex enums the speedup is more difficult to measure but it should not be slower to generate code this way regardless.
2015-06-11validate stability against deprecation versionAlexis Beingessner-3/+3
2015-06-11Auto merge of #26190 - Veedrac:no-iter, r=alexcrichtonbors-38/+38
Pull request for #26188.
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-10/+10
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-28/+28
2015-06-10Auto merge of #26182 - Manishearth:rollup, r=Manishearthbors-1/+1
- Successful merges: #26142, #26143, #26145, #26146, #26164, #26174 - Failed merges:
2015-06-10syntax: move ast_map to librustc.Eduard Burtescu-1280/+0
2015-06-09Exise 'unsafe pointer' in favor of 'raw pointer'Steve Klabnik-1/+1
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-06-08Auto merge of #26091 - chellmuth:pub-struct-field-span, r=nrcbors-1/+4
Issue: #26083 Re-submitting https://github.com/rust-lang/rust/pull/26084 r? @nrc
2015-06-08Auto merge of #25823 - oli-obk:static_to_const_lint, r=alexcrichtonbors-2/+2
r? @eddyb
2015-06-07StructField span should include `pub`Chris Hellmuth-1/+4
2015-06-07change some statics to constantsOliver 'ker' Schneider-2/+2
2015-06-04Rollup merge of #25994 - marcusklaas:issue-25969, r=huonwManish Goregaokar-2/+1
Issue: https://github.com/rust-lang/rust/issues/25969 Compare the span on the stable branch (correct) with the span on the nightly branch (incorrect) for the following example: http://is.gd/lTAo9c. This pull request fixes the regression. @Manishearth has been kind enough to pitch some ideas for a regression test, mainly revolving around testing the span in compile-fail test, but this has proven unsuccessful. Other suggestions/ ideas would be much appreciated!
2015-06-04Fix span for ExprPath variantsMarcus Klaas-2/+1
2015-06-03Remove #[static_assert]Steve Klabnik-5/+0
This was always a weird feature, and isn't being used in the compiler. Static assertions should be done better than this. This implements RFC #1096. Fixes #13951 Fixes #23008 Fixes #6676 This is behind a feature gate, but that's still a [breaking-change]
2015-05-29Add feature-gate to calling const fnNiko Matsakis-3/+6
2015-05-27Auto merge of #25791 - barosl:use-paths-as-items, r=alexcrichtonbors-0/+10
Currently, for `use` declarations with multiple paths, only the `use` item itself is saved in the AST map, not the individual path nodes. This can lead to a problem when a span of a specific path node is needed. For example, #24818 caused an ICE because of this, in `ImportResolver::check_for_conflicting_import()`. Fixes #25763.
2015-05-27Auto merge of #25713 - Stebalien:pattern, r=alexcrichtonbors-0/+1
Needed to support: ```rust match X { pattern if Y ... } for pattern in Y {} ``` IMO, this shouldn't require an RFC because it can't interfere with any future language changes (because `pattern if` and `pattern in` are already legal in rust) and can't cause any ambiguity.
2015-05-26Fix typo.Nick Hamann-1/+1
2015-05-26Associate each path in a `use` declaration with the item in the AST mapBarosl Lee-0/+10
Currently, for `use` declarations with multiple paths, only the `use` item itself is saved in the AST map, not the individual path nodes. This can lead to a problem when a span of a specific path node is needed. For example, #24818 caused an ICE because of this, in `ImportResolver::check_for_conflicting_import()`. Fixes #25763.
2015-05-26Make caching in stability work. This improves stability check performanceAriel Ben-Yehuda-2/+2
by 90%.
2015-05-24Auto merge of #25609 - nikomatsakis:const-fn, r=pnkfelixbors-68/+190
This is a port of @eddyb's `const-fn` branch. I rebased it, tweaked a few things, and added tests as well as a feature gate. The set of tests is still pretty rudimentary, I'd appreciate suggestions on new tests to write. Also, a double-check that the feature-gate covers all necessary cases. One question: currently, the feature-gate allows the *use* of const functions from stable code, just not the definition. This seems to fit our usual strategy, and implies that we might (perhaps) allow some constant functions in libstd someday, even before stabilizing const-fn, if we were willing to commit to the existence of const fns but found some details of their impl unsatisfactory. r? @pnkfelix
2015-05-24Auto merge of #25168 - Manishearth:register_attr, r=eddybbors-13/+31
This lets plugin authors opt attributes out of the `custom_attribute` and `unused_attribute` checks. cc @thepowersgang
2015-05-23Rollup merge of #25710 - Manishearth:no_decorator_clone, r=sfacklerOliver Schneider-34/+34
fixes #25683 I have a very nonscientific measurement of the data via valgrind/massif [here](https://gist.github.com/Manishearth/4c47f15f6835cb3957c4) I measured the memory usage for both --pretty=expanded and -Z no-trans It *seems* like there's a 20-25MB decrease during expansion on stage2 librustc; but I'm not quite sure. r? @eddyb (have not yet run tests, but it compiles fine, might want to wait before giving r+) cc @nrc @huon
2015-05-22Allow patterns to be followed by if and in.Steven Allen-0/+1
Needed to support: match X { pattern if Y ... } for pattern in Y {}
2015-05-22Let MultiItemDecorator take `&Annotatable` (fixes #25683)Manish Goregaokar-34/+34
2015-05-22Remove error diagnostics uniqueness check and .json generation.Felix S. Klock II-17/+4
This is meant to be a temporary measure to get the builds to be reliable again; see also Issue #25705.
2015-05-22Two more small fixes.Niko Matsakis-1/+2
2015-05-21Make various fixes:Niko Matsakis-50/+76
- 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-21rustc: const-qualify `const fn` function and method calls.Eduard Burtescu-14/+22
2015-05-21syntax: parse `const fn` for free functions and inherent methods.Eduard Burtescu-38/+125
2015-05-19Auto merge of #25550 - sfackler:derive-debug-unsized, r=alexcrichtonbors-5/+11
Closes #25394
2015-05-17Make #[derive(Debug)] work with unsized fieldsSteven Fackler-5/+11
Closes #25394
2015-05-18syntax: Remove unused `packed` attributeklutzy-1/+0
The attribute was removed by #16499.
2015-05-17Allow #[derive()] to generate unsafe methodsManish Goregaokar-1/+23
2015-05-17Auto merge of #25387 - eddyb:syn-file-loader, r=nikomatsakisbors-106/+107
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-16Auto merge of #25462 - alexcrichton:favicon-https, r=nrcbors-1/+1
Helps prevent mixed content warnings if accessing docs over HTTPS. Closes #25459
2015-05-16Auto merge of #25444 - nikomatsakis:macro-tt-fix, r=pnkfelixbors-34/+78
Permit token trees, identifiers, and blocks to be following by sequences. Fixes #25436. r? @pnkfelix
2015-05-16Auto merge of #25487 - P1start:extern-crate-unexpected-error, r=huonwbors-5/+1
Closes #25468.
2015-05-16Clarify the error message for malformed `extern crate` statementsP1start-5/+1
Closes #25468.
2015-05-16Fix the spans of `move` closuresP1start-4/+5
Closes #24986.
2015-05-15libs: Move favicon URLs to HTTPSAlex Crichton-1/+1
Helps prevent mixed content warnings if accessing docs over HTTPS. Closes #25459
2015-05-15Permit token trees, identifiers, and blocks to be following byNiko Matsakis-34/+78
sequences. Fixes #25436.
2015-05-15Auto merge of #25219 - Eljay:fix-comment-parsing, r=alexcrichtonbors-24/+39
Fixes #25182, parser didn't account for \r\n in regular comments, only doc-comments.
2015-05-15syntax: Unquoting some statements requires trailing semicolonsErick Tryzelaar-3/+11
2015-05-15syntax: Add unquoting ast::{Generics,WhereClause}Erick Tryzelaar-13/+38
2015-05-15syntax: Allow pretty printing more interpolated itemsErick Tryzelaar-13/+13