about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-05-17Rename Unsafe to SafetySantiago Pastorino-17/+17
2024-05-16Rollup merge of #125172 - tgross35:f16-f128-as-casting, r=compiler-errorsMatthias Krüger-3/+393
Fix assertion when attempting to convert `f16` and `f128` with `as` These types are currently rejected for `as` casts by the compiler. Remove this incorrect check and add codegen tests for all conversions involving these types.
2024-05-16Don't ICE because recomputing overflow goals during ↵Michael Goulet-179/+81
find_best_leaf_obligation causes inference side-effects
2024-05-16Fix assertion when attempting to convert `f16` and `f128` with `as`Trevor Gross-3/+393
These types are currently rejected for `as` casts by the compiler. Remove this incorrect check and add codegen tests for all conversions involving these types.
2024-05-16Auto merge of #124987 - ↵bors-140/+155
workingjubilee:macro-metavar-expr-with-a-shorter-len, r=c410-f3r,joshtriplett,joshtriplett Rename `${length()}` to `${len()}` Implements the rename suggested in https://github.com/rust-lang/rust/pull/122808#issuecomment-2047722187 > I brought this up in the doc PR but it belongs here – `length` should probably be renamed `len` before stabilization. The latter is de facto standard in the standard library, whereas the former is only used in a single unstable API. These metafunctions aren’t library items of course, but should presumably still be consistent with established names. r? `@c410-f3r`
2024-05-15Rollup merge of #125146 - Oneirical:panic-impl, r=jieyouxuLeón Orell Valerian Liehr-7/+19
Migrate `run-make/panic-impl-transitive` 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 itself is quite simple, but the "handle panics by entering infinite loop" part is strange.
2024-05-15Rollup merge of #125142 - GuillaumeGomez:migrate-rustdoc-themes, r=jieyouxuLeón Orell Valerian Liehr-19/+33
Migrate `run-make/rustdoc-themes` to new rmake.rs Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
2024-05-15Auto merge of #125134 - compiler-errors:negative-traits-are-not-notable, ↵bors-0/+24
r=fmease rustdoc: Negative impls are not notable In #124097, we add `impl !Iterator for [T]` for coherence reasons, and since `Iterator` is a [notable trait](https://github.com/rust-lang/rust/blob/8387315ab3c26a57a1f53a90f188f0bc88514bca/library/core/src/iter/traits/iterator.rs#L40), this means that all `-> &[_]` now are tagged with a `!Iterator` impl as a notable trait. I "fixed" the failing tests in that PR with 6cbbb8b709a43482847243484ed67131e372ba71, where I just blessed the tests, since I didn't want to mix these changes with that PR; however, don't believe negative impls are notable, and this PR aims to prevent these impls from being mentioned. In the standard library, we use negative impls purely to guide coherence. They're not really a signal of anything useful to the end-user. If there ever is a case that we want negative impls to be mentioned as notable, this really should be an opt-in feature.
2024-05-15fix tidyOneirical-1/+6
2024-05-15rewrite panic-impl-transitiveOneirical-7/+14
2024-05-15Auto merge of #125144 - fmease:rollup-4uft293, r=fmeasebors-32/+31
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 #125104 - Oneirical:test6, r=jieyouxuLeón Orell Valerian Liehr-16/+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 #125027 - Oneirical:c-test-with-remove, r=jieyouxuLeón Orell Valerian Liehr-16/+15
Migrate `run-make/c-link-to-rust-staticlib` to `rmake` Part of #121876. r? `@jieyouxu`
2024-05-15Auto merge of #123413 - petrochenkov:delegmulti2, r=fmeasebors-6/+175
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-15Migrate `run-make/rustdoc-themes` to new rmakeGuillaume Gomez-11/+31
2024-05-15Add new `htmldocck` function to `run-make-support`Guillaume Gomez-8/+2
2024-05-15Rollup merge of #125135 - chenyukang:yukang-fix-116502, r=compiler-errorsMatthias Krüger-0/+46
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-0/+58
Add `on_unimplemented" typo suggestions
2024-05-15Fix the dedup error because of spans from suggestionyukang-0/+46
2024-05-15Auto merge of #125031 - Oneirical:dynamic-libs, r=jieyouxubors-24/+30
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-14rustdoc: Negative impls are not notableMichael Goulet-0/+24
2024-05-14fix the testOneirical-5/+1
2024-05-15Auto merge of #125084 - Jules-Bertholet:fix-125058, r=Nadrierilbors-0/+42
`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-6/+175
```rust reuse prefix::{a, b, c} ```
2024-05-15Add `on_unimplemented" typo suggestionsmejrs-0/+58
2024-05-14Port issue-11908 to rmakeOneirical-24/+30
2024-05-14port no-cdylib-as-rdylib testOneirical-16/+16
2024-05-14remove cxx_flagsJulien-2/+1
2024-05-14rewrite c-link-to-rust-staticlibOneirical-16/+20
2024-05-14Auto merge of #125120 - compiler-errors:rollup-mnjybwv, r=compiler-errorsbors-27/+313
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-0/+247
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 #125080 - bvanjoi:fix-124946, r=nnethercoteMichael Goulet-0/+34
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-15/+26
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-14only find segs chain for missing methods when no available candidatesbohan-0/+34
2024-05-14Auto merge of #123816 - tgross35:f16-f128-mangling, r=michaelwoeristerbors-241/+920
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-14Auto merge of #125023 - morr0ne:linux-none-target, r=Nilstriebbors-0/+3
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
2024-05-14Auto merge of #124228 - compiler-errors:lint-overcaptures, r=oli-obkbors-1/+204
Warn against changes in opaque lifetime captures in 2024 Adds a (mostly[^1]) machine-applicable lint `IMPL_TRAIT_OVERCAPTURES` which detects cases where we will capture more lifetimes in edition 2024 than in edition <= 2021, which may lead to erroneous borrowck errors. This lint is gated behind the `precise_capturing` feature gate and marked `Allow` for now. [^1]: Except when there are APITs -- I may work on that soon r? oli-obk
2024-05-14Auto merge of #125026 - Oneirical:clink-tests, r=jieyouxubors-7/+18
Migrate `run-make/c-link-to-rust-va-list-fn` to `rmake` Part of #121876. r? `@jieyouxu`
2024-05-13And finally add testsMichael Goulet-0/+133
2024-05-13Warn against redundant use<...>Michael Goulet-1/+71
2024-05-13Add test to make sure suggestions are still quickMichael Goulet-0/+247
2024-05-14Auto merge of #125098 - jhpratt:rollup-2qm4gga, r=jhprattbors-0/+109
Rollup of 4 pull requests Successful merges: - #116675 ([ptr] Document maximum allocation size) - #124997 (Fix ICE while casting a type with error) - #125072 (Add test for dynamic dispatch + Pin::new soundness) - #125090 (Migrate fuchsia docs from `pm` to `ffx`) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-13lto function, static_library call, renameOneirical-4/+4
2024-05-13fix fmtOneirical-2/+1
2024-05-13Rollup merge of #125072 - Darksonn:pin-dyn-dispatch-sound, r=jhprattJacob Pratt-0/+28
Add test for dynamic dispatch + Pin::new soundness While working on [the `#[derive(SmartPointer)]` RFC][1], I realized that the soundness of <code>impl [DispatchFromDyn](https://doc.rust-lang.org/stable/std/ops/trait.DispatchFromDyn.html) for [Pin](https://doc.rust-lang.org/stable/std/pin/struct.Pin.html)</code> relies on the restriction that you can't implement [`Unpin`](https://doc.rust-lang.org/stable/std/marker/trait.Unpin.html) for trait objects. As far as I can tell, the relevant error exists to solve some unrelated issues with coherence. To avoid cases where `Pin` is made unsound due to changes in the coherence-related errors, add a test that verifies that unsound use of `Pin` and `DispatchFromDyn` does not become allowed in the future. [1]: https://github.com/rust-lang/rfcs/pull/3621
2024-05-13Rollup merge of #124997 - gurry:124848-ice-should-be-sized, r=NadrierilJacob Pratt-0/+81
Fix ICE while casting a type with error Fixes #124848 The ICE originates here: https://github.com/rust-lang/rust/blob/f9a3fd966162b3c7386d90fe4626471f66ba3b8f/compiler/rustc_hir_typeck/src/cast.rs#L143 The underlying cause is that a type with error, `MyType` was involved in a cast. During cast checks the below method `pointer_kind` was called: https://github.com/rust-lang/rust/blob/f9a3fd966162b3c7386d90fe4626471f66ba3b8f/compiler/rustc_hir_typeck/src/cast.rs#L87-L91 Thanks to the changes in PR #123491, `type_is_sized_modulo_regions` in `pointer_kind` returned `false` which caused control to reach the `span_bug` here: https://github.com/rust-lang/rust/blob/f9a3fd966162b3c7386d90fe4626471f66ba3b8f/compiler/rustc_hir_typeck/src/cast.rs#L143 resulting in an ICE. This PR fixes the issue by changing the `span_bug` to a `span_delayed_bug`.
2024-05-14Auto merge of #124256 - nnethercote:rm-NtIdent-NtLifetime, r=petrochenkovbors-8/+2
Remove `NtIdent` and `NtLifetime` This is one part of the bigger "remove `Nonterminal` and `TokenKind::Interpolated`" change drafted in #114647. More details in the individual commit messages. r? `@petrochenkov`