about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-04-06Don't lint for self-recursion when the function can divergeJonas Schievink-0/+18
2020-04-05Rollup merge of #70815 - RalfJung:layout-debug, r=jonas-schievinkDylan DPC-6/+45
Enable layout debugging for `impl Trait` type aliases I also made it print the actual type name that the alias picks under the hood.
2020-04-05also print type typeRalf Jung-5/+5
2020-04-05also print rustc_layout on impl trait type aliasesRalf Jung-2/+41
2020-04-05Rollup merge of #70806 - RalfJung:miri-assignment-check, r=eddybDylan DPC-0/+10
fix Miri assignment sanity check Thanks @eddyb for pointing me to the right APIs! r? @eddyb Fixes https://github.com/rust-lang/rust/issues/70804
2020-04-05add testRalf Jung-0/+10
2020-04-05Rollup merge of #70768 - petrochenkov:macambig, r=Centril,mark-i-mDylan DPC-0/+13
macro_rules: `NtLifetime` cannot start with an identifier Fixes https://github.com/rust-lang/rust/issues/70446
2020-04-05Rollup merge of #70748 - ogoffart:enum-layout-optim2, r=eddybDylan DPC-0/+25
Do not disable field reordering on enums with big discriminant The field are always re-ordered to minimize padding, regardless of the alignment of the discriminant (spinoff from #70477)
2020-04-04macro_rules: `NtLifetime` cannot start with an identifierVadim Petrochenkov-0/+13
2020-04-04Auto merge of #70272 - eddyb:type-of-impl-trait, r=nikomatsakisbors-124/+167
typeck/type_of: let wfcheck handle generics in opaque types' substs. I was working on #70164, and `type_of`'s handling of opaque types seemed to be, by far, the trickiest use of `Ty::walk`, but I believe it wasn't doing anything (see https://github.com/rust-lang/rust/pull/57896#discussion_r396064431 - I suspect, based on glancing at the PR discussion, that an early attempt was kept in, despite becoming just an overcomplicated way to do exactly the same as the previous simple type equality check). I would've loved to remove `ResolvedOpaqueTy` (keep the `Ty` and lose the `Substs`), but it looks like the MIR borrowck part of the process needs that now, so it would've been added anyway since #57896, even if that PR hadn't happened. <hr/> In the process, I've moved the remaining substitution validation to `wfcheck`, which was already handling lifetimes, and kept only `delay_span_bug`s in `type_of`, as an insurance policy. I've added tests for lifetime and const cases, they seem to be checked correctly now. (and more uniform than they were in https://github.com/rust-lang/rust/issues/63063#issuecomment-602162804) However, the quality of the errors is maybe a bit worse, and they don't trigger when there are other errors (not sure if this is due to compilation stop points or something more specific to one opaque type). r? @nikomatsakis cc @matthewjasper @oli-obk @Aaron1011
2020-04-04tests: add tests for lifetime and const params of opaque types.Eduard-Mihai Burtescu-27/+94
2020-04-04typeck/type_of: let wfcheck handle duplicate generics in opaque types' substs.Eduard-Mihai Burtescu-42/+26
2020-04-04typeck/type_of: let wfcheck handle concrete types in opaque types' substs.Eduard-Mihai Burtescu-46/+51
2020-04-04typeck/type_of: don't ignore incorrect defining uses of opaque types.Eduard-Mihai Burtescu-59/+46
2020-04-04typeck/type_of: simplify checking of opaque types with multipler defining uses.Eduard-Mihai Burtescu-3/+3
2020-04-04Auto merge of #69718 - arlosi:debughash, r=eddybbors-3/+15
Add hash of source files in debug info LLVM supports placing the hash of source files inside the debug info. This information can be used by a debugger to verify that the source code matches the executable. This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option. * DWARF only supports MD5 * LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11). * CodeView (.PDB) supports MD5, SHA1, and SHA256. Fixes #68980. Tracking issue: #70401 rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623
2020-04-03Auto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakisbors-0/+42
Make the rustc respect the `-C codegen-units` flag in incremental mode. This PR implements (the as of yet unapproved) major change proposal at https://github.com/rust-lang/compiler-team/issues/245. See the description there for background and rationale. The changes are pretty straightforward and should be easy to rebase if the proposal gets accepted at some point. r? @nikomatsakis cc @pnkfelix
2020-04-03Do not disable field reordering on enums with big discriminantOlivier Goffart-0/+25
The field are always re-ordered to minimize padding, regardless of the alignment of the discriminant
2020-04-03Rollup merge of #70741 - DutchGhost:test-59023, r=CentrilMazdak Farrokhzad-0/+17
Add test for #59023 Adds a test for https://github.com/rust-lang/rust/issues/59023 Closes https://github.com/rust-lang/rust/issues/59023
2020-04-03Rollup merge of #70720 - ecstatic-morse:issue-70637, r=oli-obkMazdak Farrokhzad-0/+12
Place TLS initializers with relocations in .tdata Should fix #70673, although I'm not sure how to test this. Perhaps @joshlf could find a MCVE? Also adds more context to the FIXME. r? @oli-obk
2020-04-03Rollup merge of #70640 - jonas-schievink:async-ice, r=cramertjMazdak Farrokhzad-0/+56
Hide `task_context` when lowering body Fixes https://github.com/rust-lang/rust/issues/70594
2020-04-03Rollup merge of #70576 - Rustin-Liu:rustin-patch-link-cfg, r=varkorMazdak Farrokhzad-1/+1
Update the description of the ticket to point at RFC 1721 Fixes #70538. My first PR to rust. So please let me know if I'm doing something wrong.
2020-04-03Add regression test for #70673Oliver Scherer-0/+12
2020-04-04Update the description of link_cfg unstableRustin-Liu-1/+1
Fmt code Update tests Modify msg Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-03Add test for #59023DutchGhost-0/+17
2020-04-03Rollup merge of #70725 - Centril:nix-unwraps, r=estebankDylan DPC-0/+51
Avoid `.unwrap()`s on `.span_to_snippet(...)`s First commit fixes https://github.com/rust-lang/rust/issues/70724 and the others fix similar issues found by grepping. r? @estebank
2020-04-03Rollup merge of #70696 - jumbatm:extend-issue-69020-test, r=RalfJungDylan DPC-93/+184
Extend #69020 test to include reversed operand order. Make sure we still emit if a lint if the generic argument comes first. See https://github.com/rust-lang/rust/pull/70566#issuecomment-607671340. r? @RalfJung
2020-04-03Auto merge of #70582 - pnkfelix:update-llvm-to-fix-69841, r=cuviperbors-0/+30
Fix #69841 by updating LLVM submodule. Fix #69841 by updating LLVM submodule. Includes regression test for issue 69841.
2020-04-03Auto merge of #70642 - eddyb:remap-sysroot-src, r=Mark-Simulacrumbors-582/+229
Translate the virtual `/rustc/$hash` prefix back to a real directory. Closes #53486 and fixes #53081, by undoing the remapping to `/rustc/$hash` on the fly, when appropriate (e.g. our testsuites, or user crates that depend on `libstd`), but not during the Rust build itself (as that could leak the absolute build directory into the artifacts, breaking deterministic builds). Tested locally by setting `remap-debuginfo = true` in `config.toml`, which without these changes, was causing 56 tests to fail (see https://github.com/rust-lang/rust/issues/53081#issuecomment-606703215 for more details). cc @Mark-Simulacrum @alexcrichton @ehuss
2020-04-03add_type_neq_err_label: don't .unwrapMazdak Farrokhzad-0/+51
2020-04-03Add comment explaining the reversed operands testsjumbatm-59/+60
Also, fix the goofy reversed names with something clearer.
2020-04-03Rollup merge of #70716 - matthewjasper:infer-const-type-regions, r=eddybMazdak Farrokhzad-3/+14
Unerase regions in infer_placeholder_type closes #70608
2020-04-03Rollup merge of #70595 - wesleywiser:remove_unused_discriminant_reads, r=oli-obkMazdak Farrokhzad-9/+56
Remove unused discriminant reads from MIR bodies Allow the `SimplifyLocals` pass to remove reads of discriminants if the read is never used. Fixes #70531 r? @oli-obk
2020-04-02Add hash of source files in debug infoArlo Siemsen-3/+15
* Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-04-02unerase regions in `infer_placeholder_type`Matthew Jasper-3/+14
2020-04-02Move #69020 test to ui/associated-const + rebless.jumbatm-90/+162
2020-04-02Extend #69020 test to include reversed order.jumbatm-0/+18
Make sure we check the case where the generic operand comes first, in case any future changes make this ordering matter.
2020-04-02Rollup merge of #70681 - rcoh:russell/70677-raw-str-panic, r=petrochenkovMazdak Farrokhzad-0/+14
Handle unterminated raw strings with no #s properly The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file. Fixes #70677 r? @petrochenkov cc @Centril
2020-04-02Rollup merge of #70634 - Centril:import-directly, r=Mark-SimulacrumMazdak Farrokhzad-2/+4
Remove some reexports in `rustc_middle` This will help get these imports out of the way of detecting the true dependencies in and out to `rustc_middle`, thereby helping future work towards https://github.com/rust-lang/rust/issues/65031.
2020-04-02Rollup merge of #70421 - Centril:recover-const-async-fn-ptr, r=estebankMazdak Farrokhzad-5/+185
parse: recover on `const fn()` / `async fn()` Recover on `const fn()` and `async fn()` function pointers, suggesting to remove the qualifier. For example: ``` error: an `fn` pointer type cannot be `async` --> $DIR/recover-const-async-fn-ptr.rs:6:11 | LL | type T3 = async fn(); | -----^^^^^ | | | `async` because of this | help: remove the `async` qualifier ``` r? @estebank
2020-04-02Remove unused discriminant reads from MIR bodiesWesley Wiser-9/+56
Allow the `SimplifyLocals` pass to remove reads of discriminants if the read is never used.
2020-04-02fix fulldeps test falloutMazdak Farrokhzad-2/+4
2020-04-02tests: remove ignore directives from tests that mention core/alloc/std spans.Eduard-Mihai Burtescu-582/+229
2020-04-02Auto merge of #70362 - TimDiekmann:alloc-overhaul, r=Amanieubors-60/+74
Overhaul of the `AllocRef` trait to match allocator-wg's latest consens; Take 2 GitHub won't let me reopen #69889 so I make a new PR. In addition to #69889 this fixes the unsoundness of `RawVec::into_box` when using allocators supporting overallocating. Also it uses `MemoryBlock` in `AllocRef` to unify `_in_place` methods by passing `&mut MemoryBlock`. Additionally, `RawVec` now checks for `size_of::<T>()` again and ignore every ZST. The internal capacity of `RawVec` isn't used by ZSTs anymore, as `into_box` now requires a length to be specified. r? @Amanieu fixes rust-lang/wg-allocators#38 fixes rust-lang/wg-allocators#41 fixes rust-lang/wg-allocators#44 fixes rust-lang/wg-allocators#51
2020-04-02Handle unterminated raw strings with no #s properlyRussell Cohen-0/+14
The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file.
2020-04-01Rollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obkDylan DPC-74/+148
Miri: make backtrace function names and spans match up Currently, Miri backtraces are a bit confusing: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside call to `f` | ^^^^ = note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5 ``` When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*. This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11 note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside `main` | ^^^^ = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34 = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73 = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5 ``` Now function name and printed line numbers match up in the notes. This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside. With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used). r? @oli-obk
2020-04-01Rollup merge of #70535 - jonas-schievink:graph-refactor, r=nikomatsakisDylan DPC-0/+23
Track the finalizing node in the specialization graph Fixes https://github.com/rust-lang/rust/issues/70419 Fixes https://github.com/rust-lang/rust/issues/70442 r? @eddyb
2020-04-01Rollup merge of #70522 - rcoh:60762-raw-string-errors, r=petrochenkovMazdak Farrokhzad-15/+50
Improve error messages for raw strings (#60762) This diff improves error messages around raw strings in a few ways: - Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test) - Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings - Detect potentially intended terminators (longest sequence of "#*" is suggested) Fixes #60762 cc @estebank who reviewed the original (abandoned) PR for the same ticket. r? @Centril
2020-04-01Hide `task_context` when lowering bodyJonas Schievink-0/+56
2020-04-01Rollup merge of #70556 - Centril:fix-70552, r=estebankDylan DPC-0/+11
parse_and_disallow_postfix_after_cast: account for `ExprKind::Err`. Fixes https://github.com/rust-lang/rust/issues/70552. r? @estebank cc @daboross