summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2017-11-12Disable `mmap` in `libbacktrace` on Apple platformsJohn Colanduoni-0/+34
Fixes #45731 libbacktrace uses mmap if available to map ranges of the files containing debug information. On macOS `mmap` will succeed even if the mapped range does not exist, and a SIGBUS (with an unusual EXC_BAD_ACCESS code 10) will occur when the program attempts to page in the memory. To combat this we force `libbacktrace` to be built with the simple `read` based fallback on Apple platforms.
2017-10-07Auto merge of #44841 - alexcrichton:thinlto, r=michaelwoeristerbors-0/+94
rustc: Implement ThinLTO This commit is an implementation of LLVM's ThinLTO for consumption in rustc itself. Currently today LTO works by merging all relevant LLVM modules into one and then running optimization passes. "Thin" LTO operates differently by having more sharded work and allowing parallelism opportunities between optimizing codegen units. Further down the road Thin LTO also allows *incremental* LTO which should enable even faster release builds without compromising on the performance we have today. This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then also implements two forms of ThinLTO: * In one mode we'll *only* perform ThinLTO over the codegen units produced in a single compilation. That is, we won't load upstream rlibs, but we'll instead just perform ThinLTO amongst all codegen units produced by the compiler for the local crate. This is intended to emulate a desired end point where we have codegen units turned on by default for all crates and ThinLTO allows us to do this without performance loss. * In anther mode, like full LTO today, we'll optimize all upstream dependencies in "thin" mode. Unlike today, however, this LTO step is fully parallelized so should finish much more quickly. There's a good bit of comments about what the implementation is doing and where it came from, but the tl;dr; is that currently most of the support here is copied from upstream LLVM. This code duplication is done for a number of reasons: * Controlling parallelism means we can use the existing jobserver support to avoid overloading machines. * We will likely want a slightly different form of incremental caching which integrates with our own incremental strategy, but this is yet to be determined. * This buys us some flexibility about when/where we run ThinLTO, as well as having it tailored to fit our needs for the time being. * Finally this allows us to reuse some artifacts such as our `TargetMachine` creation, where all our options we used today aren't necessarily supported by upstream LLVM yet. My hope is that we can get some experience with this copy/paste in tree and then eventually upstream some work to LLVM itself to avoid the duplication while still ensuring our needs are met. Otherwise I fear that maintaining these bindings may be quite costly over the years with LLVM updates!
2017-10-07rustc: Implement ThinLTOAlex Crichton-0/+94
This commit is an implementation of LLVM's ThinLTO for consumption in rustc itself. Currently today LTO works by merging all relevant LLVM modules into one and then running optimization passes. "Thin" LTO operates differently by having more sharded work and allowing parallelism opportunities between optimizing codegen units. Further down the road Thin LTO also allows *incremental* LTO which should enable even faster release builds without compromising on the performance we have today. This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then also implements two forms of ThinLTO: * In one mode we'll *only* perform ThinLTO over the codegen units produced in a single compilation. That is, we won't load upstream rlibs, but we'll instead just perform ThinLTO amongst all codegen units produced by the compiler for the local crate. This is intended to emulate a desired end point where we have codegen units turned on by default for all crates and ThinLTO allows us to do this without performance loss. * In anther mode, like full LTO today, we'll optimize all upstream dependencies in "thin" mode. Unlike today, however, this LTO step is fully parallelized so should finish much more quickly. There's a good bit of comments about what the implementation is doing and where it came from, but the tl;dr; is that currently most of the support here is copied from upstream LLVM. This code duplication is done for a number of reasons: * Controlling parallelism means we can use the existing jobserver support to avoid overloading machines. * We will likely want a slightly different form of incremental caching which integrates with our own incremental strategy, but this is yet to be determined. * This buys us some flexibility about when/where we run ThinLTO, as well as having it tailored to fit our needs for the time being. * Finally this allows us to reuse some artifacts such as our `TargetMachine` creation, where all our options we used today aren't necessarily supported by upstream LLVM yet. My hope is that we can get some experience with this copy/paste in tree and then eventually upstream some work to LLVM itself to avoid the duplication while still ensuring our needs are met. Otherwise I fear that maintaining these bindings may be quite costly over the years with LLVM updates!
2017-10-06implement pattern-binding-modes RFCTobias Schottdorf-0/+636
See the [RFC] and [tracking issue]. [tracking issue]: https://github.com/rust-lang/rust/issues/42640 [RFC]: https://github.com/rust-lang/rfcs/blob/491e0af/text/2005-match-ergonomics.md
2017-10-06Improve resolution of associated types in macros 2.0Vadim Petrochenkov-0/+34
2017-09-30Auto merge of #44783 - alexcrichton:lto-codegen-units, r=michaelwoeristerbors-0/+15
rustc: Enable LTO and multiple codegen units This commit is a refactoring of the LTO backend in Rust to support compilations with multiple codegen units. The immediate result of this PR is to remove the artificial error emitted by rustc about `-C lto -C codegen-units-8`, but longer term this is intended to lay the groundwork for LTO with incremental compilation and ultimately be the underpinning of ThinLTO support. The problem here that needed solving is that when rustc is producing multiple codegen units in one compilation LTO needs to merge them all together. Previously only upstream dependencies were merged and it was inherently relied on that there was only one local codegen unit. Supporting this involved refactoring the optimization backend architecture for rustc, namely splitting the `optimize_and_codegen` function into `optimize` and `codegen`. After an LLVM module has been optimized it may be blocked and queued up for LTO, and only after LTO are modules code generated. Non-LTO compilations should look the same as they do today backend-wise, we'll spin up a thread for each codegen unit and optimize/codegen in that thread. LTO compilations will, however, send the LLVM module back to the coordinator thread once optimizations have finished. When all LLVM modules have finished optimizing the coordinator will invoke the LTO backend, producing a further list of LLVM modules. Currently this is always a list of one LLVM module. The coordinator then spawns further work to run LTO and code generation passes over each module. In the course of this refactoring a number of other pieces were refactored: * Management of the bytecode encoding in rlibs was centralized into one module instead of being scattered across LTO and linking. * Some internal refactorings on the link stage of the compiler was done to work directly from `CompiledModule` structures instead of lists of paths. * The trans time-graph output was tweaked a little to include a name on each bar and inflate the size of the bars a little
2017-09-30rustc: Enable LTO and multiple codegen unitsAlex Crichton-0/+15
This commit is a refactoring of the LTO backend in Rust to support compilations with multiple codegen units. The immediate result of this PR is to remove the artificial error emitted by rustc about `-C lto -C codegen-units-8`, but longer term this is intended to lay the groundwork for LTO with incremental compilation and ultimately be the underpinning of ThinLTO support. The problem here that needed solving is that when rustc is producing multiple codegen units in one compilation LTO needs to merge them all together. Previously only upstream dependencies were merged and it was inherently relied on that there was only one local codegen unit. Supporting this involved refactoring the optimization backend architecture for rustc, namely splitting the `optimize_and_codegen` function into `optimize` and `codegen`. After an LLVM module has been optimized it may be blocked and queued up for LTO, and only after LTO are modules code generated. Non-LTO compilations should look the same as they do today backend-wise, we'll spin up a thread for each codegen unit and optimize/codegen in that thread. LTO compilations will, however, send the LLVM module back to the coordinator thread once optimizations have finished. When all LLVM modules have finished optimizing the coordinator will invoke the LTO backend, producing a further list of LLVM modules. Currently this is always a list of one LLVM module. The coordinator then spawns further work to run LTO and code generation passes over each module. In the course of this refactoring a number of other pieces were refactored: * Management of the bytecode encoding in rlibs was centralized into one module instead of being scattered across LTO and linking. * Some internal refactorings on the link stage of the compiler was done to work directly from `CompiledModule` structures instead of lists of paths. * The trans time-graph output was tweaked a little to include a name on each bar and inflate the size of the bars a little
2017-09-29Rollup merge of #44287 - Eh2406:master, r=aturonMark Simulacrum-2/+95
Allow T op= &T for built-in numeric types T v2 Manually rebase of @Migi https://github.com/rust-lang/rust/pull/41336
2017-09-27Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkovbors-35/+57
Initial support for `..=` syntax #28237 This PR adds `..=` as a synonym for `...` in patterns and expressions. Since `...` in expressions was never stable, we now issue a warning. cc @durka r? @aturon
2017-09-23Rollup merge of #44770 - dtolnay:borrowed, r=sfacklerCorey Farwell-0/+12
Less confusing placeholder when RefCell is exclusively borrowed Based on ExpHP's comment in [*RefCell.borrow_mut get strange result*](https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994): > it would perhaps be nicer if it didn't put something that could be misinterpreted as a valid string value The previous Debug implementation would show: RefCell { value: "<borrowed>" } The new one is: RefCell { value: <borrowed> }
2017-09-23Rollup merge of #44745 - alexcrichton:no-delim-none, r=estebankCorey Farwell-0/+24
rustc: Don't use DelimToken::None if possible This commit fixes a regression from #44601 where lowering attribute to HIR now involves expanding interpolated tokens to their actual tokens. In that commit all interpolated tokens were surrounded with a `DelimToken::None` group of tokens, but this ended up causing regressions like #44730 where the various attribute parsers in `syntax/attr.rs` weren't ready to cope with `DelimToken::None`. Instead of fixing the parser in `attr.rs` this commit instead opts to just avoid the `DelimToken::None` in the first place, ensuring that the token stream should look the same as it did before where possible. Closes #44730
2017-09-22dotdoteq_in_patterns feature gateBadel2-0/+2
2017-09-22Add support for `..=` syntaxAlex Burka-35/+55
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-09-21Less confusing placeholder when RefCell is exclusively borrowedDavid Tolnay-0/+12
Based on ExpHP's comment in https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994 > it would perhaps be nicer if it didn't put something that could be > misinterpreted as a valid string value The previous Debug implementation would show: RefCell { value: "<borrowed>" } The new one is: RefCell { value: <borrowed> }
2017-09-21Refactor lifetime name into an enumTaylor Cramer-0/+12
2017-09-21rustc: Don't use DelimToken::None if possibleAlex Crichton-0/+24
This commit fixes a regression from #44601 where lowering attribute to HIR now involves expanding interpolated tokens to their actual tokens. In that commit all interpolated tokens were surrounded with a `DelimToken::None` group of tokens, but this ended up causing regressions like #44730 where the various attribute parsers in `syntax/attr.rs` weren't ready to cope with `DelimToken::None`. Instead of fixing the parser in `attr.rs` this commit instead opts to just avoid the `DelimToken::None` in the first place, ensuring that the token stream should look the same as it did before where possible. Closes #44730
2017-09-20Implement underscore lifetimesTaylor Cramer-0/+35
2017-09-21Auto merge of #44551 - scalexm:copy-clone-closures, r=arielb1bors-0/+57
Implement `Copy`/`Clone` for closures Implement RFC [#2132](https://github.com/rust-lang/rfcs/pull/2132) (tracking issue: #44490). NB: I'm not totally sure about the whole feature gates thing, that's my first PR of this kind...
2017-09-20Auto merge of #44392 - Zoxc:yield-order, r=nikomatsakisbors-0/+71
Only consider yields coming after the expressions when computing generator interiors When looking at the scopes which temporaries of expressions can live for during computation of generator interiors, only consider yields which appear after the expression in question in the HIR.
2017-09-20Implement `Copy`/`Clone` for closuresscalexm-0/+57
2017-09-20address review commentsAriel Ben-Yehuda-0/+30
2017-09-20Mark yields after visiting subexpressions. Never ignore yields for scopes in ↵John Kåre Alsaker-21/+0
bindings.
2017-09-20Only consider yields coming after the expressions when computing generator ↵John Kåre Alsaker-0/+62
interiors
2017-09-18[libstd_unicode] Expose UnicodeVersion typeBehnam Esfahbod-0/+22
In <https://github.com/rust-lang/rust/pull/42998>, we added an uninstantiable type for the internal `UNICODE_VERSION` value, `UnicodeVersion`, but it was not made public to the outside of the crate, resulting in the value becoming less useful. Here we make the type accessible from the outside. Also add a run-pass test to make sure the type and value can be accessed as intended.
2017-09-16Auto merge of #43017 - durka:stabilize-const-invocation, r=eddybbors-29/+64
Individualize feature gates for const fn invocation This PR changes the meaning of `#![feature(const_fn)]` so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward. This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review. - `std::cell` - `Cell::new` - `RefCell::new` - `UnsafeCell::new` - `std::mem` - `size_of` - `align_of` - `std::ptr` - `null` - `null_mut` - `std::sync` - `atomic` - `Atomic{Bool,Ptr,Isize,Usize}::new` - `once` - `Once::new` - primitives - `{integer}::min_value` - `{integer}::max_value` Some other functions are const but they are also unstable or hidden, e.g. `Unique::new` so they don't have to be considered at this time. After this stabilization, the following `*_INIT` constants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR. - `std::sync` - `atomic` - `ATOMIC_{BOOL,ISIZE,USIZE}_INIT` - `once` - `ONCE_INIT`
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-26/+36
2017-09-14readd testEh2406-3/+1
2017-09-14Auto merge of #44480 - Zoxc:gen-liveness, r=arielb1bors-0/+30
Analyse storage liveness and preserve it during generator transformation This uses a dataflow analysis on `StorageLive` and `StorageDead` statements to infer where the storage of locals are live. The result of this analysis is intersected with the regular liveness analysis such that a local is can only be live when its storage is. This fixes https://github.com/rust-lang/rust/issues/44184. If the storage of a local is live across a suspension point, we'll insert a `StorageLive` statement for it after the suspension point so storage liveness is preserved. This fixes https://github.com/rust-lang/rust/issues/44179. r? @arielb1
2017-09-14Auto merge of #44484 - tirr-c:issue-44332, r=petrochenkovbors-0/+14
Parse nested closure with two consecutive parameter lists properly This is a followup of #44332. --- Currently, in nightly, this does not compile: ```rust fn main() { let f = |_||x, y| x+y; println!("{}", f(())(1, 2)); // should print 3 } ``` `|_||x, y| x+y` should be parsed as `|_| (|x, y| x+y)`, but the parser didn't accept `||` between `_` and `x`. This patch fixes the problem. r? @petrochenkov
2017-09-13Analyse storage liveness and preserve it during generator transformationJohn Kåre Alsaker-0/+30
2017-09-13honor #[rustc_const_unstable] attributesAlex Burka-0/+25
2017-09-13Auto merge of #44456 - eddyb:stable-drop-const, r=nikomatsakisbors-5/+50
Stabilize drop_types_in_const. Closes #33156, stabilizing the new, revised, rules, and improving the error message. r? @nikomatsakis cc @SergioBenitez
2017-09-12Missing trailing newlineEh2406-1/+1
2017-09-12Auto merge of #43716 - MaloJaffre:_-in-literals, r=petrochenkovbors-0/+14
Accept underscores in unicode escapes Fixes #43692. I don't know if this need an RFC, but at least the impl is here!
2017-09-11Auto merge of #44442 - Aaron1011:promote-static-ref, r=eddybbors-0/+18
Fix regression in promotion of rvalues referencing a static This commit makes librustc_passes::consts::CheckCrateVisitor properly mark expressions as promotable if they reference a static, as it's perfectly fine for one static to reference another. It fixes a regression that prevented a temporary rvalue from referencing a static if it was itself declared within a static. Prior to commit https://github.com/rust-lang/rust/commit/b8c05fe90bc, `region::ScopeTree` would only register a 'terminating scope' for function bodies. Thus, while rvalues in a static that referenced a static would be marked unpromotable, the lack of enclosing scope would cause mem_categorization::MemCategorizationContext::cat_rvalue_node to compute a 'temporary scope' of `ReStatic`. Since this had the same effect as explicitly selecting a scope of `ReStatic` due to the rvalue being marked by CheckCrateVisitor as promotable, no issue occurred. However, commit https://github.com/rust-lang/rust/commit/b8c05fe90bc made ScopeTree unconditionally register a 'terminating scope' Since mem_categorization would now compute a non-static 'temporary scope', the aforementioned rvalues would be erroneously marked as living for too short a time. By fixing the behavior of CheckCrateVisitor, this commit avoids changing mem_categorization's behavior, while ensuring that temporary values in statics are still allowed to reference other statics. Fixes issue #44373
2017-09-11Auto merge of #44383 - qmx:gh/40473/no-inline-trait-method, r=nikomatsakisbors-0/+25
MIR: should not inline trait method Fixes #40473. The idea here is bailing out of inlining if we're talking about a trait method.
2017-09-11Parse nested closure with two consecutive parameter lists properlyWonwoo Choi-0/+14
2017-09-09Auto merge of #44251 - kennytm:osx-backtrace, r=alexcrichtonbors-3/+1
Add libbacktrace support for Apple platforms (resubmitted) Resubmitting #43422 rebased on the current master (cc @JohnColanduoni). I have added an additional commit to fallback to `dladdr`-based `resolve_symbol` if `libbacktrace` returns `None`, otherwise the stack trace will be full of `<unknown>` when you forget to pass the `-g` flag (actually it seems — at least on macOS — the `dladdr` symbol is more accurate than the `libbacktrace` one).
2017-09-09Stabilize drop_types_in_const.Eduard-Mihai Burtescu-5/+50
2017-09-09Auto merge of #44212 - eddyb:drop-const, r=nikomatsakisbors-2/+20
Allow Drop types in const's too, with #![feature(drop_types_in_const)]. Implements the remaining amendment, see #33156. cc @SergioBenitez r? @nikomatsakis
2017-09-08Fix regression in promotion of rvalues referencing a staticAaron Hill-0/+18
This commit makes librustc_passes::consts::CheckCrateVisitor properly mark expressions as promotable if they reference a static, as it's perfectly fine for one static to reference another. It fixes a regression that prevented a temporary rvalue from referencing a static if it was itself declared within a static. Prior to commit https://github.com/rust-lang/rust/commit/b8c05fe90bc, `region::ScopeTree` would only register a 'terminating scope' for function bodies. Thus, while rvalues in a static that referenced a static would be marked unpromotable, the lack of enclosing scope would cause mem_categorization::MemCategorizationContext::cat_rvalue_node to compute a 'temporary scope' of `ReStatic`. Since this had the same effect as explicitly selecting a scope of `ReStatic` due to the rvalue being marked by CheckCrateVisitor as promotable, no issue occurred. However, commit https://github.com/rust-lang/rust/commit/b8c05fe90bc made ScopeTree unconditionally register a 'terminating scope' Since mem_categorization would now compute a non-static 'temporary scope', the aforementioned rvalues would be erroneously marked as living for too short a time. By fixing the behavior of CheckCrateVisitor, this commit avoids changing mem_categorization's behavior, while ensuring that temporary values in statics are still allowed to reference other statics. Fixes issue #44373
2017-09-06better test documentationDouglas Campos-0/+2
2017-09-06add broken testDouglas Campos-0/+23
2017-09-06Rollup merge of #44327 - Eh2406:FIXME#12808, r=aturonMark Simulacrum-2/+1
#12808 is closed remove the FIXME let's see if this can be cleaned up. https://github.com/rust-lang/rust/issues/12808#issuecomment-326852052
2017-09-06Rollup merge of #44326 - Eh2406:FIXME#44590, r=arielb1Mark Simulacrum-3/+2
#33490 is closed remove the FIXME let's see if this can be cleaned up. https://github.com/rust-lang/rust/issues/33490#issuecomment-326851930
2017-09-06Rollup merge of #44277 - mattico:test-33185, r=nikomatsakisMark Simulacrum-0/+26
Add test for #33185 Closes #33185
2017-09-06Rollup merge of #44276 - mattico:test-35376, r=alexcrichtonMark Simulacrum-0/+51
Add test for #35676 Closes #35676
2017-09-04#12808 is closed remove the FIXMEEh2406-2/+1
2017-09-04#33490 is closed remove the FIXMEEh2406-3/+2
2017-09-03get ci greenEh2406-1/+3