about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-07-19Auto merge of #99451 - Dylan-DPC:rollup-ceghu18, r=Dylan-DPCbors-387/+280
Rollup of 8 pull requests Successful merges: - #97183 (wf-check generators) - #98320 (Mention first and last macro in backtrace) - #99335 (Use split_once in FromStr docs) - #99347 (Use `LocalDefId` in `OpaqueTypeKey`) - #99392 (Fix debuginfo tests.) - #99404 (Use span_bug for unexpected field projection type) - #99410 (Update invalid atomic ordering lint) - #99434 (Fix `Skip::next` for non-fused inner iterators) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-19Add E0790 as more specific variant of E0283aticu-63/+194
2022-07-19Rollup merge of #99410 - tmiasko:atomic-lint, r=fee1-deadDylan DPC-254/+57
Update invalid atomic ordering lint The restriction that success ordering must be at least as strong as its failure ordering in compare-exchange operations was lifted in #98383.
2022-07-19Rollup merge of #98320 - compiler-errors:macro-backtrace, r=estebankDylan DPC-132/+132
Mention first and last macro in backtrace Slight improvement to diagnostic mentioning what macro an error originates from. Not sure if it's worthwhile.
2022-07-19Rollup merge of #97183 - oli-obk:tait_ice_async, r=jackh726Dylan DPC-1/+91
wf-check generators fixes #90409 We should not rely on generators being well formed by construction now that they can get used via type alias impl trait (and thus users can choose generic arguments that are invalid). This can cause surprising behaviour if (definitely unsound) transmutes are used, and it's generally saner to just check for well formedness.
2022-07-19Auto merge of #98189 - mystor:fast_ident_literal, r=eddybbors-28/+12
proc_macro/bridge: stop using a remote object handle for proc_macro Ident and Literal This is the fourth part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch transforms the `Ident` and `Group` types into structs serialized over IPC rather than handles. Symbol values are interned on both the client and server when deserializing, to avoid unnecessary string copies and keep the size of `TokenTree` down. To do the interning efficiently on the client, the proc-macro crate is given a vendored version of the fxhash hasher, as `SipHash` appeared to cause performance issues. This was done rather than depending on `rustc_hash` as it is unfortunately difficult to depend on crates from within `proc_macro` due to it being built at the same time as `std`. In addition, a custom arena allocator and symbol store was also added, inspired by those in `rustc_arena` and `rustc_span`. To prevent symbol re-use across multiple invocations of a macro on the same thread, a new range of `Symbol` names are used for each invocation of the macro, and symbols from previous invocations are cleaned-up. In order to keep `Ident` creation efficient, a special ASCII-only case was added to perform ident validation without using RPC for simple identifiers. Full identifier validation couldn't be easily added, as it would require depending on the `rustc_lexer` and `unicode-normalization` crates from within `proc_macro`. Unicode identifiers are validated and normalized using RPC. See the individual commit messages for more details on trade-offs and design decisions behind these patches.
2022-07-19Mention first and last macro in backtraceMichael Goulet-132/+132
2022-07-18Don't add attribute to allow unused-qualifications to derive impl'sSamrat Man Singh-0/+38
Currently `#![forbid(unused_qualifications)]` is incompatible with all derive's because we add `#[allow(unused_qualifications)]` in all generated impl's.
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-169/+178
Closes #99255
2022-07-19Add a note about privacy to wrapping suggestionMaybe Waffle-1/+1
2022-07-19check accessibility before suggesting wrapping expressionsMaybe Waffle-0/+83
2022-07-19Suggest a fix for `NonZero*` <- `*` coercion errorMaybe Waffle-0/+40
2022-07-18Revert "Stabilize $$ in Rust 1.63.0"Christopher Durham-19/+55
This reverts commit 9edaa76adce4de737db54194eb13d6c298827b37.
2022-07-18Check generators for well formednessOli Scherer-1/+91
2022-07-18proc_macro: stop using a remote object handle for IdentNika Layzell-28/+12
Doing this for all unicode identifiers would require a dependency on `unicode-normalization` and `rustc_lexer`, which is currently not possible for `proc_macro` due to it being built concurrently with `std` and `core`. Instead, ASCII identifiers are validated locally, and an RPC message is used to validate unicode identifiers when needed. String values are interned on the both the server and client when deserializing, to avoid unnecessary copies and keep Ident cheap to copy and move. This appears to be important for performance. The client-side interner is based roughly on the one from rustc_span, and uses an arena inspired by rustc_arena. RPC messages passing symbols always include the full value. This could potentially be optimized in the future if it is revealed to be a performance bottleneck. Despite now having a relevant implementaion of Display for Ident, ToString is still specialized, as it is a hot-path for this object. The symbol infrastructure will also be used for literals in the next part.
2022-07-18Rollup merge of #99394 - JohnTitor:issue-95230, r=compiler-errorsDylan DPC-0/+7
Add regression test for #95230 Closes #95230 r? ```@compiler-errors``` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-18Rollup merge of #99351 - compiler-errors:arg-mismatch-blame, r=davidtwcoDylan DPC-4/+4
Use `typeck_results` to get accurate qpath res for arg mismatch error Improves error message from "function" to actually what we're calling (e.g. enum variant constrcutor) in a few cases :smile_cat:
2022-07-18Add `PhantomData` marker for dropck to `BTreeMap`Frank Steffahn-3/+50
closes #99408
2022-07-18Update invalid atomic ordering lintTomasz Miąsko-254/+57
The restriction that success ordering must be at least as strong as its failure ordering in compare-exchange operations was lifted in #98383.
2022-07-18Add some additional double-adjustment regression testsMichael Goulet-0/+46
2022-07-18Auto merge of #99137 - jackh726:wf-no-infcx, r=estebankbors-3/+8
Don't pass InferCtxt to WfPredicates Simple cleanup. Infer vars will get passed up as obligations and shallowed resolved later. This actually improves one test output.
2022-07-18Add regression test for #95230Yuki Okushi-0/+7
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-18Rollup merge of #99360 - compiler-errors:issue-99331, r=fee1-deadYuki Okushi-2/+19
Do not ICE when we have `-Zunpretty=expanded` with invalid ABI Fixes #99331
2022-07-18Rollup merge of #99356 - compiler-errors:tait-in-assoc-ty-supertraits, r=oli-obkYuki Okushi-0/+41
Do not constraint TAITs when checking impl/trait item compatibility Check out the UI test for the example. Open to other approaches to fix this issue -- ideally we _would_ be able to collect this opaque type constraint in a way to use it in `find_opaque_ty_constraints`, so we can report a better mismatch error in the incompatible case, and just allow it in the compatible case. But that seems like a bigger refactor, so I wouldn't want to start it unless someone else thought it was a good idea. cc #99348 r? ``@oli-obk``
2022-07-18Rollup merge of #99350 - compiler-errors:issue-99240, r=fee1-deadYuki Okushi-28/+103
Be more precise when suggesting removal of parens on unit ctor * Fixes #99240 by only suggesting to remove parens on path exprs, not arbitrary expressions with enum type * Generalizes by suggesting removal of parens on unit struct, too, because why not?
2022-07-17rustdoc: extend `#[doc(tuple_variadic)]` to fn pointersMichael Howell-4/+4
The attribute is also renamed `fake_variadic`.
2022-07-17Auto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obkbors-22/+44
Use constant eval to do strict mem::uninit/zeroed validity checks I'm not sure about the code organisation here, I just dumped the check in rustc_const_eval at the root. Not hard to move it elsewhere, in any case. Also, this means cranelift codegen intrinsics lose the strict checks, since they don't seem to depend on rustc_const_eval, and I didn't see a point in keeping around two copies. I also left comments in the is_zero_valid methods about "uhhh help how do i do this", those apply to both methods equally. Also rustc_codegen_ssa now depends on rustc_const_eval... is this okay? Pinging `@RalfJung` since you were the one who mentioned this to me, so I'm assuming you're interested. Haven't had a chance to run full tests on this since it's really warm, and it's 1AM, I'll check out any failures/comments in the morning :)
2022-07-17use body's param-env when checking if type needs dropMichael Goulet-0/+21
2022-07-17use rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when ↵Michael Goulet-4/+38
rendering path
2022-07-17Rollup merge of #99354 - JohnTitor:issue-95829, r=compiler-errorsYuki Okushi-0/+42
Add regression test for #95829 Closes #95829 r? `@compiler-errors` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-17Rollup merge of #99036 - TaKO8Ki:fix-test-for-88138, r=compiler-errorsYuki Okushi-186/+97
Add `#[test]` to functions in test modules I implemented a suggestion in #91770, but the ui test I created was inadequate and I have fixed that.
2022-07-16Do not ICE when we have -Zunpretty=expand with invalid ABIMichael Goulet-2/+19
2022-07-16Do not constraint TAITs when checking impl/trait item compatibilityMichael Goulet-0/+41
2022-07-17Add regression test for #95829Yuki Okushi-0/+42
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-16Stabilize `let_chains`Caio-681/+359
2022-07-16Use typeck_results to avoid duplicate ast_ty_to_ty callMichael Goulet-32/+22
2022-07-16Use typeck_results to get accurate qpath res for arg mismatch errorMichael Goulet-4/+4
2022-07-16Be more precise when suggesting removal of parens on unit adt ctorMichael Goulet-24/+65
2022-07-16Rollup merge of #99290 - compiler-errors:revert-98794, r=lcnrMatthias Krüger-34/+5
Revert "Highlight conflicting param-env candidates" This reverts #98794, commit 08135254dcf22be0d5661ea8f75e703b29a83514. Seems to have caused an incremental compilation bug. The root cause of the incr comp bug is somewhat unrelated but is triggered by this PR, so I don't feel comfortable with having this PR in the codebase until it can be investigated further. Fixes #99233.
2022-07-16Rollup merge of #99258 - estebank:suggest-let, r=wesleywiserMatthias Krüger-29/+155
Provide structured suggestion for dropped temp value
2022-07-16Rollup merge of #99213 - davidtwco:translation-migrate-passes, r=compiler-errorsMatthias Krüger-74/+74
migrate some of `rustc_passes::check_attr`'s diagnostics and derive improvements - Implements `IntoDiagnosticArg` for `char` using its `Debug` implementation and introduces a macro for those types which just delegate the implementation to `ToString`. - Apply the `#[rustc_lint_diagnostics]` attribute to `LintDiagnosticBuilder::build` so that diagnostic migration lints will trigger for it - some diagnostics in `rustc_privacy` need updated after this since the lints apply to that crate. - Add support for `MultiSpan` with any of the attributes that work on a `Span` in the diagnostic derive (`SessionDiagnostic` + `LintDiagnostic`). 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. - 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_`. - Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable. I got tired after a while. I modified some diagnostic output for consistency while doing this, nothing too crazy. r? `@compiler-errors`
2022-07-16Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebankMatthias Krüger-24/+131
Allow destructuring opaque types in their defining scopes fixes #96572 Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck. ```rust type T = impl Copy; let foo: T = (1u32, 2u32); let (a, b) = foo; ``` The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.
2022-07-16Auto merge of #99315 - JohnTitor:rollup-77wzoc1, r=JohnTitorbors-0/+77
Rollup of 7 pull requests Successful merges: - #98387 (Add new unstable API `downcast` to `std::io::Error`) - #98662 (Add std::fs::write documentation precision) - #99253 (Remove FIXME from MIR `always_storage_live_locals`) - #99264 (Fix typo in mod.rs) - #99270 (Add `#[must_use]` to `Box::from_raw`) - #99277 (Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends) - #99307 (Add regression test for #64401) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-16Auto merge of #99263 - compiler-errors:issue-99261, r=jyn514bors-0/+17
Fix ICE in `named_arguments_used_positionally` lint Fixes #99261 Fixes #99289 Fixes #99284 Fixes #99273 Fixes #99297 Fixes #99271 This match pattern: ``` FormatSpec { width: Count::CountIsName(s, _), .. } | FormatSpec { precision: Count::CountIsName(s, _), .. } ``` does not account for when both `width` and `precision` are both `Count::CountIsName`, so split the check for these two fields into two separate `if let`. Also, remove any future potential for ICEs by removing the index operator altogether. --- It is still suspicious that this indexing was broken and caused the ICE, as opposed to just causing a spurious lint message. cc `@PrestonFrom,` who may be familiar with this code because of implementing the lint this touches, perhaps you'd like to look into why named arguments in `FormatSpec.precision` seem to have indices that don't correspond to a span in `Context.arg_spans`? Edit: Opened #99265 to track a (related?) incorrect argument indexing issue.
2022-07-16Rollup merge of #99307 - JohnTitor:issue-64401, r=compiler-errorsYuki Okushi-0/+51
Add regression test for #64401 Closes #64401 r? `@compiler-errors` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-16Rollup merge of #99270 - rhysd:issue-99269, r=Mark-SimulacrumYuki Okushi-0/+26
Add `#[must_use]` to `Box::from_raw` Fixes #99269
2022-07-16Add regression test for #64401Yuki Okushi-0/+51
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
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-15Correctly handle path stability for 'use tree' itemsAaron Hill-3/+38
PR #5956 started checking the stability of path segments. However, this was not applied to 'use tree' items (e.g. 'use some::path::{ItemOne, ItemTwo}') due to the way that we desugar these items in HIR lowering. This PR modifies 'use tree' lowering to preserve resolution information, which is needed by stability checking.