about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-10-08Auto merge of #77678 - jyn514:tracing, r=Mark-Simulacrumbors-7/+0
Upgrade to tracing-subscriber 0.2.13 The primary motivation is to get the changes from https://github.com/tokio-rs/tracing/pull/990. Example output: ``` $ RUSTDOC_LOG=debug rustdoc +rustc2 warning: some trace filter directives would enable traces that are disabled statically | `debug` would enable the DEBUG level for all targets = note: the static max level is `info` = help: to enable DEBUG logging, remove the `max_level_info` feature ``` r? `@Mark-Simulacrum` cc `@hawkw` ❤️
2020-10-08Auto merge of #75470 - estebank:bare-type-expr, r=davidtwcobors-0/+56
Detect blocks that could be struct expr bodies This approach lives exclusively in the parser, so struct expr bodies that are syntactically correct on their own but are otherwise incorrect will still emit confusing errors, like in the following case: ```rust fn foo() -> Foo { bar: Vec::new() } ``` ``` error[E0425]: cannot find value `bar` in this scope --> src/file.rs:5:5 | 5 | bar: Vec::new() | ^^^ expecting a type here because of type ascription error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> src/file.rs:5:15 | 5 | bar: Vec::new() | ^^^^^ only `Fn` traits may use parentheses error[E0107]: wrong number of type arguments: expected 1, found 0 --> src/file.rs:5:10 | 5 | bar: Vec::new() | ^^^^^^^^^^ expected 1 type argument ``` If that field had a trailing comma, that would be a parse error and it would trigger the new, more targetted, error: ``` error: struct literal body without path --> file.rs:4:17 | 4 | fn foo() -> Foo { | _________________^ 5 | | bar: Vec::new(), 6 | | } | |_^ | help: you might have forgotten to add the struct literal inside the block | 4 | fn foo() -> Foo { Path { 5 | bar: Vec::new(), 6 | } } | ``` Partially address last remaining part of #34255.
2020-10-07Upgrade to tracing 0.2.13Joshua Nelson-7/+0
The primary motivation is to get the changes from https://github.com/tokio-rs/tracing/pull/990. Example output: ``` $ RUSTDOC_LOG=debug rustdoc +rustc2 warning: some trace filter directives would enable traces that are disabled statically | `debug` would enable the DEBUG level for all targets = note: the static max level is `info` = help: to enable DEBUG logging, remove the `max_level_info` feature ``` - Remove useless test This was testing for an ICE when passing `RUST_LOG=rustc_middle`. I noticed it because it started giving the tracing warning (because tests are not run with debug-logging enabled). Since this bug seems unlikely to re-occur, I just removed it altogether.
2020-10-07Detect blocks that could be struct expr bodiesEsteban Küber-0/+56
This approach lives exclusively in the parser, so struct expr bodies that are syntactically correct on their own but are otherwise incorrect will still emit confusing errors, like in the following case: ```rust fn foo() -> Foo { bar: Vec::new() } ``` ``` error[E0425]: cannot find value `bar` in this scope --> src/file.rs:5:5 | 5 | bar: Vec::new() | ^^^ expecting a type here because of type ascription error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> src/file.rs:5:15 | 5 | bar: Vec::new() | ^^^^^ only `Fn` traits may use parentheses error[E0107]: wrong number of type arguments: expected 1, found 0 --> src/file.rs:5:10 | 5 | bar: Vec::new() | ^^^^^^^^^^ expected 1 type argument ``` If that field had a trailing comma, that would be a parse error and it would trigger the new, more targetted, error: ``` error: struct literal body without path --> file.rs:4:17 | 4 | fn foo() -> Foo { | _________________^ 5 | | bar: Vec::new(), 6 | | } | |_^ | help: you might have forgotten to add the struct literal inside the block | 4 | fn foo() -> Foo { Path { 5 | bar: Vec::new(), 6 | } } | ``` Partially address last part of #34255.
2020-10-07Auto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obkbors-16/+17
Give `impl Trait` in a `const fn` its own feature gate ...previously it was gated under `#![feature(const_fn)]`. I think we actually want to do this in all const-contexts? If so, this should be `#![feature(const_impl_trait)]` instead. I don't think there's any way to make use of `impl Trait` within a `const` initializer. cc #77463 r? `@oli-obk`
2020-10-07Auto merge of #77617 - AnthonyMikh:slice_windows_no_bounds_checking, r=lcnrbors-0/+35
Eliminate bounds checking in slice::Windows This is how `<core::slice::Windows as Iterator>::next` looks right now: ```rust fn next(&mut self) -> Option<&'a [T]> { if self.size > self.v.len() { None } else { let ret = Some(&self.v[..self.size]); self.v = &self.v[1..]; ret } } ``` The line with `self.v = &self.v[1..];` relies on assumption that `self.v` is definitely not empty at this point. Else branch is taken when `self.size <= self.v.len()`, so `self.v` can be empty if `self.size` is zero. In practice, since `Windows` is never created directly but rather trough `[T]::windows` which panics when `size` is zero, `self.size` is never zero. However, the compiler doesn't know about this check, so it keeps the code which checks bounds and panics. Using `NonZeroUsize` lets the compiler know about this invariant and reliably eliminate bounds checking without `unsafe` on `-O2`. Here is assembly of `Windows<'a, u32>::next` before and after this change ([goldbolt](https://godbolt.org/z/xrefzx)): <details> <summary>Before</summary> ``` example::next: push rax mov rcx, qword ptr [rdi + 8] mov rdx, qword ptr [rdi + 16] cmp rdx, rcx jbe .LBB0_2 xor eax, eax pop rcx ret .LBB0_2: test rcx, rcx je .LBB0_5 mov rax, qword ptr [rdi] mov rsi, rax add rsi, 4 add rcx, -1 mov qword ptr [rdi], rsi mov qword ptr [rdi + 8], rcx pop rcx ret .LBB0_5: lea rdx, [rip + .L__unnamed_1] mov edi, 1 xor esi, esi call qword ptr [rip + core::slice::slice_index_order_fail@GOTPCREL] ud2 .L__unnamed_2: .ascii "./example.rs" .L__unnamed_1: .quad .L__unnamed_2 .asciz "\f\000\000\000\000\000\000\000\016\000\000\000\027\000\000" ``` </details> <details> <summary>After</summary> ``` example::next: mov rcx, qword ptr [rdi + 8] mov rdx, qword ptr [rdi + 16] cmp rdx, rcx jbe .LBB0_2 xor eax, eax ret .LBB0_2: mov rax, qword ptr [rdi] lea rsi, [rax + 4] add rcx, -1 mov qword ptr [rdi], rsi mov qword ptr [rdi + 8], rcx ret ``` </details> Note the lack of call to `core::slice::slice_index_order_fail` in second snippet. #### Possible reasons _not_ to merge this PR: * this changes the error message on panic in `[T]::windows`. However, AFAIK this messages are not covered by backwards compatibility policy.
2020-10-07Auto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, ↵bors-67/+134
r=estebank resolve: improve "try using the enum's variant" Fixes #73427. This PR improves the "try using the enum's variant" suggestion: - Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only emitted for variants that have no fields (since the suggestion can't know what value fields would have). - Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided. - A help message is added which mentions the variants which are no longer suggested. All of the diagnostic logic introduced by this PR is separated from the normal code path for a successful compilation. r? `@estebank`
2020-10-07Add codegen testAnthonyMikh-0/+35
2020-10-07Auto merge of #77595 - petrochenkov:asmident, r=oli-obkbors-0/+75
builtin_macros: Fix use of interpolated identifiers in `asm!` Fixes https://github.com/rust-lang/rust/issues/77584
2020-10-07Auto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514bors-1/+180
Unclosed html tag lint Part of #67799. I think `@ollie27` will be interested (`@Manishearth` too since they opened the issue ;) ). r? `@jyn514`
2020-10-07Rollup merge of #77605 - da-x:fix-rustc-def-path, r=petrochenkovDylan DPC-4/+4
Fix rustc_def_path to show the full path and not the trimmed one Follow-up fix for #73996.
2020-10-07Rollup merge of #77568 - lcnr:mir-inline-def-id, r=ecstatic-morseDylan DPC-0/+38
inliner: use caller param_env We used the callee param env instead of the caller param env by accident in #77430, this PR fixes that and caches it in the `Inliner` struct. fixes #77564 r? @ecstatic-morse
2020-10-06Update to chalk 0.31. Implement some unimplemented. Ignore some tests in ↵Jack Huey-49/+76
compare mode chalk don't finish.
2020-10-06Fix NLL compare mode testsMatthew Jasper-5/+42
2020-10-06Fix tests from rebaseMatthew Jasper-459/+552
2020-10-06Don't require lifetime super-bounds on traits apply to trait objects of that ↵Matthew Jasper-0/+16
trait
2020-10-06Normalize super trait bounds when confirming object candidatesMatthew Jasper-0/+26
2020-10-06Fix rebaseMatthew Jasper-89/+80
2020-10-06Don't immediately error for recursive projectionsMatthew Jasper-12/+13
2020-10-06Fix bootstrapMatthew Jasper-3/+3
2020-10-06Handle multiple trait-def projection candidatesMatthew Jasper-0/+16
2020-10-06Avoid cycles from projection boundsMatthew Jasper-61/+61
Only check the own predicates of associated types when confirming projection candidates. Also consider implied bounds when comparing trait and impl methods.
2020-10-06Avoid cycle with projections from object typesMatthew Jasper-83/+73
Normalizing `<dyn Iterator<Item = ()> as Iterator>::Item` no longer requires selecting `dyn Iterator<Item = ()>: Iterator`. This was previously worked around by using a special type-folder to normalize things.
2020-10-06Normalize projection bounds when considering candidatesMatthew Jasper-99/+120
This unfortunately requires some winnowing hacks to avoid now ambiguous candidates.
2020-10-06Handle multiple applicable projection candidatesMatthew Jasper-0/+23
2020-10-06Fix bugs in evaluating WellFormed predicatesMatthew Jasper-0/+39
- List the nestsed obligations in an order that works with the single pass used by evaluation - Propagate recursion depth correctly
2020-10-06Avoid cycle in nested obligations for object candidateMatthew Jasper-0/+206
Bounds of the form `type Future: Future<Result=Self::Result>` exist in some ecosystem crates. To validate these bounds for trait objects we need to normalize `Self::Result` in a way that doesn't cause a cycle.
2020-10-06Remove predicates on associated types from traitsMatthew Jasper-40/+55
These need to only be bounds to avoid cycle errors in trait checking.
2020-10-06Fix tests and bootstrapMatthew Jasper-53/+151
2020-10-06Ensure that associated types for trait objects satisfy their boundsMatthew Jasper-5/+115
2020-10-06Check associated type bounds for object safety violationsMatthew Jasper-0/+26
2020-10-06Check opaque types satisfy their boundsMatthew Jasper-33/+90
2020-10-06Check projections are well-formed when using projection candidatesMatthew Jasper-2/+229
2020-10-06Separate bounds and predicates for associated/opaque typesMatthew Jasper-978/+698
2020-10-06Rollup merge of #77591 - Aaron1011:fix/hygiene-def-scope, r=estebankYuki Okushi-0/+47
Record `expansion_that_defined` into crate metadata Fixes #77523 Now that hygiene serialization is implemented, we also need to record `expansion_that_defined` so that we properly handle a foreign `SyntaxContext`.
2020-10-06Rollup merge of #77587 - ehuss:unicode-escape-span, r=ecstatic-morseYuki Okushi-6/+4
Fix span for unicode escape suggestion. If a unicode escape is missing the curly braces, the suggested fix is to add the curly braces, but the span for the fix was incorrect. It was not covering the `\u`, but the suggested text includes the `\u`, causing the resulting fix to be `"\u\u{1234}"`. This changes it so that the span includes the `\u`. An alternate fix would be to remove `\u` from the suggested fix, but I think the error message reads better if the entire escape is included.
2020-10-06Rollup merge of #77534 - ↵Yuki Okushi-6/+84
Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov Disallow overriding forbid in same scope Rebased #73379. Fixes #70819.
2020-10-06Fix rustc_def_path to show the full path and not the trimmed oneDan Aloni-4/+4
2020-10-05Remove `fn` from feature nameDylan MacKenzie-7/+7
2020-10-05Make `min_const_fn` `impl Trait` test into a gate testDylan MacKenzie-2/+4
2020-10-05Bless test outuptDylan MacKenzie-11/+10
2020-10-05Use new feature gate in `impl-trait` testsDylan MacKenzie-4/+4
2020-10-06builtin_macros: Fix use of interpolated identifiers in `asm!`Vadim Petrochenkov-0/+75
2020-10-05Record `expansion_that_defined` into crate metadataAaron Hill-0/+47
Fixes #77523 Now that hygiene serialization is implemented, we also need to record `expansion_that_defined` so that we properly handle a foreign `SyntaxContext`.
2020-10-05Fix span for unicode escape suggestion.Eric Huss-6/+4
2020-10-05Renamed tests to avoid exceeding Windows max path limitRich Kadel-585/+585
2020-10-05Updates to experimental coverage counter injectionRich Kadel-1511/+17701
This is a combination of 18 commits. Commit #2: Additional examples and some small improvements. Commit #3: fixed mir-opt non-mir extensions and spanview title elements Corrected a fairly recent assumption in runtest.rs that all MIR dump files end in .mir. (It was appending .mir to the graphviz .dot and spanview .html file names when generating blessed output files. That also left outdated files in the baseline alongside the files with the incorrect names, which I've now removed.) Updated spanview HTML title elements to match their content, replacing a hardcoded and incorrect name that was left in accidentally when originally submitted. Commit #4: added more test examples also improved Makefiles with support for non-zero exit status and to force validation of tests unless a specific test overrides it with a specific comment. Commit #5: Fixed rare issues after testing on real-world crate Commit #6: Addressed PR feedback, and removed temporary -Zexperimental-coverage -Zinstrument-coverage once again supports the latest capabilities of LLVM instrprof coverage instrumentation. Also fixed a bug in spanview. Commit #7: Fix closure handling, add tests for closures and inner items And cleaned up other tests for consistency, and to make it more clear where spans start/end by breaking up lines. Commit #8: renamed "typical" test results "expected" Now that the `llvm-cov show` tests are improved to normally expect matching actuals, and to allow individual tests to override that expectation. Commit #9: test coverage of inline generic struct function Commit #10: Addressed review feedback * Removed unnecessary Unreachable filter. * Replaced a match wildcard with remining variants. * Added more comments to help clarify the role of successors() in the CFG traversal Commit #11: refactoring based on feedback * refactored `fn coverage_spans()`. * changed the way I expand an empty coverage span to improve performance * fixed a typo that I had accidently left in, in visit.rs Commit #12: Optimized use of SourceMap and SourceFile Commit #13: Fixed a regression, and synched with upstream Some generated test file names changed due to some new change upstream. Commit #14: Stripping out crate disambiguators from demangled names These can vary depending on the test platform. Commit #15: Ignore llvm-cov show diff on test with generics, expand IO error message Tests with generics produce llvm-cov show results with demangled names that can include an unstable "crate disambiguator" (hex value). The value changes when run in the Rust CI Windows environment. I added a sed filter to strip them out (in a prior commit), but sed also appears to fail in the same environment. Until I can figure out a workaround, I'm just going to ignore this specific test result. I added a FIXME to follow up later, but it's not that critical. I also saw an error with Windows GNU, but the IO error did not specify a path for the directory or file that triggered the error. I updated the error messages to provide more info for next, time but also noticed some other tests with similar steps did not fail. Looks spurious. Commit #16: Modify rust-demangler to strip disambiguators by default Commit #17: Remove std::process::exit from coverage tests Due to Issue #77553, programs that call std::process::exit() do not generate coverage results on Windows MSVC. Commit #18: fix: test file paths exceeding Windows max path len
2020-10-05Auto merge of #77549 - tmiasko:simplify-branch-same-fix, r=oli-obkbors-0/+21
Fix miscompile in SimplifyBranchSame Cherry-picked from #77486, but with a different test case that used to be compiled incorrectly on both master & beta branches.
2020-10-05inliner: use caller param_envBastian Kauschke-0/+38
2020-10-05Auto merge of #77557 - Dylan-DPC:rollup-aib9ptp, r=Dylan-DPCbors-442/+1154
Rollup of 11 pull requests Successful merges: - #75853 (Use more intra-doc-links in `core::fmt`) - #75928 (Remove trait_selection error message in specific case) - #76329 (Add check for doc alias attribute at crate level) - #77219 (core::global_allocator docs link to std::alloc::GlobalAlloc) - #77395 (BTreeMap: admit the existence of leaf edges in comments) - #77407 (Improve build-manifest to work with the improved promote-release) - #77426 (Include scope id in SocketAddrV6::Display) - #77439 (Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`) - #77471 (BTreeMap: refactoring around edges, missed spots) - #77512 (Allow `Abort` terminators in all const-contexts) - #77514 (Replace some once(x).chain(once(y)) with [x, y] IntoIter) Failed merges: r? `@ghost`