about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-11-17Rollup merge of #133116 - RalfJung:const-null-ptr, r=dtolnay许杰友 Jieyou Xu (Joe)-3/+1
stabilize const_ptr_is_null FCP passed in https://github.com/rust-lang/rust/issues/74939. The second commit cleans up const stability around UB checks a bit, now that everything they need (except for `const_eval_select`) is stable. Fixes https://github.com/rust-lang/rust/issues/74939
2024-11-17Rollup merge of #133093 - est31:let_chains_tests, r=traviscross许杰友 Jieyou Xu (Joe)-6/+68
Let chains tests Filing this as this marks off two of the open issues in #132833: * extending the tests for `move-guard-if-let-chain.rs` and `conflicting_bindings.rs` to have chains with multiple let's (one implementation could for example search for the first `let` and then terminate). * An instance where a temporary lives shorter than with nested ifs, breaking compilation: #103476. This was fixed in the end by the if let rescoping work. Closes #103476
2024-11-17Rollup merge of #133060 - tyrone-wu:removelet-span-suggestion, r=jieyouxu许杰友 Jieyou Xu (Joe)-13/+28
Trim whitespace in RemoveLet primary span Separate `RemoveLet` span into primary span for `let` and removal suggestion span for `let `, so that primary span does not include whitespace. Fixes: #133031
2024-11-17Rollup merge of #133051 - estebank:cond-misparse, r=jieyouxu许杰友 Jieyou Xu (Joe)-28/+323
Increase accuracy of `if` condition misparse suggestion Fix #132656. Look at the expression that was parsed when trying to recover from a bad `if` condition to determine what was likely intended by the user beyond "maybe this was meant to be an `else` body". ``` error: expected `{`, found `map` --> $DIR/missing-dot-on-if-condition-expression-fixable.rs:4:30 | LL | for _ in [1, 2, 3].iter()map(|x| x) {} | ^^^ expected `{` | help: you might have meant to write a method call | LL | for _ in [1, 2, 3].iter().map(|x| x) {} | + ``` If a macro statement has been parsed after `else`, suggest a missing `if`: ``` error: expected `{`, found `falsy` --> $DIR/else-no-if.rs:47:12 | LL | } else falsy! {} { | ---- ^^^^^ | | | expected an `if` or a block after this `else` | help: add an `if` if this is the condition of a chained `else if` statement | LL | } else if falsy! {} { | ++ ```
2024-11-17Auto merge of #133120 - matthiaskrgr:rollup-4actosy, r=matthiaskrgrbors-34/+28
Rollup of 7 pull requests Successful merges: - #131717 (Stabilize `const_atomic_from_ptr`) - #132134 (Remove `ResultsVisitable`) - #132449 (mark is_val_statically_known intrinsic as stably const-callable) - #132569 (rustdoc search: allow queries to end in an empty path segment) - #132787 (Unify FnKind between AST visitors and make WalkItemKind more straight forward) - #132832 (Deny capturing late-bound ty/const params in nested opaques) - #133097 (Opt out TaKO8Ki from review rotation for now) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-16stabilize const_ptr_is_nullRalf Jung-3/+1
2024-11-17Mark `numeric-types.rs` as 64-bit only for nowJieyou Xu-2/+5
This is to unblock the tree, a proper fix will need to be investigated. I think the debuginfo test suite supports revisions, however debugger directives do not respect such revisions, which is problematic. It's that 32-bit and 64-bit msvc of course have different integer widths for `isize` and `usize`, meaning their underlying integer is different and thus printed differently.
2024-11-16Rollup merge of #132832 - compiler-errors:late-ty, r=cjgillotMatthias Krüger-25/+21
Deny capturing late-bound ty/const params in nested opaques First, this reverts a7f609504c92c9912b61025ae26a5404d3ee4311. I can't exactly remember why I approved this specific bit of https://github.com/rust-lang/rust/pull/132466; specifically, I don't know that the purpose of that commit is, and afaict we will never have an opaque that captures late-bound params through a const because opaques can't be used inside of anon consts. Am I missing something `@cjgillot?` Since I can't see a case where this matters, and no tests seem to fail. The second commit adds a `deny_late_regions: bool` to distinguish `Scope::LateBoundary` which should deny *any* late-bound params or just ty/consts. Then, when resolving opaques we wrap ourselves in a `Scope::LateBoundary { deny_late_regions: false }` so that we deny late-bound ty/const, which fixes a bunch of ICEs that all vaguely look like `impl for<T> Trait<Assoc = impl OtherTrait<T>>`. I guess this could be achieved other ways; for example, with a different scope kind, or maybe we could just reuse `Scope::Opaque`. But this seems a bit more verbose. I'm open to feedback anyways. Fixes #131535 Fixes #131637 Fixes #132530 I opted to remove those crashes tests ^ without adding them as regular tests, since they're basically triggering uninteresting late-bound ICEs far off in the trait solver, and the reason that existing tests such as `tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs` don't ICE are kinda just coincidental (i.e. due to a missing impl block). I don't really feel motivated to add random permutations to tests just to exercise non-lifetime binders. r? cjgillot
2024-11-16Rollup merge of #132569 - lolbinarycat:rustdoc-search-path-end-empty-v2, ↵Matthias Krüger-8/+6
r=notriddle rustdoc search: allow queries to end in an empty path segment fixes https://github.com/rust-lang/rust/issues/129707 this can be used to show all items in a module, or all associated items for a type. currently sufferes slightly due to case insensitivity, so `Option::` will also show items in the `option::` module. it disables the checking of the last path element, otherwise only items with short names will be shown r? `@notriddle`
2024-11-16Rollup merge of #132449 - RalfJung:is_val_statically_known, r=compiler-errorsMatthias Krüger-1/+1
mark is_val_statically_known intrinsic as stably const-callable The intrinsic doesn't actually "do" anything in terms of language semantics, and we are already using it in stable const fn. So let's just properly mark it as stably const-callable to avoid needing `rustc_allow_const_fn_unstable` (and thus reducing noise and keeping the remaining `rustc_allow_const_fn_unstable` as a more clear signal). Cc `@rust-lang/lang` usually you have to approve exposing intrinsics in const, but this intrinsic is basically just a compiler implementation detail. So FCP doesn't seem necessary. Cc `@rust-lang/wg-const-eval`
2024-11-16Reword suggestion messageEsteban Küber-21/+21
2024-11-16Better account for `else if` macro conditions mising an `if`Esteban Küber-1/+8
If a macro statement has been parsed after `else`, suggest a missing `if`: ``` error: expected `{`, found `falsy` --> $DIR/else-no-if.rs:47:12 | LL | } else falsy! {} { | ---- ^^^^^ | | | expected an `if` or a block after this `else` | help: add an `if` if this is the condition of a chained `else if` statement | LL | } else if falsy! {} { | ++ ```
2024-11-16Increase accuracy of `if` condition misparse suggestionEsteban Küber-8/+296
Look at the expression that was parsed when trying to recover from a bad `if` condition to determine what was likely intended by the user beyond "maybe this was meant to be an `else` body". ``` error: expected `{`, found `map` --> $DIR/missing-dot-on-if-condition-expression-fixable.rs:4:30 | LL | for _ in [1, 2, 3].iter()map(|x| x) {} | ^^^ expected `{` | help: you might have meant to write a method call | LL | for _ in [1, 2, 3].iter().map(|x| x) {} | + ```
2024-11-17Update cdb annotations for `unit-type.rs` with cdb `10.0.26100.2161`Jieyou Xu-4/+7
2024-11-17Update cdb annotations for `range-types.rs` with cdb `10.0.26100.2161`Jieyou Xu-7/+13
2024-11-17Update cdb annotations for `numeric-types` with cdb `10.0.26100.2161`Jieyou Xu-29/+32
2024-11-16Auto merge of #130443 - veluca93:legacy-const-generics-fix, r=BoxyUwUbors-19/+113
Fix ICE when passing DefId-creating args to legacy_const_generics. r? BoxyUwU Fixes #123077 Fixes #129150
2024-11-16Add regression test for issue #103476, fixed in edition 2024est31-0/+25
2024-11-16Also check if let chains with multiple lets in these two testsest31-6/+43
2024-11-16Fix ICE when passing DefId-creating args to legacy_const_generics.Luca Versari-19/+113
2024-11-15Rollup merge of #133080 - ehuss:edition-desugar-span, r=compiler-errorsGuillaume Gomez-0/+75
Fix span edition for 2024 RPIT coming from an external macro This fixes a problem where code generated by an external macro with an RPIT would end up using the call-site edition instead of the macro's edition for the RPIT. When used from a 2024 crate, this caused the code to change behavior to the 2024 capturing rules, which we don't want. This was caused by the impl-trait lowering code would replace the span with one marked with `DesugaringKind::OpaqueTy` desugaring. However, it was also overriding the edition of the span with the edition of the local crate. Instead it should be using the edition of the span itself. Fixes https://github.com/rust-lang/rust/issues/132917
2024-11-15Rollup merge of #133074 - ferrocene:ja-make-ui-test-os-agnostic, r=NoratriebGuillaume Gomez-11/+9
make UI test OS-agnostic the internal representation of `std::sync::Mutex` depends on the compilation target. due to this, the compiler produces different number of errors for UI test `issue-17431-6.rs` depending on the compilation target. for example, when compiling the UI test to an `*-apple-*` or `*-qnx7*` target, the "cycle detected" error is not reported ``` console $ cat src/lib.rs use std::sync::Mutex; enum Foo { X(Mutex<Option<Foo>>), } impl Foo { fn bar(self) {} } fn main() {} $ cargo check --target x86_64-apple-ios 2>&1 | rg '^error\[' error[E0072]: recursive type `Foo` has infinite size ``` whereas rustc produces two errors for other OSes, like Linux, which is what the UI test expects ``` console $ cargo check --target x86_64-unknown-linux-gnu 2>&1 | rg '^error\[' error[E0072]: recursive type `Foo` has infinite size error[E0391]: cycle detected when computing when `Foo` needs drop ``` this commit replaces the problematic `Mutex` with `UnsafeCell`, which has the same internal representation regardless of the compilation target. with that change, rustc reports two errors for all compilation targets. ``` console $ cat src/lib.rs use std::cell::UnsafeCell; enum Foo { X(UnsafeCell<Option<Foo>>), } impl Foo { fn bar(self) {} } fn main() {} $ cargo check --target x86_64-apple-ios 2>&1 | rg '^error\[' error[E0072]: recursive type `Foo` has infinite size error[E0391]: cycle detected when computing when `Foo` needs drop ``` with this change, we can remove the `ignore-apple` directive as the UI test now also passes on apple targets.
2024-11-15Rollup merge of #132978 - WaffleLapkin:very-semantic-change-kind, ↵Guillaume Gomez-109/+74
r=compiler-errors Mention both release *and* edition breakage for never type lints This PR makes ~~two changes~~ a change to the never type lints (`dependency_on_unit_never_type_fallback` and `never_type_fallback_flowing_into_unsafe`): 1. Change the wording of the note to mention that the breaking change will be made in an edition _and_ in a future release 2. ~~Make these warnings be reported in deps (hopefully the lints are matured enough)~~ r? ``@compiler-errors`` cc ``@ehuss`` closes #132930
2024-11-15Rollup merge of #132936 - surechen:fix_131989, r=NadrierilGuillaume Gomez-40/+180
For expr `return (_ = 42);` unused_paren lint should not be triggered fixes #131989
2024-11-15rustdoc search: allow queries to end in an empty path segmentbinarycat-8/+6
fixes https://github.com/rust-lang/rust/issues/129707 this can be used to show all items in a module, or all associated items for a type. currently sufferes slightly due to case insensitivity, so `Option::` will also show items in the `option::` module. it disables the checking of the last path element, otherwise only items with short names will be shown
2024-11-15Auto merge of #133079 - matthiaskrgr:rollup-k8u7syk, r=matthiaskrgrbors-19/+60
Rollup of 4 pull requests Successful merges: - #132817 (Recurse into APITs in `impl_trait_overcaptures`) - #133021 (Refactor `configure_annotatable`) - #133045 (tests: Test pac-ret flag merging on clang with LTO) - #133049 (Change Visitor::visit_precise_capturing_arg so it returns a Visitor::Result) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-15Fix span edition for 2024 RPIT coming from an external macroEric Huss-93/+1
This fixes a problem where code generated by an external macro with an RPIT would end up using the call-site edition instead of the macro's edition for the RPIT. When used from a 2024 crate, this caused the code to change behavior to the 2024 capturing rules, which we don't want. This was caused by the impl-trait lowering code would replace the span with one marked with `DesugaringKind::OpaqueTy` desugaring. However, it was also overriding the edition of the span with the edition of the local crate. Instead it should be using the edition of the span itself. Fixes https://github.com/rust-lang/rust/issues/132917
2024-11-15Rollup merge of #133045 - mrkajetanp:pauth-test-clang-lto-flag-merge, r=jieyouxuMatthias Krüger-3/+15
tests: Test pac-ret flag merging on clang with LTO Extend the test for pac-ret with clang and LTO by checking that different branch protection flags are preserved after the LTO step. There was an issue in older LLVM versions that was causing this to behave incorrectly. try-job: aarch64-gnu-debug
2024-11-15Rollup merge of #132817 - compiler-errors:impl-trait-overcaptures-apit, ↵Matthias Krüger-16/+45
r=BoxyUwU Recurse into APITs in `impl_trait_overcaptures` We were previously not detecting cases where an RPIT was located in the return type of an async function, leading to underfiring of the `impl_trait_overcaptures`. This PR does this recursion properly now. cc https://github.com/rust-lang/rust/issues/132809
2024-11-15Add test for precise-capturing from an external macroEric Huss-0/+167
2024-11-15Trim whitespace in RemoveLet primary spanTyrone Wu-13/+28
Separate `RemoveLet` span into primary span for `let` and removal suggestion span for `let `, so that primary span does not include whitespace. Fixes: #133031 Signed-off-by: Tyrone Wu <wudevelops@gmail.com>
2024-11-15Auto merge of #132992 - RalfJung:check-consts-feature-gate, r=compiler-errorsbors-1/+1
check_consts: fix error requesting feature gate when that gate is not actually needed When working on https://github.com/rust-lang/hashbrown/pull/586 I noticed that the compiler asks for the `rustc_private` feature to be enabled if one forgets to set `rustc_const_stable_indirect` on a function -- but enabling `rustc_private` would not actually help. This fixes the diagnostics. r? `@compiler-errors`
2024-11-15make UI test OS-agnosticJorge Aparicio-11/+9
the internal representation of `std::sync::Mutex` depends on the compilation target. due to this, the compiler produces different number of errors for UI test `issue-17431-6.rs` depending on the compilation target. for example, when compiling the UI test to an `*-apple-*` or `*-qnx7*` target, the "cycle detected" error is not reported ``` console $ cat src/lib.rs use std::sync::Mutex; enum Foo { X(Mutex<Option<Foo>>), } impl Foo { fn bar(self) {} } fn main() {} $ cargo check --target x86_64-apple-ios 2>&1 | rg '^error\[' error[E0072]: recursive type `Foo` has infinite size ``` whereas rustc produces two errors for other OSes, like Linux, which is what the UI test expects ``` console $ cargo check --target x86_64-unknown-linux-gnu 2>&1 | rg '^error\[' error[E0072]: recursive type `Foo` has infinite size error[E0391]: cycle detected when computing when `Foo` needs drop ``` this commit replaces the problematic `Mutex` with `UnsafeCell`, which has the same internal representation regardless of the compilation target. with that change, rustc reports two errors for all compilation targets. ``` console $ cat src/lib.rs use std::cell::UnsafeCell; enum Foo { X(UnsafeCell<Option<Foo>>), } impl Foo { fn bar(self) {} } fn main() {} $ cargo check --target x86_64-apple-ios 2>&1 | rg '^error\[' error[E0072]: recursive type `Foo` has infinite size error[E0391]: cycle detected when computing when `Foo` needs drop ``` with this change, we can remove the `ignore-apple` directive as the UI test now also passes on apple targets.
2024-11-15tests: Test pac-ret flag merging on clang with LTOKajetan Puchalski-3/+15
Extend the test for pac-ret with clang and LTO by checking that different branch protection flags are preserved after the LTO step. There was an issue in older LLVM versions that was causing this to behave incorrectly. Tests the LLVM behaviour added in: https://github.com/llvm/llvm-project/commit/1782810b8440144a0141c24192acbaeb55a1545d
2024-11-14Rollup merge of #133053 - liushuyu:simd-test-x86-baseline-fix, r=workingjubileeJubilee-6/+4
tests: Fix the SIMD FFI tests with certain x86 configuration This pull request fixes the SIMD FFI tests with certain x86 configurations by gating the SSE2 intrinsic behind the `sse2` feature gate. A generic LLVM intrinsic that is easy to un-fuse on those platforms is added to compensate for those platforms.
2024-11-14Rollup merge of #133050 - tgross35:inline-f16-f128, r=saethlinJubilee-0/+29
Always inline functions signatures containing `f16` or `f128` There are a handful of tier 2 and tier 3 targets that cause a LLVM crash or linker error when generating code that contains `f16` or `f128`. The cranelift backend also does not support these types. To work around this, every function in `std` or `core` that contains these types must be marked `#[inline]` in order to avoid sending any code to the backend unless specifically requested. However, this is inconvenient and easy to forget. Introduce a check for these types in the frontend that automatically inlines any function signatures that take or return `f16` or `f128`. Note that this is not a perfect fix because it does not account for the types being passed by reference or as members of aggregate types, but this is sufficient for what is currently needed in the standard library. Fixes: https://github.com/rust-lang/rust/issues/133035 Closes: https://github.com/rust-lang/rust/pull/133037
2024-11-14Rollup merge of #132905 - xingxue-ibm:link-unwind, r=bjorn3Jubilee-9/+5
[AIX] Add crate "unwind" to link with libunwind The Rust on IBM AIX uses LLVM's `libunwind`. Since crate `unwind` is a dependency of crate `std` and `#![no_std]` is specified in the test case, `libunwind` is not included in the link command by default. As a result, the test case fails to link with the error "Undefined symbol: ._Unwind_Resume" on AIX. This PR explicitly adds crate `unwind` for AIX, along with feature `panic_unwind`, which is required to include the `unwind` crate.
2024-11-14tests/run-make/simd-ffi: use a generic LLVM intrinsics ...liushuyu-5/+3
... to do more comprehensive type checking
2024-11-14Always inline functions signatures containing `f16` or `f128`Trevor Gross-0/+29
There are a handful of tier 2 and tier 3 targets that cause a LLVM crash or linker error when generating code that contains `f16` or `f128`. The cranelift backend also does not support these types. To work around this, every function in `std` or `core` that contains these types must be marked `#[inline]` in order to avoid sending any code to the backend unless specifically requested. However, this is inconvenient and easy to forget. Introduce a check for these types in the frontend that automatically inlines any function signatures that take or return `f16` or `f128`. Note that this is not a perfect fix because it does not account for the types being passed by reference or as members of aggregate types, but this is sufficient for what is currently needed in the standard library. Fixes: https://github.com/rust-lang/rust/issues/133035 Closes: https://github.com/rust-lang/rust/pull/133037
2024-11-14Auto merge of #133047 - matthiaskrgr:rollup-9se1vth, r=matthiaskrgrbors-0/+68
Rollup of 4 pull requests Successful merges: - #128197 (Skip locking span interner for some syntax context checks) - #133040 ([rustdoc] Fix handling of footnote reference in footnote definition) - #133043 (rustdoc-search: case-sensitive only when capitals are used) - #133046 (Clippy subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-14tests/run-make/simd-ffi: fix test crashing on x86 targets ...liushuyu-2/+2
... that do not have SSE2 support (e.g. i586)
2024-11-14Rollup merge of #133043 - notriddle:master, r=fmeaseMatthias Krüger-0/+48
rustdoc-search: case-sensitive only when capitals are used This is the "smartcase" behavior, described by vim and dtolnay. Fixes https://github.com/rust-lang/rust/issues/133017
2024-11-14rustdoc-search: case-sensitive only when capitals are usedMichael Howell-0/+48
This is the "smartcase" behavior, described by vim and dtolnay.
2024-11-14Add regression test for #131946Guillaume Gomez-0/+20
2024-11-14Include the "unwind" crate to link with libunwind instead of the "libc" crate.Xing Xue-9/+5
2024-11-14Rollup merge of #133005 - notriddle:notriddle/trie-search, r=GuillaumeGomezGuillaume Gomez-23/+45
rustdoc: use a trie for name-based search Potentially https://github.com/rust-lang/rust/issues/131156 — need to try reproducing the problem with `windows` Preview and profiler results ---------------------------- Here's some quick profiling in Firefox done on the rust compiler docs: - Before: https://share.firefox.dev/3UPm3M8 - After: https://share.firefox.dev/40LXvYb Here's the results for the node.js profiler: - https://notriddle.com/rustdoc-html-demo-15/trie-perf/index.html Here's a copy that you can use to try it out. Compare it with [the nightly]. Try typing `typecheckercontext` one character at a time, slowly. - https://notriddle.com/rustdoc-html-demo-15/compiler-doc-trie/index.html [the nightly]: https://doc.rust-lang.org/nightly/nightly-rustc/ The fuzzy match algo is based on [Fast String Correction with Levenshtein-Automata] and the corresponding implementation code in [moman] and [Lucene]; the bit-packing representation comes from Lucene, but the actual matcher is more based on `fsc.py`. As suggested in the paper, a trie is used to represent the FSA dictionary. The same trie is used for prefix matching. Substring matching is done with a side table of three-character[^1] windows that point into the trie. [Fast String Correction with Levenshtein-Automata]: https://github.com/tpn/pdfs/blob/master/Fast%20String%20Correction%20with%20Levenshtein-Automata%20(2002)%20(10.1.1.16.652).pdf [Lucene]: https://fossies.org/linux/lucene/lucene/core/src/java/org/apache/lucene/util/automaton/Lev1TParametricDescription.java [moman]: https://gitlab.com/notriddle/moman-rustdoc User-visible changes -------------------- I don't expect anybody to notice anything, but it does cause two changes: - Substring matches, in the middle of a name, only apply if there's three or more characters in the search query. - Levenshtein distance limit now maxes out at two. In the old version, the limit was w/3, so you could get looser matches for queries with 9 or more characters[^1] in them. - It uses more RAM. - It's faster (assuming you don't swap thrash). [^1]: technically utf-16 code units
2024-11-14Rollup merge of #132172 - dianne:suggest-borrow-generic, r=matthewjasperGuillaume Gomez-51/+210
borrowck diagnostics: suggest borrowing function inputs in generic positions # Summary This generalizes borrowck's existing suggestions to borrow instead of moving when passing by-value to a function that's generic in that input. Previously, this was special-cased to `AsRef`/`Borrow`-like traits and `Fn`-like traits. This PR changes it to test if, for a moved place with type `T`, that the callee's signature and clauses don't break if you substitute in `&T` or `&mut T`. For instance, it now works with `Read`/`Write`-like traits. Fixes https://github.com/rust-lang/rust/issues/131413 # Incidental changes - No longer spuriously suggests mutable borrows of closures in some situations (see e.g. the tests in [tests/ui/closures/2229_closure_analysis/](https://github.com/rust-lang/rust/compare/master...dianne:rust:suggest-borrow-generic?expand=1#diff-8dfb200c559f0995d0f2ffa2f23bc6f8041b263e264e5c329a1f4171769787c0)). - No longer suggests cloning closures that implement `Fn`, since they can be borrowed (see e.g. [tests/ui/moves/borrow-closures-instead-of-move.stderr](https://github.com/rust-lang/rust/compare/master...dianne:rust:suggest-borrow-generic?expand=1#diff-5db268aac405eec56d099a72d8b58ac46dab523cf013e29008104840168577fb)). This keeps the behavior to suppress suggestions of `fn_once.clone()()`. I think it might make sense to suggest it with a "but this might not be your desired behavior" caveat, as is done when something is used after being consumed as the receiver for a method call. That's probably out of the scope of this PR though. # Limitations and possible improvements - This doesn't work for receivers of method calls. This is a small change, and I have it implemented locally, but I'm not sure it's useful on its own. In most cases I've found borrowing the receiver would change the call's output type (see below). In other cases (e.g. `Iterator::sum`), borrowing the receiver isn't useful since it's consumed. - This doesn't work when it would change the call's output type. In general, I figure inserting references into the output type is an unwanted change. However, this also means it doesn't work in cases where the new output type would be effectively the same as the old one. For example, from the rand crate, the iterator returned by [`Rng::sample_iter`](https://docs.rs/rand/latest/rand/trait.Rng.html#method.sample_iter) is effectively the same (modulo regions) whether you borrow or consume the receiver `Rng`, so common usage involves borrowing it. I'm not sure whether the best approach is to add a more complex check of approximate equivalence, to forego checking the call's output type and give spurious suggestions, or to leave it as-is. - This doesn't work when it would change the call's other input types. Instead, it could suggest borrowing any others that have the same parameter type (but only when suggesting shared borrows). I think this would be a pretty easy change, but I don't think it's very useful so long as the normalized output type can't change. I'm happy to implement any of these (or other potential improvements to this), but I'm not sure which are common enough patterns to justify the added complexity. Please let me know if any sound worthwhile.
2024-11-14Rollup merge of #132773 - jakos-sec:fix-asan-win32, r=jieyouxuGuillaume Gomez-0/+29
PassWrapper: disable UseOdrIndicator for Asan Win32 As described in https://reviews.llvm.org/D137227 UseOdrIndicator should be disabled on Windows since link.exe does not support duplicate weak definitions. Fixes https://github.com/rust-lang/rust/issues/124390. Credits also belong to `@1c3t3a` who worked with me on this. We are currently testing this on a Windows machine.
2024-11-14Rollup merge of #132310 - jieyouxu:max-llvm-version, r=onur-ozkanGuillaume Gomez-5/+5
compiletest: add `max-llvm-major-version` directive To complement existing `min-llvm-version` so contributors don't have to use `ignore-llvm-version: 20 - 99` to emulate `max-llvm-major-version: 19`. Closes #132305. cc `@workingjubilee` who suggested this. ### Implementation steps - [x] 1. Implement the directive (this PR) - [x] 2. Open an accompanying dev-guide PR to describe the directive (https://github.com/rust-lang/rustc-dev-guide/pull/2129) r? bootstrap
2024-11-14tests: use `max-llvm-major-version` instead of `ignore-llvm-version` range ↵许杰友 Jieyou Xu (Joe)-5/+5
like `N - 99` For tests that use `ignore-llvm-version: N - M`, replace that with `max-llvm-major-version: N-1`.