about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-07-20Fix hack that remaps env constness.Deadbeef-16/+1
WARNING: might have perf implications. Are there any more problems with having a constness in the `ParamEnv` now? :)
2022-07-16Auto merge of #96482 - willcrichton:fix-trait-suggestion-for-binops, r=estebankbors-14/+72
Add Output = expected type trait obligation for known binary operators This PR is a follow-on to #94034 that addresses #96442. That is, after replacing the trait-suggestion logic in `op.rs` with a more generic path that analyzes a general set of `Obligation`s, then we lost some specificity in the suggestions where the bounds on the associated type `Output=` would not get suggested. This PR fixes this issue by changing `FnCtxt::construct_obligation_for_trait` to include a new `ProjectionPredicate` obligation for binary operators that obliges that `Output` is the same as the expected type of the expression. Additionally, to get the expected type of the expression, this PR threads the `Expectation<'tcx>` structure throughout several functions. See src/test/ui/generic-associated-types/missing-bounds.stderr for an example of how this works. One side effect of this change is it causes type-check failures with binops to include additional information. Specifically, many now say ``` error: type mismatch resolving `<Lhs as TheBinop>::Output == ExpectedTy` ``` It's up for discussion whether this added context is worth it to the user. r? `@estebank`
2022-07-15Fix suggestion regression with incorrect syntactic combination of trait boundsWill Crichton-3/+13
2022-07-15Propagate Expectation around binop typeck code to construct more precise ↵Will Crichton-12/+60
trait obligations for binops.
2022-07-16Auto merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelixbors-7/+85
Revert "Work around invalid DWARF bugs for fat LTO" Since September, the toolchain has not been generating reliable DWARF information for static variables when LTO is on. This has affected projects in the embedded space where the use of LTO is typical. In our case, it has kept us from bumping past the 2021-09-22 nightly toolchain lest our debugger break. This has been a pretty dramatic regression for people using debuggers and static variables. See #90357 for more info and a repro case. This commit is a mechanical revert of d5de680e20def848751cb3c11e1182408112b1d3 from PR #89041, which caused the issue. (Note on that PR that the commit's author has requested it be reverted.) I have locally verified that this fixes #90357 by restoring the functionality of both the repro case I posted on that bug, and debugger behavior on real programs. There do not appear to be test cases for this in the toolchain; if I've missed them, point me at 'em and I'll update them.
2022-07-15Auto merge of #99288 - Aaron1011:stable-intrinsics, r=yaahcbors-0/+17
Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules` Fixes #99286 PR #95956 accidentally made these intrinsics unstable when accessed through the unstable path segment 'std::intrinsics'
2022-07-15Set minimum GDB version needed for basic-types-globals* tests.Luqman Aden-0/+2
2022-07-15Auto merge of #99015 - lcnr:fn-ctxt-no-more, r=compiler-errorsbors-42/+9
stop using `FnCtxt` outside of hir typeck the requirements between **hir typeck**™, and **not hir typeck**™ are different enough to warrant a full split. with this PR `FnCtxt` is now only used for hir typeck (and for one clippy lint which seems to be emulating hir typeck). Once this PR has landed I intend to move `FnCtxt` into a new crate. This should also allow some further general improvements here. r? rust-lang/types
2022-07-15Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules`Aaron Hill-0/+17
Fixes #99286 PR #95956 accidentally made these intrinsics unstable when accessed through the unstable path segment 'std::intrinsics'
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-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-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-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-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