about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-06-13Update variance-object-types.stderrYoke-1/+1
2022-06-13Remove trailing whitespaceMaybe Waffle-2/+2
2022-06-13remove use Cell in variance-object-types.rsYoke-1/+0
2022-06-13Improve suggestion wordingMaybe Waffle-5/+5
2022-06-13del unrelated commentYoke-3/+0
issues97981
2022-06-12Rollup merge of #97920 - bjorn3:test_annotation_fixes, r=Dylan-DPCMichael Goulet-3/+5
Fix some test annotations These are necessary for running the rustc test suite with cg_clif.
2022-06-12Improves parser diagnostics, fixes #93867threadexception-24/+47
2022-06-12Fix some test annotationsbjorn3-3/+5
These are necessary for running the rustc test suite with cg_clif
2022-06-12Rollup merge of #98012 - compiler-errors:poly-trait-refs-are-traits, r=cjgillotDylan DPC-28/+28
`ValuePairs::PolyTraitRefs` should be called "trait"s in type error diagnostics Pretty simple, we already do this for `ValuePairs::TraitRefs`...
2022-06-12Fix erroneous span for borrowck errorMichael Goulet-1/+37
2022-06-12Auto merge of #97993 - lengyijun:clean-variance, r=compiler-errorsbors-9/+9
clean variance test Remove unnecessary generic parameter.
2022-06-12Auto merge of #97778 - compiler-errors:misc-diagnostics-tidy, r=cjgillotbors-14/+80
Tidy up miscellaneous bounds suggestions Just some small fixes to suggestions - Generalizes `Ty::is_suggestable` into a `TypeVisitor`, so that it can be called on things other than `Ty` - Makes `impl Trait` in arg position no longer suggestible (generalizing the fix in #97640) - Fixes `impl Trait` not being replaced with fresh type param when it's deeply nested in function signature (fixes #97760) - Fixes some poor handling of `where` clauses with no predicates (also #97760) - Uses `InferCtxt::resolve_numeric_literals_with_default` so we suggest `i32` instead of `{integer}` (fixes #97677) Sorry there aren't many tests the fixes. Most of them would just be duplicates of other tests with empty `where` clauses or `impl Trait` in arg position instead of generic params. Let me know if you'd want more test coverage.
2022-06-11Properly replace `impl Trait` in fn args, turn {integer} to i32Michael Goulet-0/+49
2022-06-11Handle empty where-clause betterMichael Goulet-14/+31
2022-06-11ValuePairs::PolyTraitRefs should be called 'trait'Michael Goulet-28/+28
2022-06-11Auto merge of #97705 - compiler-errors:guide-inference, r=lcnrbors-0/+31
Fix inference issues with unconstrained base expr in `type_changing_struct_update` Use fresh infer vars to guide inference along in `type_changing_struct_update`. Fixes #96878
2022-06-11Auto merge of #95880 - cjgillot:def-ident-span, r=petrochenkovbors-92/+189
Handle `def_ident_span` like `def_span`. `def_ident_span` had an ad-hoc status in the compiler. This PR refactors it to be a first-class citizen like `def_span`: - it gets encoded in the main metadata loop, instead of the visitor; - its implementation is updated to mirror the one of `def_span`. We do not remove the `Option` in the return type, since some items do not have an ident, AnonConsts for instance.
2022-06-11Fix broken test caseMichael Howell-1/+1
2022-06-11Fix incorrectly spelled "variadic"Michael Howell-3/+3
2022-06-11Guide inference along during type_changing_struct_updateMichael Goulet-0/+31
2022-06-11Auto merge of #97989 - Dylan-DPC:rollup-wol1a1y, r=Dylan-DPCbors-8/+17
Rollup of 5 pull requests Successful merges: - #97761 (validating the vtable can lead to Stacked Borrows errors) - #97789 (Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no`) - #97913 (Wrap `HirId`s of locals into `LocalVarId`s for THIR nodes) - #97979 (Fix typos in Provider API docs) - #97987 (remove an unnecessary `String`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-11Have the drop code suggestion not include `let _ =`Aaron Kofsky-4/+4
2022-06-11Reword suggestion messages.Aaron Kofsky-4/+4
2022-06-11clean variance testlengyijun-9/+9
2022-06-11Rollup merge of #97789 - ferrocene:pa-fix-issue-71363-test, r=cjgillotDylan DPC-8/+17
Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no` The test relies on `library/std/src/error.rs` not corresponding to a local path, but remapping might still find the related local file of a remapped path. To fix the test, this PR adds a new `-Z` flag to disable finding the corresponding local path of a remapped path.
2022-06-11Auto merge of #97903 - est31:unused_macro_rules_compile_error, r=petrochenkovbors-0/+113
Never regard macro rules with compile_error! invocations as unused The very point of compile_error! is to never be reached, and one of the use cases of the macro, currently also listed as examples in the documentation of compile_error, is to create nicer errors for wrong macro invocations. Thus, we should never warn about unused macro arms that contain invocations of compile_error. See also https://github.com/rust-lang/rust/pull/96150#issuecomment-1126599107 and the discussion after that. Furthermore, the PR also contains two commits to silence `unused_macro_rules` when a macro has an invalid rule, and to add a test that `unused_macros` does not behave badly in the same situation. r? `@petrochenkov` as I've talked to them about this
2022-06-11Rollup merge of #97812 - TaKO8Ki:suggest-to-swap-struct-and-trait, r=estebankDylan DPC-0/+143
Suggest to swap a struct and a trait in trait impls closes #89590
2022-06-11Rollup merge of #97703 - lcnr:post-89862, r=estebankDylan DPC-10/+164
some additional `need_type_info.rs` cleanup also fixes #97698, fixes #97806 cc `@estebank`
2022-06-11Rollup merge of #96868 - nrc:turbo-stable, r=jhpratt,nbdd0121,nagisaDylan DPC-97/+9
Stabilize explicit_generic_args_with_impl_trait This is a stabilisation PR for `explicit_generic_args_with_impl_trait`. * [tracking issue](https://github.com/rust-lang/rust/issues/83701) - [Stabilisation report](https://github.com/rust-lang/rust/issues/83701#issuecomment-1109949897) - [FCP entered](https://github.com/rust-lang/rust/issues/83701#issuecomment-1120285703) * [implementation PR](https://github.com/rust-lang/rust/pull/86176) * [Reference PR](https://github.com/rust-lang/reference/pull/1212) * There is no mention of using the turbofish operator in the book (other than an entry in the operator list in the appendix), so there is no documentation to change/add there, unless we felt like we should add a section on using turbofish, but that seems orthogonal to `explicit_generic_args_with_impl_trait`
2022-06-10Rollup merge of #97957 - estebank:spancito, r=compiler-errorsMatthias Krüger-9/+18
Make `std::` prefix suggestion test `run-rustfix`
2022-06-10Fix suggestions for `&a: T` parametersMaybe Waffle-60/+449
Previously we were suggesting stuff like `fn f( &u32) {}`
2022-06-10Bless tests.Camille GILLOT-92/+189
2022-06-11Add regression test for #54378Yuki Okushi-0/+26
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-10Auto merge of #96837 - tmiasko:stdio-fcntl, r=joshtriplettbors-0/+46
Use `fcntl(fd, F_GETFD)` to detect if standard streams are open In the previous implementation, if the standard streams were open, but the RLIMIT_NOFILE value was below three, the poll would fail with EINVAL: > ERRORS: EINVAL The nfds value exceeds the RLIMIT_NOFILE value. Switch to the existing fcntl based implementation to avoid the issue. Fixes #96621.
2022-06-10Auto merge of #97939 - JohnTitor:rollup-79pxupb, r=JohnTitorbors-1/+30
Rollup of 6 pull requests Successful merges: - #97718 (Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383)) - #97876 (update docs for `std::future::IntoFuture`) - #97888 (Don't use __gxx_personality_v0 in panic_unwind on emscripten target) - #97922 (Remove redundant calls to reserve in impl Write for VecDeque) - #97927 (Do not introduce bindings for types and consts in HRTB.) - #97937 (Fix a typo in `test/ui/hrtb/hrtb-just-for-static.rs`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-10Rollup merge of #97937 - TaKO8Ki:fix-typo-in-hrtb-just-for-static, r=Dylan-DPCYuki Okushi-1/+1
Fix a typo in `test/ui/hrtb/hrtb-just-for-static.rs` closes #97934
2022-06-10Rollup merge of #97927 - cjgillot:issue-97836, r=petrochenkovYuki Okushi-0/+21
Do not introduce bindings for types and consts in HRTB. Fixes https://github.com/rust-lang/rust/issues/97836 r? `@petrochenkov`
2022-06-10Rollup merge of #97718 - xFrednet:95540-delayed-good-path-ice-for-expect, ↵Yuki Okushi-0/+8
r=wesleywiser Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383) Fixes a small ICE with the `delayed_good_path_bug` check. --- r? ``@wesleywiser`` cc: ``@eddyb`` this might be interesting, since you've added a `FIXME` comment above the modified check which kind of discusses a case like this closes: https://github.com/rust-lang/rust/issues/95540 cc: https://github.com/rust-lang/rust/issues/85549
2022-06-10fix a typoTakayuki Maeda-1/+1
2022-06-09interpret: unify offset_from check with offset checkRalf Jung-17/+17
2022-06-09Test that the unused_macros lint works correctly if rules are malformedest31-0/+41
The unused_macro_rules lint had a bug where it would regard all rules of a macro as unused if one rule were malformed. This bug doesn't exist with the unused_macros lint. To ensure it doesn't appear in the future, we add a test for it.
2022-06-09Suppress the unused_macro_rules lint if malformed rules are encounteredest31-0/+19
Prior to this commit, if a macro had any malformed rules, all rules would be reported as unused, regardless of whether they were used or not. So we just turn off unused rule checking completely for macros with malformed rules.
2022-06-09Never regard macro rules with compile_error! invocations as unusedest31-0/+53
The very point of compile_error! is to never be reached, and one of the use cases of the macro, currently also listed as examples in the documentation of compile_error, is to create nicer errors for wrong macro invocations. Thus, we shuuld never warn about unused macro arms that contain invocations of compile_error.
2022-06-09Do not introduce bindings for types and consts in HRTB.Camille GILLOT-0/+21
2022-06-09Stabilize the `bundle` native library modifierVadim Petrochenkov-69/+4
2022-06-09Use `multipart_suggestion` to create an applicable suggestion.Aaron Kofsky-4/+4
The "consider explicitly droping" can now suggest a machine applicable suggestion now.
2022-06-09Rollup merge of #95860 - c410-f3r:stabilize-meta, r=joshtriplettYuki Okushi-55/+19
Stabilize `$$` in Rust 1.63.0 # Stabilization proposal This PR proposes the stabilization of a subset of `#![feature(macro_metavar_expr)]` or more specifically, the stabilization of dollar-dollar (`$$`). Tracking issue: #83527 Version: 1.63 (2022-06-28 => beta, 2022-08-11 => stable). ## What is stabilized ```rust macro_rules! foo { () => { macro_rules! bar { ( $$( $$any:tt )* ) => { $$( $$any )* }; } }; } fn main() { foo!(); } ``` ## Motivation For more examples, see the [RFC](https://github.com/markbt/rfcs/blob/macro_metavar_expr/text/0000-macro-metavar-expr.md). Users must currently resort to a tricky and not so well-known hack to declare nested macros with repetitions. ```rust macro_rules! foo { ($dollar:tt) => { macro_rules! bar { ( $dollar ( $any:tt )* ) => { $dollar ( $any )* }; } }; } fn main() { foo!($); } ``` As seen above, such hack is fragile and makes work with declarative macros much more unpleasant. Dollar-dollar (`$$`), on the other hand, makes nested macros more intuitive. ## What isn't stabilized `count`, `ignore`, `index` and `length` are not being stabilized due to the lack of consensus. ## History * 2021-02-22, [RFC: Declarative macro metavariable expressions](https://github.com/rust-lang/rfcs/pull/3086) * 2021-03-26, [Tracking Issue for RFC 3086: macro metavariable expressions](https://github.com/rust-lang/rust/issues/83527) * 2022-02-01, [Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/93545) * 2022-02-25, [[1/2] Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/94368) * 2022-03-11, [[2/2] Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/94833) * 2022-03-12, [Fix remaining meta-variable expression TODOs](https://github.com/rust-lang/rust/pull/94884) * 2019-03-21, [[macro-metavar-expr] Fix generated tokens hygiene](https://github.com/rust-lang/rust/pull/95188) * 2022-04-07, [Kickstart the inner usage of macro_metavar_expr](https://github.com/rust-lang/rust/pull/95761) * 2022-04-07, [[macro_metavar_expr] Add tests to ensure the feature requirement](https://github.com/rust-lang/rust/pull/95764) ## Non-stabilized expressions https://github.com/rust-lang/rust/issues/83527 lists several concerns about some characteristics of `count`, `index` and `length` that effectively make their stabilization unfeasible. `$$` and `ignore`, however, are not part of any discussion and thus are suitable for stabilization. It is not in the scope of this PR to detail each concern or suggest any possible converging solution. Such thing should be restrained in this tracking issue. ## Tests This list is a subset of https://github.com/rust-lang/rust/tree/master/src/test/ui/macros/rfc-3086-metavar-expr * [Ensures that nested macros have correct behavior](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/dollar-dollar-has-correct-behavior.rs) * [Compares produced tokens to assert expected outputs](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs) * [Checks the declarations of the feature](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/required-feature.rs) * [Verifies all possible errors that can occur due to incorrect user input](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs) ## Possible future work Once consensus is achieved, other nightly expressions can be stabilized. Thanks ``@markbt`` for creating the RFC and thanks to ``@petrochenkov`` and ``@mark-i-m`` for reviewing the implementations.
2022-06-09move suggestions to its own methodTakayuki Maeda-10/+76
2022-06-08rustdoc: show tuple impls as `impl Trait for (T, ...)`Michael Howell-1/+15
This commit adds a new unstable attribute, `#[doc(tuple_varadic)]`, that shows a 1-tuple as `(T, ...)` instead of just `(T,)`, and links to a section in the tuple primitive docs that talks about these.
2022-06-09Auto merge of #97740 - RalfJung:ctfe-cycle-spans, r=lcnrbors-8/+8
use precise spans for recursive const evaluation This fixes https://github.com/rust-lang/rust/issues/73283 by using a `TyCtxtAt` with a more precise span when the interpreter recursively calls itself. Hopefully such calls are sufficiently rare that this does not cost us too much performance. (In theory, cycles can also arise through layout computation, as layout can depend on consts -- but layout computation happens all the time so we'd have to do something to not make this terrible for performance.)