about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-09-01Auto merge of #115276 - fmease:rustdoc-obj-lt-defs-handle-self-ty-params, ↵bors-0/+34
r=GuillaumeGomez rustdoc: correctly deal with self ty params when eliding default object lifetimes Fixes #115179.
2023-09-01Rollup merge of #115424 - notriddle:notriddle/issue-106413, r=oli-obkMatthias Krüger-0/+159
diagnostics: avoid wrong `unused_parens` on `x as (T) < y` Fixes #106413 Fixes #80636
2023-09-01rustdoc: correctly deal with self ty params when eliding default object ↵León Orell Valerian Liehr-0/+34
lifetimes
2023-09-01Auto merge of #113126 - Bryanskiy:delete_old, r=petrochenkovbors-1173/+798
Replace old private-in-public diagnostic with type privacy lints Next part of RFC https://github.com/rust-lang/rust/issues/48054. r? `@petrochenkov`
2023-09-01Auto merge of #111752 - dingxiangfei2009:lower-or-pattern, r=cjgillotbors-590/+931
Lower `Or` pattern without allocating place cc `@azizghuloum` `@cjgillot` Related to #111583 and #111644 While reviewing #111644, it occurs to me that while we directly lower conjunctive predicates, which are connected with `&&`, into the desirable control flow, today we don't directly lower the disjunctive predicates, which are connected with `||`, in the similar fashion. Instead, we allocate a place for the boolean temporary to hold the result of evaluating the `||` expression. Usually I would expect optimization at later stages to "inline" the evaluation of boolean predicates into simple CFG, but #111583 is an example where `&&` is failing to be optimized away and the assembly shows that both the expensive operands are evaluated. Therefore, I would like to make a small change to make the CFG a bit more straight-forward without invoking the `as_temp` machinery, and plus avoid allocating the place to hold the boolean result as well.
2023-09-01Auto merge of #113201 - oli-obk:recursive_type_alias, r=estebank,compiler-errorsbors-13/+70
Permit recursive weak type aliases I saw #63097 and thought "we can do ~~better~~ funnier". So here it is. It's not useful, but it's certainly something. This may actually become feasible with lazy norm (so in 5 years (constant, not reducing over time)). r? `@estebank` cc `@GuillaumeGomez`
2023-09-01Auto merge of #115400 - gurry:issue-115264-ice, r=compiler-errorsbors-0/+36
Return ident for ExprField and PatField HIR nodes Fixes #115264
2023-08-31diagnostics: avoid wrong `unused_parens` on `x as (T) < y`Michael Howell-0/+159
2023-09-01Return ident for ExprField and PatField HIR nodesGurinder Singh-0/+36
2023-08-31Auto merge of #115366 - ↵bors-0/+19
compiler-errors:associated-type-bound-implicit-lifetimes, r=jackh726 Capture lifetimes for associated type bounds destined to be lowered to opaques Some associated type bounds get lowered to opaques, but they're not represented in the AST as opaques. That means that we never collect lifetimes for them (`record_lifetime_params_for_impl_trait`) which are used currently for RPITITs, which capture all of their in-scope lifetimes[^1]. This means that the nested RPITITs that arise from some type like `impl Foo<Type: Bar>` (~> `impl Foo<Type = impl Bar>`) don't capture any lifetimes, leading to ICEs. This PR makes sure we collect the lifetimes for associated type bounds as well, and make sure that they are set up correctly for opaque type lowering later. Fixes #115360 [^1]: #114489
2023-09-01update tests that are ignored by debugDing Xiang Fei-278/+326
2023-08-31Auto merge of #115389 - bvanjoi:fix-115380, r=petrochenkovbors-1/+1
fix(resolve): update def if binding is warning ambiguity Fixes #115380
2023-08-31Auto merge of #115384 - lqd:default-universe-info, r=matthewjasperbors-0/+119
Work around ICE in diagnostics for local super-universes missing `UniverseInfo`s In issue #114907, canonicalization of liveness dropck-outlives results (IIUC) encounters universes absent from the original query. Some local universes [are created](https://github.com/lqd/rust/blob/f3a1bae88c617330b8956818da3cea256336c1cf/compiler/rustc_infer/src/infer/canonical/query_response.rs#L417-L425) for the mapping, but importantly, they won't have associated causes. These missing `UniverseInfo`s can be [needed](https://github.com/lqd/rust/blob/f3a1bae88c617330b8956818da3cea256336c1cf/compiler/rustc_borrowck/src/diagnostics/region_errors.rs#L376) during diagnostics, [causing the `IndexMap: key not found` ICE](https://github.com/lqd/rust/blob/d55522aad87c5605d7edd5dd4b37926e8b446117/compiler/rustc_borrowck/src/region_infer/mod.rs#L2252) seen in the issue. This PR works around this by returning the suboptimal catch-all cause, to avoid the ICE. It does results in suboptimal diagnostics right now, but it's better than an ICE. r? `@matthewjasper.` Let me know if there's a good easy-ish way to fix this, but I believe that for some of these erroneous cases and diagnostics, that inference/canonicalization/higher-ranked subtyping/etc may not behave exactly the same with the new trait solver? If that's the case then it'd probably be best to wait a bit more to do the correct fix. Fixes #114907. cc `@aliemjay`
2023-08-31fix(resolve): update def if binding is warning ambiguitybohan-1/+1
2023-08-31Auto merge of #115290 - compiler-errors:ctor-unsafe, r=cjgillotbors-16/+52
`rustc_layout_scalar_valid_range` makes ctors unsafe We already validate this when we use the ctor in a call, e.g. `Variant(1)`, but not if we use the ctor as a fn ptr, e.g. `.map(Variant)`. The easiest way to fix the latter is (afaict) is by marking the ctor as unsafe itself. Fixes #115284
2023-08-31Rollup merge of #115378 - ferrocene:ignore-cross-compile, r=lqdMatthias Krüger-0/+7
`ignore-cross-compile` remaining tests that run binaries Follow up to https://github.com/rust-lang/rust/pull/114958
2023-08-31Auto merge of #115392 - compiler-errors:coherence-spans, r=aliemjaybors-17/+7
Don't record spans for predicates in coherence Should improve perf (https://github.com/rust-lang/rust/pull/115107#issuecomment-1695090589) for https://github.com/rust-lang/rust/pull/114023#issuecomment-1688514709 r? aliemjay
2023-08-30Auto merge of #115194 - tmiasko:inline-always-encode-mir, r=compiler-errorsbors-0/+19
Fix inlining with -Zalways-encode-mir Only inline functions that are considered eligible for inlining by the reachability pass. This constraint was previously indirectly enforced by only exporting MIR of eligible functions, but that approach doesn't work with -Zalways-encode-mir enabled.
2023-08-30Test and note unsafe ctor to fn ptr coercionMichael Goulet-16/+25
Also remove a note that I don't consider to be very useful in context.
2023-08-30rustc_layout_scalar_valid_range makes ctors unsafeMichael Goulet-0/+27
2023-08-30Auto merge of #115144 - Zoxc:parallel-guard, r=compiler-errorsbors-2/+5
Add `ParallelGuard` type to handle unwinding in parallel sections This adds a `ParallelGuard` type to handle unwinding in parallel sections instead of manually dealing with panics in each parallel operation. This also adds proper panic handling to the `join` operation. cc `@SparrowLii`
2023-08-30Don't record spans for predicates in coherenceMichael Goulet-17/+7
2023-08-30Update failure statusJohn Kåre Alsaker-2/+5
2023-08-30add test for issue 114907Rémy Rakic-0/+119
2023-08-30Permit recursive weak type aliasesOli Scherer-13/+70
2023-08-30`ignore-cross-compile` remaining tests that run binariesLukas Wirth-0/+7
2023-08-30Test variances of TAITsOli Scherer-0/+136
2023-08-30Revert "Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726"Oli Scherer-79/+62
This reverts commit cb9467515b5a9b15aaa905683c6b4dd9e851056c, reversing changes made to 57781b24c54f9548722927ba88c343ff28da94ce.
2023-08-30lower bare boolean expression with if-constructDing Xiang Fei-14/+2
2023-08-30lower ExprKind::Use, LogicalOp::Or and UnOp::NotDing Xiang Fei-409/+415
Co-authored-by: Abdulaziz Ghuloum <aghuloum@gmail.com>
2023-08-30mir-opt test before patchDing Xiang Fei-0/+299
2023-08-30Rollup merge of #115363 - kpreid:suggest-private, r=compiler-errorsMatthias Krüger-0/+25
Don't suggest adding parentheses to call an inaccessible method. Previously, code of this form would emit E0615 (attempt to use a method as a field), thus emphasizing the existence of private methods that the programmer probably does not care about. Now it ignores their existence instead, producing error E0609 (no field). The motivating example is: ```rust let x = std::rc::Rc::new(()); x.inner; ``` which would previously mention the private method `Rc::inner()`, even though `Rc<T>` intentionally has no public methods so that it can be a transparent smart pointer for any `T`. ```rust error[E0615]: attempted to take value of method `inner` on type `Rc<()>` --> src/main.rs:3:3 | 3 | x.inner; | ^^^^^ method, not a field | help: use parentheses to call the method | 3 | x.inner(); | ++ ``` With this change, it emits E0609 and no suggestion.
2023-08-30Rollup merge of #115355 - lqd:issue-115351, r=compiler-errorsMatthias Krüger-0/+39
new solver: handle edge case of a recursion limit of 0 Apparently a recursion limit of 0 is possible/valid/useful/used/cute, the more you know 🌟 . (It's somewhat interesting to me that the old solver seemingly handles this, and that the new solver currently requires a recursion limit of 2 here) r? `@compiler-errors.` Fixes #115351.
2023-08-30Rollup merge of #115347 - y21:generic-bound-impl-trait-ty, r=compiler-errorsMatthias Krüger-0/+40
suggest removing `impl` in generic trait bound position rustc already does this recovery in type param position (`<T: impl Trait>` -> `<T: Trait>`). This PR also adds that suggestion in trait bound position (e.g. `where T: impl Trait` or `trait Trait { type Assoc: impl Trait; }`)
2023-08-30Rollup merge of #115313 - gurry:issue-114918-cycle-detected, r=compiler-errorsMatthias Krüger-0/+91
Make `get_return_block()` return `Some` only for HIR nodes in body Fixes #114918 The issue occurred while compiling the following input: ```rust fn uwu() -> [(); { () }] { loop {} } ``` It was caused by the code below trying to suggest a missing return type which resulted in a const eval cycle: https://github.com/rust-lang/rust/blob/1bd043098e05839afb557bd7a2858cb09a4054ca/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs#L68-L75 The root cause was `get_return_block()` returning an `Fn` node for a node in the return type (i.e. the second `()` in the return type `[(); { () }]` of the input) although it is supposed to do so only for nodes that lie in the body of the function and return `None` otherwise (at least as per my understanding). The PR fixes the issue by fixing this behaviour of `get_return_block()`.
2023-08-30Rollup merge of #114704 - bvanjoi:fix-114636, r=compiler-errorsMatthias Krüger-38/+44
parser: not insert dummy field in struct Fixes #114636 This PR eliminates the dummy field, initially introduced in #113999, thereby enabling unrestricted use of `ident.unwrap()`. A side effect of this action is that we can only report the error of the first macro invocation field within the struct node. An alternative solution might be giving a virtual name to the macro, but it appears more complex.(https://github.com/rust-lang/rust/issues/114636#issuecomment-1670228715). Furthermore, if you think https://github.com/rust-lang/rust/issues/114636#issuecomment-1670228715 is a better solution, feel free to close this PR.
2023-08-30Make get_return_block() return Some only for HIR nodes in bodyGurinder Singh-0/+91
Fixes # 114918
2023-08-30Capture lifetimes for associated type bounds destined to be lowered to opaquesMichael Goulet-0/+19
2023-08-29Don't suggest adding parentheses to call an inaccessible method.Kevin Reid-0/+25
Previously, the test code would emit E0615, thus revealing the existence of private methods that the programmer probably does not care about. Now it ignores their existence instead, producing error E0609 (no field). The motivating example is: ```rust let x = std::rc::Rc::new(()); x.inner; ``` which would previously mention the private method `Rc::inner()`, even though `Rc<T>` intentionally has no public methods so that it can be a transparent smart pointer for any `T`.
2023-08-29add non-regression test for issue 115351Rémy Rakic-0/+39
2023-08-29Rollup merge of #115187 - ouz-a:smir_wrap, r=oli-obkMatthias Krüger-31/+3
Add new interface to smir Removes the boiler plate from `crate-info.rs`, and creates new interface for the smir. Addressing https://github.com/rust-lang/project-stable-mir/issues/23 r? `@spastorino`
2023-08-29Rollup merge of #115174 - davidtwco:needs-test-bad-location-list-67992, ↵Matthias Krüger-0/+31
r=wesleywiser tests: add test for #67992 Fixes #67992. Just adding a regression test for this issue.
2023-08-29Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obkMatthias Krüger-0/+42
Don't ICE on layout computation failure Fixes #111176 regression. r? `@oli-obk`
2023-08-29suggest removing `impl` in generic trait bound positiony21-0/+40
2023-08-29Auto merge of #112775 - c410-f3r:t3st3ss, r=petrochenkovbors-0/+0
Move tests r? `@petrochenkov`
2023-08-29Create StableMir replacer for SMirCallsouz-a-31/+3
2023-08-29there seems to be no reason to treat ZST specially in these casesRalf Jung-7/+7
2023-08-29rustc_abi: audit uses of is_zst; fix a case of giving an enum insufficient ↵Ralf Jung-0/+58
alignment
2023-08-29Auto merge of #115260 - scottmcm:not-quite-so-cold, r=WaffleLapkinbors-2/+11
Use `preserve_mostcc` for `extern "rust-cold"` As experimentation in #115242 has shown looks better than `coldcc`. Notably, clang exposes `preserve_most` (https://clang.llvm.org/docs/AttributeReference.html#preserve-most) but not `cold`, so this change should put us on a better-supported path. And *don't* use a different convention for cold on Windows, because that actually ends up making things worse. (See comment in the code.) cc tracking issue #97544
2023-08-28Move testsCaio-0/+0