about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2017-07-06Auto merge of #42727 - alexcrichton:allocators-new, r=eddybbors-7/+23
rustc: Implement the #[global_allocator] attribute This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/1974 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-7/+23
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-59/+75
2017-07-02Output line column info when panickingest31-5/+6
2017-06-29Auto merge of #42902 - petrochenkov:keydcrate, r=jseyfriedbors-50/+41
Make `$crate` a keyword Fixes https://github.com/rust-lang/rust/issues/42898 r? @jseyfried or @nrc
2017-06-29Give a tracking-issue number for unsized tuple coercion.Masaki Hara-1/+1
2017-06-29Move unsized_tuple_coercion behind a feature gate.Masaki Hara-0/+6
2017-06-29Change some terminology around keywords and reserved identifierspetrochenkov-42/+33
2017-06-29Make `$crate` a keywordVadim Petrochenkov-8/+8
2017-06-29Rollup merge of #42886 - durka:pplmm-mwe, r=petrochenkovAriel Ben-Yehuda-1/+3
syntax: allow negative integer literal expression to be interpolated as pattern Fixes #42820. r? @jseyfried
2017-06-27syntax: allow negative integer literal expression to be interpolated as patternAlex Burka-1/+3
2017-06-26Update and fix a few testsAlex Crichton-2/+2
2017-06-26Address review comments.Jeffrey Seyfried-17/+39
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-80/+122
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-41/+245
2017-06-26Clean up `tokenstream::Cursor` and `proc_macro`.Jeffrey Seyfried-27/+27
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-118/+109
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-24Add a feature gate for the `#[allow_fail]` attributePaul Woolcock-1/+8
2017-06-24add `allow_fail` test attributePaul Woolcock-3/+12
This change allows the user to add an `#[allow_fail]` attribute to tests that will cause the test to compile & run, but if the test fails it will not cause the entire test run to fail. The test output will show the failure, but in yellow instead of red, and also indicate that it was an allowed failure.
2017-06-23Removed as many "```ignore" as possible.kennytm-8/+10
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-21Rollup merge of #42620 - wesleywiser:compile_error, r=brsonCorey Farwell-0/+5
Add compile_error! Related to #40872
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-19Add compile_error!Wesley Wiser-0/+5
Related to #40872
2017-06-18Auto merge of #42593 - ibabushkin:on-demand-external-source, r=eddybbors-47/+40
Implement lazy loading of external crates' sources. Fixes #38875 Fixes #38875. This is a follow-up to #42507. When a (now correctly translated) span from an external crate is referenced in a error, warning or info message, we still don't have the source code being referenced. Since stuffing the source in the serialized metadata of an rlib is extremely wasteful, the following scheme has been implemented: * File maps now contain a source hash that gets serialized as well. * When a span is rendered in a message, the source hash in the corresponding file map(s) is used to try and load the source from the corresponding file on disk. If the file is not found or the hashes don't match, the failed attempt is recorded (and not retried). * The machinery fetching source lines from file maps is augmented to use the lazily loaded external source as a secondary fallback for file maps belonging to external crates. This required a small change to the expected stderr of one UI test (it now renders a span, where previously was none). Further work can be done based on this - some of the machinery previously used to hide external spans is possibly obsolete and the hashing code can be reused in different places as well. r? @eddyb
2017-06-16Auto merge of #42690 - frewsxcv:rollup, r=frewsxcvbors-31/+45
Rollup of 5 pull requests - Successful merges: #42616, #42651, #42654, #42656, #42685 - Failed merges:
2017-06-16Rollup merge of #42656 - VBChunguk:struct-field-attributes, r=nikomatsakisCorey Farwell-31/+2
Remove struct_field_attributes feature gate Part of #41681. ~This PR only removes the feature gate; this *does not* update any documentations.~ This PR removes the feature gate and the corresponding chapter of the Unstable Book. I'm not very sure about the changes I made though... Just followed the stabilization guideline. r? @nikomatsakis
2017-06-16Rollup merge of #42616 - estebank:span-fix, r=nikomatsakisCorey Farwell-0/+43
Position span label correctly when it isn't last Fix #42595. Before: ``` 15 | map.entry("e").or_insert(0) += 1; | ---------------------------^^^^^ot use `+=` on type `&mut {integer}` ``` After: ``` 15 | map.entry("e").or_insert(0) += 1; | ---------------------------^^^^^ | | | cannot use `+=` on type `&mut {integer}` ```
2017-06-16Auto merge of #42578 - estebank:recover-binop, r=nikomatsakisbors-9/+94
Learn to parse `a as usize < b` Parsing `a as usize > b` always works, but `a as usize < b` was a parsing error because the parser would think the `<` started a generic type argument for `usize`. The parser now attempts to parse as before, and if a DiagnosticError is returned, try to parse again as a type with no generic arguments. If this fails, return the original `DiagnosticError`. Fix #22644.
2017-06-15Position span label correctly when it isn't lastEsteban Küber-0/+43
2017-06-15Review commentsEsteban Küber-99/+71
- generate error instead of warning - remove `RewindPoint` and just keep a copy of `Parser` to rewind state. - `dont_parse_generics: bool` -> `parse_generics: bool` - remove `eat_lt` - move error handling code to separate method
2017-06-15Remove struct_field_attributes feature gateWonwoo Choi-31/+2
2017-06-14Auto merge of #42433 - marco-c:profiling, r=alexcrichtonbors-0/+11
Build instruction profiler runtime as part of compiler-rt r? @alexcrichton This is #38608 with some fixes. Still missing: - [x] testing with profiler enabled on some builders (on which ones? Should I add the option to some of the already existing configurations, or create a new configuration?); - [x] enabling distribution (on which builders?); - [x] documentation.
2017-06-13Auto merge of #42471 - nrc:save-sig-2, r=eddybbors-7/+20
save-analysis: signatures for everything!
2017-06-12External spans: added lazy source loading elsewhereInokentiy Babushkin-24/+25
* In other places where the `src` member of a file map is accessed, we now load and possibly work with external source as well.
2017-06-12Change `<` interpreted as generic arg start warningEsteban Küber-23/+33
``` warning: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:16:33 | 16 | println!("{}", a as usize < b); | - ^ interpreted as generic argument | | | not interpreted as comparison | help: if you want to compare the casted value then write: | println!("{}", (a as usize) < b); ```
2017-06-12Fix affected testsEsteban Küber-1/+2
2017-06-12External spans: address review.Inokentiy Babushkin-13/+3
* The lazy loading mechanism has been moved to a more appropriate place. * Return values from the functions invoked there are properly used. * Documentation has gotten some minor improvements. * Possibly some larger restructuring will need to take place still.
2017-06-11Suggest non-ambiguous comparison after castEsteban Küber-2/+19
``` warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison --> $DIR/issue-22644.rs:16:33 | 16 | println!("{}", a as usize < b); | ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here | help: if you want to compare the casted value then write | println!("{}", (a as usize) < b); ```
2017-06-12Add a sig module to save-analysisNick Cameron-7/+20
Generates signatures for use in Rustdoc and similar tools.
2017-06-11Learn to parse `a as usize < b`Esteban Küber-8/+93
Parsing `a as usize > b` always works, but `a as usize < b` was a parsing error because the parser would think the `<` started a generic type argument for `usize`. The parser now attempts to parse as before, and if a DiagnosticError is returned, try to parse again as a type with no generic arguments. If this fails, return the original `DiagnosticError`.
2017-06-11Add E0609Guillaume Gomez-0/+11
2017-06-11External spans: fixed unit tests and addressed review.Inokentiy Babushkin-3/+4
2017-06-11Added hash verification to external source loading.Inokentiy Babushkin-7/+2
2017-06-11Added consumption logic for external sources in FileMapInokentiy Babushkin-1/+1
We now fetch source lines from the `external_src` member as a secondary fallback if no regular source is present, that is, if the file map belongs to an external crate and the source has been fetched from disk.
2017-06-11Improved lazy external source loading and inserted calls.Inokentiy Babushkin-1/+1
2017-06-10Added external crates' sources to FileMap.Inokentiy Babushkin-0/+20
They are now handled in their own member to prevent mutating access to the `src` member. This way, we can safely load external sources, while keeping the mutation of local source strings off-limits.
2017-06-10Moved FileMap construction to it's own constructor.Inokentiy Babushkin-27/+3
The rationale is that BOM stripping is needed for lazy source loading for external crates, and duplication can be avoided by moving the corresponding functionality to libsyntax_pos.
2017-06-10Added source hashes to FileMapInokentiy Babushkin-0/+10
We can use these to perform lazy loading of source files belonging to external crates. That way we will be able to show the source code of external spans that have been translated.
2017-06-10Auto merge of #42533 - Mark-Simulacrum:macro-parse-speed-small, r=jseyfriedbors-27/+34
Speed up expansion This reduces duplication, thereby increasing expansion speed. Based on tests with rust-uinput, this produces a 29x performance win (440 seconds to 15 seconds). I want to land this first, since it's a minimal patch, but with more changes to the macro parsing I can get down to 12 seconds locally. There is one FIXME added to the code that I'll keep for now since changing it will spread outward and increase the patch size, I think. Fixes #37074. r? @jseyfried cc @oberien
2017-06-08Speed up expansion.Mark Simulacrum-27/+34
This reduces duplication, thereby increasing expansion speed.