Commit Graph

261529 Commits

Author SHA1 Message Date
Matthias Krüger 40557c8049
Rollup merge of #128111 - estebank:no-question, r=fmease
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-25 04:43:20 +02:00
Matthias Krüger 04e4569ffd
Rollup merge of #127872 - Oneirical:antestral-traditions, r=jieyouxu
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-25 04:43:19 +02:00
Matthias Krüger cce2db06c0
Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obk
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-25 04:43:19 +02:00
Matthias Krüger cfc5f25b3d
Rollup merge of #127054 - compiler-errors:bound-ordering, r=fmease
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-25 04:43:18 +02:00
León Orell Valerian Liehr 7da751a108
Apply suggestions from code review 2024-07-25 03:00:04 +02:00
bors e7d66eac5e Auto merge of #128155 - matthiaskrgr:rollup-lxtal9f, r=matthiaskrgr
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-24 22:37:03 +00:00
Esteban Küber 9bd7680b2e Fix ddltool-failed test 2024-07-24 21:06:24 +00:00
Esteban Küber 850faea030 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-24 21:03:27 +00:00
Matthias Krüger 104a421a46
Rollup merge of #128140 - veera-sivarajan:remove-ident-to-str-conversions, 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-24 22:22:18 +02:00
Matthias Krüger d146ecdcb9
Rollup merge of #128135 - joboet:reduplicate_tls, r=tgross35
std: use duplicate thread local state in tests

With rust-lang/miri#3739 merged, the deduplication hack is no longer necessary.
2024-07-24 22:22:18 +02:00
Matthias Krüger dec0c48f1c
Rollup merge of #128122 - tgross35:missing-fragment-specifier-unconditional, 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-24 22:22:17 +02:00
Matthias Krüger 07947f3773
Rollup merge of #128046 - GrigorenkoPV:90435, r=tgross35
Fix some `#[cfg_attr(not(doc), repr(..))]`

Now that #90435 seems to have been resolved.
2024-07-24 22:22:17 +02:00
Matthias Krüger 2ff33bb1df
Rollup merge of #127717 - gurry:127441-stray-impl-sugg, r=compiler-errors
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-24 22:22:16 +02:00
Matthias Krüger ed5dfed535
Rollup merge of #126548 - rik86189:issue-88264-fix, r=tgross35
Improved clarity of documentation for std::fs::create_dir_all

Closes #88264
2024-07-24 22:22:15 +02:00
Matthias Krüger 7fac549ff1
Rollup merge of #126042 - davidzeng0:master, r=Amanieu
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-24 22:22:15 +02:00
Matthias Krüger 6bf5fd500a
Rollup merge of #122192 - oli-obk:type_of_opaque_for_const_checks, r=lcnr
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-24 22:22:14 +02:00
bors c1a6199e9d Auto merge of #128146 - notriddle:notriddle/natsortfixes, r=GuillaumeGomez
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-24 20:15:26 +00:00
Michael Howell 53846925ca rustdoc: clean up and fix ord violations in item sorting
Based on e3fdafc263 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-24 11:08:44 -07:00
Trevor Gross c9886a1ddf 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-24 13:16:46 -04:00
bors 6106b05b27 Auto merge of #128142 - matthiaskrgr:rollup-rep8ofv, r=matthiaskrgr
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-24 16:44:29 +00:00
Oli Scherer 8ea461da55 Do not assemble candidates for auto traits of opaque types in their defining scope 2024-07-24 16:00:48 +00:00
Oli Scherer 548c44760f Add regression tests 2024-07-24 16:00:48 +00:00
Oli Scherer acba6449f8 Do not try to reveal hidden types when trying to prove Freeze in the defining scope 2024-07-24 16:00:48 +00:00
Matthias Krüger 2dc88bf88a
Rollup merge of #128133 - nnethercote:fix-cfg_attr-spans, r=petrochenkov
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-24 18:00:41 +02:00
Matthias Krüger f3a7c3fd3b
Rollup merge of #128131 - ChrisDenton:stuff, r=workingjubilee
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-24 18:00:40 +02:00
Matthias Krüger e342efe545
Rollup merge of #128120 - compiler-errors:async-fn-name, r=oli-obk
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-24 18:00:40 +02:00
Matthias Krüger 34abb9647c
Rollup merge of #127733 - GrigorenkoPV:don't-forget, r=Amanieu
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-24 18:00:39 +02:00
Matthias Krüger ce523d65e0
Rollup merge of #127480 - biabbas:vxworks, r=workingjubilee
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:🧵:min_stack() reference from process_vxworks.rs and update to set stack size of rtpthread

Thank you.
2024-07-24 18:00:38 +02:00
Matthias Krüger 122b0b2ef2
Rollup merge of #127457 - donno2048:master, r=albertlarsan68
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-24 18:00:37 +02:00
Matthias Krüger 91c03ef069
Rollup merge of #127374 - estebank:wrong-generic-args, r=oli-obk
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-24 18:00:37 +02:00
Matthias Krüger 720c6f19b7
Rollup merge of #127252 - fitzgen:edge-cases-for-bitwise-operations, r=m-ou-se
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-24 18:00:36 +02:00
Matthias Krüger 130d15e23e
Rollup merge of #126152 - RalfJung:size_of_val_raw, r=saethlin
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-24 18:00:35 +02:00
Oli Scherer fdff100545 Add regression test 2024-07-24 15:40:25 +00:00
Veera 4d5ac84285 Remove Unnecessary `.as_str()` Conversions 2024-07-24 11:06:23 -04:00
rik86189 dfb3fb32ce Improved clarity of documentation for std::fs::create_dir_all 2024-07-24 14:23:29 +02:00
joboet a4dd0d6899
std: use duplicate thread local state in tests
With rust-lang/miri#3739 merged, the deduplication hack is no longer necessary.
2024-07-24 14:13:57 +02:00
bors 2ccafed862 Auto merge of #126024 - oli-obk:candidate_key_caching_is_unsound_yay, r=lcnr
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-24 11:59:10 +00:00
Nicholas Nethercote ac26b883bf 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.
2024-07-24 21:03:52 +10:00
Oli Scherer 61b5e11c47 Don't use global caches if opaques can be defined 2024-07-24 10:45:21 +00:00
bors d24930ceb4 Auto merge of #127524 - oli-obk:feed_item_attrs2, r=petrochenkov
Make ast `MutVisitor` have the same method name and style as `Visitor`

It doesn't map 100% because some `MutVisitor` methods can filter or even expand to multiple items, but consistency seems nicer.

tracking issue: https://github.com/rust-lang/rust/issues/127615
2024-07-24 09:36:57 +00:00
Chris Denton 7cd25b1b11
Forbid unsafe_op_in_unsafe_fn in sys/pal/windows 2024-07-24 08:28:47 +00:00
Chris Denton 9b87fbc3e5
Import `core::ffi::c_void` in more places 2024-07-24 08:27:22 +00:00
bors 08a9ca7c18 Auto merge of #128127 - tmandry:you-wouldnt-bump-a-fuchsia, r=Kobzol
Bump Fuchsia

This includes changes to unblock merging #126024.

try-job: x86_64-fuchsia
2024-07-24 07:12:24 +00:00
bors f4831e6317 Auto merge of #128128 - matthiaskrgr:rollup-jz6w0ck, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #125962 (Update tracking issue for `const_binary_heap_new_in`)
 - #126770 (Add elem_offset and related methods)
 - #127481 (Remove generic lifetime parameter of trait `Pattern`)
 - #128043 (Docs for core::primitive: mention that "core" can be shadowed, too, so we should write "::core")
 - #128092 (Remove wrapper functions from c.rs)
 - #128100 (Allow to pass a full path for `run-make` tests)
 - #128106 (Fix return type of FileAttr methods on AIX target)
 - #128108 (ensure std step before preparing sysroot)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-24 04:48:02 +00:00
B I Mohammed Abbas 0ea5694c7c Add chroot unsupported implementation for VxWorks 2024-07-24 09:59:04 +05:30
Tyler Mandry 2fd41dfff9 Bump Fuchsia
This includes changes to unblock merging #126024.
2024-07-23 20:30:24 -07:00
Matthias Krüger 1fe9726c95
Rollup merge of #128108 - onur-ozkan:ensure-std-for-precompiled-rustc, r=Kobzol
ensure std step before preparing sysroot

When using download-rustc, any stage other than 0 or 1 (e.g., cargo +stage2 build/doc) will fail to find std while compiling on simple rust sources. Ensuring the std step fixes this issue.

r? Kobzol
2024-07-24 05:05:37 +02:00
Matthias Krüger 888422880c
Rollup merge of #128106 - hallfox:patch-1, r=ChrisDenton
Fix return type of FileAttr methods on AIX target

At some point it seems `SystemTime::new` changed from returning `SystemTime` to `io::Result<SystemTime>`. This seems to have been addressed on other platforms, but was never changed for AIX.

This was caught by running
```
python3 x.py build --host x86_64-unknown-linux-gnu --target powerpc64-ibm-aix
```
2024-07-24 05:05:36 +02:00
Matthias Krüger 20e86c9f2d
Rollup merge of #128100 - GuillaumeGomez:run-make-path, r=Kobzol,jieyouxu
Allow to pass a full path for `run-make` tests

It's common (at least for me) to pass a full path to a `run-make` test (including the `rmake.rs` file) and to see that it isn't found, which is a bit frustrating.

With these changes, we can now optionally pass the `rmake.rs` (or even `Makefile`) at the end of the path.

cc ```@jieyouxu```
r? ```@Kobzol```
2024-07-24 05:05:35 +02:00
Matthias Krüger ee77dda778
Rollup merge of #128092 - ChrisDenton:wrappers, r=workingjubilee
Remove wrapper functions from c.rs

I'd like for the windows `c.rs` just to contain the basic platform definitions and not anything higher level unless absolutely necessary. So this removes some wrapper functions that weren't really necessary in any case. The functions are only used in a few places which themselves are relatively thin wrappers. The "interesting" bit is that we had an `AlertableIoFn` that abstracted over `ReadFileEx` and `WriteFileEx`. I've replaced this with a closure.

Also I removed an `#[allow(unsafe_op_in_unsafe_fn)]` while I was moving things around.
2024-07-24 05:05:34 +02:00