about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-07-25Rollup merge of #128185 - surechen:fix_128042_2, r=compiler-errorsMatthias Krüger-1/+42
Fix a span error when parsing a wrong param of function. fixes #128042 Before this change, the span of param `*mut Self` in `fn oof(*mut Self)` contains `(` before it, so the suggestion in E0424 will be error.
2024-07-25Rollup merge of #128137 - GrigorenkoPV:cstr-derive, r=dtolnayMatthias Krüger-11/+21
CStr: derive PartialEq, Eq; add test for Ord While working on #128046, I've spotted a peculiarity: `CStr` has `PartialEq, Eq, PartialOrd, Ord` implemented manually and not derived. While we can't derive `PartialOrd, Ord` (due to inner `[c_char]` being `[i8]` or `[u8]` on different platforms), we *can* derive `PartialEq, Eq` (I think), allowing as to remove `#[allow(clippy::derived_hash_with_manual_eq)]` as well. (I really hope `c_char: Eq` on all platforms)
2024-07-25Rollup merge of #127999 - ChrisDenton:arm32, r=AmanieuMatthias Krüger-41/+45
Inject arm32 shims into Windows metadata generation I had been keen to eventually move to using windows-sys as a normal Cargo dependency. But for linking, compile times and other reasons that's unlikely to ever happen. So if we're sticking with generated bindings then injecting any necessary missing type definitions (i.e. for the MS unsupported arm32) is simpler than defining whole functions ourselves just because we need to manually implement those types on a tier 3 platform. This also reduces the places we need to change when making changes to how we use `#[link]`. r? libs
2024-07-25Rollup merge of #126908 - GnomedDev:cow-inline-asm-temp-piece, r=compiler-errorsMatthias Krüger-27/+28
Use Cow<'static, str> for InlineAsmTemplatePiece::String This removes a bunch of `&'static str -> String` allocations in codegen cranelift.
2024-07-25Fix a span error when parsing a wrong param of function.surechen-1/+42
fixes #128042
2024-07-25Auto merge of #128102 - Oneirical:real-testate, r=Kobzolbors-29/+52
Migrate `extern-diff-internal-name`, `extern-multiple-copies` and `extern-multiple-copies2` `run-make` tests 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). Please try: try-job: test-various
2024-07-25CStr: derive PartialEq, Eq; add test for OrdPavel Grigorenko-11/+21
2024-07-25Auto merge of #127995 - workingjubilee:say-turings-prayer, r=BoxyUwUbors-65/+57
compiler: Never debug_assert in codegen In the name of Turing and his Hoarey heralds, assert our truths before creating a monster! The `rustc_codegen_llvm` and `rustc_codegen_ssa` crates are fairly critical for rustc's correctness. Small mistakes here can easily result in undefined behavior, since a "small mistake" can mean something like "link and execute the wrong code". We should probably run any and all asserts in these modules unconditionally on whether this is a "debug build", and damn the costs in performance. ...Especially because the costs in performance seem to be *nothing*. It is not clear how much correctness we gain here, but I'll take free correctness improvements.
2024-07-25Auto merge of #128169 - matthiaskrgr:rollup-ylsoq30, r=matthiaskrgrbors-607/+792
Rollup of 5 pull requests Successful merges: - #127054 (Reorder trait bound modifiers *after* `for<...>` binder in trait bounds) - #127528 (Replace ASCII control chars with Unicode Control Pictures) - #127872 (Migrate `pointer-auth-link-with-c`, `c-dynamic-rlib` and `c-dynamic-dylib` `run-make` tests to rmake) - #128111 (Do not use question as label) - #128160 (Don't ICE when auto trait has assoc ty in old solver) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-25Rollup merge of #128160 - compiler-errors:auto, r=jackh726Matthias Krüger-23/+103
Don't ICE when auto trait has assoc ty in old solver Kinda a pointless change to make, but it's observable w/o the feature gate, so let's just fix it. I reintroduced this ICE when I removed the "auto impl" kind from `ImplSource` in #112687. Fixes #117829 Fixes #127746
2024-07-25Rollup merge of #128111 - estebank:no-question, r=fmeaseMatthias Krüger-151/+159
Do not use question as label We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
2024-07-25Rollup merge of #127872 - Oneirical:antestral-traditions, r=jieyouxuMatthias Krüger-57/+113
Migrate `pointer-auth-link-with-c`, `c-dynamic-rlib` and `c-dynamic-dylib` `run-make` tests 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). Please try: try-job: x86_64-msvc try-job: i686-mingw try-job: aarch64-apple
2024-07-25Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obkMatthias Krüger-308/+216
Replace ASCII control chars with Unicode Control Pictures Replace ASCII control chars like `CR` with Unicode Control Pictures like `␍`: ``` error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | LL | /// doc comment with bare CR: '␍' | ^ ``` Centralize the checking of unicode char width for the purposes of CLI display in one place. Account for the new replacements. Remove unneeded tracking of "zero-width" unicode chars, as we calculate these in the `SourceMap` as needed now.
2024-07-25Rollup merge of #127054 - compiler-errors:bound-ordering, r=fmeaseMatthias Krüger-68/+201
Reorder trait bound modifiers *after* `for<...>` binder in trait bounds This PR suggests changing the grammar of trait bounds from: ``` [CONSTNESS] [ASYNCNESS] [?] [BINDER] [TRAIT_PATH] const async ? for<'a> Sized ``` to ``` ([BINDER] [CONSTNESS] [ASYNCNESS] | [?]) [TRAIT_PATH] ``` i.e., either ``` ? Sized ``` or ``` for<'a> const async Sized ``` (but not both) ### Why? I think it's strange that the binder applies "more tightly" than the `?` trait polarity. This becomes even weirder when considering that we (or at least, I) want to have `async` trait bounds expressed like: ``` where T: for<'a> async Fn(&'a ()) -> i32, ``` and not: ``` where T: async for<'a> Fn(&'a ()) -> i32, ``` ### Fallout No crates on crater use this syntax, presumably because it's literally useless. This will require modifying the reference grammar, though. ### Alternatives If this is not desirable, then we can alternatively keep parsing `for<'a>` after the `?` but deprecate it with either an FCW (or an immediate hard error), and begin parsing `for<'a>` *before* the `?`.
2024-07-25Apply suggestions from code reviewLeón Orell Valerian Liehr-2/+6
2024-07-24Auto merge of #128155 - matthiaskrgr:rollup-lxtal9f, r=matthiaskrgrbors-335/+742
Rollup of 8 pull requests Successful merges: - #122192 (Do not try to reveal hidden types when trying to prove auto-traits in the defining scope) - #126042 (Implement `unsigned_signed_diff`) - #126548 (Improved clarity of documentation for std::fs::create_dir_all) - #127717 (Fix malformed suggestion for repeated maybe unsized bounds) - #128046 (Fix some `#[cfg_attr(not(doc), repr(..))]`) - #128122 (Mark `missing_fragment_specifier` as `FutureReleaseErrorReportInDeps`) - #128135 (std: use duplicate thread local state in tests) - #128140 (Remove Unnecessary `.as_str()` Conversions) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-24Don't ICE when auto trait has assoc ty in old solverMichael Goulet-23/+103
2024-07-24Fix ddltool-failed testEsteban Küber-1/+1
2024-07-24Do not use question as labelEsteban Küber-151/+159
We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
2024-07-24Rollup merge of #128140 - veera-sivarajan:remove-ident-to-str-conversions, ↵Matthias Krüger-4/+4
r=compiler-errors Remove Unnecessary `.as_str()` Conversions Because comparing interned values is much more efficient than converting a `rustc_span::symbol::Ident` to `&str` and then doing the comparison. docs: https://doc.rust-lang.org/stable/nightly-rustc/rustc_span/symbol/struct.Ident.html#method.as_str
2024-07-24Rollup merge of #128135 - joboet:reduplicate_tls, r=tgross35Matthias Krüger-16/+8
std: use duplicate thread local state in tests With rust-lang/miri#3739 merged, the deduplication hack is no longer necessary.
2024-07-24Rollup merge of #128122 - tgross35:missing-fragment-specifier-unconditional, ↵Matthias Krüger-1/+116
r=petrochenkov Mark `missing_fragment_specifier` as `FutureReleaseErrorReportInDeps` We are moving toward forbidding `missing_fragment_specifier` either in edition 2024 or unconditionally. Make a first step toward this by ensuring crates that rely on the old behavior are reported when used as dependencies. Tracking issue: <https://github.com/rust-lang/rust/issues/128143>
2024-07-24Rollup merge of #128046 - GrigorenkoPV:90435, r=tgross35Matthias Krüger-15/+11
Fix some `#[cfg_attr(not(doc), repr(..))]` Now that #90435 seems to have been resolved.
2024-07-24Rollup merge of #127717 - gurry:127441-stray-impl-sugg, r=compiler-errorsMatthias Krüger-29/+295
Fix malformed suggestion for repeated maybe unsized bounds Fixes #127441 Now when we encounter something like `foo(a : impl ?Sized + ?Sized)`, instead of suggesting removal of both bounds and leaving `foo(a: impl )` behind, we suggest changing the first bound to `Sized` and removing the second bound, resulting in `foo(a: impl Sized)`. Although the issue was reported for impl trait types, it also occurred with regular param bounds. So if we encounter `foo<T: ?Sized + ?Sized>(a: T)` we now detect that all the bounds are `?Sized` and therefore emit the suggestion to remove the entire predicate `: ?Sized + ?Sized` resulting in `foo<T>(a: T)`. Lastly, if we encounter a situation where some of the bounds are something other than `?Sized`, then we emit separate removal suggestions for each `?Sized` bound. E.g. if we see `foo(a: impl ?Sized + Bar + ?Sized)` or `foo<T: ?Sized + Bar + ?Sized>(a: T)` we emit suggestions such that the user will be left with `foo(a : impl Bar)` or `foo<T: Bar>(a: T)` respectively.
2024-07-24Rollup merge of #126548 - rik86189:issue-88264-fix, r=tgross35Matthias Krüger-7/+2
Improved clarity of documentation for std::fs::create_dir_all Closes #88264
2024-07-24Rollup merge of #126042 - davidzeng0:master, r=AmanieuMatthias Krüger-0/+61
Implement `unsigned_signed_diff` <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> Implements https://github.com/rust-lang/rust/issues/126041
2024-07-24Rollup merge of #122192 - oli-obk:type_of_opaque_for_const_checks, r=lcnrMatthias Krüger-263/+245
Do not try to reveal hidden types when trying to prove auto-traits in the defining scope fixes #99793 this avoids the cycle error by just causing a selection error, which is not fatal. We pessimistically assume that freeze does not hold, which is always a safe assumption.
2024-07-24Auto merge of #128146 - notriddle:notriddle/natsortfixes, r=GuillaumeGomezbors-70/+119
rustdoc: clean up and fix ord violations in item sorting Based on https://github.com/rust-lang/rust/pull/128139 with a few minor changes: - The name sorting function is changed to follow the [version sort] from the style guide - the `cmp` function is redesigned to more obviously make a partial order, by always return `cmp()` of the same variable as the `!=` above [version sort]: https://doc.rust-lang.org/nightly/style-guide/index.html#sorting
2024-07-24Use Cow<'static, str> for InlineAsmTemplatePiece::StringGnomedDev-27/+28
2024-07-24rustdoc: clean up and fix ord violations in item sortingMichael Howell-70/+119
Based on e3fdafc263a4a705a3bec1a6865a4d011b2ec7c5 with a few minor changes: - The name sorting function is changed to follow the [version sort] from the style guide - the `cmp` function is redesigned to more obviously make a partial order, by always return `cmp()` of the same variable as the `!=` above [version sort]: https://doc.rust-lang.org/nightly/style-guide/index.html#sorting Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-07-24Mark `missing_fragment_specifier` as `FutureReleaseErrorReportInDeps`Trevor Gross-1/+116
We are moving toward forbidding `missing_fragment_specifier` either in edition 2024 or unconditionally. Make a first step toward this by ensuring crates that rely on the old behavior are reported when used as dependencies. Tracking issue: <https://github.com/rust-lang/rust/issues/128143>
2024-07-24Auto merge of #128142 - matthiaskrgr:rollup-rep8ofv, r=matthiaskrgrbors-435/+528
Rollup of 9 pull requests Successful merges: - #126152 (size_of_val_raw: for length 0 this is safe to call) - #127252 (Add edge-case examples to `{count,leading,trailing}_{ones,zeros}` methods) - #127374 (Tweak "wrong # of generics" suggestions) - #127457 (Make tidy fast without compromising case alternation) - #127480 (Fix build failure on vxworks #127084 ) - #127733 (Replace some `mem::forget`'s with `ManuallyDrop`) - #128120 (Gate `AsyncFn*` under `async_closure` feature) - #128131 (Import `c_void` rather than using the full path) - #128133 (Improve spans on evaluated `cfg_attr`s.) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-24Do not assemble candidates for auto traits of opaque types in their defining ↵Oli Scherer-54/+93
scope
2024-07-24Add regression testsOli Scherer-0/+88
2024-07-24Do not try to reveal hidden types when trying to prove Freeze in the ↵Oli Scherer-261/+67
defining scope
2024-07-24Rollup merge of #128133 - nnethercote:fix-cfg_attr-spans, r=petrochenkovMatthias Krüger-41/+41
Improve spans on evaluated `cfg_attr`s. When converting something like `#![cfg_attr(cond, attr)]` into `#![attr]`, we currently duplicate the `#` token and the `!` token. But weirdly, there is also this comment: // We don't really have a good span to use for the synthesized `[]` // in `#[attr]`, so just use the span of the `#` token. Maybe that comment used to be true? But now it is false: we can duplicate the existing delimiters (and their spans and spacing), much like we do for the `#` and `!`. This commit does that, thus removing the incorrect comment, and improving the spans on `Group`s in a few proc-macro tests. `@petrochenkov`
2024-07-24Rollup merge of #128131 - ChrisDenton:stuff, r=workingjubileeMatthias Krüger-32/+35
Import `c_void` rather than using the full path Follow up to #128092. As requested, this imports `c_void` in more places. I also fixed up some imports to use `core` for core types instead of `crate`. While that is not strictly necessary, I think ideally things in `sys/pal` should only depend on itself or core so that the code is less spaghetti. We're far away from that ideal at the moment but I can at least try to slowly move in that direction. Also this forbids `unsafe_op_in_unsafe_fn` for library/std/src/sys/pal/windows by fixing up the remaining unsafe bits that are just punting their unsafe requirements onto the caller of the `unsafe` function (or definition macro). <!-- r? workingjubilee -->
2024-07-24Rollup merge of #128120 - compiler-errors:async-fn-name, r=oli-obkMatthias Krüger-12/+43
Gate `AsyncFn*` under `async_closure` feature T-lang has not come to a consensus on the naming of async closure callable bounds, and as part of allowing the async closures RFC merge, we agreed to place `AsyncFn` under the same gate as `async Fn` so that these syntaxes can be evaluated in parallel. See https://github.com/rust-lang/rfcs/pull/3668#issuecomment-2246435537 r? oli-obk
2024-07-24Rollup merge of #127733 - GrigorenkoPV:don't-forget, r=AmanieuMatthias Krüger-132/+88
Replace some `mem::forget`'s with `ManuallyDrop` > but I would like to see a larger effort to replace all uses of `mem::forget`. _Originally posted by `@saethlin` in https://github.com/rust-lang/rust/issues/127584#issuecomment-2226087767_ So, r? `@saethlin` Sorry, I have finished writing all of this before I got your response.
2024-07-24Rollup merge of #127480 - biabbas:vxworks, r=workingjubileeMatthias Krüger-5/+35
Fix build failure on vxworks #127084 PR to address issue #127084 . 1. Skip `reset_segpipe` for vxworks 2. Return unimplemented error for vxworks from settimes and lchown 3. Temporarily skip dirfd for vxworks 4. Add allow unused unsafe on read_at and write_at functions in unix/fs.rs 5. Using cfg disable ON_BROKEN_PIPE_FLAG_USED and on_broken_pipe_flag_used() for vxworks 6. Remove old crate::syscommon::thread::min_stack() reference from process_vxworks.rs and update to set stack size of rtpthread Thank you.
2024-07-24Rollup merge of #127457 - donno2048:master, r=albertlarsan68Matthias Krüger-31/+35
Make tidy fast without compromising case alternation Fixes tidy speed issue but still catches case-alternation, enabled for other `style.rs` files, and also detects test files better. r? `@albertlarsan68` `@Nilstrieb`
2024-07-24Rollup merge of #127374 - estebank:wrong-generic-args, r=oli-obkMatthias Krüger-176/+184
Tweak "wrong # of generics" suggestions Fix incorrect suggestion, make verbose and change message to make more sense when it isn't a span label.
2024-07-24Rollup merge of #127252 - fitzgen:edge-cases-for-bitwise-operations, r=m-ou-seMatthias Krüger-6/+35
Add edge-case examples to `{count,leading,trailing}_{ones,zeros}` methods Some architectures (i386) do not define a "count leading zeros" instruction, they define a "find first set bit" instruction (`bsf`) whose result is undefined when given zero (ie none of the bits are set). Of this family of bitwise operations, I always forget which of these things is potentially undefined for zero, and I'm also not 100% sure that Rust provides a hard guarantee for the results of these methods when given zero. So I figured there are others who have these same uncertainties, and it would be good to resolve them and answer the question via extending these doc examples/tests. See https://en.wikipedia.org/wiki/Find_first_set#Hardware_support for more info on i386 and `bsf` on zero.
2024-07-24Rollup merge of #126152 - RalfJung:size_of_val_raw, r=saethlinMatthias Krüger-0/+32
size_of_val_raw: for length 0 this is safe to call For motivation, see https://github.com/rust-lang/unsafe-code-guidelines/issues/465, specifically around [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/465#issuecomment-2136401114). Cc `@rust-lang/opsem`
2024-07-24Add regression testOli Scherer-0/+49
2024-07-24Remove Unnecessary `.as_str()` ConversionsVeera-4/+4
2024-07-24Improved clarity of documentation for std::fs::create_dir_allrik86189-7/+2
2024-07-24std: use duplicate thread local state in testsjoboet-16/+8
With rust-lang/miri#3739 merged, the deduplication hack is no longer necessary.
2024-07-24Auto merge of #126024 - oli-obk:candidate_key_caching_is_unsound_yay, r=lcnrbors-2/+11
Do not use global caches if opaque types can be defined fixes #119272 r? `@lcnr` This is certainly a crude way to make the cache sound wrt opaque types, but since perf lets us get away with this, let's do it in the old solver and let the new solver fix this correctly once and for all. cc https://github.com/rust-lang/rust/pull/122192#issuecomment-2149252655
2024-07-24Improve spans on evaluated `cfg_attr`s.Nicholas Nethercote-41/+41
When converting something like `#![cfg_attr(cond, attr)]` into `#![attr]`, we currently duplicate the `#` token and the `!` token. But weirdly, there is also this comment: // We don't really have a good span to use for the synthesized `[]` // in `#[attr]`, so just use the span of the `#` token. Maybe that comment used to be true? But now it is false: we can duplicate the existing delimiters (and their spans and spacing), much like we do for the `#` and `!`. This commit does that, thus removing the incorrect comment, and improving the spans on `Group`s in a few proc-macro tests.