about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-05-16Remove hir::IdentVadim Petrochenkov-0/+4
2016-05-15Auto merge of #33505 - petrochenkov:self, r=nrcbors-198/+182
Remove ExplicitSelf from HIR `self` argument is already kept in the argument list and can be retrieved from there if necessary, so there's no need for the duplication. The same changes can be applied to AST, I'll make them in the next breaking batch. The first commit also improves parsing of method declarations and fixes https://github.com/rust-lang/rust/issues/33413. r? @eddyb
2016-05-15Auto merge of #33619 - jonathandturner:improve_structured_errors, r=nikomatsakisbors-4/+5
Batch of improvements to errors for new error format This is a batch of improvements to existing errors to help get the most out of the new error format. * Added labels to primary spans (^^^) for a set of errors that didn't currently have them * Highlight the source blue under the secondary notes for better readability * Move some of the "Note:" into secondary spans+labels * Fix span_label to take &mut instead, which makes it work the same as other methods in that set
2016-05-14Auto merge of #33568 - nrc:save-json-2, r=pnkfelixbors-4/+1
save-analysis: JSON mk2 cc @aochagavia r? @pnkfelix
2016-05-14syntax: Refactor parsing of method declarationsVadim Petrochenkov-198/+182
Fix spans and expected token lists, fix #33413 + other cosmetic improvements Add test for #33413 Convert between `Arg` and `ExplicitSelf` precisely Simplify pretty-printing for methods
2016-05-13Auto merge of #33513 - sanxiyn:tab-in-error, r=nikomatsakisbors-2/+32
Better handling of tab in error cc #33240.
2016-05-12Update errors to use new error formatJonathan Turner-4/+4
2016-05-12Set of fixes to improve borrowcks that weren't updatedJonathan Turner-0/+1
2016-05-12Better handling of tab in errorSeo Sanghyeon-2/+32
2016-05-11save-analysis: give better text info in value fieldsNick Cameron-4/+1
2016-05-09Auto merge of #33443 - jseyfried:resolve_ast, r=nrcbors-0/+38
Perform name resolution before and during ast->hir lowering This PR performs name resolution before and during ast->hir lowering instead of in phase 3. r? @nrc
2016-05-09Auto merge of #32900 - alexcrichton:panic2abort, r=nikomatsakisbors-1/+12
rustc: Implement custom panic runtimes This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account). Closes #32837
2016-05-09Auto merge of #33048 - Amanieu:integer_atomics, r=alexcrichtonbors-2/+6
Add integer atomic types Tracking issue: #32976 RFC: rust-lang/rfcs#1543 The changes to AtomicBool in the RFC are not included, they are in a separate PR (#32365).
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-1/+12
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-05-09Auto merge of #33484 - murarth:diagnostic-builder-fields, r=brsonbors-0/+8
Add accessor methods to DiagnosticBuilder
2016-05-09Add #[cfg(target_has_atomic)] to get atomic support for the current targetAmanieu d'Antras-2/+6
2016-05-09Move resolution to before loweringJeffrey Seyfried-0/+38
2016-05-08Rollup merge of #33369 - nikomatsakis:graceful-empty-span, r=jntrnrManish Goregaokar-1/+49
degrade gracefully with empty spans In https://github.com/rust-lang/rust/pull/32756, we solved the final test failure, but digging more into it the handling of that scenario could be better. The error was caused by an empty span supplied by the parser representing EOF. This patch checks that we cope more gracefully with such spans: r? @jonathandturner
2016-05-08Auto merge of #33091 - sanxiyn:unused-trait-import-3, r=nrcbors-1/+1
Warn unused trait imports, rebased Rebase of #30021. Fix #25730.
2016-05-08Auto merge of #33130 - eddyb:mir-const, r=nikomatsakisbors-1/+4
Implement constant support in MIR. All of the intended features in `trans::consts` are now supported by `mir::constant`. The implementation is considered a temporary measure until `miri` replaces it. A `-Z orbit` bootstrap build will only translate LLVM IR from AST for `#[rustc_no_mir]` functions. Furthermore, almost all checks of constant expressions have been moved to MIR. In non-`const` functions, trees of temporaries are promoted, as per RFC 1414 (rvalue promotion). Promotion before MIR borrowck would allow reasoning about promoted values' lifetimes. The improved checking comes at the cost of four `[breaking-change]`s: * repeat counts must contain a constant expression, e.g.: `let arr = [0; { println!("foo"); 5 }];` used to be allowed (it behaved like `let arr = [0; 5];`) * dereference of a reference to a `static` cannot be used in another `static`, e.g.: `static X: [u8; 1] = [1]; static Y: u8 = (&X)[0];` was unintentionally allowed before * the type of a `static` *must* be `Sync`, irrespective of the initializer, e.g. `static FOO: *const T = &BAR;` worked as `&T` is `Sync`, but it shouldn't because `*const T` isn't * a `static` cannot wrap `UnsafeCell` around a type that *may* need drop, e.g. `static X: MakeSync<UnsafeCell<Option<String>>> = MakeSync(UnsafeCell::new(None));` was previously allowed based on the fact `None` alone doesn't need drop, but in `UnsafeCell` it can be later changed to `Some(String)` which *does* need dropping The drop restrictions are relaxed by RFC 1440 (#33156), which is implemented, but feature-gated. However, creating `UnsafeCell` from constants is unstable, so users can just enable the feature gate.
2016-05-07Rollup merge of #33336 - birkenfeld:issue-27361, r=sfacklerSteve Klabnik-1/+1
parser: do not try to continue with `unsafe` on foreign fns The changed line makes it look like `unsafe` is allowed, but the first statement of `parse_item_foreign_fn` is: ``` self.expect_keyword(keywords::Fn)?; ``` So we get the strange "expected one of `fn`, `pub`, `static`, or `unsafe`, found `unsafe`". Fixes: #27361
2016-05-07Add accessor methods to DiagnosticBuilderMurarth-0/+8
2016-05-07Implement RFC 1440 "Allow Drop types in statics/const functions".Eduard Burtescu-1/+4
2016-05-07Auto merge of #33333 - birkenfeld:issue-30318, r=Manishearthbors-1/+4
parser: show a helpful note on unexpected inner comment Fixes: #30318.
2016-05-06Auto merge of #33311 - birkenfeld:issue33262, r=nrcbors-9/+2
parser: fix suppression of syntax errors in range RHS Invalid expressions on the RHS were just swallowed without generating an error. The new version more closely mirrors the code for parsing `..x` in the `parse_prefix_range_expr` method below, where no cancel is done either. Fixes #33262.
2016-05-05Auto merge of #33128 - xen0n:more-confusing-unicode-chars, r=nagisabors-6/+53
Add more aliases for Unicode confusable chars Building upon #29837, this PR: * added aliases for space characters, * distinguished square brackets from parens, and * added common CJK punctuation characters as aliases. This will especially help CJK users who may have forgotten to switch off IME when coding.
2016-05-03parser: show a helpful note on unexpected inner commentGeorg Brandl-1/+4
Fixes: #30318.
2016-05-03Rollup merge of #33343 - birkenfeld:issue-32214, r=ManishearthManish Goregaokar-5/+1
parser: change warning into an error on `T<A=B, C>` part of #32214 This seems to be the obvious fix, and the error message is consistent with all the other parser errors ("expected x, found y").
2016-05-03Remove unused trait imports introduced while in reviewSeo Sanghyeon-1/+1
2016-05-03degrade gracefully with empty spansNiko Matsakis-1/+49
2016-05-03Rollup merge of #33334 - birkenfeld:issue29088, r=ManishearthManish Goregaokar-5/+4
lexer: do not display char confusingly in error message Current code leads to messages like `... use a \xHH escape: \u{e4}` which is confusing. The printed span already points to the offending character, which should be enough to identify the non-ASCII problem. Fixes: #29088
2016-05-03Rollup merge of #33309 - birkenfeld:pp, r=nrcManish Goregaokar-85/+44
Make libsyntax::print::pp more idiomatic Minor cleanup, and using VecDeque as a ring buffer instead of a vector.
2016-05-02assert we get at least two rendered lines backNiko Matsakis-2/+5
2016-05-02avoid double panicNiko Matsakis-1/+2
2016-05-02do not fail if len(rendered_lines) is == 1Niko Matsakis-10/+14
also handle more rendered-lines
2016-05-02update unit testsNiko Matsakis-39/+38
2016-05-02Finish up with 'old school' error modeJonathan Turner-12/+63
2016-05-02Add back in a 'old school' error formatJonathan Turner-50/+201
2016-05-02change color of warning to YELLOWNiko Matsakis-1/+1
2016-05-02fix snippet tests MORE!Niko Matsakis-2/+2
2016-05-02Nit: use Range::containsNiko Matsakis-7/+3
2016-05-02fix tests betterNiko Matsakis-5/+5
2016-05-02Nit: remove push_primary_span, which was never calledNiko Matsakis-4/+0
2016-05-02Nit: add commentNiko Matsakis-3/+5
2016-05-02only emit `^` at the start of a multi-line errorNiko Matsakis-143/+67
as a result, simplify elision code
2016-05-02Nit: use last_mut betterNiko Matsakis-4/+3
2016-05-02Nit: in emitter.rsNiko Matsakis-2/+1
2016-05-02Nit: address various style nitsNiko Matsakis-5/+10
2016-05-02Nit: do not use RLKNiko Matsakis-12/+14
2016-05-02Nit: do not import variants from StyleNiko Matsakis-24/+23