Commit Graph

254005 Commits

Author SHA1 Message Date
Matthias Krüger
bd305e10c2
Rollup merge of #124510 - linyihai:raw-ident-in-typo-suggestion, r=fmease
Add raw identifier in a typo suggestion

Fixes #68962
2024-05-03 20:33:45 +02:00
Matthias Krüger
8e3f61b9f9
Rollup merge of #124059 - RalfJung:default_alloc_error_hook, r=workingjubilee
default_alloc_error_hook: explain difference to default __rdl_oom in alloc

Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.
2024-05-03 20:33:45 +02:00
Matthias Krüger
4b913a2330
Rollup merge of #123815 - trueb2:patch-1, r=workingjubilee
Fix cannot usage in time.rs

Fix a small grammar error in usage of cannot in time.rs errors
2024-05-03 20:33:44 +02:00
Matthias Krüger
a296693376
Rollup merge of #122492 - GrigorenkoPV:ptr_as_ref_unchecked, r=workingjubilee
Implement ptr_as_ref_unchecked

Implementation of #122034.

Prefixed the feature name with `ptr_` for clarity.

Linked const-unstability to #91822, so the post there should probably be updated to mentions the 3 new methods when/if this PR is merged.
2024-05-03 20:33:44 +02:00
Ralf Jung
3f6703bbd8 default_alloc_error_hook: explain difference to default __rdl_oom in alloc 2024-05-03 19:12:33 +02:00
bors
d6d3b342e8 Auto merge of #124660 - matthiaskrgr:rollup-j8bfzfn, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #124461 (handle the targets that are missing in stage0)
 - #124492 (Generalize `adjust_from_tcx` for `Allocation`)
 - #124588 (Use `ObligationCtxt` in favor of `TraitEngine` in many more places)
 - #124612 (Add support for inputing via stdin with run-make-support)
 - #124613 (Allow fmt to run on rmake.rs test files)
 - #124649 (Fix HorizonOS build broken by #124210)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-03 15:37:22 +00:00
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
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
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
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
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
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
Nicholas Nethercote
7c6d36345f Remove an unnecessary #[macro_use]. 2024-05-03 09:06:25 +10:00
Nicholas Nethercote
d817856978 Remove an unnecessary re-export of rustc_span::hygiene. 2024-05-03 09:06:25 +10:00
Nicholas Nethercote
aabb90d254 rustc_expand: clean up attributes.
Sort them, and remove the unused ones (`lint_reasons` and
`proc_macro_span`).
2024-05-03 09:06:23 +10:00
Nicholas Nethercote
3722eb0b8f Tweak consts_may_unify.
`ConstKind::Value` is the only variant where control flow leaves the
first match on `impl_ct.kind()`, so there is no need for a second match
on the same expression later on.
2024-05-03 08:07:48 +10:00
Urgau
0a03b0961a run-make-support: add support for stdin input with rustc/rustdoc 2024-05-02 20:54:22 +02:00
bors
79734f1db8 Auto merge of #124629 - matthiaskrgr:rollup-gttvzrg, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124138 (Ignore LLVM ABI in dlltool tests since those targets don't use dlltool)
 - #124414 (remove extraneous note on `UnableToRunDsymutil` diagnostic)
 - #124579 (Align: add bytes_usize and bits_usize)
 - #124622 (Cleanup: Rid the `rmake` test runners of `extern crate run_make_support;`)
 - #124623 (shallow resolve in orphan check)
 - #124624 (Use `tcx.types.unit` instead of `Ty::new_unit(tcx)`)
 - #124627 (interpret: hide some reexports in rustdoc)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-02 18:24:38 +00:00