about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-19fully de-stabilize all custom inner attributesRalf Jung-55/+31
2025-01-16Auto merge of #135458 - jieyouxu:migrate-extern-fn-reachable, r=lqdbors-26/+61
tests: Port `extern-fn-reachable` to rmake.rs Part of #121876. ## Summary This PR ports `tests/run-make/extern-fn-reachable` to use `rmake.rs`. Notable changes: - We now use the `object` crate and look at the exported symbols specifically. - This test's coverage regressed against windows-msvc back in [replace dynamic library module with libloading #90716](https://github.com/rust-lang/rust/pull/90716), but since we use `object` now, we're able to claw the test coverage back. - The checks are now stricter: 1. It no longer looks for substring symbol matches in `nm` textual outputs, it inspects the symbol names precisely. 2. We now also explicitly check for the presence of leading underscore in exported symbol names on apple vs non-apple targets. - Added another case of `#[no_mangle] fn fun6() {}` (note the lack of `pub`) to check that Rust nameres visibility is orthogonal to symbol visibility in dylib. ## History - Test was initially introduced as a run-pass[^run-pass] test as part of [Don't mark reachable extern fns as internal #10539](https://github.com/rust-lang/rust/pull/10539). - Test re-introduced as a run-make test in https://github.com/rust-lang/rust/pull/13741. - Later, the test coverage regressed in https://github.com/rust-lang/rust/pull/90716. [^run-pass]: no longer a thing nowadays Supersedes #128314. Co-authored with `@lolbinarycat.` try-job: x86_64-msvc try-job: i686-msvc try-job: i686-mingw try-job: x86_64-mingw-1 try-job: x86_64-apple-1 try-job: aarch64-apple try-job: test-various
2025-01-15Auto merge of #135555 - matthiaskrgr:rollup-jnqdbuu, r=matthiaskrgrbors-15/+56
Rollup of 5 pull requests Successful merges: - #135497 (fix typo in typenames of pin documentation) - #135522 (add incremental test for issue 135514) - #135523 (const traits: remove some known-bug that do not seem to make sense) - #135535 (Add GUI test for #135499) - #135541 (Methods of const traits are const) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-15Rollup merge of #135535 - GuillaumeGomez:gui-test-135499, r=notriddleMatthias Krüger-0/+6
Add GUI test for #135499 Fixes #135510. cc `@lolbinarycat` r? `@notriddle`
2025-01-15Rollup merge of #135523 - RalfJung:wrong-known-bug, r=compiler-errorsMatthias Krüger-15/+10
const traits: remove some known-bug that do not seem to make sense These tests were made to point to #103507 in https://github.com/rust-lang/rust/pull/114134; I think that was a mistake: that issue is about a rather specific problem, and most tests marked as known-bug in that PR are pointing at https://github.com/rust-lang/rust/issues/110395 which makes more sense. Of the 4 tests that still point to #103507: - One is [the original test](https://github.com/rust-lang/rust/blob/20882608529a969bd878ad787cf0038716c021df/tests/ui/impl-trait/normalize-tait-in-const.rs). It still fails to compile, though currently for unrelated reasons (`~const Fn` is not valid as that is not a const trait). I made it point at #110395 like all the other tests that were disabled when the previous const trait impl was removed. - One is being fixed in https://github.com/rust-lang/rust/pull/135423 - The other two are fixed in this PR The errors we are getting here are not great but they do look correct? FWIW there are still a whole lot of tests mentioning #110395 despite that issue being closed... I hope someone is tracking that.^^ r? `@compiler-errors`
2025-01-15Rollup merge of #135522 - lqd:issue-135514, r=compiler-errorsMatthias Krüger-0/+40
add incremental test for issue 135514 r? `@compiler-errors` as requested in https://github.com/rust-lang/rust/issues/135514#issuecomment-2591614811 This adds parts of `@steffahn's` repro as an incremental test for #135514. I had initially added the actual exploitation of the issue into the safe transmute, but removed it because it's not exactly needed for such a test. I can add it back if you'd like. I've verified that the test fails with https://github.com/rust-lang/rust/pull/133828 reverted.
2025-01-15Add GUI test for #135499Guillaume Gomez-0/+6
2025-01-15Rollup merge of #135498 - compiler-errors:dyn-upcasting-completeness, r=lcnrGuillaume Gomez-0/+29
Prefer lower `TraitUpcasting` candidates in selection Fixes #135463. The underlying cause is this ambiguity, but it's more clear (and manifests as a coercion error, rather than a MIR validation error) when it's written the way I did in the UI test. Sorry this is cursed r? lcnr
2025-01-15Rollup merge of #135003 - RalfJung:deprecate-allowed-through-unstable, ↵Guillaume Gomez-3/+25
r=davidtwco deprecate `std::intrinsics::transmute` etc, use `std::mem::*` instead The `rustc_allowed_through_unstable_modules` attribute lets users call `std::mem::transmute` as `std::intrinsics::transmute`. The former is a reexport of the latter, and for a long time we didn't properly check stability for reexports, so making this a hard error now would be a breaking change for little gain. But at the same time, `std::intrinsics::transmute` is not the intended path for this function, so I think it is a good idea to show a deprecation warning when that path is used. This PR implements that, for all the functions in `std::intrinsics` that carry the attribute. I assume this will need ``@rust-lang/libs-api`` FCP.
2025-01-15Rollup merge of #132654 - joboet:lazy_main, r=ChrisDentonGuillaume Gomez-4/+4
std: lazily allocate the main thread handle https://github.com/rust-lang/rust/pull/123550 eliminated the allocation of the main thread handle, but at the cost of greatly increased complexity. This PR proposes another approach: Instead of creating the main thread handle itself, the runtime simply remembers the thread ID of the main thread. The main thread handle is then only allocated when it is used, using the same lazy-initialization mechanism as for non-runtime use of `thread::current`, and the `name` method uses the thread ID to identify the main thread handle and return the correct name ("main") for it. Thereby, we also allow accessing `thread::current` before main: as the runtime no longer tries to install its own handle, this will no longer trigger an abort. Rather, the name returned from `name` will only be "main" after the runtime initialization code has run, but I think that is acceptable. This new approach also requires some changes to the signal handling code, as calling `thread::current` would now allocate when called on the main thread, which is not acceptable. I fixed this by adding a new function (`with_current_name`) that performs all the naming logic without allocation or without initializing the thread ID (which could allocate on some platforms). Reverts #123550, CC ``@GnomedDev``
2025-01-15Auto merge of #134353 - oli-obk:safe-target-feature-unsafe-by-default, ↵bors-40/+62
r=wesleywiser Treat safe target_feature functions as unsafe by default [less invasive variant] This unblocks * #134090 As I stated in https://github.com/rust-lang/rust/pull/134090#issuecomment-2541332415 I think the previous impl was too easy to get wrong, as by default it treated safe target feature functions as safe and had to add additional checks for when they weren't. Now the logic is inverted. By default they are unsafe and you have to explicitly handle safe target feature functions. This is the less (imo) invasive variant of #134317, as it doesn't require changing the Safety enum, so it only affects FnDefs and nothing else, as it should.
2025-01-15Auto merge of #135525 - jhpratt:rollup-4gu2wpm, r=jhprattbors-125/+190
Rollup of 7 pull requests Successful merges: - #132397 (Make missing_abi lint warn-by-default.) - #133807 (ci: Enable opt-dist for dist-aarch64-linux builds) - #134143 (Convert `struct FromBytesWithNulError` into enum) - #134338 (Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsics) - #134678 (Update `ReadDir::next` in `std::sys::pal::unix::fs` to use `&raw const (*p).field` instead of `p.byte_offset().cast()`) - #135424 (Detect unstable lint docs that dont enable their feature) - #135520 (Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-15Rollup merge of #135520 - ↵Jacob Pratt-0/+13
compiler-errors:mono-impossible-drop-with-lifetimes, r=BoxyUwU Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs Absolutely clueless mistake of mine. Whoops. When eagerly collecting mono items, when we encounter an ADT, we try to monomorphize its drop glue. In #135313, I made it so that this acts more like eagerly monomorphizing functions, where we allow (in this case) ADTs with lifetimes, since those can be erased by codegen. However, I did not account for the call to `instantiate_and_check_impossible_predicates`, which was still passing an empty set of args. This means that if the ADT in question had any predicates, we'd get an index out of bounds panic. This PR creates the correct set of args for the ADT. Fixes #135515. I assume that this manifests in that issue because of `-Clink-dead-code` or something.
2025-01-15Rollup merge of #132397 - m-ou-se:warn-missing-abi, r=NadrierilJacob Pratt-125/+177
Make missing_abi lint warn-by-default. This makes the missing_abi lint warn-by-default, as suggested here: https://github.com/rust-lang/rfcs/pull/3722#issuecomment-2447719047 This needs a lang FCP.
2025-01-15Avoid notes that only make sense for unsafe functionsOli Scherer-13/+0
2025-01-15Try to render shorthand differentlyOli Scherer-6/+3
2025-01-15Render fn defs with target_features attrs with the attribute [second site]Oli Scherer-24/+24
2025-01-15Render fn defs with target_features attrs with the attributeOli Scherer-14/+15
2025-01-15Hide the internal unsafety of safe target_feature fn itemsOli Scherer-1/+1
2025-01-15Treat safe target_feature functions as unsafe by defaultOli Scherer-40/+77
2025-01-15intrinsics: deprecate calling them via the unstable std::intrinsics pathRalf Jung-1/+10
2025-01-15allowed_through_unstable_modules: support showing a deprecation message when ↵Ralf Jung-2/+15
the unstable module name is used
2025-01-15fix known-bug link in normalize-tait-in-constRalf Jung-4/+5
2025-01-15add test for issue 135514Rémy Rakic-0/+40
2025-01-15remove some known-bug that do not seem to make senseRalf Jung-11/+5
2025-01-15Make sure we actually use the right trivial lifetime substs when eagerly ↵Michael Goulet-0/+13
monomorphizing drop for structs
2025-01-14Rollup merge of #135425 - compiler-errors:not-conditionally-const, r=RalfJungJubilee-18/+16
Do not consider traits that have unsatisfied const conditions to be conditionally const This will improve error messages as we continue to constify traits, since we don't want to start calling things "conditionally const" if they aren't implemented with a const impl anyways. The only case that this affects today is `Deref` since that's one of the only constified traits in the standard library :) r? RalfJung
2025-01-14Rollup merge of #135423 - compiler-errors:enforce-const-trait-syntactical, ↵Jubilee-32/+151
r=oli-obk,RalfJung Enforce syntactical stability of const traits in HIR This PR enforces what I'm calling *syntactical* const stability of traits. In other words, it enforces the ability to name `~const`/`const` traits in trait bounds in various syntax positions in HIR (including in the trait of an impl header). This functionality is analogous to the *regular* item stability checker, which is concerned with making sure that you cannot refer to unstable items by name, and is implemented as an extension of that pass. This is separate from enforcing the *recursive* const stability of const trait methods, which is implemented in MIR and runs on MIR bodies. That will require adding a new `NonConstOp` to the const checker and probably adjusting some logic to deduplicate redundant errors. However, this check is separate and necessary for making sure that users don't add `~const`/`const` bounds to items when the trait is not const-stable in the first place. I chose to separate enforcing recursive const stability out of this PR to make it easier to review. I'll probably open a follow-up following this one, blocked on this PR. r? `@RalfJung` cc `@rust-lang/project-const-traits`
2025-01-14Rollup merge of #135380 - compiler-errors:mismatch-valtree, r=lcnrJubilee-0/+107
Make sure we can produce `ConstArgHasWrongType` errors for valtree consts I forgot about `ty::ConstKind::Value` in #134771. The error message here could use some work -- both in the new trait solver and the old trait solver. But unrelated to the issue here. Fixes https://github.com/rust-lang/rust/issues/135361 -- this was only ICEing in coherence because coherence uses the new trait solver, but I don't think the minimization is worth committing compared to the test I added. r? ```@lcnr``` or ```@BoxyUwU```
2025-01-14Rollup merge of #135353 - lolbinarycat:rustdoc-disable-minification, r=notriddleJubilee-1/+2
re-add --disable-minification to rustdoc this also makes the rust.docs-minification option work as advertised in config.toml nothing fancy this time, this is intended to be perma-unstable. it's only really here for the benefit of rustdoc devs. mitegates https://github.com/rust-lang/rust/issues/135345 It was removed in https://github.com/rust-lang/rust/commit/f9e1f6ffdf03ec33cb29e20c88fc7bcc938c7f42.
2025-01-14Rollup merge of #135302 - lolbinarycat:rustdoc-search-return-sort-134935, ↵Jubilee-0/+30
r=notriddle for purely return-type based searches, deprioritize clone-like functions closes https://github.com/rust-lang/rust/issues/134935
2025-01-14Rollup merge of #135264 - compiler-errors:layout-propagate-errors, r=oli-obkJubilee-14/+91
Consider more erroneous layouts as `LayoutError::ReferencesError` to suppress spurious errors Fixes #135208 r? oli-obk
2025-01-14Rollup merge of #135228 - compiler-errors:normalizes-ur-dispatch, r=BoxyUwUJubilee-2/+118
Improve `DispatchFromDyn` and `CoerceUnsized` impl validation * Disallow arbitrary 1-ZST fields in `DispatchFromDyn` -- only `PhantomData`, and 1-ZSTs that mention no params (which is needed to support, e.g., the `Global` alloctor in `Box<T, U = Global>`). * Don't allow coercing between non-ZSTs to ZSTs (since the previous check wasn't actually checking the field tys were the same before checking the layout...) * Normalize the field before checking it's `PhantomData`. Fixes #135215 Fixes #135214 Fixes #135220 r? ```@BoxyUwU``` or reassign
2025-01-14Rollup merge of #134940 - compiler-errors:scrape, r=lcnrJubilee-0/+13
Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck Otherwise we're just randomly registering these region relations into the infcx which isn't good r? lcnr
2025-01-14Auto merge of #135496 - matthiaskrgr:rollup-ps0cjzn, r=matthiaskrgrbors-9/+146
Rollup of 7 pull requests Successful merges: - #134216 (Enable "jump to def" feature on patterns) - #134880 (Made `Path::name` only have item name rather than full name) - #135466 (Leak check in `impossible_predicates` to avoid monomorphizing impossible instances) - #135476 (Remove remnant of asmjs) - #135479 (mir borrowck: cleanup late-bound region handling) - #135493 (Fix legacy symbol mangling of closures) - #135495 (Add missing closing backtick in commit hook message 🐸) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-14Make sure to scrape region constraints from deeply normalizing type outlives ↵Michael Goulet-0/+13
assumptions in borrowck
2025-01-14Enforce syntactical stability of const traits in HIRMichael Goulet-32/+151
2025-01-14Consider more erroneous layouts as LayoutError::ReferencesError to suppress ↵Michael Goulet-14/+91
spurious errors
2025-01-14Do not consider traits that have unsatisfied const conditions to be ↵Michael Goulet-18/+16
conditionally const
2025-01-14Normalize field before checking PhantomData in coerce/dispatch impl validationMichael Goulet-0/+25
2025-01-14Make sure we can produce ConstArgHasWrongType errors for valtree constsMichael Goulet-0/+107
2025-01-14Rollup merge of #135493 - compiler-errors:legacy-mangle-closure, r=lqdMatthias Krüger-0/+6
Fix legacy symbol mangling of closures When this code was written, there was no `type_of` implementation for closures. That has long since been changed. In the UI test: ``` trait A where [(); (|| {}, 1).1]: Sized, { } ``` We tried to walk up the def path tree for the closure, from closure -> anon const -> trait. When we reached the trait, we tried to call `type_of` on it which obviously doesn't do the right thing and ICEs. Fixes #135418
2025-01-14Rollup merge of #135479 - lcnr:method-calls-on-opaques, r=compiler-errorsMatthias Krüger-8/+8
mir borrowck: cleanup late-bound region handling r? types
2025-01-14Rollup merge of #135466 - compiler-errors:leak-check-impossible, r=lcnrMatthias Krüger-0/+79
Leak check in `impossible_predicates` to avoid monomorphizing impossible instances Fixes #135462 r? lcnr
2025-01-14Rollup merge of #134880 - as1100k-forks:fix-rustdoc-json-path-name, ↵Matthias Krüger-1/+1
r=aDotInTheVoid Made `Path::name` only have item name rather than full name Closes #134853 This PR makes `Path::name` to only have item name rather than full name, i.e. with the following code ```rust pub mod foo { pub struct Bar; } pub fn get_bar() -> foo::Bar { foo::Bar } ``` and running `./rustdoc ./demo.rs -wjson -Zunstable-options` gives: ```json { "41": { "id": 41, "name": "get_bar", "inner": { "function": { "sig": { "inputs": [], "output": { "resolved_path": { "name": "Bar", "id": 0, "args": { "angle_bracketed": { "args": [], "constraints": [] } } } } } } } } } ``` _Information which isn't useful here was trimmed_ r? aDotInTheVoid
2025-01-14Rollup merge of #134216 - GuillaumeGomez:jump-to-def-pats, r=fmeaseMatthias Krüger-0/+52
Enable "jump to def" feature on patterns Part of https://github.com/rust-lang/rust/issues/89095. Pattern (as in "patterns in pattern matching") were not handled by the feature, it's now added. It all started when I realized that prelude values like `Some` or `Err` were not getting a link generated either (added support for it in the first commit). r? ``@fmease``
2025-01-14Prefer lower TraitUpcasting candidatesMichael Goulet-0/+29
2025-01-14Auto merge of #135313 - compiler-errors:needs-mono, r=BoxyUwUbors-0/+43
Eagerly mono drop for structs with lifetimes That is, use `!generics.requires_monomorphization()` rather than `generics.is_empty()` like the rest of the mono collector code.
2025-01-15tests: port `extern-fn-reachable` to rmake.rs许杰友 Jieyou Xu (Joe)-26/+61
Co-authored-by: binarycat <binarycat@envs.net>
2025-01-14Fix legacy symbol mangling of closuresMichael Goulet-0/+6