about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-05-16Fix `for_loops_over_fallibles` hits in compiletest/src/json.rszachs18-2/+2
2024-05-15Allow for_loops_over_fallibles in test that tests &mut Result as IntoIterator.Zachary S-0/+1
2024-05-15Fix article in testZachary S-4/+4
2024-05-15Use 'a' article for &Option.Zachary S-0/+1
2024-05-15Fix more new for_loops_over_fallibles hits in compiler.Zachary S-3/+3
2024-05-15Add tests for 'Also apply `warn(for_loops_over_fallibles)` to &T and &mut T, ↵Zachary S-1/+83
not just T = Result/Option.'
2024-05-15Include reference in lint diagnosticZachary S-4/+9
2024-05-15Fix new for_loops_over_fallibles hits in compiler.Zachary S-6/+6
2024-05-15Also apply `warn(for_loops_over_fallibles)` to &T and &mut T, not just T = ↵Zachary S-1/+9
Result/Option.
2024-05-15Auto merge of #125144 - fmease:rollup-4uft293, r=fmeasebors-125/+190
Rollup of 6 pull requests Successful merges: - #124307 (Optimize character escaping.) - #124975 (Use an helper to move the files) - #125027 (Migrate `run-make/c-link-to-rust-staticlib` to `rmake`) - #125038 (Invert comparison in `uN::checked_sub`) - #125104 (Migrate `run-make/no-cdylib-as-rdylib` to `rmake`) - #125137 (MIR operators: clarify Shl/Shr handling of negative offsets) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-15Rollup merge of #125137 - RalfJung:mir-sh, r=scottmcmLeón Orell Valerian Liehr-2/+6
MIR operators: clarify Shl/Shr handling of negative offsets "made unsigned" was not fully clear (made unsigned how? by using `abs`? no), so let's say "re-interpreted as an unsigned value of the same size" instead. r? `@scottmcm`
2024-05-15Rollup merge of #125104 - Oneirical:test6, r=jieyouxuLeón Orell Valerian Liehr-17/+16
Migrate `run-make/no-cdylib-as-rdylib` to `rmake` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). > "the test will fail if the cdylib is picked, because it doesn't export any rust symbols" Is that true? Is there a way to verify? I suggest maybe extending the test with: (after cleaning the directory) ```rust rustc() .input("bar.rs") .crate_type("cdylib") .run(); rustc() .input("foo.rs") .prefer_dynamic() .run(); fail(); ``` to make sure we're actually testing something here.
2024-05-15Rollup merge of #125038 - ivan-shrimp:checked_sub, r=joboetLeón Orell Valerian Liehr-3/+3
Invert comparison in `uN::checked_sub` After #124114, LLVM no longer combines the comparison and subtraction in `uN::checked_sub` when either operand is a constant (demo: https://rust.godbolt.org/z/MaeoYbsP1). The difference is more pronounced when the expression is slightly more complex (https://rust.godbolt.org/z/4rPavsYdc). This is due to the use of `>=` here: https://github.com/rust-lang/rust/blob/ee97564e3a9f9ac8c65103abb37c6aa48d95bfa2/library/core/src/num/uint_macros.rs#L581-L593 For constant `C`, LLVM eagerly converts `a >= C` into `a > C - 1`, but the backend can only combine `a < C` with `a - C`, not `C - 1 < a` and `a - C`: https://github.com/llvm/llvm-project/blob/e586556e375fc5c4f7e76b5c299cb981f2016108/llvm/lib/CodeGen/CodeGenPrepare.cpp#L1697-L1742 This PR[^1] simply inverts the `>=` into `<` to restore the LLVM magic, and somewhat align this with the implementation of `uN::overflowing_sub` from #103299. When the result is stored as an `Option` (rather than being branched/cmoved on), the discriminant is `self >= rhs`. This PR doesn't affect the codegen (and relevant tests) of that since LLVM will negate `self < rhs` to `self >= rhs` when necessary. [^1]: Note to `self`: My very first contribution to publicly-used code. Hopefully like what I should learn to always be, tiny and humble.
2024-05-15Rollup merge of #125027 - Oneirical:c-test-with-remove, r=jieyouxuLeón Orell Valerian Liehr-17/+15
Migrate `run-make/c-link-to-rust-staticlib` to `rmake` Part of #121876. r? `@jieyouxu`
2024-05-15Rollup merge of #124975 - lu-zero:move_file, r=clubby789León Orell Valerian Liehr-7/+24
Use an helper to move the files In case the source is not in the same filesystem. See https://github.com/openwrt/packages/commit/c1b3e0440f67bcec101a3f72525f9c90eb4e6497#commitcomment-141886468
2024-05-15Rollup merge of #124307 - reitermarkus:escape-debug-size-hint-inline, r=joboetLeón Orell Valerian Liehr-79/+126
Optimize character escaping. Allow optimization of panicking branch in `EscapeDebug`, see https://github.com/rust-lang/rust/pull/121805. r? `@joboet`
2024-05-15Auto merge of #123413 - petrochenkov:delegmulti2, r=fmeasebors-58/+509
delegation: Implement list delegation ```rust reuse prefix::{a, b, c}; ``` Using design described in https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823 (the lists are desugared at macro expansion time). List delegations are expanded eagerly when encountered, similarly to `#[cfg]`s, and not enqueued for later resolution/expansion like regular macros or glob delegation (https://github.com/rust-lang/rust/pull/124135). Part of https://github.com/rust-lang/rust/issues/118212.
2024-05-15Auto merge of #125032 - compiler-errors:crash-dump-dir, r=onur-ozkanbors-8/+14
Make crashes dump mir to build dir Set `-Zdump-mir-dir` for `crashes`-style tests. Alternatively, we just remove `tests/crashes/124436.rs`, since if the only way to get it to repro is via `-Zdump-mir`, then maybe it's not worth it to fix. Fixes #125029
2024-05-15MIR operators: clarify Shl/Shr handling of negative offsetsRalf Jung-2/+6
2024-05-15Auto merge of #125136 - matthiaskrgr:rollup-ljm15m3, r=matthiaskrgrbors-34/+135
Rollup of 4 pull requests Successful merges: - #124990 (Also expand weak alias tys inside consts inside `expand_weak_alias_tys`) - #125108 (coverage: `CoverageIdsInfo::mcdc_bitmap_bytes` is never needed) - #125132 (Add `on_unimplemented" typo suggestions) - #125135 (Fix the dedup error because of spans from suggestion) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-15Rollup merge of #125135 - chenyukang:yukang-fix-116502, r=compiler-errorsMatthias Krüger-1/+47
Fix the dedup error because of spans from suggestion Fixes #116502 I believe this kind of issue is supposed resolved by #118057, but the `==` in `span` respect syntax context, here we should only care that they point to the same bytes of source text, so should use `source_equal`.
2024-05-15Rollup merge of #125132 - mejrs:diag, r=compiler-errorsMatthias Krüger-5/+85
Add `on_unimplemented" typo suggestions
2024-05-15Rollup merge of #125108 - Zalathar:info-bitmap-bytes, r=nnethercoteMatthias Krüger-27/+2
coverage: `CoverageIdsInfo::mcdc_bitmap_bytes` is never needed This code for recalculating `mcdc_bitmap_bytes` in a query doesn't provide any benefit, because its result won't have changed from the value in `FunctionCoverageInfo` that was computed during the MIR instrumentation pass. Extracted from #124571, to avoid having this held up by unrelated issues with condition count checks. `@rustbot` label +A-code-coverage
2024-05-15Rollup merge of #124990 - fmease:expand-weak-aliases-within-cts, ↵Matthias Krüger-1/+1
r=compiler-errors Also expand weak alias tys inside consts inside `expand_weak_alias_tys` Ever since #121344 has been merged, I couldn't let go of the fear that I might've slipped a tiny bug into rustc (:P). Checking the type flags of the `Const` is strictly more correct than only checking the ones of the `Const`'s `Ty`. I don't think it's possible to trigger an ICE rn (i.e., one of the two `bug!("unexpected weak alias type")` I added in branches where `expand_weak_alias_tys` should've expanded *all* weak alias tys) because presently const exprs aren't allowed to capture late-bound vars. To be future-proof however, we should iron this out. A possible reproducer would be the following if I'm not mistaken (currently fails to compile due to the aforementioned restriction): ```rs #![feature(lazy_type_alias, adt_const_params, generic_const_exprs)] type F = for<'a> fn(A<{ S::<Weak<'a>>(loop {}) }>) -> &'a (); type A<const N: S<Weak<'static>>> = (); #[derive(PartialEq, Eq, std::marker::ConstParamTy)] struct S<T>(T); type Weak<'a> = &'a (); ``` Whether a late-bound region should actually be considered constrained by a const expr is a separate question — one which we don't need to answer until / unless we actually allow them in such contexts (probable answer: only inside the return exprs of a block but not inside the stmts). r? oli-obk (he's not available rn but that's fine) or types or compiler
2024-05-15Fix the dedup error because of spans from suggestionyukang-1/+47
2024-05-15Auto merge of #125031 - Oneirical:dynamic-libs, r=jieyouxubors-37/+79
Migrate `run-make/issue-11908` to new `rmake.rs` format Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Set as draft, because I have a few concerns: - [x] I am not sure if `target().contains("darwin")` is a good way of checking that the target is on OSX. - [x] I find it strange that the `dylib` part of the test adapts to different target platforms, but not the `rlib` part. Is `rlib` named the same on all platforms?
2024-05-14fix the testOneirical-5/+1
2024-05-15Auto merge of #125084 - Jules-Bertholet:fix-125058, r=Nadrierilbors-1/+53
`rustc_hir_typeck`: Account for `skipped_ref_pats` in `expr_use_visitor` Fixes #125058 r? `@Nadrieril` cc https://github.com/rust-lang/rust/issues/123076 `@rustbot` label A-edition-2024 A-patterns
2024-05-15delegation: Implement list delegationVadim Petrochenkov-58/+509
```rust reuse prefix::{a, b, c} ```
2024-05-15Add `on_unimplemented" typo suggestionsmejrs-5/+85
2024-05-14Port issue-11908 to rmakeOneirical-37/+79
2024-05-14port no-cdylib-as-rdylib testOneirical-17/+16
2024-05-14remove cxx_flagsJulien-2/+1
2024-05-14rewrite c-link-to-rust-staticlibOneirical-17/+20
2024-05-14Auto merge of #125125 - lovesegfault:opt-dist-specify-rustc-perf, ↵bors-0/+6
r=Mark-Simulacrum feat(tools/opt-dist): allow local builds to specify a rustc-perf checkout This is a first step towards allowing `opt-dist` to work in a sandboxed / air-gapped environment, as it allows users to bypass the ad-hoc download of `rustc-perf`.
2024-05-14feat(tools/opt-dist): allow local builds to specify a rustc-perf checkoutBernardo Meurer Costa-0/+6
2024-05-14Auto merge of #125120 - compiler-errors:rollup-mnjybwv, r=compiler-errorsbors-599/+1042
Rollup of 7 pull requests Successful merges: - #119838 (style-guide: When breaking binops handle multi-line first operand better) - #124844 (Use a proper probe for shadowing impl) - #125047 (Migrate `run-make/issue-14500` to new `rmake.rs` format) - #125080 (only find segs chain for missing methods when no available candidates) - #125088 (Uplift `AliasTy` and `AliasTerm`) - #125100 (Don't do post-method-probe error reporting steps if we're in a suggestion) - #125118 (Use new utility functions/methods in run-make tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-14Rollup merge of #125118 - GuillaumeGomez:cleanup-run-make, r=jieyouxuMichael Goulet-12/+6
Use new utility functions/methods in run-make tests Little cleanup using new functions/methods I added into the `run-make-support` library. r? `@jieyouxu`
2024-05-14Rollup merge of #125100 - compiler-errors:faster, r=nnethercoteMichael Goulet-9/+284
Don't do post-method-probe error reporting steps if we're in a suggestion Currently in method probing, if we fail to pick a method, then we reset and try to collect relevant candidates for method errors: https://github.com/rust-lang/rust/blob/34582118afaf00b0eb2d209a90b181c7156b501c/compiler/rustc_hir_typeck/src/method/probe.rs#L953-L993 However, we do method lookups via `lookup_method_for_diagnostic` and only care about the result if the method probe was a *success*. Namely, we don't need to do a bunch of other lookups on failure, since we throw away these results anyways, such as an expensive call to: https://github.com/rust-lang/rust/blob/34582118afaf00b0eb2d209a90b181c7156b501c/compiler/rustc_hir_typeck/src/method/probe.rs#L959 And: https://github.com/rust-lang/rust/blob/34582118afaf00b0eb2d209a90b181c7156b501c/compiler/rustc_hir_typeck/src/method/probe.rs#L985 --- This PR also renames some methods so it's clear that they're for diagnostics. r? `@nnethercote`
2024-05-14Rollup merge of #125088 - compiler-errors:uplift-alias-ty, r=lcnrMichael Goulet-534/+574
Uplift `AliasTy` and `AliasTerm` Follow-up from #125076. r? lcnr
2024-05-14Rollup merge of #125080 - bvanjoi:fix-124946, r=nnethercoteMichael Goulet-6/+67
only find segs chain for missing methods when no available candidates Fixes #124946 This PR includes two changes: - Extracting the lookup for the missing method in chains into a single function. - Calling this function only when there are no candidates available.
2024-05-14Rollup merge of #125047 - Oneirical:test5, r=jieyouxuMichael Goulet-16/+39
Migrate `run-make/issue-14500` to new `rmake.rs` format Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Note: I find suspicious that `libbar.a` is hardcoded and is not using the `STATICLIB` call to adapt to Windows platforms. Is this intentional? If not, this will need to be changed.
2024-05-14Rollup merge of #124844 - compiler-errors:shadow-probe, r=lcnrMichael Goulet-22/+39
Use a proper probe for shadowing impl r? lcnr
2024-05-14Rollup merge of #119838 - joshtriplett:style-guide-binop-indent, ↵Michael Goulet-0/+33
r=compiler-errors style-guide: When breaking binops handle multi-line first operand better Use the indentation of the *last* line of the first operand, not the first. Fixes https://github.com/rust-lang/style-team/issues/189
2024-05-14only find segs chain for missing methods when no available candidatesbohan-6/+67
2024-05-14Auto merge of #123816 - tgross35:f16-f128-mangling, r=michaelwoeristerbors-244/+924
Add v0 symbol mangling for `f16` and `f128` As discussed at <https://github.com/rust-lang/rust/pull/122106>, use the crate encoding to represent new primitives.
2024-05-14Use new utility functions/methods in run-make testsGuillaume Gomez-12/+6
2024-05-14Enable v0 mangling tests and add checks for `f16`/`f128`Trevor Gross-241/+920
2024-05-14Add v0 symbol mangling for `f16` and `f128`Trevor Gross-3/+4
As discussed at <https://github.com/rust-lang/rust/pull/122106>, use the crate encoding to represent new primitives.
2024-05-14Auto merge of #125023 - morr0ne:linux-none-target, r=Nilstriebbors-0/+73
Add x86_64-unknown-linux-none target Adds a freestanding linux binary with no libc dependency. This is useful for writing programs written only in rust. It is also essential for writing low level stuff like libc or a dynamic linker. Tier 3 policy: >A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) I will be the designed maintainer for this target >Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. The target triple is consistent with other targets >Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo. There is no confusion with other targets since it explicitly adds "none" at the end instead of omitting the environment >Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. The target does not introduce any unusual requirement >The target must not introduce license incompatibilities. There are no license incompatibilities > Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0). Everything added is under that license >The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements. There are no new dependencies >Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3. There is no proprietary dependencies >"onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users. No such terms exist for this target >Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. >This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements. Understood >Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. The target already implements core. It might be possible in the future to add support for alloc and std by leveraging crates such as [origin](https://github.com/sunfishcode/origin/) and [rustix](https://github.com/bytecodealliance/rustix) > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary. I believe the proper docs are added >Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. > Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications. Understood > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. > In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target. No other targets are effected >Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. The same backends used by other linux targets work without issues