about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-09-07Rollup merge of #101451 - cjgillot:test-100521, r=TaKO8KiYuki Okushi-0/+65
Add incremental test for changing struct name in assoc type. The ICE appears on beta and is fixed on nightly. Fixes #100521
2022-09-06Rollup merge of #101462 - aDotInTheVoid:rdj-enum-field-2, r=GuillaumeGomezGuillaume Gomez-1/+149
Rustdoc-Json: Store Variant Fields as their own item. Closes #100587 Closes #92945 Successor to #100762 Unlike that one, we don't have merge `StructType` and `Variant`, as after #101386 `Variant` stores enum specific information (discriminant). Resolves the naming discussion (https://github.com/rust-lang/rust/pull/100762#discussion_r950690526) by having seperate enums for struct and enum kinds Resolves `#[doc(hidden)]` on tuple structs (https://github.com/rust-lang/rust/pull/100762#discussion_r950833884) by storing as a `Vec<Option<Id>>` r? `@GuillaumeGomez`
2022-09-06Rollup merge of #101457 - ChayimFriedman2:struct-field-semi, r=fee1-deadGuillaume Gomez-3/+48
Recover from using `;` as separator between fields Partially fixes #101440 (only for record structs). Doing that for tuple structs is harder as their parsing passes through a bunch of helper functions. I don't know how to do that. But [their error message is better anyway](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cc6ee8bb2593596c0cea89d49e79bcb4) and suggests using a comma, even if it doesn't suggest replacing the semicolon with it.
2022-09-06Rollup merge of #101445 - TaKO8Ki:suggest-introducing-explicit-lifetime, ↵Guillaume Gomez-10/+44
r=oli-obk Suggest introducing an explicit lifetime if it does not exist Fixes #101027
2022-09-06Rollup merge of #101434 - ↵Guillaume Gomez-24/+26
JhonnyBillM:replace-session-for-handler-in-into-diagnostic, r=davidtwco Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess` Suggested by the team in [this Zulip Topic](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler). `Handler` already has almost all the capabilities of `ParseSess` when it comes to diagnostic emission, in this migration we only needed to add the ability to access `source_map` from the emitter in order to get a `Snippet` and the `start_point`. Not sure if adding these two methods [`span_to_snippet_from_emitter` and `span_start_point_from_emitter`] is the best way to address this gap. P.S. If this goes in the right direction, then we probably may want to move `SessionDiagnostic` to `rustc_errors` and rename it to `DiagnosticHandler` or something similar. r? `@davidtwco` r? `@compiler-errors`
2022-09-06Rollup merge of #101357 - compiler-errors:variant-sugg-tweak, r=oli-obkGuillaume Gomez-232/+232
Include enum path in variant suggestion (except for `Result` and `Option`, which we should have via the prelude) Fixes #101356
2022-09-06Auto merge of #101479 - Dylan-DPC:rollup-v8ite0y, r=Dylan-DPCbors-0/+91
Rollup of 5 pull requests Successful merges: - #100658 (TyCtxt::get_attr should check that no duplicates are allowed) - #101021 (Migrate ``rustc_middle`` diagnostic) - #101287 (Document eager evaluation of `bool::then_some` argument) - #101412 (Some more cleanup in `core`) - #101427 (Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-06Rollup merge of #101427 - compiler-errors:issue-101421, r=cjgillotDylan DPC-0/+71
Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments Fixes #101421 cc #100838
2022-09-06Rollup merge of #100658 - chenyukang:100631-check-get-attr, r=lcnrDylan DPC-0/+20
TyCtxt::get_attr should check that no duplicates are allowed Fixes #100631
2022-09-06Auto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillotbors-0/+31
Suggest removing unnecessary prefix let in patterns Helps with #101291, though I think `@estebank` probably wants this: > Finally, I think it'd be nice if we could detect that we don't know for sure and "just" swallow the rest of the expression (find the next ; accounting for nested braces) or the end of the item (easier). ... to be implemented before we close that issue out completely.
2022-09-06get_attr should check that no duplicates are allowedyukang-0/+20
2022-09-06Auto merge of #101359 - ↵bors-3/+1
compiler-errors:cannot-call-trait-object-with-unsized-return, r=lcnr Point out when a callable is not actually callable because its return is not sized Fixes #100755 I didn't add a UI test for that one because it's equivalent to the UI test that already exists in the suite.
2022-09-06Rollup merge of #101425 - compiler-errors:point-at-ty-param, r=spastorinoYuki Okushi-0/+23
Point at type parameter in plain path expr Slightly better error message for a kinda unique use case.
2022-09-06Rollup merge of #99291 - est31:let_else_tests, r=joshtriplettYuki Okushi-0/+321
Add let else drop order tests Add a systematic matrix based test that checks temporary drop order in various settings, `let-else-drop-order.rs`, as requested [here](https://github.com/rust-lang/rust/pull/93628#issuecomment-1055738523). The drop order of let and let else is supposed to be the and in order to ensure this, the test checks that this holds for a number of cases. The test also ensures that we drop the temporaries of the condition before executing the else block. cc #87335 tracking issue for `let else`
2022-09-05Rustdoc-Json: Store Variant Fields as their own item.Nixon Enraght-Moony-1/+149
Closes #100587 Closes #92945
2022-09-05Point out when a callable is not actually callable because its return is not ↵Michael Goulet-3/+1
sized
2022-09-05Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr ↵Michael Goulet-0/+71
arguments
2022-09-05Recover from using `;` as separator between fieldsChayim Refael Friedman-3/+48
2022-09-05Add test.Camille GILLOT-0/+65
2022-09-05FIX - broken translatable diagnostics testsJhonny Bill Mena-5/+5
2022-09-05FIX - broken translatable diagnostics testsJhonny Bill Mena-13/+15
2022-09-05use `propagate_through_exprs` instead of `propagate_through_expr`Takayuki Maeda-22/+22
fix `ExprKind` static_assert_size fix hir-stats
2022-09-05Add matrix based test for documenting the let / let else temporary drop orderest31-0/+321
The drop order of let and let else is supposed to be the same, and in order to ensure this, the test checks that this holds for the given list of cases. The test also ensures that we drop the temporaries of the condition before executing the else block. We made the test matrix based so it can check all the possible combinations and find out possible edge cases.
2022-09-05suggest introducing an explicit lifetime if it does not existTakayuki Maeda-10/+44
2022-09-05Auto merge of #101439 - Dylan-DPC:rollup-2wf1mtj, r=Dylan-DPCbors-151/+352
Rollup of 6 pull requests Successful merges: - #101142 (Improve HIR stats) - #101367 (Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch) - #101391 (more clippy::perf fixes) - #101409 (Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates) - #101420 (Fix `hir::Local` doc to match with the variable name used: `init`) - #101429 (Don't suggest reborrow if usage is inside a closure) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-05Rollup merge of #101429 - compiler-errors:issue-101119, r=lcnrDylan DPC-0/+31
Don't suggest reborrow if usage is inside a closure I can't think of why we would ever be able to *successfully* suggest a mutable reborrow `&mut *` due to a move happening due to a closure, so just suppress it. Fixes #101119
2022-09-05Rollup merge of #101409 - ↵Dylan DPC-0/+15
WaffleLapkin:rust_2021_compatibility_no_warn_in_2021_crates, r=TaKO8Ki Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates Fixes #101284
2022-09-05Rollup merge of #101367 - compiler-errors:suggest-copied-or-cloned, r=lcnrDylan DPC-0/+129
Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch Fixes #100699, but in the opposite direction (instead of suggesting to fix the signature, it fixes the body)
2022-09-05Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwcoDylan DPC-151/+177
Improve HIR stats #100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection. r? `@davidtwco`
2022-09-05Auto merge of #101414 - mystor:pm_nested_cross_thread, r=eddybbors-3/+20
proc_macro/bridge: use the cross-thread executor for nested proc-macros While working on some other changes in the bridge, I noticed that when running a nested proc-macro (which is currently only possible using the unstable `TokenStream::expand_expr`), any symbols held by the proc-macro client would be invalidated, as the same thread would be used for the nested macro by default, and the interner doesn't handle nested use. After discussing with `@eddyb,` we decided the best approach might be to force the use of the cross-thread executor for nested invocations, as it will never re-use thread-local storage, avoiding the issue. This shouldn't impact performance, as expand_expr is still unstable, and infrequently used. This was chosen rather than making the client symbol interner handle nested invocations, as that would require replacing the internal interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be disjoint), and the symbol interner is known to be fairly perf-sensitive. This patch adds checks to the execution strategy to use the cross-thread executor when doing nested invocations. An alternative implementation strategy could be to track this information in the `ExtCtxt`, however a thread-local in the `proc_macro` crate was chosen to add an assertion so that `rust-analyzer` is aware of the issue if it implements `expand_expr` in the future. r? `@eddyb`
2022-09-05UPDATE - into_diagnostic to take a Handler instead of a ParseSessJhonny Bill Mena-11/+11
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
2022-09-05Don't suggest reborrow if usage is inside a closureMichael Goulet-0/+31
2022-09-05Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomezbors-0/+119
Rustdoc-Json: Add enum discriminant Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as 1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output) 2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60) JSON doesn't have either of these limitations. r? `@GuillaumeGomez`
2022-09-05Auto merge of #100759 - fee1-dead-contrib:const_eval_select_real_intrinsic, ↵bors-70/+89
r=oli-obk,RalfJung Make `const_eval_select` a real intrinsic This fixes issues where `track_caller` functions do not have nice panic messages anymore when there is a call to the function, and uses the MIR system to replace the call instead of dispatching via lang items. Fixes #100696.
2022-09-04Point at type parameter in plain path exprMichael Goulet-0/+23
2022-09-04proc_macro/bridge: use the cross-thread executor for nested proc-macrosNika Layzell-3/+20
While working on some other changes in the bridge, I noticed that when running a nested proc-macro (which is currently only possible using the unstable `TokenStream::expand_expr`), any symbols held by the proc-macro client would be invalidated, as the same thread would be used for the nested macro by default, and the interner doesn't handle nested use. After discussing with @eddyb, we decided the best approach might be to force the use of the cross-thread executor for nested invocations, as it will never re-use thread-local storage, avoiding the issue. This shouldn't impact performance, as expand_expr is still unstable, and infrequently used. This was chosen rather than making the client symbol interner handle nested invocations, as that would require replacing the internal interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be disjoint), and the symbol interner is known to be fairly perf-sensitive. This patch adds checks to the execution strategy to use the cross-thread executor when doing nested invocations. An alternative implementation strategy could be to track this information in the `ExtCtxt`, however a thread-local in the `proc_macro` crate was chosen to add an assertion so that `rust-analyzer` is aware of the issue if it implements `expand_expr` in the future. r? @eddyb
2022-09-04Rollup merge of #101407 - GuillaumeGomez:rm-duplicated-gui-test, r=Dylan-DPCMatthias Krüger-22/+0
Remove duplicated test (superseeded by search-form-elements.goml) I realized it when I worked on https://github.com/rust-lang/rust/pull/101348. The checks are more complete in `search-form-elements.goml` (for example [here](https://github.com/rust-lang/rust/blob/master/src/test/rustdoc-gui/search-form-elements.goml#L12-L29)). r? `@Dylan-DPC`
2022-09-04Rollup merge of #101388 - compiler-errors:issue-101376, r=fee1-deadMatthias Krüger-0/+35
Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop` Fixes #101376
2022-09-04Don't fire `rust_2021_incompatible_closure_captures` in edition = 2021Maybe Waffle-0/+15
2022-09-04Remove duplicated test (superseeded by search-form-elements.goml)Guillaume Gomez-22/+0
2022-09-04Auto merge of #101296 - compiler-errors:head-span-for-enclosing-scope, r=oli-obkbors-266/+189
Use head span for `rustc_on_unimplemented`'s `enclosing_scope` attr This may make #101281 slightly easier to understand
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-70/+89
2022-09-04Auto merge of #100726 - jswrenn:transmute, r=oli-obkbors-687/+1167
safe transmute: use `Assume` struct to provide analysis options This task was left as a TODO in #92268; resolving it brings [`BikeshedIntrinsicFrom`](https://doc.rust-lang.org/nightly/core/mem/trait.BikeshedIntrinsicFrom.html) more in line with the API defined in [MCP411](https://github.com/rust-lang/compiler-team/issues/411). **Before:** ```rust pub unsafe trait BikeshedIntrinsicFrom< Src, Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_VALIDITY: bool, const ASSUME_VISIBILITY: bool, > where Src: ?Sized, {} ``` **After:** ```rust pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }> where Src: ?Sized, {} ``` `Assume::visibility` has also been renamed to `Assume::safety`, as library safety invariants are what's actually being assumed; visibility is just the mechanism by which it is currently checked (and that may change). r? `@oli-obk` --- Related: - https://github.com/rust-lang/compiler-team/issues/411 - https://github.com/rust-lang/rust/issues/99571
2022-09-04Also suggest dereferencing LHS when both &mut T and T are valid binop LHSMichael Goulet-0/+35
2022-09-04Address nits, rename enclosing_scope => parent_labelMichael Goulet-43/+43
2022-09-04Use head span for rustc_on_unimplemented's enclosing_scope attrMichael Goulet-196/+119
2022-09-04Rollup merge of #101369 - compiler-errors:global-asm-pprint, r=jackh726Matthias Krüger-0/+12
Fix `global_asm` macro pretty printing Fixes #101051 Fixes #101047
2022-09-04Rollup merge of #100647 - obeis:issue-99875, r=nagisaMatthias Krüger-32/+81
Make trait bound not satisfied specify kind Closes #99875
2022-09-04Rollup merge of #100302 - compiler-errors:deref-path-methods, r=jackh726Matthias Krüger-0/+20
Suggest associated method on deref types when path syntax method fails Fixes #100278
2022-09-03Rustdoc-Json: Add enum discriminantNixon Enraght-Moony-0/+119