about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
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-15avoid running the overlap check twicelcnr-4/+0
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-15Rework trait expansion to happen once explicitlyMichael Goulet-351/+362
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
2025-01-14fix typo and unit testbinarycat-1/+2
2025-01-14make rustc_encodable_decodable feature properly unstableRalf Jung-103/+0
2025-01-14Auto merge of #135278 - tgross35:ignore-std-dep-crates, r=SparrowLiibors-0/+120
Exclude dependencies of `std` for diagnostics Currently crates in the sysroot can show up in diagnostic suggestions, such as in https://github.com/rust-lang/rust/issues/135232. To prevent this, duplicate `all_traits` into `visible_traits` which only shows traits in non-private crates. Setting `#![feature(rustc_private)]` overrides this and makes items in private crates visible as well, since `rustc_private` enables use of `std`'s private dependencies. This may be reviewed per-commit. Fixes: https://github.com/rust-lang/rust/issues/135232
2025-01-14mir borrowck: cleanup late-bound region handlinglcnr-8/+8
2025-01-14make sure that the allocator is actually called in allocator testjoboet-0/+1
Originally authored by GnomedDev
2025-01-14Revert "Remove the Arc rt::init allocation for thread info"joboet-5/+4
This reverts commit 0747f2898e83df7e601189c0f31762e84328becb.