about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-11-23Exhaustively match CoroutineKind in fn_sig_for_fn_abibjorn3-60/+70
2023-11-23Fix fn_sig_for_fn_abi and the coroutine transform for generatorsbjorn3-9/+129
There were three issues previously: * The self argument was pinned, despite Iterator::next taking an unpinned mutable reference. * A resume argument was passed, despite Iterator::next not having one. * The return value was CoroutineState<Item, ()> rather than Option<Item> While these things just so happened to work with the LLVM backend, cg_clif does much stricter checks when trying to assign a value to a place. In addition it can't handle the mismatch between the amount of arguments specified by the FnAbi and the FnSig.
2023-11-23Auto merge of #117978 - petrochenkov:deleggate, r=TaKO8Ki,joshtriplettbors-0/+19
Add an experimental feature gate for function delegation In accordance with the [process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md). Detailed description of the feature can be found in the RFC repo - https://github.com/rust-lang/rfcs/pull/3530. TODO: find a lang team liaison - https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/fn.20delegation.20liaison/near/402506959.
2023-11-23Add an experimental feature gate for function delegationVadim Petrochenkov-0/+19
In accordance with the [process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md). Detailed description of the feature can be found in the RFC repo - https://github.com/rust-lang/rfcs/pull/3530.
2023-11-23Auto merge of #117815 - onur-ozkan:update-change-tracking-impl, r=albertlarsan68bors-29/+90
improve bootstrap change-tracking system This PR aims to improve how change-tracking system works for bootstrap changes by doing the followings: - Enforce embedding directive informations about the changes on `bootstrap/src/lib.rs`. - Give more informative change inputs on the terminal (https://github.com/rust-lang/rust/pull/117815#discussion_r1390239657). - Avoid spamming the change informations(by reading and creating `.last-warned-change-id` under build output dir). see the zulip conversation for more details: https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/config.2Etoml.20change.20tracking cc `@RalfJung`
2023-11-23Auto merge of #116449 - Kobzol:bootstrap-rustdoc-shim, r=petrochenkovbors-33/+79
Pass flags to `rustdoc` shim without env. vars Discussed here: https://github.com/rust-lang/rust/pull/116448#issuecomment-1748785961. Since it was not really documented why these flags were passed through the shim, I guess that the only way to find out if it's really needed... is to remove it :) r? `@petrochenkov`
2023-11-23Add LLD flags to rustdoc cargo invocationsJakub Beránek-20/+64
2023-11-23Auto merge of #118073 - saethlin:gc-dead-allocs, r=RalfJungbors-1/+13
Miri: GC the dead_alloc_map too dead_alloc_map is the last piece of state in the interpreter I can find that leaks. With this PR, all of the long-term memory growth I can find in Miri with programs that do things like run a big `loop {` or run property tests is attributable to some data structure properties in borrow tracking, and is _extremely_ slow. My only gripe with the commit in this PR is that I don't have a new test for it. I'd like to have a regression test for this, but it would have to be statistical I think because the peak memory of a process that Linux reports is not exactly the same run-to-run. Which means it would have to not be very sensitive to slow leaks (some guesswork suggests for acceptable CI time we would be checking for like 10% memory growth over a minute or two, which is still pretty fast IMO). Unless someone has a better idea for how to detect a regression, I think on balance I'm fine with manually keeping an eye on the memory use situation. r? RalfJung
2023-11-23Auto merge of #118200 - matthiaskrgr:rollup-neka6xo, r=matthiaskrgrbors-79/+249
Rollup of 4 pull requests Successful merges: - #118131 (improve tool-only help for multiple `#[default]` variants) - #118146 (Rework supertrait lint once again) - #118167 (make the 'abi_unadjusted' feature internal) - #118169 (print query map for deadlock when using parallel front end) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-23Rollup merge of #118169 - SparrowLii:deadlock_issue, r=compiler-errorsMatthias Krüger-6/+12
print query map for deadlock when using parallel front end print query map for deadlock when using parallel front end, so that we can analyze where and why deadlock occurs
2023-11-23Rollup merge of #118167 - RalfJung:unadjusted-abi-is-internal, r=petrochenkovMatthias Krüger-1/+1
make the 'abi_unadjusted' feature internal As [suggested](https://github.com/rust-lang/rust/pull/118127#issuecomment-1820736389) by `@bjorn3.`
2023-11-23Rollup merge of #118146 - compiler-errors:deref-into-dyn-regions, r=lcnrMatthias Krüger-25/+125
Rework supertrait lint once again I accidentally pushed the wrong commits because I totally didn't check I was on the right computer when updating #118026. Sorry, this should address all the nits in #118026. r? lcnr
2023-11-23Rollup merge of #118131 - lukas-code:multi-default, r=wesleywiserMatthias Krüger-47/+111
improve tool-only help for multiple `#[default]` variants When defining an enum with multiple `#[default]` variants, we emit a tool-only suggestion for every `#[default]`ed variant to remove all other `#[default]`s. This PR improves the suggestion to correctly handle the cases where one variant has multiple `#[default]`s and where different `#[default]`s have the same span due to macro expansions. fixes https://github.com/rust-lang/rust/issues/118119
2023-11-23Auto merge of #115159 - solid-rs:patch/kmc-solid/io-safety, r=workingjubileebors-132/+371
kmc-solid: I/O safety Adds the I/O safety API (#87329) for socket file descriptors in [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets. All new public items are gated by the `solid_ext` library feature. This PR adds the following public types and traits: std::os::solid::io::AsFd std::os::solid::io::BorrowedFd std::os::solid::io::OwnedFd std::os::solid::prelude::AsFd (re-export) std::os::solid::prelude::BorrowedFd (re-export) std::os::solid::prelude::OwnedFd (re-export) And trait implementations: From<std::net::TcpListener> for std::os::solid::io::OwnedFd From<std::net::TcpStream> for std::os::solid::io::OwnedFd From<std::net::UdpSocket> for std::os::solid::io::OwnedFd From<std::os::solid::io::OwnedFd> for std::net::TcpListener From<std::os::solid::io::OwnedFd> for std::net::TcpStream From<std::os::solid::io::OwnedFd> for std::net::UdpSocket std::fmt::Debug for std::os::solid::io::BorrowedFd<'_> std::fmt::Debug for std::os::solid::io::OwnedFd std::io::IsTerminal for std::os::solid::io::BorrowedFd<'_> std::io::IsTerminal for std::os::solid::io::OwnedFd std::os::fd::AsRawFd for std::os::solid::io::BorrowedFd<'_> std::os::fd::AsRawFd for std::os::solid::io::OwnedFd std::os::fd::FromRawFd for std::os::solid::io::OwnedFd std::os::fd::IntoRawFd for std::os::solid::io::OwnedFd std::os::solid::io::AsFd for &impl std::os::solid::io::AsFd std::os::solid::io::AsFd for &mut impl std::os::solid::io::AsFd std::os::solid::io::AsFd for Arc<impl std::os::solid::io::AsFd> std::os::solid::io::AsFd for Box<impl std::os::solid::io::AsFd> std::os::solid::io::AsFd for Rc<impl std::os::solid::io::AsFd> std::os::solid::io::AsFd for std::net::TcpListener std::os::solid::io::AsFd for std::net::TcpStream std::os::solid::io::AsFd for std::net::UdpSocket std::os::solid::io::AsFd for std::os::solid::io::BorrowedFd<'_> std::os::solid::io::AsFd for std::os::solid::io::OwnedFd Taking advantage of the above change, this PR also refactors the internal details of `std::sys::solid::net` to match the design of other targets, e.g., by redefining `Socket` as a newtype of `OwnedFd`.
2023-11-22Miri: GC the dead_alloc_map tooBen Kimock-1/+13
2023-11-23Nit of deadlock detectedSparrowLii-1/+1
2023-11-23Auto merge of #118065 - estebank:core-not-found-404, r=TaKO8Kibors-12/+29
When failing to import `core`, suggest `std`
2023-11-23Auto merge of #118154 - ChrisDenton:win-clippy, r=scottmcmbors-45/+43
Fix some clippy lints for library/std/src/sys/windows These issues were shown by running `x clippy` on `library/std` and filtering for `windows/` paths. I think running clippy on the full std would be great but I wanted to start smaller and with something that's hopefully easier to review. It'd be good to eventually run clippy in CI but that's a bigger conversation. I've created separate commits for each clippy lint fixed (with the commit title set to the lint name) and reviewed the changes myself. Most of the fixes here are trivial. r? libs
2023-11-22Rework supertrait lint once againMichael Goulet-25/+125
2023-11-22Auto merge of #118120 - compiler-errors:closure-kind, r=lcnrbors-102/+53
Remove `PredicateKind::ClosureKind` We don't need the `ClosureKind` predicate kind -- instead, `Fn`-family trait goals are left as ambiguous, and we only need to make progress on `FnOnce` projection goals for inference purposes. This is similar to how we do confirmation of `Fn`-family trait and projection goals in the new trait solver, which also doesn't use the `ClosureKind` predicate. Some hacky logic is added in the second commit so that we can keep the error messages the same.
2023-11-22When failing to import `core`, suggest `std`Esteban Küber-12/+29
2023-11-22Auto merge of #118178 - compiler-errors:rollup-0i11w85, r=compiler-errorsbors-243/+666
Rollup of 6 pull requests Successful merges: - #118012 (Add support for global allocation in smir) - #118013 (Enable Rust to use the EHCont security feature of Windows) - #118100 (Enable profiler in dist-powerpc64-linux) - #118142 (Tighten up link attributes for llvm-wrapper bindings) - #118147 (Fix some unnecessary casts) - #118161 (Allow defining opaques in `check_coroutine_obligations`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-22Rollup merge of #118161 - compiler-errors:coroutine-obligation-opaques, r=lcnrMichael Goulet-5/+36
Allow defining opaques in `check_coroutine_obligations` In the new trait solver, when an obligation stalls on an unresolved coroutine witness, we will stash away the *root* obligation, even if the stalled obligation is only a distant descendent of the root obligation, since the new solver is purely recursive. This means that we may need to reprocess alias-relate obligations (and others) which may define opaque types in the new solver. Currently, we use the coroutine's def id as the defining anchor in `check_coroutine_obligations`, which will allow defining no opaque types, resulting in errors like: ``` error[E0271]: type mismatch resolving `{coroutine@<source>:6:5: 6:17} <: impl Clone` --> <source>:6:5 | 6 | / move |_: ()| { 7 | | let () = yield (); 8 | | } | |_____^ types differ ``` So this PR fixes the defining anchor and does the same trick as `check_opaque_well_formed`, where we manually compare opaques that were defined against their hidden types to make sure they weren't defined differently when processing these stalled coroutine obligations. r? `@lcnr` cc `@cjgillot`
2023-11-22Rollup merge of #118147 - Nilstrieb:no-redundant-casts, r=WaffleLapkinMichael Goulet-30/+18
Fix some unnecessary casts `x clippy compiler -Aclippy::all -Wclippy::unnecessary_cast --fix` with some manual review to ensure every fix is correct.
2023-11-22Rollup merge of #118142 - saethlin:llvm-linkage, r=tmiaskoMichael Goulet-180/+206
Tighten up link attributes for llvm-wrapper bindings Fixes https://github.com/rust-lang/rust/issues/118084 by moving all of the declarations of symbols from `llvm_rust` into a separate extern block with `#[link(name = "llvm-wrapper", kind = "static")]`. This also renames `LLVMTimeTraceProfiler*` to `LLVMRustTimeTraceProfiler*` because those are functions from `llvm_rust`. r? tmiasko
2023-11-22Rollup merge of #118100 - ecnelises:ppc64_profiler, r=KobzolMichael Goulet-1/+1
Enable profiler in dist-powerpc64-linux
2023-11-22Rollup merge of #118013 - sivadeilra:user/ardavis/ehcont, r=wesleywiserMichael Goulet-1/+76
Enable Rust to use the EHCont security feature of Windows In the future Windows will enable Control-flow Enforcement Technology (CET aka Shadow Stacks). To protect the path where the context is updated during exception handling, the binary is required to enumerate valid unwind entrypoints in a dedicated section which is validated when the context is being set during exception handling. The required support for EHCONT Guard has already been merged into LLVM, long ago. This change simply adds the Rust codegen option to enable it. Relevant LLVM change: https://reviews.llvm.org/D40223 This also adds a new `ehcont-guard` option to the bootstrap config which enables EHCont Guard when building std. We at Microsoft have been using this feature for a significant period of time; we are confident that the LLVM feature, when enabled, generates well-formed code. We currently enable EHCONT using a codegen feature, but I'm certainly open to refactoring this to be a target feature instead, or to use any appropriate mechanism to enable it.
2023-11-22Rollup merge of #118012 - celinval:smir-alloc, r=ouz-aMichael Goulet-26/+329
Add support for global allocation in smir Add APIs to StableMir to support global allocation. Before this change, StableMir users had no API available to retrieve Allocation provenance information. They had to resource to internal APIs instead. One example is retrieving the Allocation of an `&str`. See test for an example on how the API can be used.
2023-11-22Auto merge of #118133 - Urgau:stabilize_trait_upcasting, r=WaffleLapkinbors-347/+97
Stabilize RFC3324 dyn upcasting coercion This PR stabilize the `trait_upcasting` feature, aka https://github.com/rust-lang/rfcs/pull/3324. The FCP was completed here: https://github.com/rust-lang/rust/issues/65991#issuecomment-1817552398. ~~And also remove the `deref_into_dyn_supertrait` lint which is now handled by dyn upcasting coercion.~~ Heavily inspired by https://github.com/rust-lang/rust/pull/101718 Fixes https://github.com/rust-lang/rust/issues/65991
2023-11-22Auto merge of #112380 - jieyouxu:useless-bindings-lint, r=WaffleLapkinbors-2/+88
Add allow-by-default lint for unit bindings ### Example ```rust #![warn(unit_bindings)] macro_rules! owo { () => { let whats_this = (); } } fn main() { // No warning if user explicitly wrote `()` on either side. let expr = (); let () = expr; let _ = (); let _ = expr; //~ WARN binding has unit type let pat = expr; //~ WARN binding has unit type let _pat = expr; //~ WARN binding has unit type // No warning for let bindings with unit type in macro expansions. owo!(); // No warning if user explicitly annotates the unit type on the binding. let pat: () = expr; } ``` outputs ``` warning: binding has unit type `()` --> $DIR/unit-bindings.rs:17:5 | LL | let _ = expr; | ^^^^-^^^^^^^^ | | | this pattern is inferred to be the unit type `()` | note: the lint level is defined here --> $DIR/unit-bindings.rs:3:9 | LL | #![warn(unit_bindings)] | ^^^^^^^^^^^^^ warning: binding has unit type `()` --> $DIR/unit-bindings.rs:18:5 | LL | let pat = expr; | ^^^^---^^^^^^^^ | | | this pattern is inferred to be the unit type `()` warning: binding has unit type `()` --> $DIR/unit-bindings.rs:19:5 | LL | let _pat = expr; | ^^^^----^^^^^^^^ | | | this pattern is inferred to be the unit type `()` warning: 3 warnings emitted ``` This lint is not triggered if any of the following conditions are met: - The user explicitly annotates the binding with the `()` type. - The binding is from a macro expansion. - The user explicitly wrote `let () = init;` - The user explicitly wrote `let pat = ();`. This is allowed for local lifetimes. ### Known Issue It is known that this lint can trigger on some proc-macro generated code whose span returns false for `Span::from_expansion` because e.g. the proc-macro simply forwards user code spans, and otherwise don't have distinguishing syntax context compared to non-macro-generated code. For those kind of proc-macros, I believe the correct way to fix them is to instead emit identifers with span like `Span::mixed_site().located_at(user_span)`. Closes #71432.
2023-11-22x fmt library/stdChris Denton-3/+2
2023-11-22redundant_slicingChris Denton-1/+1
2023-11-22cmp_nullChris Denton-2/+2
comparing with null is better expressed by the `.is_null()` method
2023-11-22manual_range_containsChris Denton-2/+2
2023-11-22op_refChris Denton-1/+1
taken reference of right operand
2023-11-22manual_mapChris Denton-5/+3
manual implementation of `Option::map`
2023-11-22unnecessary_lazy_evaluationsChris Denton-1/+1
unnecessary closure used with `bool::then`
2023-11-22redundant_closureChris Denton-4/+4
2023-11-22duration_subsecChris Denton-1/+1
calling `subsec_micros()` is more concise than this calculation
2023-11-22unnecessary_castChris Denton-9/+9
casting to the same type is unnecessary
2023-11-22needless_borrowChris Denton-8/+8
this expression creates a reference which is immediately dereferenced by the compiler
2023-11-22needless_borrows_for_generic_argsChris Denton-2/+2
the borrowed expression implements the required traits
2023-11-22manual_slice_size_calculationChris Denton-1/+1
2023-11-22unnecessary_mut_passedChris Denton-4/+4
This is where our Windows API bindings previously (and incorrectly) used `*mut` instead of `*const` pointers. Now that the bindings have been corrected, the mutable references (which auto-convert to `*mut`) are unnecessary and we can use shared references.
2023-11-22useless_conversionChris Denton-1/+1
2023-11-22needless_returnChris Denton-1/+1
unneeded `return` statement
2023-11-22Stabilize RFC3324 dyn upcasting coercionUrgau-347/+97
Aka trait_upcasting feature. And also adjust the `deref_into_dyn_supertrait` lint.
2023-11-22Auto merge of #118086 - nnethercote:queries-cleanups, r=bjorn3bors-59/+47
Queries cleanups r? `@bjorn3`
2023-11-22Auto merge of #118125 - nnethercote:custom_encodable, r=compiler-errorsbors-34/+83
Make some `newtype_index!` derived impls opt-in instead of opt-out Opt-in is the standard Rust way of doing things, and avoids some unnecessary dependencies on the `rustc_serialize` crate. r? `@lcnr`
2023-11-22Document `newtype_index` attributes.Nicholas Nethercote-2/+13