about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-07-15Make destructuring a defining useOli Scherer-0/+12
2022-07-15Allow destructuring opaque types, since the patterns constrain the opaque typesOli Scherer-24/+78
2022-07-15passes: migrate half of `check_attr`David Wood-79/+79
Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable.
2022-07-15macros: support adding warnings to diagsDavid Wood-3/+22
Both diagnostic and subdiagnostic derives were missing the ability to add warnings to diagnostics - this is made more difficult by the `warn` attribute already existing, so this name being unavailable for the derives to use. `#[warn_]` is used instead, which requires special-casing so that `{span_,}warn` is called instead of `{span_,}warn_`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-15macros: support `MultiSpan` in diag derivesDavid Wood-9/+16
Add support for `MultiSpan` with any of the attributes that work on a `Span` - requires that diagnostic logic generated for these attributes are emitted in the by-move block rather than the by-ref block that they would normally have been generated in. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-15provide `generic_param_scope` for region errorslcnr-91/+96
2022-07-15try to avoid `FnCtxt` during wflcnr-90/+54
2022-07-15remove `impl_implied_bounds` from `FnCtxt`lcnr-5/+3
2022-07-15Auto merge of #99046 - nnethercote:final-derive-output-improvements, ↵bors-255/+432
r=Mark-Simulacrum Final derive output improvements With all these changes, the derive output in `deriving-all-codegen.stdout` is pretty close to optimal, i.e. very similar to what you'd write by hand. r? `@ghost`
2022-07-15Rollup merge of #99119 - TaKO8Ki:remove-string-matching-about-methods, ↵Dylan DPC-31/+72
r=cjgillot Refactor: remove a string matching about methods This patch remove a string matching about methods and adds some rustfix tests.
2022-07-15Rollup merge of #98869 - compiler-errors:stop_guessing_head_span, r=cjgillotDylan DPC-123/+91
Remove some usages of `guess_head_span` No need to pass things through `guess_head_span` if they already point to the head span. Only major change is that we point to the head span of `enum`s on some errors now, which I prefer. r? `@cjgillot`
2022-07-15add `#[must_use]` to `Box::from_raw`rhysd-0/+26
2022-07-15Auto merge of #99267 - Dylan-DPC:rollup-d8l7y1o, r=Dylan-DPCbors-16/+153
Rollup of 6 pull requests Successful merges: - #99113 (Simplify [a]rc code a little) - #99131 (Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like`) - #99237 (removed unused CSS and unused HTML IDs) - #99239 (Add myself to the set of people notified when MIR changes.) - #99241 (Remove comment referring to constness.rs) - #99257 (Add regression test for #89436) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-15Rollup merge of #99257 - Manishearth:regression, r=jackh726Dylan DPC-0/+44
Add regression test for #89436 I never got around to adding such a test. In general I think the `yoke` crate has a bunch of interesting testcases that exercise various edges of the algorithms here, it would be nice if we could simply depend on the crate and add some tests that exercise it, but I don't think that's possible. Do you or `@eddyb` think there's any use trying to upstream a bunch of common yoke minimal working example code to the testsuite and having a ton of yoke tests?
2022-07-15Rollup merge of #99131 - compiler-errors:label-fn, r=cjgillotDylan DPC-16/+109
Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like` Fixes #98308
2022-07-15Auto merge of #97406 - aliemjay:verify-bounds-fix-master, r=oli-obkbors-0/+62
Make outlives::{components,verify} agree fixes #97405 cc `@oli-obk` this is should fix https://github.com/rust-lang/rust/pull/95474#discussion_r880660075 r? `@oli-obk`
2022-07-15Move item_span from check_item_type into each functionMichael Goulet-5/+5
2022-07-15Remove some more usages of guess_head_spanMichael Goulet-2/+6
2022-07-15Remove some usages of guess_head_span from typeckMichael Goulet-4/+4
2022-07-15Make item spans more consistentMichael Goulet-112/+76
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-196/+196
r=cjgillot gather body owners Issue #96341
2022-07-14Point out custom Fn-family trait implMichael Goulet-0/+16
2022-07-14Add support for APIT and RPIT callables in label_fn_likeMichael Goulet-20/+97
2022-07-14Add regression test for #89436Manish Goregaokar-0/+44
2022-07-14Use constant eval to do strict validity checks5225225-22/+44
2022-07-14Auto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillotbors-1/+3
Stop keeping metadata in memory before writing it to disk Fixes #96358 I created this PR according with the instruction given in the issue except for the following points: - While the issue says "Write metadata into the temporary file in `encode_and_write_metadata` even if `!need_metadata_file`", I could not do that. That is because though I tried to do that and run `x.py test`, I got a lot of test failures as follows. <details> <summary>List of failed tests</summary> <pre> <code> failures: [ui] src/test/ui/json-multiple.rs [ui] src/test/ui/json-options.rs [ui] src/test/ui/rmeta/rmeta-rpass.rs [ui] src/test/ui/save-analysis/emit-notifications.rs [ui] src/test/ui/svh/changing-crates.rs [ui] src/test/ui/svh/svh-change-lit.rs [ui] src/test/ui/svh/svh-change-significant-cfg.rs [ui] src/test/ui/svh/svh-change-trait-bound.rs [ui] src/test/ui/svh/svh-change-type-arg.rs [ui] src/test/ui/svh/svh-change-type-ret.rs [ui] src/test/ui/svh/svh-change-type-static.rs [ui] src/test/ui/svh/svh-use-trait.rs test result: FAILED. 12915 passed; 12 failed; 100 ignored; 0 measured; 0 filtered out; finished in 71.41s Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu Build completed unsuccessfully in 0:01:58 </code> </pre> </details> - I could not resolve the extra tasks about `create_rmeta_file` and `create_compressed_metadata_file` for my lack of ability.
2022-07-14rustc: add ability to output regular LTO bitcode modulesZiv Dunkelman-0/+15
Adding the option to control from rustc CLI if the resulted ".o" bitcode module files are with thinLTO info or regular LTO info. Allows using "-lto-embed-bitcode=optimized" during linkage correctly. Signed-off-by: Ziv Dunkelman <ziv.dunkelman@nextsilicon.com>
2022-07-14Auto merge of #99242 - Dylan-DPC:rollup-34bqdh8, r=Dylan-DPCbors-9/+285
Rollup of 6 pull requests Successful merges: - #98072 (Add provider API to error trait) - #98580 (Emit warning when named arguments are used positionally in format) - #99000 (Move abstract const to middle) - #99192 (Fix spans for asm diagnostics) - #99222 (Better error message for generic_const_exprs inference failure) - #99236 (solaris: unbreak build on native platform) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-14Rollup merge of #99222 - atsuzaki:generic_const_err, r=lcnrDylan DPC-7/+10
Better error message for generic_const_exprs inference failure Fixes #90531 This code: ```rs #![feature(generic_const_exprs)] fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {} fn main() { let arr = [5; 5]; foo(arr); } ``` Will now emit the following error: ```rs warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> test.rs:1:12 | 1 | #![feature(generic_const_exprs)] | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information error[E0284]: type annotations needed --> test.rs:8:7 | 8 | foo(arr); | ^^^ cannot infer the value of the const parameter `N` declared on the function `foo` | note: required by a bound in `foo` --> test.rs:3:56 | 3 | fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {} | ^^^^^ required by this bound in `foo` help: consider specifying the generic argument | 8 | foo::<N>(arr); | +++++ error: aborting due to previous error; 1 warning emitted ``` cc: `@lcnr` thanks a lot again for the help on this
2022-07-14Rollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkovDylan DPC-2/+40
Fix spans for asm diagnostics Line spans were incorrect if the first line of an asm statement was an empty string.
2022-07-14Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnrDylan DPC-0/+36
Move abstract const to middle Moves AbstractConst (and all associated methods) to rustc middle for use in `rustc_infer`. This allows for const resolution in infer to use abstract consts to walk consts and check if they are resolvable. This attempts to resolve the issue where `Foo<{ concrete const }, generic T>` is incorrectly marked as conflicting, and is independent from the other issue where nested abstract consts must be resolved. r? `@lcnr`
2022-07-14Rollup merge of #98580 - PrestonFrom:issue_98466, r=estebankDylan DPC-0/+199
Emit warning when named arguments are used positionally in format Addresses Issue 98466 by emitting an error if a named argument is used like a position argument (i.e. the name is not used in the string to be formatted). Fixes rust-lang#98466
2022-07-14Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillotbors-15/+196
Support unstable moves via stable in unstable items part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328. The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge. This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.
2022-07-14Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPCbors-46/+411
Rollup of 5 pull requests Successful merges: - #97720 (Always create elided lifetime parameters for functions) - #98315 (Stabilize `core::ffi:c_*` and rexport in `std::ffi`) - #98705 (Implement `for<>` lifetime binder for closures) - #99126 (remove allow(rustc::potential_query_instability) in rustc_span) - #99139 (Give a better error when `x dist` fails for an optional tool) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-14Fix spans for asm diagnosticsAmanieu d'Antras-2/+40
Line spans were incorrect if the first line of an asm statement was an empty string.
2022-07-14Fix overlapping implskadmin-0/+36
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-9/+288
Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
2022-07-14Rollup merge of #97720 - cjgillot:all-fresh, r=petrochenkovDylan DPC-37/+123
Always create elided lifetime parameters for functions Anonymous and elided lifetimes in functions are sometimes (async fns) --and sometimes not (regular fns)-- desugared to implicit generic parameters. This difference of treatment makes it some downstream analyses more complicated to handle. This step is a pre-requisite to perform lifetime elision resolution on AST. There is currently an inconsistency in the treatment of argument-position impl-trait for functions and async fns: ```rust trait Foo<'a> {} fn foo(t: impl Foo<'_>) {} //~ ERROR missing lifetime specifier async fn async_foo(t: impl Foo<'_>) {} //~ OK fn bar(t: impl Iterator<Item = &'_ u8>) {} //~ ERROR missing lifetime specifier async fn async_bar(t: impl Iterator<Item = &'_ u8>) {} //~ OK ``` The current implementation reports "missing lifetime specifier" on `foo`, but **accepts it** in `async_foo`. This PR **proposes to accept** the anonymous lifetime in both cases as an extra generic lifetime parameter. This change would be insta-stable, so let's ping t-lang. Anonymous lifetimes in GAT bindings keep being forbidden: ```rust fn foo(t: impl Foo<Assoc<'_> = Bar<'_>>) {} ^^ ^^ forbidden ok ``` I started a discussion here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Anonymous.20lifetimes.20in.20universal.20impl-trait/near/284968606 r? ``@petrochenkov``
2022-07-14Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiserbors-2/+3
Rename `debugging_opts` to `unstable_opts` This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear. cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options r? `@Amanieu` cc `@nikic` `@joshtriplett`
2022-07-14Auto merge of #98754 - jyn514:non-trivial-drop, r=compiler-errorsbors-32/+344
Fix drop-tracking ICE when a struct containing a field with a significant drop is used across an await Previously, drop-tracking would incorrectly assume the struct would be dropped immediately, which was not true. Fixes #98476. Also fixes https://github.com/rust-lang/rust/issues/98477, I think because the parent HIR node for type variables is the whole function instead of the expression where the variable is used. r? `@eholk`
2022-07-13Update testsKatherine Philip-7/+10
2022-07-14bless testsAli MJ Al-Nasrawy-21/+6
2022-07-14Make outlives::{components,verify} agreeAli MJ Al-Nasrawy-0/+77
2022-07-13Re-optimize `Layout::array`Scott McMurray-0/+31
This way it's one check instead of two, so hopefully it'll be better Nightly: ``` layout_array_i32: movq %rdi, %rax movl $4, %ecx mulq %rcx jo .LBB1_2 movabsq $9223372036854775805, %rcx cmpq %rcx, %rax jae .LBB1_2 movl $4, %edx retq .LBB1_2: … ``` This PR: ``` movq %rcx, %rax shrq $61, %rax jne .LBB2_1 shlq $2, %rcx movl $4, %edx movq %rcx, %rax retq .LBB2_1: … ```
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-2/+3
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13add array tests, cleanup, tidy, and blessRalf Jung-11/+30
2022-07-13assigning to a union field can never drop nowRalf Jung-19/+3
2022-07-13remove untagged_union feature gateRalf Jung-373/+349
2022-07-13also allow arrays of allowed typesRalf Jung-4/+8
2022-07-13allow unions with mutable references and tuples of allowed typesRalf Jung-7/+37