summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2017-04-04Fix ICE with nested macros in certain situations.Jeffrey Seyfried-0/+19
2017-04-01update LLVM with fix for PR32379Ariel Ben-Yehuda-0/+38
Fixes #40593.
2017-03-31add regression test for #39984Niko Matsakis-0/+21
Fixes #39984
2017-03-31Revert "Auto merge of #39485 - canndrew:inference-fix-39297, r=nikomatsakis"Niko Matsakis-26/+4
This reverts commit dc0bb3f2839c13ab42feacd423f728fbfd2f2f7a, reversing changes made to e879aa43ef63962f8e4d797292194a9f40a22a13. This is a temporary step intended to fix regressions. A more comprehensive fix for type inference and dead-code is in the works.
2017-03-20Propagate expected type hints through struct literals.Eduard-Mihai Burtescu-0/+20
2017-03-20Fix regression when `include!()`ing a `macro_rules!` containing a `$crate::` ↵Jeffrey Seyfried-0/+29
path.
2017-03-11Rollup merge of #40373 - TimNN:test-ub-packed, r=arielb1Ariel Ben-Yehuda-1/+20
Fix UB in repr(packed) tests r? @arielb1 cc #37609 and #27060
2017-03-11Rollup merge of #40319 - eddyb:it's-"unsize"-not-"unsound", r=nikomatsakisAriel Ben-Yehuda-0/+48
Disallow subtyping between T and U in T: Unsize<U>. Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes #40288. E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes. Subtyping here was introduced with `Unsize` in #24619 (landed in 1.1, original PR is #23785).
2017-03-09Use subtyping on the target of unsizing coercions.Eduard-Mihai Burtescu-0/+48
2017-03-08fix UB in repr(packed) testsTim Neumann-1/+20
2017-03-07Add tests for issues with the 'E-needtest' label.topecongiro-0/+42
2017-03-06Auto merge of #40272 - jseyfried:fix_const_macro_invocations, r=petrochenkovbors-0/+24
macros: fix const expression invocations Fixes #40136. r? @nrc
2017-03-06Add missing tests for 'E-needstest' labeled issuestopecongiro-0/+77
2017-03-05Fix const expression macro invocations.Jeffrey Seyfried-0/+24
2017-03-04Auto merge of #40242 - cramertj:fix-while-let-ribs-scope, r=petrochenkovbors-0/+16
Fix missing WhileLet pattern scope Fix #40235
2017-03-04Auto merge of #40163 - arielb1:normalization-1702, r=nikomatsakisbors-0/+96
More through normalization, Feb/Mar 2017 edition Fix a few normalization bugs. Fixes #27901. Fixes #28828. Fixes #38135. Fixes #39363. Fixes #39367.
2017-03-03Fix missing WhileLet pattern scopeTaylor Cramer-0/+16
2017-03-03Auto merge of #40133 - arielb1:operand-lifetimes, r=eddybbors-0/+55
[MIR] improve operand lifetimes r? @eddyb
2017-03-03make operands live to the end of their containing expressionAriel Ben-Yehuda-4/+17
In MIR construction, operands need to live exactly until they are used, which is during the (sub)expression that made the call to `as_operand`. Before this PR, operands lived until the end of the temporary scope, which was sometimes unnecessarily longer and sometimes too short. Fixes #38669.
2017-03-02schedule drops on bindings only after initializing themAriel Ben-Yehuda-0/+42
This reduces the number of dynamic drops in libstd from 1141 to 899. However, without this change, the next patch would have created much more dynamic drops. A basic merge unswitching hack reduced the number of dynamic drops to 644, with no effect on stack usage. I should be writing a more dedicated drop unswitching pass. No performance measurements.
2017-03-02Rollup merge of #40166 - aidanhs:aphs-index-coerce, r=nikomatsakisCorey Farwell-0/+22
Allow types passed to [] to coerce, like .index() Fixes #40085 Basically steals the relevant part of [check_argument_types](https://github.com/rust-lang/rust/blob/1.15.1/src/librustc_typeck/check/mod.rs#L2653-L2672).
2017-03-01inhibit enum layout optimizations under `#[repr(C)]` or `#[repr(u8)]`Niko Matsakis-0/+59
Fixes #40029
2017-03-01store the normalized types of statics in MIR LvaluesAriel Ben-Yehuda-0/+49
The types of statics, like all other items, are stored in the tcx unnormalized. This is necessarily so, because a) Item types other than statics have generics, which can't be normalized. b) Eager normalization causes undesirable on-demand dependencies. Keeping with the principle that MIR lvalues require no normalization in order to interpret, this patch stores the normalized type of the statics in the Lvalue and reads it to get the lvalue type. Fixes #39367.
2017-03-01more through normalization in typeck & transAriel Ben-Yehuda-0/+47
Fixes #27901. Fixes #28828. Fixes #38135. Fixes #39363.
2017-03-01Auto merge of #34198 - eddyb:you're-a-bad-transmute-and-you-should-feel-bad, ↵bors-27/+0
r=nikomatsakis Make transmuting from fn item types to pointer-sized types a hard error. Closes #19925 by removing the future compatibility lint and the associated workarounds. This is a `[breaking-change]` if you `transmute` from a function item without casting first. For more information on how to fix your code, see https://github.com/rust-lang/rust/issues/19925.
2017-03-01Allow types passed to [] to coerce, like .index()Aidan Hobson Sayers-0/+22
Fixes #40085
2017-02-28Add `syntax::ext::tt::quoted::{TokenTree, ..}` and remove ↵Jeffrey Seyfried-0/+14
`tokenstream::TokenTree::Sequence`.
2017-02-28Make transmuting from fn item types to pointer-sized types a hard error.Eduard Burtescu-27/+0
2017-02-28Auto merge of #40008 - eddyb:lazy-12, r=nikomatsakisbors-13/+54
[12/12] On-demand type-checking, const-evaluation, MIR building & const-qualification. _This is the last of a series ([prev](https://github.com/rust-lang/rust/pull/38813)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments._ <hr> As this contains all of the changes that didn't fit neatly into other PRs, I'll be elaborating a bit: ### User-facing changes * when determining whether an `impl Trait` type implements an auto-trait (e.g. `Send` or `Sync`), the function the `impl Trait` came from has to be inferred and type-checking, disallowing cycles * this results from not having an obvious place to put the "deferred obligation" in on-demand atm * while we could model side-effects like that and "post-processing passes" better, it's still more limiting than being able to know the result in the original function (e.g. specialization) *and* there are serious problems around region-checking (if a `Send` impl required `'static`, it wasn't enforced) * early const-eval requires type-checking and const-qualification to be performed first, which means: * you get the intended errors before (if any) constant evaluation error that is simply fallout * associated consts should always work now, and `const fn` type parameters are properly tracked * don't get too excited, array lengths still can't depend on type parameters * #38864 works as intended now, with `Self` being allowed in `impl` bounds * #32205 is largely improved, with associated types being limited to "exact match" `impl`s (as opposed to traversing the specialization graph to resolve unspecified type parameters to their defaults in another `impl` or in the `trait`) *while* checking for overlaps building the specialization graph for that trait - once all the trait impls' have been checked for coherence (including ahead-of-time/on-demand), it's uniform * [crater report](https://gist.github.com/eddyb/bbb869072468c7e08d6d808e75938051) looks clean (aside from `clippy` which broke due to `rustc` internal changes) ### Compiler-internal changes * `ty::Generics` * no longer contains the actual type parameter defaults, instead they're associated with the type parameter's `DefId`, like associated types in a trait definition * this allows computing `ty::Generics` as a leaf (reading only its own HIR) * holds a mapping from `DefIndex` of type parameters to their indices * `ty::AdtDef` * only tracks `#[repr(simd)]` in its `ReprOptions` `repr` field * doesn't contain `enum` discriminant values, but instead each variant either refers to either an explicit value for its discriminant, or the distance from the last explicit discriminant, if any * the `.discriminants(tcx)` method produces an iterator of `ConstInt` values, looking up explicit discriminants in a separate map, if necessary * this allows computing `ty::AdtDef` as a leaf (reading only its own HIR) * Small note: the two above (`Generics`, `AdtDef`), `TraitDef` and `AssociatedItem` should probably end up as part of the HIR, eventually, as they're trivially constructed from it * `ty::FnSig` * now also holds ABI and unsafety, alongside argument types, return type and C variadicity * `&ty::BareFnTy` and `ty::ClosureTy` have been replaced with `PolyFnSig = Binder<FnSig>` * `BareFnTy` was interned and `ClosureTy` was treated as non-trivial to `Clone` because they had a `PolyFnSig` and so used to contain a `Vec<Ty>` (now `&[Ty]`) * `ty::maps` * all the `DepTrackingMap`s have been grouped in a structure available at `tcx.maps` * when creating the `tcx`, a set of `Providers` (one `fn` pointer per map) is required for the local crate, and one for all other crates (i.e. metadata loading), `librustc_driver` plugging the various crates (e.g. `librustc_metadata`, `librustc_typeck`, `librustc_mir`) into it * when a map is queried and the value is missing, the appropriate `fn` pointer from the `Providers` of that crate is called with the `TyCtxt` and the key being queried, to produce the value on-demand * `rustc_const_eval` * demands both `typeck_tables` and `mir_const_qualif` (in preparation for miri) * tracks `Substs` in `ConstVal::Function` for `const fn` calls * returns `TypeckError` if type-checking has failed (or cases that can only be reached if it had) * this error kind is never reported, resulting in less noisy/redundant diagnostics * fixes #39548 (testcase by @larsluthman, taken from #39812, which this supersedes) * on-demand has so far been hooked up to: * `rustc_metadata::cstore_impl`: `ty`, `generics`, `predicates`, `super_predicates`, `trait_def`, `adt_def`, `variances`, `associated_item_def_ids`, `associated_item`, `impl_trait_ref`, `custom_coerce_unsized_kind`, `mir`, `mir_const_qualif`, `typeck_tables`, `closure_kind`, `closure_type` * `rustc_typeck::collect`: `ty`, `generics`, `predicates`, `super_predicates`, `type_param_predicates`, `trait_def`, `adt_def`, `impl_trait_ref` * `rustc_typeck::coherence`: `coherent_trait`, `coherent_inherent_impls` * `rustc_typeck::check`: `typeck_tables`, `closure_type`, `closure_kind` * `rustc_mir::mir_map`: `mir` * `rustc_mir::transform::qualify_consts`: `mir_const_qualif`
2017-02-27Auto merge of #38165 - Yamakaky:better-backtrace, r=petrochenkovbors-3/+4
Improve backtrace formating while panicking. Fixes #37783. Done: - Fix alignment of file paths for better readability - `RUST_BACKTRACE=full` prints all the informations (current behaviour) - `RUST_BACKTRACE=(short|yes)` is the default and does: - Skip irrelevant frames at the beginning and the end - Remove function address - Remove the current directory from the absolute paths - Remove `::hfabe6541873` at the end of the symbols - `RUST_BACKTRACE=(0|no)` disables the backtrace. - `RUST_BACKTRACE=<everything else>` is equivalent to `short` for backward compatibility. - doc - More uniform printing across platforms. Removed, TODO in a new PR: - Remove path prefix for libraries and libstd Example of short backtrace: ```rust fn fail() { panic!(); } fn main() { let closure = || fail(); closure(); } ``` Short: ``` thread 'main' panicked at 'explicit panic', t.rs:2 Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. stack backtrace: 0: t::fail at ./t.rs:2 1: t::main::{{closure}} at ./t.rs:6 2: t::main at ./t.rs:7 ``` Full: ``` thread 'main' panicked at 'This function never returns!', t.rs:2 stack backtrace: 0: 0x558ddf666478 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hec84c9dd8389cc5d at /home/yamakaky/dev/rust/rust/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: 0x558ddf65d90e - std::sys_common::backtrace::_print::hfa25f8b31f4b4353 at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:71 2: 0x558ddf65cb5e - std::sys_common::backtrace::print::h9b711e11ac3ba805 at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:60 3: 0x558ddf66796e - std::panicking::default_hook::{{closure}}::h736d216e74748044 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:355 4: 0x558ddf66743c - std::panicking::default_hook::h16baff397e46ea10 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:371 5: 0x558ddf6682bc - std::panicking::rust_panic_with_hook::h6d5a9bb4eca42c80 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:559 6: 0x558ddf64ea93 - std::panicking::begin_panic::h17dc549df2f10b99 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:521 7: 0x558ddf64ec42 - t::diverges::he6bc43fc925905f5 at /tmp/p/t.rs:2 8: 0x558ddf64ec5a - t::main::h0ffc20356b8a69c0 at /tmp/p/t.rs:6 9: 0x558ddf6687f5 - core::ops::FnOnce::call_once::hce41f19c0db56f93 10: 0x558ddf667cde - std::panicking::try::do_call::hd4c8c97efb4291df at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:464 11: 0x558ddf698d77 - __rust_try 12: 0x558ddf698c57 - __rust_maybe_catch_panic at /home/yamakaky/dev/rust/rust/src/libpanic_unwind/lib.rs:98 13: 0x558ddf667adb - std::panicking::try::h2c56ed2a59ec1d12 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:440 14: 0x558ddf66cc9a - std::panic::catch_unwind::h390834e0251cc9af at /home/yamakaky/dev/rust/rust/src/libstd/panic.rs:361 15: 0x558ddf6809ee - std::rt::lang_start::hb73087428e233982 at /home/yamakaky/dev/rust/rust/src/libstd/rt.rs:57 16: 0x558ddf64ec92 - main 17: 0x7fecb869e290 - __libc_start_main 18: 0x558ddf64e8b9 - _start 19: 0x0 - <unknown> ```
2017-02-27This test is too hard to maintain cross-platformYamakaky-46/+0
2017-02-25rustc_const_eval: always demand typeck_tables for evaluating constants.Eduard-Mihai Burtescu-0/+38
2017-02-25rustc_typeck: hook up collect and item/body check to on-demand.Eduard-Mihai Burtescu-13/+13
2017-02-25rustc_typeck: simplify AstConv requests as implemented by collect.Eduard-Mihai Burtescu-0/+3
2017-02-25Rollup merge of #40064 - arielb1:virtual-enum, r=nikomatsakisEduard-Mihai Burtescu-0/+51
trans: don't ICE when trying to create ADT trans-items ADTs are translated in-place from rustc_trans::callee, so no trans-items are needed. This fix will be superseded by the shimmir branch, but I prefer not to backport that to beta. Fixes #39823. Beta-nominating because regression. r? @michaelwoerister
2017-02-25Rollup merge of #40037 - froydnj:overflow-checks, r=alexcrichtonEduard-Mihai Burtescu-0/+35
add `-C overflow-checks` option In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks. This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks. I was seeing a [run-pass/issue-28950.rs](https://github.com/rust-lang/rust/blob/b1363a73ede57ae595f3a1be2bb75d308ba4f7f6/src/test/run-pass/issue-28950.rs) failure on my machine with these patches, but I was also seeing the failure without the changes to the core compiler. We'll see what travis says. Fixes #33134. r? @alexcrichton
2017-02-25Rollup merge of #40027 - cramertj:stabilize_static_recursion, r=nrcEduard-Mihai Burtescu-6/+0
Stabilize static_recursion Fix #29719.
2017-02-25Rollup merge of #40025 - est31:master, r=eddybEduard-Mihai Burtescu-0/+41
Implement non-capturing closure to fn coercion Implements non capturing closure coercion ([RFC 1558](https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md)). cc tracking issue #39817
2017-02-25Rollup merge of #40022 - wagenet:lib-defaults, r=alexcrichtonEduard-Mihai Burtescu-0/+38
Better handling of lib defaults r? @alexcrichton
2017-02-25Rollup merge of #40020 - alexcrichton:fix-unwind-safe, r=sfacklerEduard-Mihai Burtescu-1/+4
std: Relax UnwindSafe impl for Unique Add the `?Sized` bound as we don't require the type to be sized. Closes #40011
2017-02-25Rollup merge of #39980 - arielb1:privately-uninhabited, r=nikomatsakisEduard-Mihai Burtescu-0/+25
check_match: don't treat privately uninhabited types as uninhabited Fixes #38972, which is a regression in 1.16 from @canndrew's patchset. r? @nikomatsakis beta-nominating because regression.
2017-02-25Rollup merge of #39864 - cramertj:normalize-breaks, r=nikomatsakisEduard-Mihai Burtescu-1/+9
Normalize labeled and unlabeled breaks Part of #39849.
2017-02-24Review changesest31-8/+8
* use more convenient mk_substs function * remove type annotations * use map_bound one level farther outside * style improvements
2017-02-23Feature gateest31-1/+1
2017-02-23Implement non-capturing closure to fn coercionest31-0/+41
2017-02-23use a more conservative inhabitableness ruleAriel Ben-Yehuda-5/+1
This is a [breaking-change] from 1.15, because this used to compile: ```Rust enum Void {} fn foo(x: &Void) { match x {} } ```
2017-02-23Add tests for lib defaultsPeter Wagenet-0/+38
2017-02-23Fix tests on Windows (#1)Vadim Petrochenkov-2/+2
2017-02-23trans: don't ICE when trying to create ADT trans-itemsAriel Ben-Yehuda-0/+51
ADTs are translated in-place from rustc_trans::callee, so no trans-items are needed. This fix will be superseded by the shimmir branch, but I prefer not to backport that to beta. Fixes #39823.
2017-02-22add `-C overflow-checks` optionNathan Froyd-0/+35
In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks. This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks. Fixes #33134.