Commit Graph

254086 Commits

Author SHA1 Message Date
Matthias Krüger
a7f4a2edc6
Rollup merge of #124649 - Meziu:master, r=ChrisDenton
Fix HorizonOS build broken by #124210

HorizonOS (for the Tier-3 target `armv6k-nintendo-3ds`) does not support `dirfd()`, as many other similar targets.
2024-05-03 15:26:11 +02:00
Matthias Krüger
82030f2dd4
Rollup merge of #124613 - GuillaumeGomez:fmt-run-make, r=onur-ozkan
Allow fmt to run on rmake.rs test files

As discussed with `@jieyouxu,` `rmake.rs` from the `run-make` testsuite would benefit from being formatted as well.

Only thing needed to be done for it to work: allow support for `!` in our `rustfmt.toml` file parsing.

r? `@onur-ozkan`
2024-05-03 15:26:11 +02:00
Matthias Krüger
c27d3d5d2a
Rollup merge of #124612 - Urgau:run-make-stdin, r=jieyouxu
Add support for inputing via stdin with run-make-support

This PR adds the facility to set a input bytes that will be passed via the standard input.

This is useful for testing `rustc -` (and soon `rustdoc -`).

In #124611 took the approach of having a dedicated `run` method but it is not very convenient to use and would necessitate many functions, one for success, one for fail, ...

Instead this PR takes a different approach and allows setting the input bytes as if it were a parameter and when calling the (now custom) `output` function, we write the input bytes into stdin. I think this gives us maximum flexibility in the implementation and a simple interface for users.

To test this new logic I ported `tests/run-make/stdin-non-utf8/` to an `rmake.rs` one.

r? `@jieyouxu`
2024-05-03 15:26:10 +02:00
Matthias Krüger
08d9992812
Rollup merge of #124588 - compiler-errors:ocx, r=lcnr
Use `ObligationCtxt` in favor of `TraitEngine` in many more places

r? lcnr
2024-05-03 15:26:10 +02:00
Matthias Krüger
eaca729e0b
Rollup merge of #124492 - Strophox:adjust-allocbytes, r=RalfJung
Generalize `adjust_from_tcx` for `Allocation`

Previously, `adjust_from_tcx` would take an `Allocation` and "adjust allocation from the ones in `tcx` to a custom Machine instance [...]".
This PR generalizes this so the Machine instance can also determine the `Bytes` type of the output `Allocation`.

r? `@RalfJung`
2024-05-03 15:26:09 +02:00
Matthias Krüger
819a5f0546
Rollup merge of #124461 - onur-ozkan:followup-123546, r=pietroalbini
handle the targets that are missing in stage0

During sanity checks, we search for target names to determine if they exist in the compiler's built-in target list (`rustc --print target-list`). While a target name may be present in the stage2 compiler, it might not yet be included in stage0. This PR handles that difference.

Follow-up of https://github.com/rust-lang/rust/pull/123546
2024-05-03 15:26:08 +02:00
Strophox
38181cba79 remove trait bounds on AllocBytes 2024-05-03 15:00:37 +02:00
Ralf Jung
27353d4ccc release notes 1.78: add link to interior-mut breaking change 2024-05-03 14:56:05 +02:00
Strophox
235770c851 Cow::from(&*...) changed to Cow::Owned(Vec::from(...)) 2024-05-03 13:47:16 +02:00
Strophox
47e2cc2ea1 generalize adjust_from_tcx 2024-05-03 13:47:16 +02:00
bors
561b5dea1e Auto merge of #124646 - matthiaskrgr:rollup-crlsvg5, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #123480 (deref patterns: impl `DerefPure` for more std types)
 - #124412 (io safety: update Unix explanation to use `Arc`)
 - #124441 (String.truncate comment microfix (greater or equal))
 - #124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS)
 - #124604 (library/std: Remove unused `gimli-symbolize` feature)
 - #124607 (`rustc_expand` cleanups)
 - #124609 (variable-precision float operations can differ depending on optimization levels)
 - #124610 (Tweak `consts_may_unify`)
 - #124626 (const_eval_select: add tracking issue)
 - #124637 (AST pretty: Use `builtin_syntax` for type ascription)

Failed merges:

 - #124638 (Move some tests from `rustc_expand` to `rustc_parse`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-03 11:17:51 +00:00
Oli Scherer
821d23b329 Ensure miri only uses fallback bodies that have manually been vetted to preserve all UB that the native intrinsic would have 2024-05-03 09:16:57 +00:00
Guillaume Gomez
8f47f9773d Allow fmt to run on rmake.rs test files 2024-05-03 11:05:58 +02:00
Guillaume Gomez
3d1062c1a4 Allow to negate ignored files 2024-05-03 11:04:05 +02:00
Oli Scherer
351658ae66 Let miri and const eval execute intrinsics' fallback bodies 2024-05-03 09:01:12 +00:00
Andrea Ciliberti
bdf1eae360 Horizon OS: dirfd unavailable 2024-05-03 10:09:28 +02:00
Urgau
2c4214e0a0 run-make: port stdin-rustc to Rust-based rmake.rs 2024-05-03 08:09:57 +02:00
Nicholas Nethercote
a503893567 Fix Cargo.toml whitespace. 2024-05-03 16:03:17 +10:00
Nicholas Nethercote
a74a272a5b Use parse renaming of rustc_parse_format.
This is a case where `rustc_parse_format` is renamed as `parse` but a
couple of places don't take advantage.
2024-05-03 16:03:15 +10:00
Nicholas Nethercote
1ad91bb1eb Remove some low-value use renamings.
There are a few common abbreviations like `use rustc_ast as ast` and
`use rust_hir as hir` for names that are used a lot. But there are also
some cases where a crate is renamed just once in the whole codebase, and
that ends up making things harder to read rather than easier. This
commit removes them.
2024-05-03 16:03:12 +10:00
Nicholas Nethercote
9b3ef5404c Remove some unneeded Cargo.toml dependencies.
I found these with a hacky shell script.
2024-05-03 15:33:52 +10:00
Matthias Krüger
e6c82d9b59
Rollup merge of #124637 - fmease:ast-pretty-ty-asc-builtin-syn, r=compiler-errors
AST pretty: Use `builtin_syntax` for type ascription

Follow-up to #122806.
CC #124619.
2024-05-03 06:04:24 +02:00
Matthias Krüger
e2a53441b9
Rollup merge of #124626 - RalfJung:const_eval_select, r=joboet
const_eval_select: add tracking issue
2024-05-03 06:04:23 +02:00
Matthias Krüger
a9edd38d18
Rollup merge of #124610 - nnethercote:typenum, r=lcnr
Tweak `consts_may_unify`

r? ````@lcnr````
2024-05-03 06:04:22 +02:00
Matthias Krüger
c412751d19
Rollup merge of #124609 - RalfJung:float-precision, r=cuviper
variable-precision float operations can differ depending on optimization levels

Follow-up to https://github.com/rust-lang/rust/pull/121793 and https://github.com/rust-lang/rust/pull/118217 that accounts for optimizations changing the precision of these functions.

Fixes https://github.com/rust-lang/rust/issues/109118
Fixes https://github.com/rust-lang/rust/issues/71355
2024-05-03 06:04:22 +02:00
Matthias Krüger
ad0be151af
Rollup merge of #124607 - nnethercote:rustc_expand-cleanups, r=compiler-errors
`rustc_expand` cleanups

Some cleanups I made while looking through this code. Nothing that requires any real domain-specific knowledge about this crate.

r? ````@michaelwoerister````
2024-05-03 06:04:21 +02:00
Matthias Krüger
bd6276c95e
Rollup merge of #124604 - Enselic:std-gimli-symbolize, r=workingjubilee
library/std: Remove unused `gimli-symbolize` feature

library/backtrace also declares a feature called `gimli-symbolize` which appear used, but the feature in std with the same name is unused, so remove it.
2024-05-03 06:04:21 +02:00
Matthias Krüger
30efce95cb
Rollup merge of #124594 - jieyouxu:rmake-cc, r=fmease
run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS

In #123149 when trying to add a command wrapper for `cc`, I didn't preserve the behavior of tools.mk completely: tools.mk had

```makefile
# Extra flags needed to compile a working executable with the standard library
ifdef IS_WINDOWS
ifdef IS_MSVC
	#EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib bcrypt.lib ntdll.lib synchronization.lib
else
	#EXTRACFLAGS := -lws2_32 -luserenv -lbcrypt -lntdll -lsynchronization
	EXTRACXXFLAGS := -lstdc++
	#EXTRARSCXXFLAGS := -l static:-bundle=stdc++
endif
else
ifeq ($(UNAME),Darwin)
	#EXTRACFLAGS := -lresolv
	EXTRACXXFLAGS := -lc++
	#EXTRARSCXXFLAGS := -lc++
else
ifeq ($(UNAME),FreeBSD)
	#EXTRACFLAGS := -lm -lpthread -lgcc_s
else
ifeq ($(UNAME),SunOS)
	#EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv
else
ifeq ($(UNAME),OpenBSD)
	#EXTRACFLAGS := -lm -lpthread -lc++abi
	#RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))"
else
	#EXTRACFLAGS := -lm -lrt -ldl -lpthread
	EXTRACXXFLAGS := -lstdc++
	#EXTRARSCXXFLAGS := -lstdc++
endif
endif
endif
endif
endif
```

Note that for {`FreeBSD`, `SunOs`, `OpenBSD`} the `-lstdc++` flag is *not* passed, so `EXTRACXXFLAGS` for those platforms should be an empty `vec![]`.

r? ghost (testing this with PR CI)
2024-05-03 06:04:20 +02:00
Matthias Krüger
d7a8936b78
Rollup merge of #124441 - bravequickcleverfibreyarn:string.rs, r=Amanieu
String.truncate comment microfix (greater or equal)

String.truncate calls Vec.truncate, in turn, and that states "is greater or equal to". Beside common sense.
2024-05-03 06:04:20 +02:00
Matthias Krüger
9ab5cfd91e
Rollup merge of #124412 - RalfJung:io-safety, r=Amanieu
io safety: update Unix explanation to use `Arc`

Fixes https://github.com/rust-lang/rust/issues/124384

Cc ```@jsgf```
2024-05-03 06:04:19 +02:00
Matthias Krüger
e17a222a0a
Rollup merge of #123480 - Nadrieril:impl-all-derefpures, r=compiler-errors
deref patterns: impl `DerefPure` for more std types

Context: [deref patterns](https://github.com/rust-lang/rust/issues/87121). The requirements of `DerefPure` aren't precise yet, but these types unambiguously satisfy them.

Interestingly, a hypothetical `impl DerefMut for Cow` that does a `Clone` would *not* be eligible for `DerefPure` if we allow mixing deref patterns with normal patterns. If the following is exhaustive then the `DerefMut` would cause UB:
```rust
match &mut Cow::Borrowed(&()) {
    Cow::Owned(_) => ..., // Doesn't match
    deref!(_x) if false => ..., // Causes the variant to switch to `Owned`
    Cow::Borrowed(_) => ..., // Doesn't match
    // We reach unreachable
}
```
2024-05-03 06:04:19 +02:00
Michael Goulet
92861517aa Take ocx by move for pending obligations 2024-05-02 22:03:01 -04:00
Michael Goulet
d9eb5232b6 Use ObligationCtxt in favor of TraitEngine in many places 2024-05-02 22:03:01 -04:00
Michael Goulet
34e91ece90 Higher ranked goal source, do overflow handling less badly 2024-05-02 21:56:14 -04:00
Michael Goulet
3e03b1b190 Use a proof tree visitor to refine the Obligation for error reporting 2024-05-02 21:56:14 -04:00
Michael Goulet
382d0f73ad Record more kinds of things as impl where bounds 2024-05-02 21:56:14 -04:00
Michael Goulet
6e3808e274 Store goal source in InspectGoal 2024-05-02 21:56:14 -04:00
Michael Goulet
837bde11a2 Record certainty before evaluating nesteds, so we make candidates 2024-05-02 21:56:14 -04:00
León Orell Valerian Liehr
3a3df3e638
AST pretty: Use builtin_syntax for type ascription 2024-05-03 01:10:22 +02:00
Nicholas Nethercote
3a3a15d753 Refactor Frame.
It is currently an enum and the `tts` and `idx` fields are repeated
across the two variants.

This commit splits it into a struct `Frame` and an enum `FrameKind`, to
factor out the duplication. The commit also renames `Frame::new` as
`Frame::new_delimited` and adds `Frame::new_sequence`. I.e. both
variants now have a constructor.
2024-05-03 09:06:26 +10:00
Nicholas Nethercote
5ac017e772 Type annotate repeats.
Because the type is not obvious, and this clarifies things.
2024-05-03 09:06:26 +10:00
Nicholas Nethercote
ae7e32880a Introduce Invocation::span_mut.
Alongside the existing `Invocation::span`.
2024-05-03 09:06:26 +10:00
Nicholas Nethercote
1c15b6ae9c Replace a hard-to-read line.
Too clever by half, IMO.
2024-05-03 09:06:26 +10:00
Nicholas Nethercote
3b6978196d Tweak fully_expand_fragment loop.
Control flow never gets past the end of the `ExpandResult::Retry` match
arm, due to the `span_bug` and the `continue`. Therefore, the code after
the match can only be reached from the `ExpandResult::Ready` arm.

This commit moves that code after the match into the
`ExpandResult::Ready` arm, avoiding the need for the `continue` in the
`ExpandResult::Retry` arm.
2024-05-03 09:06:26 +10:00
Nicholas Nethercote
79c4d0202f Remove unnecessary pubs. 2024-05-03 09:06:26 +10:00
Nicholas Nethercote
c9c964fc37 Fix some comment formatting. 2024-05-03 09:06:26 +10:00
Nicholas Nethercote
d7f5319b6d Inline and remove three DummyResult methods.
They each have a single call site.
2024-05-03 09:06:26 +10:00
Nicholas Nethercote
e809df6ed4 Remove unnecessary re-export of MacroKind. 2024-05-03 09:06:25 +10:00
Nicholas Nethercote
189a8a6925 De-pub some rustc_expand modules. 2024-05-03 09:06:25 +10:00
Nicholas Nethercote
3f055893b4 Remove unused ExpCtxt methods. 2024-05-03 09:06:25 +10:00