Commit Graph

252543 Commits

Author SHA1 Message Date
bors
0d8b3346a3 Auto merge of #123945 - GuillaumeGomez:rollup-14x3enh, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #120900 (std: use `stream_position` where applicable)
 - #123373 (skip Codegen{GCC,Cranelift} when using CI rustc)
 - #123618 (Discard overflow obligations in `impl_may_apply`)
 - #123905 (rustdoc: check redundant explicit links with correct itemid)
 - #123915 (improve documentation slightly regarding some pointer methods)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-14 21:47:39 +00:00
Guillaume Gomez
32be7b7129
Rollup merge of #123915 - shenawy29:patch-1, r=Nilstrieb
improve documentation slightly regarding some pointer methods
2024-04-14 23:24:34 +02:00
Guillaume Gomez
4d32bc3801
Rollup merge of #123905 - notriddle:notriddle/redundant-explicit-link-hunks, r=GuillaumeGomez
rustdoc: check redundant explicit links with correct itemid

Fixes #123677 (a regression caused by #120702)
2024-04-14 23:24:34 +02:00
Guillaume Gomez
86b791a272
Rollup merge of #123618 - compiler-errors:overflow-ambig, r=spastorino
Discard overflow obligations in `impl_may_apply`

Hacky fix for #123493. Throws away obligations that are overflowing in `impl_may_apply` when we recompute if an impl applies, since those will lead to fatal overflow if processed during fulfillment.

Something about #114811 (I think it's the predicate reordering) caused us to evaluate predicates differently in error reporting leading to fatal overflow, though I believe the underlying overflow is possible to hit since this code was rewritten to use fulfillment.

Fixes #123493
2024-04-14 23:24:33 +02:00
Guillaume Gomez
f3a68fb718
Rollup merge of #123373 - onur-ozkan:skip-codegen, r=Mark-Simulacrum
skip Codegen{GCC,Cranelift} when using CI rustc

CI rustc uses the default codegen backend, therefore we can't run `CodegenGCC` and `CodegenCranelift` tests when using it.

cc `@bjorn3` (to make sure I am not doing anything wrong)

Fixes #123331
2024-04-14 23:24:33 +02:00
Guillaume Gomez
fa483a4829
Rollup merge of #120900 - marcospb19:std-use-seek-stream-position, r=joshtriplett
std: use `stream_position` where applicable

by replacing `seek(SeekFrom::Current(0))` calls
2024-04-14 23:24:32 +02:00
Jeremy Fitzhardinge
8880b702fe Add documentation for unused-externs(-silent) 2024-04-14 14:20:58 -07:00
Jeremy Fitzhardinge
fdcb8a9fea Stabilize --json unused-externs(-silent)
Implement https://github.com/rust-lang/compiler-team/issues/674
2024-04-14 14:20:55 -07:00
bors
29b120740b Auto merge of #123719 - RalfJung:compiler_builtins, r=Mark-Simulacrum
update compiler_builtins to 0.1.109

This pulls in https://github.com/rust-lang/compiler-builtins/pull/583 so we should make sure that does not come with any perf surprises.

Cc `@Amanieu`
2024-04-14 18:42:50 +00:00
Ralf Jung
5934aaaa97 Miri: run .CRT$XLB linker section on thread-end 2024-04-14 20:09:05 +02:00
Josh Stone
2970ae5a6b
Fix ENV quotes in aarch64-gnu/Dockerfile
Co-authored-by: Eric Huss <eric@huss.org>
2024-04-14 10:42:59 -07:00
bjorn3
3305e71095 Run static initializers 2024-04-14 18:19:52 +02:00
Ralf Jung
80dc3d14c9 move the LargeAssignments lint logic into its own file 2024-04-14 18:09:44 +02:00
Maybe Waffle
e8d2221e3b Make depth_first_search into a standalone function
Does not necessarily change much, but we never overwrite it, so I see no reason
for it to be in the `Successors` trait. (+we already have a similar `is_cyclic`)
2024-04-14 16:03:08 +00:00
Maybe Waffle
3124fa9310 Document ControlFlowGraph 2024-04-14 15:53:38 +00:00
Maybe Waffle
f5144938bd Rename WithNumEdges => NumEdges and WithStartNode => StartNode 2024-04-14 15:51:29 +00:00
Maybe Waffle
0d5fc9bf58 Merge {With,Graph}{Successors,Predecessors} into {Successors,Predecessors}
Now with GAT!
2024-04-14 15:48:53 +00:00
Maybe Waffle
398da593a5 Merge WithNumNodes into DirectedGraph 2024-04-14 15:46:40 +00:00
Michael Goulet
b09c177743 Don't leak unnameable types in -> _ recover 2024-04-14 11:43:05 -04:00
Tobias Bucher
2325b81d04 statx probe: ENOSYS might come from a faulty FUSE driver
Do the availability check regardless of the error returned from `statx`.

CC https://github.com/rust-lang/rust/pull/122079#discussion_r1564761281
2024-04-14 17:04:41 +02:00
Michael Goulet
325b24d763 Fix 1-tuple value suggestion 2024-04-14 09:42:53 -04:00
Michael Goulet
4af94cfa05 Suggest value on bare return 2024-04-14 09:42:53 -04:00
Michael Goulet
e4c71f1fd8 Fix value suggestion for array in generic context 2024-04-14 09:42:53 -04:00
Michael Goulet
d6ac50e547 Consolidate two copies of ty_kind_suggestion 2024-04-14 09:42:53 -04:00
bors
a8a88fe524 Auto merge of #122268 - ChrisDenton:no-libc, r=Mark-Simulacrum
Link MSVC default lib in core

## The Problem

On Windows MSVC, Rust invokes the linker directly. This means only the objects and libraries Rust explicitly passes to the linker are used. In short, this is equivalent to passing `-nodefaultlibs`, `-nostartfiles`, etc for gnu compilers.

To compensate for this [the libc crate links to the necessary libraries](a0f5b4b213/src/windows/mod.rs (L258-L261)). The libc crate is then linked from std, thus when you use std you get the defaults back.or integrate with C/C++.

However, this has a few problems:

- For `no_std`, users are left to manually pass the default lib to the linker
- Whereas `std` has the opposite problem, using [`/nodefaultlib`](https://learn.microsoft.com/en-us/cpp/build/reference/nodefaultlib-ignore-libraries?view=msvc-170) doesn't work as expected because Rust treats them as normal libs. This is a particular problem when you want to use e.g. the debug CRT libraries in their place or integrate with C/C++..

## The solution

This PR fixes this in two ways:

- moves linking the default lib into `core`
- passes the lib to the linker using [`/defaultlib`](https://learn.microsoft.com/en-us/cpp/build/reference/defaultlib-specify-default-library?view=msvc-170). This allows users to override it in the normal way (i.e. with [`/nodefaultlib`](https://learn.microsoft.com/en-us/cpp/build/reference/nodefaultlib-ignore-libraries?view=msvc-170)).

This is more or less equivalent to what the MSVC C compiler does. You can see what this looks like in my second commit, which I'll reproduce here for convenience:

```rust
// In library/core
#[cfg(all(windows, target_env = "msvc"))]
#[link(
    name = "/defaultlib:msvcrt",
    modifiers = "+verbatim",
    cfg(not(target_feature = "crt-static"))
)]
#[link(name = "/defaultlib:libcmt", modifiers = "+verbatim", cfg(target_feature = "crt-static"))]
extern "C" {}
```

## Alternatives

- Add the above to `unwind` and `std` but not `core`
- The status quo
- Some other kind of compiler magic maybe

This bares some discussion so I've t-libs nominated it.
2024-04-14 13:28:21 +00:00
Tobias Decking
e5cf30cd63
Update v0.rs 2024-04-14 15:01:04 +02:00
Tobias Decking
be7fb2ed55
Update encode.rs 2024-04-14 14:56:41 +02:00
Ralf Jung
ec3ac1dcd6 builtin-derive: tag → discriminant 2024-04-14 11:34:15 +02:00
Matthias Krüger
37df49059d update README and add COMPILETEST_VERBOSE_CRASHES env var which when set print stdout, stderr and exit code of "crashes" tests, useful for debugging or adding new tests 2024-04-14 11:30:29 +02:00
Matthias Krüger
6d9175f98e crashes: fix ice detection which did not trigger if code compiled without error by accident 2024-04-14 11:21:58 +02:00
Matthias Krüger
7d826ae43e tests/crashes: add ICEs from matthiaskrgr/glacier2 2024-04-14 11:21:51 +02:00
Matthias Krüger
98dd566033 add .rs crashes from https://github.com/rust-lang/glacier 2024-04-14 11:18:23 +02:00
Matthias Krüger
a5932b1507 compiletest: switch crash detection logic for run_crash_test around
previously we would explicitly look for exit code 101 and call it a crash,
however in case of stack overflows for example, exit code could differ due to the
process being killed by a signal which is not easy to detect on none-unix.

So now we reject everything that exits with 0 (no error) or 1 (compiler failed to compile code)
and "accept" everyhing else as an internal compiler error.
2024-04-14 11:18:23 +02:00
Matthias Krüger
dd1e35f9c0 run_crash_test(): better error message when we get a none-ice 2024-04-14 11:18:23 +02:00
Matthias Krüger
dde3178d58 compiletest: crashes: turn off backtraces for faster tests 2024-04-14 11:17:12 +02:00
Matthias Krüger
7048ce7e8f tidy: add tidy check agains \.rs files inside tests/crashes that are missing "//@ known-bug: " 2024-04-14 11:16:26 +02:00
Matthias Krüger
e09244fab2 add ignore-mode-crashes to the know list of compiletest directive names 2024-04-14 11:16:26 +02:00
Matthias Krüger
d6e70df1a2 crashes: add another test showing that everything works fine when we need compile-flags to repro an ice and add README 2024-04-14 11:16:15 +02:00
Matthias Krüger
7b05360a1e bootstrap/compiletest: implement "crashes" tests that fail if no ice is reproduced 2024-04-14 11:14:45 +02:00
Matthias Krüger
65ca71815a add initial ice as test 2024-04-14 11:04:27 +02:00
bors
78bc0a5656 Auto merge of #123913 - matthiaskrgr:rollup-w8stnwl, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #123651 (Thread local updates for idiomatic examples)
 - #123699 (run-make-support: tidy up support library)
 - #123779 (OpenBSD fix long socket addresses)
 - #123875 (Doc: replace x with y for hexa-decimal fmt)
 - #123879 (Add missing `unsafe` to some internal `std` functions)
 - #123889 (reduce tidy overheads in run-make checks)
 - #123898 (Generic associated consts: Check regions earlier when comparing impl with trait item def)
 - #123902 (compiletest: Update rustfix to 0.8.1)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-14 09:02:22 +00:00
Mohamed El-Shenawy
5b8864ab80
improve documentation slightly regarding some pointer methods 2024-04-14 09:56:33 +02:00
Chris Denton
87e1dd0dfd
Move msvc libs to core 2024-04-14 07:11:53 +00:00
Chris Denton
b1f1039d8b
Replace libc::c_int with core::ffi::c_int
And remove the libc crate when it isn't needed
2024-04-14 07:11:51 +00:00
Matthias Krüger
ab65c68585
Rollup merge of #123902 - ehuss:update-rustfix2, r=Mark-Simulacrum
compiletest: Update rustfix to 0.8.1

This updates the version of rustfix used in compiletest to be closer to what cargo is using. This is to help ensure `cargo fix` and compiletest are aligned. There are some unpublished changes to `rustfix`, which will update in a future PR when those are published.

Will plan to update ui_test in the near future to avoid the duplicate.
2024-04-14 09:02:00 +02:00
Matthias Krüger
20656d9202
Rollup merge of #123898 - fmease:gci-cmp-impl-item-lt-params, r=compiler-errors
Generic associated consts: Check regions earlier when comparing impl with trait item def

Fixes #123836.

r? compiler-errors or compiler
2024-04-14 09:01:59 +02:00
Matthias Krüger
d1782dba49
Rollup merge of #123889 - onur-ozkan:improve-tidy, r=Mark-Simulacrum
reduce tidy overheads in run-make checks

This change makes tidy to handle run-make checks with a single iteration, avoiding the need for multiple iterations and copying.
2024-04-14 09:01:59 +02:00
Matthias Krüger
2ba0c627de
Rollup merge of #123879 - beetrees:missing-unsafe, r=Mark-Simulacrum
Add missing `unsafe` to some internal `std` functions

Adds `unsafe` to a few internal functions that have safety requirements but were previously not marked as `unsafe`. Specifically:

- `std::sys::pal::unix:🧵:min_stack_size` needs to be `unsafe` as `__pthread_get_minstack` might dereference the passed pointer. All callers currently pass a valid initialised `libc::pthread_attr_t`.
- `std:🧵:Thread::new` (and `new_inner`) need to be `unsafe` as it requires the passed thread name to be valid UTF-8, otherwise `Thread::name` will trigger undefined behaviour. I've taken the opportunity to split out the unnamed thread case into a separate `new_unnamed` function to make the safety requirement clearer. All callers meet the safety requirement now that #123505 has been merged.
2024-04-14 09:01:58 +02:00
Matthias Krüger
2bec57d4a9
Rollup merge of #123875 - Ghamza-Jd:master, r=joboet
Doc: replace x with y for hexa-decimal fmt

I found it a bit unintuitive to know which is variable and which is the format string in `format!("{x:x}")`, so I switched it to `y`.
2024-04-14 09:01:58 +02:00
Matthias Krüger
0638780570
Rollup merge of #123779 - semarie:notgull-openbsd-socket, r=Mark-Simulacrum
OpenBSD fix long socket addresses

Original diff from ``@notgull`` in #118349, small changes from me.

on OpenBSD, getsockname(2) returns the actual size of the socket address, and  not the len of the content. Figure out the length for ourselves. see https://marc.info/?l=openbsd-bugs&m=170105481926736&w=2

Fixes #116523
2024-04-14 09:01:57 +02:00