about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2018-07-10improve error message shown for unsafe operations: explain why undefined ↵Ralf Jung-71/+28
behavior could arise Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673
2018-07-09Implement #[alloc_error_handler]Simon Sapin-0/+101
This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the alloc crate without the std crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
2018-07-09bump minimum LLVM version to 5.0gnzlbg-1/+0
2018-07-06Rollup merge of #52083 - spastorino:dont-run-ast-borrowck-on-mir-mode, ↵Mark Rousskov-4/+4
r=nikomatsakis Dont run ast borrowck on mir mode r? @nikomatsakis
2018-07-06Auto merge of #52021 - nikomatsakis:nll-region-errors, r=estebankbors-7/+6
refactor and cleanup region errors for NLL This is a WIP commit. It simplifies some of the code from https://github.com/rust-lang/rust/pull/51536 and extends a few more steps towards the errors that @davidtwco and I were shooting for. These are intended as a replacement for the general "unable to infer lifetime" messages -- one that is actually actionable. We're certainly not there yet, but the overall shape hopefully gets a bit clearer. I'm thinking about trying to open up an internals thread to sketch out the overall plan and perhaps discuss how to get the wording right, which special cases to handle, etc. r? @estebank cc @davidtwco
2018-07-06Auto merge of #52018 - flip1995:rfc2103, r=oli-obkbors-0/+46
Implementation of tool lints. Tracking issue: #44690
2018-07-06Rollup merge of #52016 - oli-obk:dedup_static_errors, r=estebankkennytm-4/+0
Deduplicate error reports for statics fixes #51970
2018-07-04Remove rustc_mir_borrowck attribute and use rustc_mir insteadSantiago Pastorino-4/+4
2018-07-04Improving span of unknown lint tool error messageflip1995-2/+2
2018-07-04Tests for tool_lintsflip1995-0/+46
2018-07-04write code to extract region names and emit new style messageNiko Matsakis-7/+6
2018-07-03Auto merge of #51926 - matthewjasper:Initialization-span, r=nikomatsakisbors-2/+2
[NLL] Use better span for initializing a variable twice Closes #51217 When assigning to a (projection from a) local immutable local which starts initialised (everything except `let PATTERN;`): * Point to the declaration of that local * Make the error message refer to the local, rather than the projection. r? @nikomatsakis
2018-07-03Deduplicate error reports for staticsOliver Schneider-4/+0
2018-07-03Rollup merge of #51958 - euclio:attr-refactor, r=petrochenkovPietro Albini-37/+0
Show known meta items in unknown meta items error This PR adds a label to E0541. It also factors built-in attribute parsing into a submodule of `attr` for ease of future refactoring. Fixes #51469.
2018-07-01Auto merge of #51110 - alexreg:new-static-eval-rules, r=eddybbors-109/+27
Loosened rules involving statics mentioning other statics Before this PR, trying to mention a static in any way other than taking a reference to it caused a compile-time error. So, while ```rust static A: u32 = 42; static B: &u32 = &A; ``` compiles successfully, ```rust static A: u32 = 42; static B: u32 = A; // error ``` and ```rust static A: u32 = 42; static B: u32 = *&A; // error ``` are not possible to express in Rust. On the other hand, introducing an intermediate `const fn` can presently allow one to do just that: ```rust static A: u32 = 42; static B: u32 = foo(&A); // success! const fn foo(a: &u32) -> u32 { *a } ``` Preventing `const fn` from allowing to work around the ban on reading from statics would cripple `const fn` almost into uselessness. Additionally, the limitation for reading from statics comes from the old const evaluator(s) and is not shared by `miri`. This PR loosens the rules around use of statics to allow statics to evaluate other statics by value, allowing all of the above examples to compile and run successfully. Reads from extern (foreign) statics are however still disallowed by miri, because there is no compile-time value to be read. ```rust extern static A: u32; static B: u32 = A; // error ``` This opens up a new avenue of potential issues, as a static can now not just refer to other statics or read from other statics, but even contain references that point into itself. While it might seem like this could cause subtle bugs like allowing a static to be initialized by its own value, this is inherently impossible in miri. Reading from a static causes the `const_eval` query for that static to be invoked. Calling the `const_eval` query for a static while already inside the `const_eval` query of said static will cause cycle errors. It is not possible to accidentally create a bug in miri that would enable initializing a static with itself, because the memory of the static *does not exist* while being initialized. The memory is not uninitialized, it is not there. Thus any change that would accidentally allow reading from a not yet initialized static would cause ICEs. Tests have been modified according to the new rules, and new tests have been added for writing to `static mut`s within definitions of statics (which needs to fail), and incremental compilation with complex/interlinking static definitions. Note that incremental compilation did not need to be adjusted, because all of this was already possible before with workarounds (like intermediate `const fn`s) and the encoding/decoding already supports all the possible cases. r? @eddyb
2018-07-01Auto merge of #51969 - pietroalbini:rollup, r=pietroalbinibors-1/+19
Rollup of 7 pull requests Successful merges: - #51511 (Stabilize Iterator::flatten in 1.29, fixes #48213.) - #51853 (Fix some doc links) - #51890 (Fix inconsequential typo in GlobalAlloc doc example) - #51920 (use literal span for concrete type suggestion) - #51921 (improve the error message when `#[panic_implementation]` is missing) - #51922 (rename the llvm-tools component to llvm-tools-preview and tweak its image) - #51961 (Fix typo in /src/librustc_resolve/lib.rs) Failed merges: r? @ghost
2018-07-01Rollup merge of #51921 - japaric:panic-impl-error, r=nagisaPietro Albini-1/+19
improve the error message when `#[panic_implementation]` is missing closes #51341 r? @nagisa cc @phil-opp
2018-07-01Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obkbors-0/+24
Speed up compilation of large constant arrays This is a different approach to #51672 as suggested by @oli-obk. Rather than write each repeated value one-by-one, we write the first one and then copy its value directly into the remaining memory. With this change, the [toy program](https://github.com/rust-lang/rust/blob/c2f4744d2db4e162df824d0bd0b093ba4b351545/src/test/run-pass/mir_heavy_promoted.rs) goes from 63 seconds to 19 seconds on my machine. Edit: Inlining `Size::bytes()` saves an additional 6 seconds dropping the total time to 13 seconds on my machine. Edit2: Now down to 2.8 seconds. r? @oli-obk cc @nnethercote @eddyb
2018-07-01Add two regression tests for const evalWesley Wiser-0/+24
2018-07-01Modified expected error messages in accordance with rebase.Alexander Regueiro-2/+7
2018-06-30move deprecation-sanity test to uiAndy Russell-37/+0
2018-06-30Minor refactoring.Alexander Regueiro-1/+1
2018-06-30Added tests fo referring to statics by value in other statics.Alexander Regueiro-0/+14
2018-06-30Added tests for writing to static mut's in statics.Alexander Regueiro-0/+22
2018-06-30Fixed bug with miri const evaluation where allocation is recursively borrowed.Alexander Regueiro-38/+1
2018-06-30Added miri error for evaluating foreign statics.Alexander Regueiro-67/+7
Updated tests accordingly.
2018-06-30Loosened rules involving statics mentioning other statics.Alexander Regueiro-26/+0
Updated tests accordingly.
2018-06-30Improve error messages when assigning to a local that starts initializedMatthew Jasper-2/+2
2018-06-30Auto merge of #51806 - oli-obk:lowering_cleanups1, r=cramertjbors-0/+2
Lowering cleanups [1/N]
2018-06-29update another cfail testJorge Aparicio-1/+1
2018-06-29improve the error message when `#[panic_implementation]` is missingJorge Aparicio-0/+18
closes #51341
2018-06-29Auto merge of #51729 - matthewjasper:move-errors, r=nikomatsakisbors-1/+1
[NLL] Better move errors Make a number of changes to improve the quality of NLL cannot move errors. * Group errors that occur in the same `match` with the same cause. * Suggest `ref`, `&` or removing `*` to avoid the move. * Show the place being matched on. Differences from AST borrowck: * `&` is suggested over `ref` when matching on a place that can't be moved from. * Removing `*` is suggested instead of adding `&` when applicable. * Sub-pattern spans aren't used, this would probably need Spans on Places. Closes #45699 Closes #46627 Closes #51187 Closes #51189 r? @pnkfelix
2018-06-28Rollup merge of #51636 - oli-obk:const_diagnostics, r=eddybMark Rousskov-35/+3
Refactor error reporting of constants cc @eddyb This PR should not change any behaviour. It solely simplifies the internal handling of the errors
2018-06-28Auto merge of #51630 - joshlf:map-split-perf, r=dtolnaybors-4/+4
Optimize RefCell refcount tracking Address the performance concern raised in https://github.com/rust-lang/rust/pull/51466#issuecomment-398255276 cc @dtolnay @nnethercote @rust-lang/wg-compiler-performance cc @RalfJung @jhjourdan for soundness concerns Can somebody kick off a perf run on this? I'm not sure how that's done, but I understand it has to be started manually. The idea of this change is to switch to representing mutable refcount as values below 0 to eliminate some branching that was required with the old algorithm.
2018-06-28Turn the use of erroneous constants into errors againOliver Schneider-0/+2
2018-06-28Don't const propagate the body of constantsOliver Schneider-39/+1
2018-06-28Merge `ConstVal` and `ConstValue`Oliver Schneider-3/+7
2018-06-28Rollup merge of #51800 - mark-i-m:edition2018compiletest, r=nikomatsakiskennytm-6/+6
Add a compiletest header for edition r? @nikomatsakis Are the `-Zunstable-options` options needed in these tests? It looks like they aren't. If not, I can remove them.
2018-06-28Rollup merge of #51799 - mark-i-m:lower_case_feature_gate, r=mark-i-mkennytm-3/+3
Lower case some feature gate error messages
2018-06-27Update tests for grouped nll move errorsMatthew Jasper-1/+1
2018-06-27Update testsOliver Schneider-0/+2
2018-06-27Optimize RefCell refcount trackingJoshua Liebow-Feeser-4/+4
2018-06-26add edition compiletest header + fix testsmark-6/+6
2018-06-26lower case some feature gate messagesmark-3/+3
2018-06-26migrate codebase to `..=` inclusive range patternsZack M. Davis-14/+13
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
2018-06-26Auto merge of #51805 - pietroalbini:rollup, r=pietroalbinibors-52/+52
Rollup of 11 pull requests Successful merges: - #51104 (add `dyn ` to display of dynamic (trait) types) - #51153 (Link panic and compile_error docs) - #51642 (Fix unknown windows build) - #51730 (New safe associated functions for PinMut) - #51731 (Fix ICEs when using continue as an array length inside closures (inside loop conditions)) - #51747 (Add error for using null characters in #[export_name]) - #51769 (Update broken rustc-guide links) - #51786 (Remove unnecessary stat64 pointer casts) - #51788 (Fix typo) - #51789 (Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`) - #51791 (Minify css) Failed merges: r? @ghost
2018-06-26Rollup merge of #51104 - zackmdavis:dynamo, r=nikomatsakisPietro Albini-52/+52
add `dyn ` to display of dynamic (trait) types ~~I'm not sure we want the `dyn` in the E0277 "trait bound [...] is not satisfied" messages ("bound" sounds like a different thing in contrast to the names of specific trait-object types like `Box<dyn Trait>`), but I'm finding the code I would need to change that hard to follow—the [display object seems to](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/traits/error_reporting.rs#L600) be a [`Predicate::Trait`](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L962) variant, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L1309) calls `.print` on its `PolyTraitPredicate` member, [which is a type alias](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L1112) for `ty::Binder<TraitPredicate<'tcx>>`, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L975-L985) ... _&c._— so maybe it's time to pull-request this and see what reviewers think.~~ Resolves #49277 (?). r? @nikomatsakis
2018-06-26Auto merge of #49469 - Nokel81:allow-irrefutable-let-patterns, r=nikomatsakisbors-0/+49
Implementation of RFC 2086 - Allow Irrefutable Let patterns This is the set of changes for RFC2086. Tracking issue #44495. Rendered [here](https://github.com/rust-lang/rfcs/pull/2086)
2018-06-25Make where clause object safety be a warn-by-default lintleonardo.yvens-2/+2
2018-06-23add `dyn` to display of dynamic (trait) type namesZack M. Davis-52/+52
The `dyn Trait` syntax was stabilized in 199ee327. Resolves #49277.