summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2023-11-09generator layout: ignore fake borrowslcnr-0/+34
(cherry picked from commit a42eca42df821a1d6e74a931195a00258f94bd6a)
2023-11-09add test for trivial bound not holding in `soa-derive`Rémy Rakic-0/+8
(cherry picked from commit 58351ae03f19520a586e7c3c1b13e74a9613d1d5)
2023-11-09Make sure that predicates with unmentioned bound vars are still considered ↵Michael Goulet-0/+32
global in the old solver (cherry picked from commit 32294fc0ed1810a16fcea649955a9b21ea061734)
2023-11-09review + add testslcnr-0/+41
(cherry picked from commit dda5e32ab0756642a5541678f5f42a3fe207eb6f)
2023-11-09dropck_outlives check generator witness needs_droplcnr-37/+10
(cherry picked from commit 57253552de475856a1f3bddedcd76e775892f770)
2023-10-20revert rust-lang/rust#114586Ali MJ Al-Nasrawy-22/+110
(cherry picked from commit a1e274f1721f6be4a36afe10e57a6825eeeaf848)
2023-10-20Disable effects in libcore againOli Scherer-0/+30
(cherry picked from commit bcdd3d77397295f1e20cd257c306d25c3a32dde2)
2023-10-20Make `#[repr(Rust)]` and `#[repr(C)]` incompatible with one anotherLeón Orell Valerian Liehr-0/+62
(cherry picked from commit d0b99e3efe62b5acc107da9c84331eae6cbe5a0d)
2023-09-30Auto merge of #115933 - oli-obk:simd_shuffle_const, r=workingjubileebors-19/+129
Prototype using const generic for simd_shuffle IDX array cc https://github.com/rust-lang/rust/issues/85229 r? `@workingjubilee` on the design TLDR: there is now a `fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;` intrinsic that allows replacing ```rust simd_shuffle(a, b, const { stuff }) ``` with ```rust simd_shuffle_generic::<_, _, {&stuff}>(a, b) ``` which makes the compiler implementations much simpler, if we manage to at some point eliminate `simd_shuffle`. There are some issues with this today though (can't do math without bubbling it up in the generic arguments). With this change, we can start porting the simple cases and get better data on the others.
2023-09-29Rollup merge of #116263 - ferrocene:pa-more-bare-metal-fixes, r=oli-obkMatthias Krüger-4/+5
More fixes for running the test suite on a bare metal target This PR adds more fixes needed to run the test suite on bare metal targets (in this case, without unwinding and with static relocations). There is no CI job exercising tests without unwinds, but I can confirm this worked in Ferrocene's CI.
2023-09-29Rollup merge of #116030 - RalfJung:abi-compat-test, r=wesleywiserMatthias Krüger-10/+173
run abi/compatibility test against a whole bunch of targets
2023-09-29Rollup merge of #112123 - bvanjoi:fix-98562, r=compiler-errorsMatthias Krüger-1/+50
fix(suggestion): insert projection to associated types Fixes #98562 This PR has fixed some help suggestions for unsupported syntax, such as `fn f<T>(_:T) where T: IntoIterator, std::iter::IntoIterator::Item = () {}` to `fn f<T: IntoIterator<Item = ()>>(_T) {}`.
2023-09-29Auto merge of #113301 - Be-ing:stabilize_bundle_whole-archive, r=petrochenkovbors-27/+0
stabilize combining +bundle and +whole-archive link modifiers Per discussion on https://github.com/rust-lang/rust/issues/108081 combining +bundle and +whole-archive already works and can be stabilized independently of other aspects of the packed_bundled_libs feature. There is no risk of regression because this was not previously allowed. r? `@petrochenkov`
2023-09-29mark relevant tests as requiring unwindingPietro Albini-2/+4
2023-09-29Auto merge of #115759 - oli-obk:open_drop_from_non-ADT, r=lcnrbors-4/+49
Reveal opaque types before drop elaboration fixes https://github.com/rust-lang/rust/issues/113594 r? `@cjgillot` cc `@JakobDegen` This pass was introduced in https://github.com/rust-lang/rust/pull/110714 I moved it before drop elaboration (which only cares about the hidden types of things, not the opaque TAIT or RPIT type) and set it to run unconditionally (instead of depending on the optimization level and whether the inliner is active)
2023-09-29add needs-relocation-model-pic to compiletestPietro Albini-2/+1
2023-09-29fix(suggestion): insert projection to associated typesbohan-1/+50
2023-09-29Rollup merge of #116253 - asquared31415:adt_const_params_feature, ↵Matthias Krüger-52/+197
r=compiler-errors Make `adt_const_params` feature suggestion consistent with other features and improve when it is emitted Makes the suggestion to add `adt_const_params` formatted like every other feature gate (notably this makes it such that the playground recognizes it). Additionally improves the situations in which that help is emitted so that it's only emitted when the type would be valid or the type *could* be valid (using a slightly incorrect heuristic that favors suggesting the feature over not) instead of, for example, implying that adding the feature would allow the use of `String`. Also adds the "the only supported types are integers, `bool` and `char`" note to the errors on fn and raw pointers. r? `@compiler-errors`
2023-09-29Rollup merge of #116201 - Jarcho:noop_fix, r=fee1-deadMatthias Krüger-7/+33
Fix `noop_method_call` detection This needs to be merged before #116198 can compile. The error occurs before the compiler is built so this needs to be a separate PR.
2023-09-29Auto merge of #116089 - estebank:issue-115992-2, r=compiler-errorsbors-53/+218
When suggesting `self.x` for `S { x }`, use `S { x: self.x }` Fix #115992. r? `@compiler-errors` Follow up to #116086.
2023-09-29Auto merge of #115843 - lcnr:bb-provisional-cache, r=compiler-errorsbors-2/+78
new solver: remove provisional cache The provisional cache is a performance optimization if there are large, interleaving cycles. Such cycles generally do not exist. It is incredibly complex and unsound in all trait solvers which have one: the old solver, chalk, and the new solver ([link](https://github.com/rust-lang/rust/blob/master/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs)). Given the assumption that it is not perf-critical and also incredibly complex, remove it from the new solver, only checking whether a goal is on the stack. While writing this, I uncovered two additional soundness bugs, see the inline comments for them. r? `@compiler-errors`
2023-09-29Auto merge of #115821 - obeis:hir-analysis-migrate-diagnostics-5, ↵bors-3/+9
r=compiler-errors Migrate `rustc_hir_analysis` to session diagnostic [Part 5] Finishing `coherence/builtin.rs` file
2023-09-28make adt_const_params feature suggestion more consistent with others and ↵asquared31415-52/+197
only suggest it when the type can probably work
2023-09-28Auto merge of #115659 - compiler-errors:itp, r=cjgillotbors-91/+44
Stabilize `impl_trait_projections` Closes #115659 ## TL;DR: This allows us to mention `Self` and `T::Assoc` in async fn and return-position `impl Trait`, as you would expect you'd be able to. Some examples: ```rust #![feature(return_position_impl_trait_in_trait, async_fn_in_trait)] // (just needed for final tests below) // ---------------------------------------- // struct Wrapper<'a, T>(&'a T); impl Wrapper<'_, ()> { async fn async_fn() -> Self { //^ Previously rejected because it returns `-> Self`, not `-> Wrapper<'_, ()>`. Wrapper(&()) } fn impl_trait() -> impl Iterator<Item = Self> { //^ Previously rejected because it mentions `Self`, not `Wrapper<'_, ()>`. std::iter::once(Wrapper(&())) } } // ---------------------------------------- // trait Trait<'a> { type Assoc; fn new() -> Self::Assoc; } impl Trait<'_> for () { type Assoc = (); fn new() {} } impl<'a, T: Trait<'a>> Wrapper<'a, T> { async fn mk_assoc() -> T::Assoc { //^ Previously rejected because `T::Assoc` doesn't mention `'a` in the HIR, // but ends up resolving to `<T as Trait<'a>>::Assoc`, which does rely on `'a`. // That's the important part -- the elided trait. T::new() } fn a_few_assocs() -> impl Iterator<Item = T::Assoc> { //^ Previously rejected for the same reason [T::new(), T::new(), T::new()].into_iter() } } // ---------------------------------------- // trait InTrait { async fn async_fn() -> Self; fn impl_trait() -> impl Iterator<Item = Self>; } impl InTrait for &() { async fn async_fn() -> Self { &() } //^ Previously rejected just like inherent impls fn impl_trait() -> impl Iterator<Item = Self> { //^ Previously rejected just like inherent impls [&()].into_iter() } } ``` ## Technical: Lifetimes in return-position `impl Trait` (and `async fn`) are duplicated as early-bound generics local to the opaque in order to make sure we are able to substitute any late-bound lifetimes from the function in the opaque's hidden type. (The [dev guide](https://rustc-dev-guide.rust-lang.org/return-position-impl-trait-in-trait.html#aside-opaque-lifetime-duplication) has a small section about why this is necessary -- this was written for RPITITs, but it applies to all RPITs) Prior to #103491, all of the early-bound lifetimes not local to the opaque were replaced with `'static` to avoid issues where relating opaques caused their *non-captured* lifetimes to be related. This `'static` replacement led to strange and possibly unsound behaviors (https://github.com/rust-lang/rust/issues/61949#issuecomment-508836314) (https://github.com/rust-lang/rust/issues/53613) when referencing the `Self` type alias in an impl or indirectly referencing a lifetime parameter via a projection type (via a `T::Assoc` projection without an explicit trait), since lifetime resolution is performed on the HIR, when neither `T::Assoc`-style projections or `Self` in impls are expanded. Therefore an error was implemented in #62849 to deny this subtle behavior as a known limitation of the compiler. It was attempted by `@cjgillot` to fix this in #91403, which was subsequently unlanded. Then it was re-attempted to much success (🎉) in #103491, which is where we currently are in the compiler. The PR above (#103491) fixed this issue technically by *not* replacing the opaque's parent lifetimes with `'static`, but instead using variance to properly track which lifetimes are captured and are not. The PR gated any of the "side-effects" of the PR behind a feature gate (`impl_trait_projections`) presumably to avoid having to involve T-lang or T-types in the PR as well. `@cjgillot` can clarify this if I'm misunderstanding what their intention was with the feature gate. Since we're not replacing (possibly *invariant*!) lifetimes with `'static` anymore, there are no more soundness concerns here. Therefore, this PR removes the feature gate. Tests: * `tests/ui/async-await/feature-self-return-type.rs` * `tests/ui/impl-trait/feature-self-return-type.rs` * `tests/ui/async-await/issues/issue-78600.rs` * `tests/ui/impl-trait/capture-lifetime-not-in-hir.rs` --- r? cjgillot on the impl (not much, just removing the feature gate) I'm gonna mark this as FCP for T-lang and T-types.
2023-09-28Auto merge of #116199 - Urgau:simplify-invalid_ref_casting, r=cjgillotbors-22/+102
Simplify some of the logic in the `invalid_reference_casting` lint This PR simplifies 2 areas of the logic for the `invalid_reference_casting` lint: - The init detection: we now use the newly added `expr_or_init` function instead of a manual detection - The ref-to-mut-ptr casting detection logic: I simplified this logic by caring less hardly about the order of the casting operations Those two simplifications permits us to detect more cases, as can be seen in the test output changes.
2023-09-28Strip `OpaqueCast` during `RevealAll`.Oli Scherer-23/+33
2023-09-28Remove unnecessary generator-check, which also fixes the issue within async ↵Oli Scherer-1/+2
functions
2023-09-28Unconditionally run `RevealAll` pass and run it earlierOli Scherer-3/+37
2023-09-28Rollup merge of #116191 - apekros:issue-56098, r=petrochenkovMatthias Krüger-0/+3
Add regression test for rust-lang#56098 Closes #56098
2023-09-28Fix `noop_method_call` detection for new diagnostic itemsJason Newcomb-7/+33
2023-09-28Rollup merge of #116215 - estebank:parse-type-angle-bracket-tweak, ↵Matthias Krüger-25/+147
r=compiler-errors Tweak wording of missing angle backets in qualified path
2023-09-28Tweak wording of missing angle backets in qualified pathEsteban Küber-25/+147
2023-09-27Fix ICE by introducing an expr_or_init variant for outside bodiesUrgau-0/+4
2023-09-27Simplify casting logic of the invalid_reference_casting lintUrgau-25/+55
2023-09-27Prefer expr_or_init over manual init detectionUrgau-20/+66
2023-09-27Rollup merge of #116187 - estebank:small-tweak, r=compiler-errorsMatthias Krüger-5/+22
Add context to `let: Ty = loop { break };` We weren't accounting for the case where `break` was immediately within the `loop` block.
2023-09-27Rollup merge of #116178 - ↵Matthias Krüger-0/+18
Milo123459:milo/add-test-for-const-async-function-in-main, r=wesleywiser Add test for `const async fn` This adds a test for #102796
2023-09-27Rollup merge of #116149 - compiler-errors:anonymize, r=lcnrMatthias Krüger-0/+13
Anonymize binders for `refining_impl_trait` check We're naively using the equality impl for `ty::Clause` in the refinement check, which is okay *except* for binders, which carry some information about where they come from in the AST. Those locations are not gonna be equal between traits and impls, so anonymize those clauses so that this doesn't matter. Fixes #116135
2023-09-27Add regression test for rust-lang#56098apekros-0/+3
2023-09-27Auto merge of #116163 - compiler-errors:lazyness, r=oli-obkbors-62/+1
Don't store lazyness in `DefKind::TyAlias` 1. Don't store lazyness of a type alias in its `DefKind`, but instead via a query. 2. This allows us to treat type aliases as lazy if `#[feature(lazy_type_alias)]` *OR* if the alias contains a TAIT, rather than having checks for both in separate parts of the codebase. r? `@oli-obk` cc `@fmease`
2023-09-27Auto merge of #116156 - oli-obk:opaque_place_unwrap, r=compiler-errorsbors-0/+36
Only prevent field projections into opaque types, not types containing opaque types fixes https://github.com/rust-lang/rust/issues/115778 I did not think that original condition through properly... I'll also need to check the similar check around the other `ProjectionKind::OpaqueCast` creation site (this one is in hir, the other one is in mir), but I'll do that change in another PR that doesn't go into a beta backport.
2023-09-26Add context to `let: Ty = loop { break };`Esteban Küber-5/+22
We weren't accounting for the case where `break` was immediately within the `loop` block.
2023-09-26add testMilo-0/+18
fix tidy remove dir
2023-09-26Anonymize binders for refining_impl_trait checkMichael Goulet-0/+13
2023-09-26Auto merge of #116175 - matthiaskrgr:rollup-cwteiwy, r=matthiaskrgrbors-6/+70
Rollup of 5 pull requests Successful merges: - #116099 (Add regression test for issue #79865) - #116131 (Rename `cold_path` to `outline`) - #116151 (Fix typo in rustdoc unstable features doc) - #116153 (Update books) - #116162 (Gate and validate `#[rustc_safe_intrinsic]`) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-26Rollup merge of #116162 - fmease:gate-n-validate-rustc_safe_intrinsic, ↵Matthias Krüger-6/+32
r=Nilstrieb Gate and validate `#[rustc_safe_intrinsic]` Copied over from #116159: > This was added as ungated in https://github.com/rust-lang/rust/pull/100719/files#diff-09c366d3ad3ec9a42125253b610ca83cad6b156aa2a723f6c7e83eddef7b1e8fR502, probably because the author looked at the surrounding attributes, which are ungated because they are gated specially behind the staged_api feature. > > I don't think we need to crater this, the attribute is entirely useless without the intrinsics feature, which is already unstable.. r? ``@Nilstrieb``
2023-09-26Rollup merge of #116099 - eduardosm:issue-79865-regression, r=oli-obkMatthias Krüger-0/+38
Add regression test for issue #79865 Closes https://github.com/rust-lang/rust/issues/79865
2023-09-26Auto merge of #115893 - RalfJung:match-require-partial-eq, r=oli-obkbors-2/+50
lint towards rejecting consts in patterns that do not implement PartialEq I think we definitely don't want to allow such consts, so even while the general plan around structural matching is up in the air, we can start the process of getting non-PartialEq matches out of the ecosystem.
2023-09-26Auto merge of #116125 - RalfJung:const-param-ty-eq, r=compiler-errorsbors-3/+34
ConstParamTy: require Eq as supertrait As discussed with `@BoxyUwu` [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/.60ConstParamTy.60.20and.20.60Eq.60). We want to say that valtree equality on const generic params agrees with `==`, but that only makes sense if `==` actually exists, hence we should have an appropriate bound. Valtree equality is an equivalence relation, so such a type can always be `Eq` and not just `PartialEq`.
2023-09-26Auto merge of #116124 - WaffleLapkin:fix-proc-macro-literal-to-string, ↵bors-0/+149
r=compiler-errors Properly print cstr literals in `proc_macro::Literal::to_string` Previously we printed the contents of the string, rather than the actual string literal (e.g. `the c string` instead of `c"the c string"`). Fixes #112820 cc #105723