about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-06-15Rollup merge of #72879 - RalfJung:miri-tctx-at, r=oli-obkRalf Jung-32/+35
Miri: avoid tracking current location three times Miri tracks the current instruction to execute in the call stack, but it also additionally has two `TyCtxtAt` that carry a `Span` that also tracks the current instruction. That is quite silly, so this PR uses `TyCtxt` instead, and then uses a method for computing the current span when a `TyCtxtAt` is needed. Having less redundant (semi-)global state seems like a good improvement to me. :D To keep the ConstProp errors the same, I had to add the option to `error_to_const_error` to overwrite the span. Also for some reason this changes cycle errors a bit -- not sure if we are now better or worse as giving those queries the right span. (It is unfortunately quite easy to accidentally use `DUMMY_SP` by calling the query on a `TyCtxt` instead of a `TyCtxtAt`.) r? @oli-obk @eddyb
2020-06-15Rollup merge of #72740 - estebank:recursive-indirection, r=matthewjasperRalf Jung-47/+125
On recursive ADT, provide indirection structured suggestion
2020-06-15Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakisbors-331/+440
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
2020-06-13Rollup merge of #73308 - yerke:fix-pretty-asm-rs-test-for-aarch64, r=AmanieuDylan DPC-0/+2
pretty/asm.rs should only be tested for x86_64 and not AArch64 pretty/asm.rs should only be tested for x86_64 and not AArch64 closes #73134 r? @Amanieu
2020-06-13run const_eval_raw with root_spanRalf Jung-4/+4
2020-06-13avoid computing precise span for const_eval queryRalf Jung-2/+2
2020-06-13pretty/asm.rs should only be tested for x86_64 and not AArch64Yerkebulan Tulibergenov-0/+2
2020-06-13Prefer the associated consts for pattern matching errorLzu Tao-136/+136
2020-06-12Auto merge of #73262 - wesleywiser:simplifyarmidentity_beta_regression, ↵bors-61/+82
r=oli-obk Disable the `SimplifyArmIdentity` pass This pass is buggy so I'm disabling it to fix a stable-to-beta regression. Related to #73223
2020-06-12Disable the `SimplifyArmIdentity` pass on betaWesley Wiser-61/+82
This pass is buggy so I'm disabling it to fix a stable-to-beta regression. Related to #73223
2020-06-12Rollup merge of #73225 - tmandry:issue-73050, r=oli-obkDylan DPC-0/+12
Allow inference regions when relating consts As first noticed by @eddyb, `super_relate_consts` doesn't need to check for inference vars since `eval` does it already (and handles lifetimes correctly by erasing them). Fixes #73050 r? @oli-obk
2020-06-12Rollup merge of #73178 - petrochenkov:explint, r=varkorDylan DPC-0/+83
expand: More precise locations for expansion-time lints First commit: a macro expansion doesn't have a `NodeId` associated with it, but it has a parent `DefId` which we can use for linting. The observable effect is that lints associated with macro expansions can now be `allow`ed at finer-grained level than whole crate. Second commit: each macro definition has a `NodeId` which we can use for linting, unless that macro definition was decoded from other crate.
2020-06-12Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnayDylan DPC-119/+119
Migrate to numeric associated consts The deprecation PR is #72885 cc #68490 cc rust-lang/rfcs#2700
2020-06-12fix const_prop spans and re-bless testsRalf Jung-26/+29
2020-06-12Auto merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schievinkbors-2/+23
Enable AVR as a Tier 3 target upstream Tracking issue: #44052. Things intentionally left out of the initial upstream: * The `target_cpu` flag I have made the cleanup suggestions by @jplatte and @jplatte in https://github.com/avr-rust/rust/commit/043550d9db0582add42e5837f636f61acb26b915. Anybody feel free to give the branch a test and see how it fares, or make suggestions on the code patch itself.
2020-06-12Rollup merge of #73195 - ayazhafiz:i/73145, r=estebankDylan DPC-0/+2025
Provide suggestion to convert numeric op LHS rather than unwrapping RHS Given a code ```rust fn foo(x: u8, y: u32) -> bool { x > y } fn main() {} ``` it could be more helpful to provide a suggestion to do "u32::from(x)" rather than "y.try_into().unwrap()", since the latter may panic. We do this by passing the LHS of a binary expression up the stack into the coercion checker. Closes #73145
2020-06-12Rollup merge of #73163 - ayushmishra2005:61137-add-long-error-code-e0724, ↵Dylan DPC-0/+1
r=davidtwco Add long error explanation for E0724 Add long explanation for the E0724 error code Part of #61137
2020-06-12Rollup merge of #73033 - Amanieu:asm-tls, r=oli-obkDylan DPC-5/+47
Fix #[thread_local] statics as asm! sym operands The `asm!` RFC specifies that `#[thread_local]` statics may be used as `sym` operands for inline assembly. This also fixes a regression in the handling of `#[thread_local]` during monomorphization which caused link-time errors with multiple codegen units, most likely introduced by #71192. r? @oli-obk
2020-06-11Add long error explanation for E0724Ayush Kumar Mishra-0/+1
Minor refactoring Minor refactoring Update src/librustc_error_codes/error_codes/E0724.md Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co> Update src/librustc_error_codes/error_codes/E0724.md Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co> Update src/librustc_error_codes/error_codes/E0724.md Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co> Minor refactoring
2020-06-11Rollup merge of #73230 - Amanieu:asm-unused2, r=petrochenkovDylan DPC-1/+21
Suggest including unused asm arguments in a comment to avoid error We require all arguments to an `asm!` to be used in the template string, just like format strings. However in some cases (e.g. `black_box`) it may be desirable to have `asm!` arguments that are not used in the template string. Currently this is a hard error rather than a lint since `#[allow]` does not work on macros (#63221), so this PR suggests using the unused arguments in an asm comment as a workaround. r? @petrochenkov
2020-06-11Rollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasperDylan DPC-2/+30
Track span of function in method calls, and use this in #[track_caller] Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-11Rollup merge of #73169 - Amanieu:asm-warnings, r=petrochenkovDylan DPC-1/+16
Handle assembler warnings properly Previously all inline asm diagnostics were treated as errors, but LLVM sometimes emits warnings and notes as well. Fixes #73160 r? @petrochenkov
2020-06-11Rollup merge of #73012 - Aaron1011:feature/span-debug-ctxt, r=matthewjasperDylan DPC-30/+30
Show `SyntaxContext` in formatted `Span` debug output This is only really useful in debug messages, so I've switched to calling `span_to_string` in any place that causes a `Span` to end up in user-visible output.
2020-06-11Rollup merge of #72180 - euclio:rustdoc-test-extra-space, r=Dylan-DPCDylan DPC-0/+22
remove extra space from crate-level doctest names Before: ``` running 2 tests test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok test src/test/rustdoc-ui/doctest-output.rs - (line 5) ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` After: ``` running 2 tests test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok test src/test/rustdoc-ui/doctest-output.rs - (line 5) ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ```
2020-06-11Fix NLL testMatthew Jasper-2/+2
2020-06-11fixup! Provide suggestion to convert numeric op LHS rather than unwrapping RHSAyaz Hafiz-138/+463
2020-06-11Provide suggestion to convert numeric op LHS rather than unwrapping RHSAyaz Hafiz-0/+1700
Given a code ```rust fn foo(x: u8, y: u32) -> bool { x > y } fn main() {} ``` it could be more helpful to provide a suggestion to do "u32::from(x)" rather than "y.try_into().unwrap()", since the latter may panic. We do this by passing the LHS of a binary expression up the stack into the coercion checker. Closes #73145
2020-06-11Add more tests for type alias impl TraitMatthew Jasper-0/+163
2020-06-11Forbid lifetime elision in let position impl TraitMatthew Jasper-20/+26
This is consistent with types.
2020-06-11Stop special casing top level TAITMatthew Jasper-291/+213
2020-06-11Check associated opaque types in check_opaque_typesMatthew Jasper-18/+36
2020-06-11Rollup merge of #73183 - Manishearth:intra-doc-macro, r=GuillaumeGomezDylan DPC-0/+62
Support proc macros in intra doc link resolution The feature was written pre-proc macro resolution, so it only supported the wacky MBE resolution rules. This adds support for proc macros as well. cc @GuillaumeGomez Fixes #73173
2020-06-11Rollup merge of #73164 - GuillaumeGomez:add-e0761, r=petrochenkovDylan DPC-2/+4
Add new E0762 error code
2020-06-11Rollup merge of #72941 - nagisa:ensure-stack-for-match, r=oli-obkDylan DPC-0/+5208
Ensure stack when building MIR for matches In particular matching on complex types such as strings will cause deep recursion to happen. Fixes #72933 r? @matthewjasper @oli-obk
2020-06-11Rollup merge of #72380 - lcnr:const_context, r=estebankDylan DPC-23/+24
Fix `is_const_context`, update `check_for_cast` A better version of #71477 Adds `fn enclosing_body_owner` and uses it in `is_const_context`. `is_const_context` now uses the same mechanism as `mir_const_qualif` as it was previously incorrect. Renames `is_const_context` to `is_inside_const_context`. I also updated `check_for_cast` in the second commit, so r? @estebank (I removed one lvl of indentation, so it might be easier to review by hiding whitespace changes)
2020-06-11Auto merge of #71896 - spastorino:existential-assoc-types-variance, ↵bors-3/+50
r=nikomatsakis Relate existential associated types with variance Invariant Fixes #71550 #72315 r? @nikomatsakis The test case reported in that issue now errors with the following message ... ``` error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in function call due to conflicting requirements --> /tmp/test.rs:25:5 | 25 | bad(&Bar(PhantomData), x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:11... --> /tmp/test.rs:24:11 | 24 | fn extend<'a, T>(x: &'a T) -> &'static T { | ^^ note: ...so that reference does not outlive borrowed content --> /tmp/test.rs:25:28 | 25 | bad(&Bar(PhantomData), x) | ^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that the types are compatible --> /tmp/test.rs:25:9 | 25 | bad(&Bar(PhantomData), x) | ^^^^^^^^^^^^^^^^^ = note: expected `&'static T` found `&T` error: aborting due to previous error For more information about this error, try `rustc --explain E0495`. ``` I could also add that test case if we want to have a weaponized one too.
2020-06-11Add a suggestion to use unused asm arguments in commentsAmanieu d'Antras-1/+21
2020-06-10Allow inference regions when relating constsTyler Mandry-0/+12
Fixes #73050
2020-06-10fix rebaseEsteban Küber-1/+4
2020-06-10Fix pprust-expr-roundtripAaron Hill-2/+2
2020-06-10Track span of function in method calls, and use this in #[track_caller]Aaron Hill-0/+28
Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-10review comments: only suggest one substitutionEsteban Küber-120/+24
2020-06-10On recursive ADT, provide indirection structured suggestionEsteban Küber-46/+217
2020-06-10Add tests for macro@ and derive@Manish Goregaokar-1/+7
2020-06-10Add tests for E0762Guillaume Gomez-2/+4
2020-06-10Rollup merge of #73157 - Aaron1011:where-oh-where-has-my-little-span-gone, ↵Dylan DPC-0/+39
r=ecstatic-morse Don't lose empty `where` clause when pretty-printing Previously, we would parse `struct Foo where;` and `struct Foo;` identically, leading to an 'empty' `where` clause being omitted during pretty printing. This will cause us to lose spans when proc-macros involved, since we will have a collected `where` token that does not appear in the pretty-printed item. We now explicitly track the presence of a `where` token during parsing, so that we can distinguish between `struct Foo where;` and `struct Foo;` during pretty-printing
2020-06-10Rollup merge of #73070 - ayazhafiz:i/72819, r=nikomatsakisDylan DPC-0/+30
Add regression test for const generic ICE in #72819 Closes #72819
2020-06-10Rollup merge of #73023 - ayushmishra2005:remove_noisy_suggestion, r=davidtwcoDylan DPC-69/+25
Remove noisy suggestion of hash_map Remove noisy suggestion of hash_map #72642 fixes #72642
2020-06-10Rollup merge of #73005 - Aaron1011:fix/error-overflow, r=estebankDylan DPC-181/+37
Don't create impl candidates when obligation contains errors Fixes #72839 In PR #72621, trait selection was modified to no longer bail out early when an error type was encountered. This allowed us treat `ty::Error` as `Sized`, causing us to avoid emitting a spurious "not sized" error after a type error had already occured. However, this means that we may now try to match an impl candidate against the error type. Since the error type will unify with almost anything, this can cause us to infinitely recurse (eventually triggering an overflow) when trying to verify certain `where` clauses. This commit causes us to skip generating any impl candidates when an error type is involved.
2020-06-10Rollup merge of #72897 - lcnr:structurally-match-normalize, r=pnkfelixDylan DPC-0/+23
normalize adt fields during structural match checking fixes #72896 currently only fixes the issue itself and compiles stage 1 libs. I believe we have to use something else to normalize the adt fields here, as I expect some partially resolved adts to cause problems :thinking: stage 1 libs and the test itself pass, not sure about the rest... Will spend some more time looking into it tomorrow. r? @pnkfelix cc @eddyb