about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-05-13Auto merge of #33513 - sanxiyn:tab-in-error, r=nikomatsakisbors-2/+32
Better handling of tab in error cc #33240.
2016-05-12Better handling of tab in errorSeo Sanghyeon-2/+32
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
2016-05-02Do not import variants from RenderedLineKindNiko Matsakis-12/+12
2016-05-02Nit: comments should be uppercase letterNiko Matsakis-4/+4
2016-05-02refactor the Emitter traitNiko Matsakis-98/+74
There is now a CoreEmitter that everything desugars to, but without losing any information. Also remove RenderSpan::FileLine. This lets the rustc_driver tests build.
2016-05-02change errors from Yellow to MagentaNiko Matsakis-1/+1
The Yellow text is very hard to read with a white background.
2016-05-02WIP factor out RudimentaryEmitterNiko Matsakis-16/+31
2016-05-02replace fileline_{help,note} with {help,note}Niko Matsakis-29/+26
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
2016-05-02thread tighter span for closures aroundNiko Matsakis-3/+3
Track the span corresponding to the `|...|` part of the closure.
2016-05-02refactor to use new snippet code and modelNiko Matsakis-723/+335
Major changes: - Remove old snippet rendering code and use the new stuff. - Introduce `span_label` method to add a label - Remove EndSpan mode and replace with a fn to get the last character of a span. - Stop using `Option<MultiSpan>` and just use an empty `MultiSpan` - and probably a bunch of other stuff :)