Commit Graph

266377 Commits

Author SHA1 Message Date
Michael Goulet
1173204b36 Use style_edition over version 2024-09-22 19:11:28 -04:00
Michael Goulet
624bc65665 Bump stage0 2024-09-22 19:04:19 -04:00
bors
6c6d210089 Auto merge of #130710 - GuillaumeGomez:rollup-mfuha68, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #130658 (Fix docs of compare_bytes)
 - #130670 (delay uncapping the max_read_size in File::read_to_end)
 - #130690 (interpret: remove outdated FIXME)
 - #130692 (make unstable Result::flatten a const fn)
 - #130702 (Add some missing unstable book tracking issue links)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-22 19:41:01 +00:00
Guillaume Gomez
a34e0f5600
Rollup merge of #130702 - clubby789:unstable-book-docs, r=ehuss
Add some missing unstable book tracking issue links
2024-09-22 19:19:16 +02:00
Guillaume Gomez
c43a9ea146
Rollup merge of #130692 - RalfJung:result-flatten, r=Noratrieb
make unstable Result::flatten a const fn

This method is still unstable (tracked at https://github.com/rust-lang/rust/issues/70142), but there's no reason I can see for it not to be const -- after all, `Option::flatten` is const. So let's make the `Result` one `const` as well, under the same feature gate.

Cc https://github.com/rust-lang/rust/issues/70142
2024-09-22 19:19:16 +02:00
Guillaume Gomez
f40efa44ab
Rollup merge of #130690 - RalfJung:interpret-abi-compat-fixme, r=jieyouxu
interpret: remove outdated FIXME

The rule about `repr(C)` types with compatible fields got removed from the ABI compat docs before they landed, so this FIXME here is no longer correct. (So this is basically a follow-up to https://github.com/rust-lang/rust/pull/130185, doing some more cleanup around deciding not to guarantee ABI compatibility for structurally compatible `repr(C)` types.)
2024-09-22 19:19:15 +02:00
Guillaume Gomez
82b4177395
Rollup merge of #130670 - the8472:read-to-end-heuristics, r=ChrisDenton
delay uncapping the max_read_size in File::read_to_end

In https://github.com/rust-lang/rust/issues/130600#issuecomment-2365136985 I realized that we're likely still passing too-large buffers to the OS, at least once at the end.

Previous issues and PRs:
* #110650
* #110655
* #118222

r? ChrisDenton
2024-09-22 19:19:15 +02:00
Guillaume Gomez
cbf23960ea
Rollup merge of #130658 - EqualMa:patch-1, r=scottmcm
Fix docs of compare_bytes

The docs of `compare_bytes`. The return value is positive if <del>`right`</del> `left` is greater
2024-09-22 19:19:14 +02:00
bors
8ed95d1d9e Auto merge of #130709 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-09-22 17:17:11 +00:00
bors
599b3295f5 Auto merge of #3852 - tiif:rwrefactor, r=RalfJung
Refactor fd read/write

This PR passed the responsibility of reading to user supplied buffer and dest place to each implementation of ``FileDescription::read/write/pread/pwrite``.

This is part of #3665.
2024-09-22 14:54:30 +00:00
Ralf Jung
d70fd882ef simplify eventfd handling a bit 2024-09-22 16:50:38 +02:00
Ralf Jung
ed24426824 remove some unnecessary to_owned 2024-09-22 16:50:38 +02:00
Ralf Jung
5dee646aea read, write: move cast-to-usize logic up and deduplicate it 2024-09-22 16:50:37 +02:00
Ralf Jung
fb1193078d further tweak FileDescription comments 2024-09-22 16:50:37 +02:00
tiif
d29be1f90a Pass pointer and len to FileDescription::write and change the type of len in read to usize 2024-09-22 16:50:36 +02:00
tiif
503b6af065 Use &[u8] instead of Vec<u8> and improve docs 2024-09-22 16:50:17 +02:00
clubby789
0510f06ad7 Add some missing tracking issue links 2024-09-22 14:03:48 +00:00
bors
0af7f0f4c4 Auto merge of #130697 - bjoernager:const-char-make-ascii, r=dtolnay
Mark `char::make_ascii_uppercase` and `char::make_ascii_lowercase` as const.

Relevant tracking issue: #130698

The `make_ascii_uppercase` and `make_ascii_lowercase` methods in `char` should be marked "const."

With the stabilisation of [`const_mut_refs`](https://github.com/rust-lang/rust/issues/57349/), this simply requires adding the `const` specifier to the function signatures.
2024-09-22 13:55:07 +00:00
Gabriel Bjørnager Jensen
be9b3b459a Mark 'make_ascii_uppercase' and 'make_ascii_lowercase' in 'char' as const; 2024-09-22 14:26:29 +02:00
bors
8243a8ca93 Auto merge of #3903 - RalfJung:auto-prs, r=RalfJung
try to give the CI job permission to create PRs

See the discussion [here](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/did.20github.20token.20permissions.20change.3F).

`@rust-lang/infra` just a heads-up that we are doing this -- I have no idea if this could cause any issues elsewhere, or if it is important that we limit the permissions here somehow, or so.
2024-09-22 10:53:45 +00:00
Ralf Jung
2859f2bafc try to give the CI job permission to create PRs 2024-09-22 12:51:11 +02:00
bors
4ae36d906f Auto merge of #130689 - RalfJung:rustc_nonnull_optimization_guaranteed, r=jieyouxu
fix rustc_nonnull_optimization_guaranteed docs

As far as I can tell, even back when this was [added](https://github.com/rust-lang/rust/pull/60300) it never *enabled* any optimizations. It just indicates that the FFI compat lint should accept those types for NPO.
2024-09-22 10:18:59 +00:00
Ralf Jung
8103505a4d fix rustc_nonnull_optimization_guaranteed docs 2024-09-22 10:00:24 +02:00
bors
80aa6fa731 Auto merge of #130688 - workingjubilee:rollup-ovre6p7, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #130648 (move enzyme flags from general cargo to rustc-specific cargo)
 - #130650 (Fixup Apple target's description strings)
 - #130664 (Generate line numbers for non-rust code examples as well)
 - #130665 (Prevent Deduplication of `LongRunningWarn`)
 - #130669 (tests: Test that `extern "C" fn` ptrs lint on slices)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-22 07:48:56 +00:00
Ralf Jung
89c3cbafb8 make unstable Result::flatten a const fn 2024-09-22 08:40:25 +02:00
bors
ee20c86282 Auto merge of #3902 - RalfJung:rustup, r=RalfJung
Rustup
2024-09-22 06:31:10 +00:00
Ralf Jung
d877ec2a3e rustfmt: switch over to setting style_edition 2024-09-22 08:29:28 +02:00
Ralf Jung
96cb08d499 Merge from rustc 2024-09-22 08:22:27 +02:00
Ralf Jung
b4c7ce55a7 Preparing for merge from rustc 2024-09-22 08:22:18 +02:00
Ralf Jung
27400ea4ed interpret: remove outdated FIXME 2024-09-22 08:18:30 +02:00
Jubilee
f314db6d6b
Rollup merge of #130669 - workingjubilee:slicing-fnptr-tests-finely, r=compiler-errors
tests: Test that `extern "C" fn` ptrs lint on slices

This seems to have slipped past the `improper_ctypes_definitions` lint at some point. I found similar tests but not one with this exact combination, so test the semi-unique combination.
2024-09-21 22:34:34 -07:00
Jubilee
b0208640c6
Rollup merge of #130665 - veera-sivarajan:fix-118612, r=compiler-errors
Prevent Deduplication of `LongRunningWarn`

Fixes #118612

As mention in the issue, `LongRunningWarn` is meant to be repeated multiple times.

Therefore, this PR stores a unique number in every instance of `LongRunningWarn` so that it's not hashed into the same value and omitted by the deduplication mechanism.
2024-09-21 22:34:34 -07:00
Jubilee
825b22fab2
Rollup merge of #130664 - GuillaumeGomez:generate-line-numbers-on-non-rust, r=notriddle
Generate line numbers for non-rust code examples as well

Currently, the "enable line numbers" setting only generated it for rust code examples. Found this limitation a bit strange so I decided to remove it.

You can test it [here](https://rustdoc.crud.net/imperio/generate-line-number-non-rust/doc/lib2/sub_mod/struct.Foo.html).

r? ``@notriddle``
2024-09-21 22:34:33 -07:00
Jubilee
2875d6f98e
Rollup merge of #130650 - BlackHoleFox:apple-target-desc-consistency, r=jieyouxu
Fixup Apple target's description strings

Noticed this inconsistency in how the Apple target's had their new descriptions written while looking at https://github.com/rust-lang/rust/pull/130614, and figured it was easy enough to fixup shortly. I think prefixing every OS with `Apple` is clearer, especially for less known ones like `visionOS` and `watchOS`; so that's what was done here along with making the architecture names more consistent and then some other small tweaks.

~~r​? `@thomcc~~`

cc `@madsmtm`
2024-09-21 22:34:32 -07:00
Jubilee
959f33ac85
Rollup merge of #130648 - onur-ozkan:enzyme-linking, r=Kobzol
move enzyme flags from general cargo to rustc-specific cargo

Resolves #130637.
2024-09-21 22:34:32 -07:00
bors
1f9a018fa3 Auto merge of #130446 - durin42:llvm-20-fix-CommandLineArgs, r=workingjubilee
rustc_llvm: adapt to flattened CLI args in LLVM

This changed in
llvm/llvm-project@e190d074a0. I decided to stick with more duplication between the ifdef blocks to make the code easier to read for the next two years before we can plausibly drop LLVM 19.

`@rustbot` label: +llvm-main

try-job: x86_64-msvc
2024-09-22 05:26:41 +00:00
bors
6ce376774c Auto merge of #130246 - dianne:issue-97589-fix, r=petrochenkov
rustc_expand: remember module `#[path]`s during expansion

During invocation collection, if a module item parsed from a `#[path]` attribute needed a second pass after parsing, its path wouldn't get added to the file path stack, so cycle detection broke. This checks the `#[path]` in such cases, so that it gets added appropriately. I think it should work identically to the case for external modules that don't need a second pass, but I'm not 100% sure.

Fixes #97589
2024-09-22 02:59:38 +00:00
bors
55043f067d Auto merge of #130337 - BoxyUwU:anon_const_macro_call, r=camelid
Fix anon const def-creation when macros are involved take 2

Fixes #130321

There were two cases that #129137 did not handle correctly:

- Given a const argument `Foo<{ bar!() }>` in which `bar!()` expands to `N`, we would visit the anon const and then visit the `{ bar() }` expression instead of visiting the macro call. This meant that we would build a def for the anon const as `{ bar!() }` is not a trivial const argument as `bar!()` is not a path.
- Given a const argument `Foo<{ bar!() }>` is which `bar!()` expands to `{ qux!() }` in which `qux!()` expands to `N`, it should not be considered a trivial const argument as `{{ N }}` has two pairs of braces.  If we only looked at `qux`'s expansion it would *look* like a trivial const argument even though it is not. We have to track whether we have "unwrapped" a brace already when recursing into the expansions of `bar`/`qux`/any macro

r? `@camelid`
2024-09-22 00:31:03 +00:00
Guillaume Gomez
f451a410e3 Add GUI regression test for non-rust code blocks line numbers 2024-09-22 00:18:44 +02:00
Guillaume Gomez
54efd132ae Generate line numbers for non-rust code examples as well 2024-09-22 00:18:44 +02:00
Guillaume Gomez
7c35266552 Strip last backline from non-rust code examples 2024-09-22 00:18:44 +02:00
bors
764e6aec81 Auto merge of #130674 - compiler-errors:rollup-yu105fl, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #127766 (add `extern "C-cmse-nonsecure-entry" fn` )
 - #129629 (Implement Return Type Notation (RTN)'s path form in where clauses)
 - #130408 (Avoid re-validating UTF-8 in `FromUtf8Error::into_utf8_lossy`)
 - #130651 (Add --enable-profiler to armhf dist)
 - #130653 (ABI compatibility: mention Result guarantee)
 - #130666 (Assert that `explicit_super_predicates_of` and `explicit_item_super_predicates` truly only contains bounds for the type itself)
 - #130667 (compiler: Accept "improper" ctypes in extern "rust-cold" fn)
 - #130673 (Parser: recover from `:::` to `::`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-21 22:09:47 +00:00
Boxy
781ec111b7 Handle macro calls in anon const def creation take 2 2024-09-21 22:17:18 +01:00
Michael Goulet
52f146d363
Rollup merge of #130673 - GrigorenkoPV:path-triple-colon, r=compiler-errors
Parser: recover from `:::` to `::`

Closes #130613
2024-09-21 15:18:59 -04:00
Michael Goulet
a66563ff0e
Rollup merge of #130667 - workingjubilee:she-is-c-c-c-cold, r=compiler-errors
compiler: Accept "improper" ctypes in extern "rust-cold" fn
2024-09-21 15:18:58 -04:00
Michael Goulet
d1b43d09e3
Rollup merge of #130666 - compiler-errors:super-bounds, r=fee1-dead,fmease
Assert that `explicit_super_predicates_of` and `explicit_item_super_predicates` truly only contains bounds for the type itself

We distinguish _implied_ predicates (anything that is implied from elaborating a trait bound) from _super_ predicates, which are are the subset of implied predicates that share the same self type as the trait predicate we're elaborating. This was originally done in #107614, which fixed a large class of ICEs and strange errors where the compiler expected the self type of a trait predicate not to change when elaborating super predicates.

Specifically, super predicates are special for various reasons: they're the valid candidates for trait upcasting, are the only predicates we elaborate when doing closure signature inference, etc. So making sure that we get this list correct and don't accidentally "leak" any other predicates into this list is quite important.

This PR adds some debug assertions that we're in fact not doing so, and it fixes an oversight in the effect desugaring rework.
2024-09-21 15:18:58 -04:00
Michael Goulet
2e43793fd6
Rollup merge of #130653 - RalfJung:result-abi-compat, r=traviscross
ABI compatibility: mention Result guarantee

This has been already documented in https://doc.rust-lang.org/std/result/index.html#representation, but for `Option` we mirrored those docs in the "ABI compatibility" section, so let's do the same here.

Cc ``@workingjubilee`` ``@rust-lang/lang``
2024-09-21 15:18:57 -04:00
Michael Goulet
3640d114fe
Rollup merge of #130651 - qwertynerd97:patch-1, r=Kobzol
Add --enable-profiler to armhf dist

Adds the --enable-profiler flag to the RUST_CONFIGURE_ARGS for armhf distribution for Linux.  This enables running coverage for tests in builds for this target

try-job: dist-armhf-linux
2024-09-21 15:18:57 -04:00
Michael Goulet
493852ccd6
Rollup merge of #130408 - okaneco:into_lossy_refactor, r=Noratrieb
Avoid re-validating UTF-8 in `FromUtf8Error::into_utf8_lossy`

Part of the unstable feature `string_from_utf8_lossy_owned` - #129436

Refactor `FromUtf8Error::into_utf8_lossy` to copy valid UTF-8 bytes into the buffer, avoiding double validation of bytes.
Add tests that mirror the `String::from_utf8_lossy` tests.
2024-09-21 15:18:56 -04:00
Michael Goulet
d72d44d8ed
Rollup merge of #129629 - compiler-errors:rtn-in-path, r=jackh726
Implement Return Type Notation (RTN)'s path form in where clauses

Implement return type notation (RTN) in path position for where clauses. We already had RTN in associated type position ([e.g.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=627a4fb8e2cb334863fbd08ed3722c09)), but per [the RFC](https://rust-lang.github.io/rfcs/3654-return-type-notation.html#where-rtn-can-be-used-for-now):

> As a standalone type, RTN can only be used as the Self type of a where-clause [...]

Specifically, in order to enable code like:

```rust
trait Foo {
    fn bar() -> impl Sized;
}

fn is_send(_: impl Send) {}

fn test<T>()
where
    T: Foo,
    T::bar(..): Send,
{
    is_send(T::bar());
}
```

* In the resolver, when we see a `TyKind::Path` whose final segment is `GenericArgs::ParenthesizedElided` (i.e. `(..)`), resolve that path in the *value* namespace, since we're looking for a method.
* When lowering where clauses in HIR lowering, we first try to intercept an RTN self type via `lower_ty_maybe_return_type_notation`. If we find an RTN type, we lower it manually in a way that respects its higher-ranked-ness (see below) and resolves to the corresponding RPITIT. Anywhere else, we'll emit the same "return type notation not allowed in this position yet" error we do when writing RTN in every other position.
* In `resolve_bound_vars`, we add some special treatment for RTN types in where clauses. Specifically, we need to add new lifetime variables to our binders for the early- and late-bound vars we encounter on the method. This implements the higher-ranked desugaring [laid out in the RFC](https://rust-lang.github.io/rfcs/3654-return-type-notation.html#converting-to-higher-ranked-trait-bounds).

This PR also adds a bunch of tests, mostly negative ones (testing error messages).

In a follow-up PR, I'm going to mark RTN as no longer incomplete, since this PR basically finishes the impl surface that we should initially stabilize, and the RFC was accepted.

cc [RFC 3654](https://github.com/rust-lang/rfcs/pull/3654) and https://github.com/rust-lang/rust/issues/109417
2024-09-21 15:18:56 -04:00