about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-10-30Rollup merge of #131096 - GuillaumeGomez:rm-no_unused, r=notriddle许杰友 Jieyou Xu (Joe)-0/+88
rustdoc: Remove usage of `allow(unused)` attribute on `no_run` merged doctests Fixes [#130681](https://github.com/rust-lang/rust/issues/130681). It fixes the behaviour difference with the current doctests. r? ``@notriddle``
2024-10-30Rollup merge of #130098 - adetaylor:arbitrary-self-types-block-generics, ↵许杰友 Jieyou Xu (Joe)-44/+429
r=wesleywiser Reject generic self types. The RFC for arbitrary self types v2 declares that we should reject "generic" self types. This commit does so. The definition of "generic" was unclear in the RFC, but has been explored in https://github.com/rust-lang/rust/issues/129147 and the conclusion is that "generic" means any `self` type which is a type parameter defined on the method itself, or references to such a type. This approach was chosen because other definitions of "generic" don't work. Specifically, * we can't filter out generic type _arguments_, because that would filter out Rc<Self> and all the other types of smart pointer we want to support; * we can't filter out all type params, because Self itself is a type param, and because existing Rust code depends on other type params declared on the type (as opposed to the method). This PR decides to make a new error code for this case, instead of reusing the existing E0307 error. This makes the code a bit more complex, but it seems we have an opportunity to provide specific diagnostics for this case so we should do so. This PR filters out generic self types whether or not the 'arbitrary self types' feature is enabled. However, it's believed that it can't have any effect on code which uses stable Rust, since there are no stable traits which can be used to indicate a valid generic receiver type, and thus it would have been impossible to write code which could trigger this new error case. It is however possible that this could break existing code which uses either of the unstable `arbitrary_self_types` or `receiver_trait` features. This breakage is intentional; as we move arbitrary self types towards stabilization we don't want to continue to support generic such types. This PR adds lots of extra tests to arbitrary-self-from-method-substs. Most of these are ways to trigger a "type mismatch" error which https://github.com/rust-lang/rust/blob/9b82580c7347f800c2550e6719e4218a60a80b28/compiler/rustc_hir_typeck/src/method/confirm.rs#L519 hopes can be minimized by filtering out generics in this way. We remove a FIXME from confirm.rs suggesting that we make this change. It's still possible to cause type mismatch errors, and a subsequent PR may be able to improve diagnostics in this area, but it's harder to cause these errors without contrived uses of the turbofish. This is a part of the arbitrary self types v2 project, https://github.com/rust-lang/rfcs/pull/3519 https://github.com/rust-lang/rust/issues/44874 r? `@wesleywiser`
2024-10-30Reject generic self types.Adrian Taylor-44/+429
The RFC for arbitrary self types v2 declares that we should reject "generic" self types. This commit does so. The definition of "generic" was unclear in the RFC, but has been explored in https://github.com/rust-lang/rust/issues/129147 and the conclusion is that "generic" means any `self` type which is a type parameter defined on the method itself, or references to such a type. This approach was chosen because other definitions of "generic" don't work. Specifically, * we can't filter out generic type _arguments_, because that would filter out Rc<Self> and all the other types of smart pointer we want to support; * we can't filter out all type params, because Self itself is a type param, and because existing Rust code depends on other type params declared on the type (as opposed to the method). This PR decides to make a new error code for this case, instead of reusing the existing E0307 error. This makes the code a bit more complex, but it seems we have an opportunity to provide specific diagnostics for this case so we should do so. This PR filters out generic self types whether or not the 'arbitrary self types' feature is enabled. However, it's believed that it can't have any effect on code which uses stable Rust, since there are no stable traits which can be used to indicate a valid generic receiver type, and thus it would have been impossible to write code which could trigger this new error case. It is however possible that this could break existing code which uses either of the unstable `arbitrary_self_types` or `receiver_trait` features. This breakage is intentional; as we move arbitrary self types towards stabilization we don't want to continue to support generic such types. This PR adds lots of extra tests to arbitrary-self-from-method-substs. Most of these are ways to trigger a "type mismatch" error which https://github.com/rust-lang/rust/blob/9b82580c7347f800c2550e6719e4218a60a80b28/compiler/rustc_hir_typeck/src/method/confirm.rs#L519 hopes can be minimized by filtering out generics in this way. We remove a FIXME from confirm.rs suggesting that we make this change. It's still possible to cause type mismatch errors, and a subsequent PR may be able to improve diagnostics in this area, but it's harder to cause these errors without contrived uses of the turbofish. This is a part of the arbitrary self types v2 project, https://github.com/rust-lang/rfcs/pull/3519 https://github.com/rust-lang/rust/issues/44874 r? @wesleywiser
2024-10-30Auto merge of #130860 - tmandry:fix-directives, r=jieyouxubors-16/+23
Fix directives for lint-non-snake-case-crate This test fails on targets without unwinding or with `--target-rustcflags=-Cpanic=abort` because the proc macro was compiled as the target, not the host. Some targets were explicitly disabled to pass CI, but these directives are more general. * `needs-dynamic-linking` is self explanatory * `force-host` for proc macros * `no-prefer-dynamic` is apparently also used for proc macros Note that `needs-unwind` can also be useful for situations other than proc macros where unwinding is necessary. r? `@jieyouxu` try-job: test-various
2024-10-30Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebankMatthias Krüger-141/+141
Use `token_descr` more in error messages This is the first two commits from #124141, put into their own PR to get things rolling. Commit messages have the details. r? ``@estebank`` cc ``@petrochenkov``
2024-10-30Rollup merge of #129394 - Jarcho:irrefutable_let_patterns, r=NadrierilMatthias Krüger-1/+39
Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains fixes #128661 Is there any preference where the test goes? There looks to be several places it could fit.
2024-10-29Fix directives for lint-non-snake-case-crateTyler Mandry-16/+23
This test fails on targets without unwinding because the proc macro was compiled as the target, not the host. Some targets were explicitly disabled to pass CI, but these directives are more general. Fixes Fuchsia tests.
2024-10-29Don't lint `irrefutable_let_patterns` on leading patterns if `else if` ↵Jason Newcomb-1/+39
let-chains.
2024-10-29Rollup merge of #132157 - estebank:long-types-3, r=jieyouxuMatthias Krüger-405/+405
Remove detail from label/note that is already available in other note Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` *Ignore first three commits from https://github.com/rust-lang/rust/pull/132086.*
2024-10-29Rollup merge of #132151 - compiler-errors:coroutine-resume-outlives, ↵Matthias Krüger-0/+98
r=spastorino Ensure that resume arg outlives region bound for coroutines When proving that `{Coroutine}: 'region`, we must also prove that the coroutine's resume ty outlives that region as well. See the inline comment. Fixes #132104
2024-10-29Rollup merge of #131984 - dingxiangfei2009:stabilize-if-let-rescope, ↵Matthias Krüger-75/+24
r=traviscross,lcnr Stabilize if_let_rescope Close #131154 Tracked by #124085
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-405/+405
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-10-29Rollup merge of #132312 - jieyouxu:delete-crashes-23707, r=matthiaskrgrJubilee-109/+0
Delete `tests/crashes/23707.rs` because it's flaky It's conditioned on `only-x86_64` because it doesn't reliably fail on other platforms, it's optimization dependent and failed to ICE post-PGO in <https://github.com/rust-lang/rust/pull/132300#issuecomment-2443279042>. Remove this test for now without prejudice against relanding the test in a more reliable form. I removed the `S-bug-has-test` label from #23707. r? compiler
2024-10-29Rollup merge of #132266 - krasimirgg:llvm-20-testfix, ↵Jubilee-3/+8
r=hanna-kruppe,beetrees,workingjubilee riscv-soft-abi-with-float-features.rs: adapt for LLVM 20 Adapts a test for LLVM 20. No functional changes intended.
2024-10-29Rollup merge of #132194 - compiler-errors:rpitit-super-wc, r=spastorinoJubilee-0/+21
Collect item bounds for RPITITs from trait where clauses just like associated types We collect item bounds from trait where clauses for *associated types*, i.e. this: ```rust trait Foo where Self::Assoc: Send { type Assoc; } ``` Becomes this: ```rust trait Foo { type Assoc: Send; } ``` Today, with RPITITs/AFIT and return-type notation, we don't do that, i.e.: ```rust trait Foo where Self::method(..): Send { fn method() -> impl Sized; } fn is_send(_: impl Send) {} fn test<T: Foo>() { is_send(T::method()); } ``` ...which fails on nightly today. Turns out it's super easy to fix this, and we just need to use the `associated_type_bounds` lowering function in `explicit_item_bounds_with_filter`, which has that logic baked in.
2024-10-29Rollup merge of #132119 - compiler-errors:effects-old-solver, r=lcnrJubilee-168/+106
Hack out effects support for old solver Opening this for vibes ✨ Turns out that a basic, somewhat incomplete implementation of host effects is achievable in the old trait solver pretty easily. This should be sufficient for us to use in the standard library itself. Regarding incompleteness, maybe we should always treat host predicates as ambiguous in intercrate mode (at least in the old solver) to avoid any worries about accidental impl overlap or something. r? ```@lcnr``` cc ```@fee1-dead```
2024-10-29Auto merge of #132277 - workingjubilee:rollup-5e6q6e4, r=workingjubileebors-29/+30
Rollup of 9 pull requests Successful merges: - #130259 (Lower AST node id only once) - #131441 (Add a new trait `proc_macro::ToTokens`) - #132247 (stable_mir: Directly use types from rustc_abi) - #132249 (compiler: Add rustc_abi dependence to the compiler) - #132255 (Add `LayoutData::is_uninhabited` and use it) - #132258 ([rustdoc] Unify variant struct fields margins with struct fields) - #132260 (cg_llvm: Use a type-safe helper to cast `&str` and `&[u8]` to `*const c_char`) - #132261 (refactor: cleaner check to return None) - #132271 (Updating Fuchsia platform-support documentation) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-29Delete `tests/crashes/23707.rs` because it's flaky许杰友 Jieyou Xu (Joe)-109/+0
It's conditioned on `only-x86_64` because it doesn't reliably fail on other platforms, it's optimization dependent and failed to ICE post-PGO in <https://github.com/rust-lang/rust/pull/132300#issuecomment-2443279042>. Remove this test for now without prejudice against relanding the test in a more reliable form.
2024-10-29Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgaubors-33/+828
Lint against getting pointers from immediately dropped temporaries Fixes #123613 ## Changes: 1. New lint: `dangling_pointers_from_temporaries`. Is a generalization of `temporary_cstring_as_ptr` for more types and more ways to get a temporary. 2. `temporary_cstring_as_ptr` is removed and marked as renamed to `dangling_pointers_from_temporaries`. 3. `clippy::temporary_cstring_as_ptr` is marked as renamed to `dangling_pointers_from_temporaries`. 4. Fixed a false positive[^fp] for when the pointer is not actually dangling because of lifetime extension for function/method call arguments. 5. `core::cell::Cell` is now `rustc_diagnostic_item = "Cell"` ## Questions: - [ ] Instead of manually checking for a list of known methods and diagnostic items, maybe add some sort of annotation to those methods in library and check for the presence of that annotation? https://github.com/rust-lang/rust/pull/128985#issuecomment-2318714312 ## Known limitations: ### False negatives[^fn]: See the comments in `compiler/rustc_lint/src/dangling.rs` 1. Method calls that are not checked for: - `temporary_unsafe_cell.get()` - `temporary_sync_unsafe_cell.get()` 2. Ways to get a temporary that are not recognized: - `owning_temporary.field` - `owning_temporary[index]` 3. No checks for ref-to-ptr conversions: - `&raw [mut] temporary` - `&temporary as *(const|mut) _` - `ptr::from_ref(&temporary)` and friends [^fn]: lint **should** be emitted, but **is not** [^fp]: lint **should not** be emitted, but **is**
2024-10-28Hack out effects support for old solverMichael Goulet-168/+106
2024-10-28Rollup merge of #132258 - GuillaumeGomez:variant-structfields-margins, ↵Jubilee-6/+7
r=notriddle [rustdoc] Unify variant struct fields margins with struct fields As discussed in https://github.com/rust-lang/rust/pull/132220. | before | after | |-|-| | ![image](https://github.com/user-attachments/assets/d8d8336d-7fe4-45fb-a5a5-36a4023223f5) | ![Screenshot from 2024-10-28 11-17-24](https://github.com/user-attachments/assets/9d0d9633-b857-45b4-9217-7d0d1aa8f770) | r? ```@notriddle```
2024-10-28Rollup merge of #130259 - adwinwhite:lower-node-id-once, r=cjgillotJubilee-23/+23
Lower AST node id only once Fixes #96346. I basically followed the given instructions except the inline part. `lower_jump_destination` can't reuse local existing `HirId` due to unknown name resolution result so I created an additional mapping for labels. r? ```@cjgillot```
2024-10-28Auto merge of #132145 - RalfJung:stdarch, r=Amanieubors-6/+21
bump stdarch This lets us remove a hack from https://github.com/rust-lang/rust/pull/131349. r? `@Amanieu` try-job: test-various
2024-10-28riscv-soft-abi-with-float-features.rs: adapt for LLVM 20Krasimir Georgiev-3/+8
2024-10-28Auto merge of #132262 - matthiaskrgr:rollup-pcphi6l, r=matthiaskrgrbors-0/+24
Rollup of 4 pull requests Successful merges: - #131391 (Stabilize `isqrt` feature) - #132248 (rustc_transmute: Directly use types from rustc_abi) - #132252 (compiler: rename LayoutS to LayoutData) - #132253 (Known-bug test for `keyword_idents` lint not propagating to other files) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-28New lint: `dangling_pointers_from_temporaries`Pavel Grigorenko-33/+828
2024-10-28Rollup merge of #132253 - Zalathar:keyword-idents-bug, r=jieyouxuMatthias Krüger-0/+24
Known-bug test for `keyword_idents` lint not propagating to other files Known-bug test for `keyword_idents` lint not propagating to other files when configured via attribute (#132218).
2024-10-28we can now enable the 'const stable fn must be stable' checkRalf Jung-6/+21
2024-10-28Auto merge of #132244 - jyn514:linker-refactors, r=bjorn3bors-176/+179
fix various linker warnings separated out from https://github.com/rust-lang/rust/pull/119286; this doesn't have anything user-facing, i just want to land these changes so i can stop rebasing them. r? `@bjorn3`
2024-10-28Add GUI regression test for variant structfields marginsGuillaume Gomez-6/+7
2024-10-28Lower AST node id only onceAdwin White-23/+23
2024-10-28Known-bug test for `keyword_idents` lint not propagating to other filesZalathar-0/+24
2024-10-28Rollup merge of #132243 - compiler-errors:no-span, r=jieyouxu许杰友 Jieyou Xu (Joe)-9/+5
Remove `ObligationCause::span()` method I think it's an incredibly confusing footgun to expose both `obligation_cause.span` and `obligation_cause.span()`. Especially because `ObligationCause::span()` (the method) seems to just be hacking around a single quirk in the way we set up obligation causes for match arms. First commit removes the need for that hack, with only one diagnostic span changing (but IMO not really getting worse -- I'd argue that it was already confusing).
2024-10-28Rollup merge of #132227 - compiler-errors:better-const-span, r=Nadrieril许杰友 Jieyou Xu (Joe)-238/+232
Pass constness with span into lower_poly_trait_ref Gives us a span to point at for ~const/const on non-const traits. Split from #132209. r? Nadrieril
2024-10-28Rollup merge of #132220 - GuillaumeGomez:gui-test-struct-fields-margins, ↵许杰友 Jieyou Xu (Joe)-10/+42
r=notriddle Add GUI regression test for doc struct fields margins Fixes #131402. r? `@notriddle`
2024-10-28Rollup merge of #132086 - estebank:long-types, r=jieyouxu许杰友 Jieyou Xu (Joe)-0/+82
Tweak E0277 highlighting and "long type" path printing Partially address #132013. ![Output from this PR for the repro case in #132013](https://github.com/user-attachments/assets/a073ba37-4adc-411e-81f7-6cb9a945ce3d)
2024-10-28Error on alignments greater than `isize::MAX`asquared31415-0/+44
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-10-28Tweak more warnings.Nicholas Nethercote-108/+108
Much like the previous commit. I think the removal of "the token" in each message is fine here. There are many more error messages that mention tokens without saying "the token" than those that do say it.
2024-10-28Tweak `expand_incomplete_parse` warning.Nicholas Nethercote-33/+33
By using `token_descr`, as is done for many other errors, we can get slightly better descriptions in error messages, e.g. "macro expansion ignores token `let` and any following" becomes "macro expansion ignores keyword `let` and any tokens following". This will be more important once invisible delimiters start being mentioned in error messages -- without this commit, that leads to error messages such as "error at ``" because invisible delimiters are pretty printed as an empty string.
2024-10-27port `tests/ui/linkage-attr/framework` to run-makejyn-40/+43
this makes it much easier to understand test failures. before: ``` diff of stderr: 1 error: linking with `LINKER` failed: exit status: 1 2 | - ld: Undefined symbols: 4 _CFRunLoopGetTypeID, referenced from: 5 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` after: ``` === HAYSTACK === error: linking with `cc` failed: exit status: 1 | = note: use `--verbose` to show all linker arguments = note: Undefined symbols for architecture arm64: "_CFRunLoopGetTypeID", referenced from: main::main::hbb553f5dda62d3ea in main.main.d17f5fbe6225cf88-cgu.0.rcgu.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) error: aborting due to 1 previous error === NEEDLE === _CFRunLoopGetTypeID\.?, referenced from: thread 'main' panicked at /Users/jyn/git/rust-lang/rust/tests/run-make/linkage-attr-framework/rmake.rs:22:10: needle was not found in haystack ``` this also fixes a failure related to missing whitespace; we don't actually care about whitespace in this test.
2024-10-27give a better error for tuple structs in `derive(Diagnostic)`jyn-136/+136
2024-10-27Stop using the whole match expr span for an arm's obligation spanMichael Goulet-9/+5
2024-10-27Auto merge of #132237 - matthiaskrgr:rollup-ulogwtd, r=matthiaskrgrbors-84/+58
Rollup of 5 pull requests Successful merges: - #132043 (Simplify param handling in `resolve_bound_vars`) - #132214 (Cleanup: Move an impl-Trait check from AST validation to AST lowering) - #132221 (Clean up some comments on lint implementation) - #132228 (Revert "ci update freebsd version proposal, freebsd 12 being eol.") - #132234 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-27Rollup merge of #132214 - fmease:mv-impl-trait-val-paths, r=compiler-errorsMatthias Krüger-84/+58
Cleanup: Move an impl-Trait check from AST validation to AST lowering Namely the one that rejects `impl Trait` in qself types and non-final path segments. There's no good reason to perform this during AST validation. We have better infrastructure in place in the AST lowerer (`ImplTraitContext`). This shaves off a lot of code. We now lower `impl Trait` in bad positions to `{type error}` which allows us to remove a special case from HIR ty lowering. Coincidentally fixes #126725. Well, it only *masks* it by passing `{type error}` to HIR analysis instead of a "bad" opaque. I was able to find a new reproducer for it. See the issue.
2024-10-27Auto merge of #131284 - ↵bors-215/+231
dingxiangfei2009:rename-smart-ptr-to-coerce-referent, r=compiler-errors Rename macro `SmartPointer` to `CoercePointee` As per resolution #129104 we will rename the macro to better reflect the technical specification of the feature and clarify the communication. - `SmartPointer` is renamed to `CoerceReferent` - `#[pointee]` attribute is renamed to `#[referent]` - `#![feature(derive_smart_pointer)]` gate is renamed to `#![feature(derive_coerce_referent)]`. - Any mention of `SmartPointer` in the file names are renamed accordingly. r? `@compiler-errors` cc `@nikomatsakis` `@Darksonn`
2024-10-27Add GUI regression test for doc struct fields marginsGuillaume Gomez-10/+42
2024-10-27Move an impl-Trait check from AST validation to AST loweringLeón Orell Valerian Liehr-84/+58
2024-10-27Auto merge of #132213 - workingjubilee:rollup-tg1g3l5, r=workingjubileebors-5/+32
Rollup of 4 pull requests Successful merges: - #132123 (allow type-based search on foreign functions) - #132183 (Fix code HTML items making big blocks if too long) - #132192 (expand: Stop using artificial `ast::Item` for macros loaded from metadata) - #132205 (docs: Correctly link riscv32e from platform-support.md) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-26Rollup merge of #132183 - GuillaumeGomez:code-in-docblock, r=notriddleJubilee-5/+19
Fix code HTML items making big blocks if too long Encountered this bug randomly where `code` item in docblocks would look like this: ![Screenshot from 2024-10-26 15-44-46](https://github.com/user-attachments/assets/a9c1df9d-5007-49eb-a7dd-a2c381b2511e) With this fix it looks like this: ![image](https://github.com/user-attachments/assets/ea918595-5434-4781-b68c-6abd38689365) r? ``@notriddle``
2024-10-26Rollup merge of #132123 - lolbinarycat:rustdoc-search-foreign-func, r=notriddleJubilee-0/+13
allow type-based search on foreign functions fixes https://github.com/rust-lang/rust/issues/131804 preferably will be merged after #129708, but that may take a while to be approved due to being a new feature, whereas this is definitely a bug, and should be fixed.