about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-12-02Rollup merge of #66654 - ecstatic-morse:check-consts-ref, r=eddyb,matthewjasperRalf Jung-52/+44
Handle const-checks for `&mut` outside of `HasMutInterior` Addresses [this comment](https://github.com/rust-lang/rust/pull/64470#discussion_r328200508). Const-checking relied on `HasMutInterior` to forbid `&mut` in a const context. This was strange because all we needed to do was look for an `Rvalue::Ref` with a certain `BorrowKind`, whereas the `Qualif` traits are specifically meant to get the qualifs for a *value*. This PR removes that logic from `HasMutInterior` and moves it into `check_consts::Validator`. As a result, we can now properly handle qualifications for `static`s, which had to be ignored previously since you can e.g. borrow a static `Cell` from another `static`. We also remove the `derived_from_illegal_borrow` logic, since it is no longer necessary; we give good errors for subsequent reborrows/borrows of illegal borrows.
2019-12-02Rollup merge of #66245 - tmiasko:cfg-sanitize, r=oli-obkRalf Jung-0/+41
Conditional compilation for sanitizers Configure sanitize option when compiling with a sanitizer to make it possible to execute different code depending on whether given sanitizer is enabled or not.
2019-12-02Rollup merge of #66907 - eddyb:br-nicer-named, r=oli-obkMazdak Farrokhzad-20/+20
rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl. Context: these `fmt::Debug` impls only get used with `-Z verbose` (which some tests use). I was going to print the path like in #66850 (or rather, use `DefId`'s `fmt::Debug`, which is close but not as nice), but then I realized that most of the `DefId`s were `crate0:DefIndex(0)`, i.e. the crate root. As the crate root is not a lifetime, they're clearly dummies of some sort, and we don't have to print anything other than the name for them. This means that out of all the tests, there's only 5 instances of `BrNamed` that now print the full path to the lifetime parameter, and everything else is shorter instead, which doesn't feel too bad. cc @nikomatsakis
2019-12-02Rollup merge of #66905 - petrochenkov:rmplugin2, r=CentrilMazdak Farrokhzad-122/+53
rustc_plugin: Remove some remaining plugin features - Plugin arguments (`#![plugin(my_plugin(args))]`) are no longer supported. - Registering additional plugins from command line (`-Z extra-plugins=my_plugin`) is no longer supported, `-Z crate-attr=plugin(my_plugin)` can be used instead. - Lint `plugin_as_library` is removed as mostly useless now, when plugins exist as a compatibility feature with greatly reduced functionality. - Plugins registering additional LLVM passes (`Registry::register_llvm_pass`) are no longer supported, `-C passes=my_passes` can be used instead. r? @Centril
2019-12-02Rollup merge of #66850 - eddyb:span-free-formats, r=oli-obkMazdak Farrokhzad-10/+10
rustc: hide HirId's fmt::Debug output from -Z span_free_formats. This replaces the only occurrences of `HirId {...}` from tests with paths, i.e.: ```rust [closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T] ``` becomes, after this PR: ```rust [closure@foo<T>::{{closure}}#0 q:&i32, t:&T] ``` r? @oli-obk cc @michaelwoerister
2019-12-01rustc_plugin: Some further cleanupVadim Petrochenkov-18/+2
Remove a useless test
2019-12-01rustc_plugin: Remove support for plugins adding LLVM passesVadim Petrochenkov-35/+0
2019-12-01rustc_lint: Remove lint `plugin_as_library`Vadim Petrochenkov-24/+4
2019-12-01rustc_plugin: Remove support for adding plugins from command lineVadim Petrochenkov-3/+11
2019-12-01rustc_plugin: Remove support for plugin argumentsVadim Petrochenkov-33/+27
2019-12-01Conditional compilation for sanitizersTomasz Miąsko-0/+41
Configure sanitize option when compiling with a sanitizer to make it possible to execute different code depending on whether given sanitizer is enabled or not.
2019-12-01Rollup merge of #66880 - aDotInTheVoid:add-E0203-long, r=GuillaumeGomezMazdak Farrokhzad-0/+1
Add long error code explanation message for E0203 Addressed some of #61137 r? @GuillaumeGomez
2019-12-01Rollup merge of #66679 - mark-i-m:fix-anon-lifetime-errors, r=matthewjasperMazdak Farrokhzad-103/+82
Improve lifetime errors with implicit trait object lifetimes r? @matthewjasper cc @estebank I still think the ideal solution would be to construct a `BrAnon`, but that seems like a more invasive change, and can be done later. This at least gets rid of the hack in `OutliveSuggestion` and is slightly more principled.
2019-11-30Rollup merge of #66870 - tmiasko:simplify-ty, r=oli-obkMazdak Farrokhzad-0/+95
SimplifyArmIdentity only for locals with the same type Fixes #66856 Fixes #66851
2019-11-30Rollup merge of #66612 - Nadrieril:or-patterns-initial, r=varkorMazdak Farrokhzad-0/+238
Initial implementation of or-pattern usefulness checking The title says it all. I'd like to request a perf run on that, hopefully this doesn't kill performance too much. cc https://github.com/rust-lang/rust/issues/54883
2019-11-30rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.Eduard-Mihai Burtescu-20/+20
2019-11-30Apply suggestions from code reviewNadrieril Feneanar-1/+1
Co-Authored-By: varkor <github@varkor.com>
2019-11-29Rollup merge of #66847 - dtolnay:_fmt, r=joshtriplettDavid Tolnay-20/+32
Allow any identifier as format arg name Previously: ```console error: invalid format string: invalid argument name `_x` --> src/main.rs:2:16 | 2 | println!("{_x}", _x=0); | ^^ invalid argument name in format string | = note: argument names cannot start with an underscore ``` Not supporting identifiers starting with underscore appears to have been an arbitrary limitation from 2013 in code that was most likely never reviewed: https://github.com/rust-lang/rust/pull/8245/files#diff-0347868ef389c805e97636623e4a4ea6R277 The error message was dutifully improved in #50610 but is there any reason that leading underscore would be a special case? This commit updates the format_args parser to accept identifiers with leading underscores.
2019-11-29Bless ui test for libstd reformatDavid Tolnay-2/+2
2019-11-29Add explanation message for E0203Nixon-0/+1
2019-11-29Rollup merge of #66793 - matthewjasper:record-static-refs, r=cramertjRalf Jung-0/+40
Record temporary static references in generator witnesses Closes #66695 * Record the pointer to static's type in MIR. * Normalize the static's type (so that constants can be compared correctly).
2019-11-29Rollup merge of #66791 - cjgillot:arena, r=Mark-SimulacrumRalf Jung-1/+6
Handle GlobalCtxt directly from librustc_interface query system This PR constructs the `GlobalCtxt` as a member of the `Queries` in librustc_interface. This simplifies the code to construct it, at the expense of added complexity in the query control flow. This allows to handle the arenas directly from librustc_interface. Based on #66707 r? @Zoxc
2019-11-29Rollup merge of #66589 - TheSamsa:master, r=Dylan-DPCRalf Jung-1/+25
Draw vertical lines correctly in compiler error messages ... with multiline annotations correctly when non-1space unicode characters are to the left For this we use the correct calculation of the 'left' identation closes #66552
2019-11-29SimplifyArmIdentity only for locals with the same typeTomasz Miąsko-0/+95
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-29Auto merge of #66321 - ninjasource:async-fn-resume-after-completion, r=oli-obkbors-0/+123
Async fn resume after completion #65419 -- Attempting to run an async fn after completion mentions generators Not yet ready for review - work in progress Just need to run the tests on a proper build server
2019-11-29remove get_named_spanMark Mansi-50/+28
2019-11-29improve lifetime errors with implicit trait object lifetimesMark Mansi-79/+80
2019-11-29Ignore wasm for panic testsDavid Haig-0/+6
2019-11-29Auto merge of #66697 - petrochenkov:nocstore, r=eddybbors-1/+1
rustc_metadata: Privatize more things and a couple of other refactorings This PR continues https://github.com/rust-lang/rust/pull/66496 and hits the point of diminishing returns. All fields of `CrateRoot` and `CrateMetadata` are privatized. For read-only fields this certainly makes sense, but for a few fields updateable from outside of `rmeta.rs` (mostly `creader.rs`) it was done mostly for consistency, I can make them `pub(crate)` again if requested. `cstore.rs` (which became small after #66496) was merged into `creader.rs`. A few things noticed while making the privacy changes were addressed in the remaining refactoring commits. Fixes https://github.com/rust-lang/rust/issues/66550 r? @eddyb @Mark-Simulacrum
2019-11-29Auto merge of #66645 - RalfJung:dereferenceable, r=pnkfelixbors-1/+3
remove the 'dereferenceable' attribute from Box Fixes https://github.com/rust-lang/rust/issues/66600 r? @eddyb @rkruppe
2019-11-29Auto merge of #66590 - Aaron1011:fix/real-impl-trait-coherence, r=varkorbors-0/+19
Apply proper commit from PR #63934 While working on PR #63934, I accidentally reverted to an older version of the PR while working on a rebase. The PR was then merged, not with the later, approved changes, but with earlier, unapproved changes. This PR applies the changes that were *suppoesd* to be mereged in PR #63934. All of the proper tests appear to have been merged in PR #63934, so this PR adds no new tests
2019-11-29Auto merge of #66547 - leo60228:procfs-fallback, r=dtolnaybors-0/+23
Fallback to .init_array when no arguments are available on glibc Linux Linux is one of the only platforms where `std::env::args` doesn't work in a cdylib.
2019-11-29Auto merge of #66567 - estebank:suggest-copy, r=Centrilbors-49/+85
Use structured suggestion when requiring `Copy` constraint in type param
2019-11-28rustc: hide HirId's fmt::Debug output from -Z span_free_formats.Eduard-Mihai Burtescu-10/+10
2019-11-28Deduplicate type param constraint suggestion codeEsteban Küber-30/+30
2019-11-28Use structured suggestion when requiring `Copy` constraint in type paramEsteban Küber-46/+82
2019-11-28Allow any identifier as format arg nameDavid Tolnay-20/+32
Previously: error: invalid format string: invalid argument name `_x` --> src/main.rs:2:16 | 2 | println!("{_x}", a=0); | ^^ invalid argument name in format string | = note: argument names cannot start with an underscore Not supporting identifiers starting with underscore appears to have been an arbitrary limitation from 2013 in code that was most likely never reviewed: https://github.com/rust-lang/rust/pull/8245/files#diff-0347868ef389c805e97636623e4a4ea6R277 The error message was dutifully improved in #50610 but is there any reason that leading underscore would be a special case? This commit updates the format_args parser to accept identifiers with leading underscores.
2019-11-28Apply proper commit from PR #63934Aaron Hill-0/+19
While working on PR #63934, I accidentally reverted to an older version of the PR while working on a rebase. The PR was then merged, not with the later, approved changes, but with earlier, unapproved changes. This PR applies the changes that were *suppoesd* to be mereged in PR #63934. All of the proper tests appear to have been merged in PR #63934, so this PR adds no new tests Fixes #66580
2019-11-28rustc_metadata: Move `has_global_allocator` from session to cstoreVadim Petrochenkov-1/+1
2019-11-28Auto merge of #66642 - ecstatic-morse:promotion-in-const, r=eddybbors-29/+44
Create promoted MIR fragments for `const` and `static`s Resolves #65732. The previous strategy of removing `Drop` and `StorageDead` for promoted locals only worked for rvalue lifetime extension and only if no `loop`s were present. This PR applies the approach currently used for `fn` and `const fn`s to `const` and `statics`. This may have some performance impacts. r? @eddyb
2019-11-28Auto merge of #66603 - Nadrieril:fix-65413, r=varkorbors-7/+81
Fix #65413 #65413 was due to an oversight in `pat_constructor` that didn't check if a particular const value was maybe a slice/array const.
2019-11-28Auto merge of #66246 - matthewjasper:simplify-mem-cat, r=pnkfelixbors-25/+5
Simplify memory categorization With AST borrowck gone, mem_categorization can be simplified, a lot. * `cmt_` is now called `Place`. Most local variable names have been updated to reflect this, but the `cat_*` methods retain their names. * `MemCategorizationContext` no longer needs a `ScopeTree` and always needs an `InferCtxt`. * `Place` now uses a similar representation to `mir::Place` with a `Vec` of projections. * `Upvar` places don't include the implicit environment and capture derefs. These are now handled by `regionck` when needed. * Various types, methods and variants only used by AST borrowck have been removed. * `ExprUseVisitor` now lives in `rustc_typeck::expr_use_visitor`. * `MemCategorizationContext` and `Place` live in `rustc_typeck::mem_categorization`. * `Place` is re-exported in `rustc_typeck::expr_use_visitor` so that Clippy can access it. The loss of an error in `issue-4335.rs` is due to a change in capture inference in ill-formed programs. If any projection from a variable is moved from then we capture that variable by move, whether or not the place being moved from allows this. Closes #66270
2019-11-28Moved tests and fixed merge conflictDavid Haig-2/+3
2019-11-28Fixed unit testDavid Haig-1/+1
2019-11-28SquashDavid Haig-0/+116
2019-11-28Auto merge of #66294 - davidhewitt:const_fn_memoization, r=oli-obkbors-129/+55
Add memoization for const function evaluations When a const function is being evaluated, as long as all its arguments are zero-sized-types (or it has no arguments) then we can trivially memoize the evaluation result using the existing query mechanism. With thanks to @oli-obk for mentoring me through this at RustFest Barcelona. r? @oli-obk
2019-11-27Update test for mutably borrowed statics in a constDylan MacKenzie-6/+21
This checks `static mut` as well for E0017, and blesses tests now that we emit an error for a mut deref.
2019-11-27Remove test for unused error codeDylan MacKenzie-37/+0
This error code is never emitted, and the contents of this test are identical to that of `E0017.rs`.
2019-11-27Also test shared borrows of `Cell` for good errorsDylan MacKenzie-3/+20
2019-11-27Rollup merge of #66800 - jyn514:combine-const-match-tests, r=Dylan-DPCTyler Mandry-22/+11
Combine similar tests for const match See https://github.com/rust-lang/rust/pull/66788#issuecomment-558799307 for context.