Commit Graph

237899 Commits

Author SHA1 Message Date
The 8472
8d8f06b277 avoid excessive initialization when copying to a Vec
It now keeps track of initialized bytes to avoid reinitialization.
It also keeps track of read sizes to avoid initializing more bytes
than the reader needs. This is important when passing a huge vector to a
Read that only has a few bytes to offer and doesn't implement read_buf().
2023-11-04 16:11:01 +01:00
bors
9c20ddd956 Auto merge of #117507 - nnethercote:rustc_span, r=Nilstrieb
`rustc_span` cleanups

Just some things I found while looking over this crate.

r? `@oli-obk`
2023-11-03 14:57:40 +00:00
bors
a026bd49e1 Auto merge of #117538 - matthiaskrgr:rollup-63u77xb, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #117434 (delegate `<Box<E> as Error>::provide` to `<E as Error>::provide`)
 - #117505 (Fix incorrect trait bound restriction suggestion)
 - #117520 (Clippy subtree update)
 - #117523 (oli-obk is on vacation)
 - #117533 (Revert "bootstrap: do not purge docs on CI environment")

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-03 12:45:01 +00:00
Matthias Krüger
c0fa97c3d6
Rollup merge of #117533 - onur-ozkan:revert-117471, r=onur-ozkan
Revert "bootstrap: do not purge docs on CI environment"

This reverts commit 6198e881d3.

ref https://github.com/rust-lang/rust/issues/117430#issuecomment-1791609163, https://github.com/rust-lang/rust/pull/117471#issuecomment-1791937529
2023-11-03 12:44:53 +01:00
Matthias Krüger
7a0df44799
Rollup merge of #117523 - compiler-errors:oli-vacation, r=compiler-errors
oli-obk is on vacation

`@oli-obk` is away and asked me to put him in the vacation list 😸
2023-11-03 12:44:52 +01:00
Matthias Krüger
9028ce3580
Rollup merge of #117520 - flip1995:clippyup, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2023-11-03 12:44:50 +01:00
Matthias Krüger
6cb627b681
Rollup merge of #117505 - estebank:issue-117501, r=TaKO8Ki
Fix incorrect trait bound restriction suggestion

Suggest

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
   |                      +++++++
```

instead of

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait + <T = B>, B>(a: A) -> B {
   |                      +++++++++
```

Fix #117501.
2023-11-03 12:44:50 +01:00
Matthias Krüger
958a6af147
Rollup merge of #117434 - BugenZhao:box-error-provide, r=cuviper
delegate `<Box<E> as Error>::provide` to `<E as Error>::provide`

Fix #117432.
2023-11-03 12:44:49 +01:00
bors
adda05fe3e Auto merge of #117535 - RalfJung:revert-cranelift, r=onur-ozkan
Revert "Auto merge of #117328 - lqd:cranelift-rocket, r=Mark-Simulacrum"

This reverts commit 1dfb6b162b, reversing changes made to bcb5798dd8.

That commit broke generating nightly rustc docs. Revert it until we can figure out how to have both, cranelift and docs.

Fixes https://github.com/rust-lang/rust/issues/117430
2023-11-03 10:41:36 +00:00
bors
49112241e9 Auto merge of #117510 - elichai:patch-3, r=cuviper
Add track_caller to transmute_copy

Currently if `size_of::<Src>() < size_of::<Dst>()` you will see the following error:
```rust
thread 'test' panicked at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/mem/mod.rs:1056:5:
cannot transmute_copy if Dst is larger than Src
```
This fixes it so it will show the invocation location
2023-11-03 08:41:59 +00:00
Ralf Jung
f38849841b Revert "Auto merge of #117328 - lqd:cranelift-rocket, r=Mark-Simulacrum"
This reverts commit 1dfb6b162b, reversing
changes made to bcb5798dd8.

That commit broke generating nightly rustc docs. Revert it until we can figure out how to have both, cranelift and docs.
2023-11-03 08:03:28 +01:00
onur-ozkan
fedfca71ed Revert "bootstrap: do not purge docs on CI environment"
This reverts commit 6198e881d3.
2023-11-03 09:15:26 +03:00
bors
1d6f05fd37 Auto merge of #116439 - compiler-errors:on-unimplemented, r=davidtwco
Pretty print `Fn` traits in `rustc_on_unimplemented`

I don't think that users really ever should need to think about `Fn*` traits' tupled args for a simple trait error.

r? diagnostics
2023-11-03 06:08:03 +00:00
bors
2429818b20 Auto merge of #117508 - nnethercote:symbols-FxIndexSet, r=cuviper
Use `FxIndexSet` in the symbol interner.

It makes the code a little nicer.

r? `@ghost`
2023-11-03 04:07:42 +00:00
bors
6b9d6dedd0 Auto merge of #117313 - GuillaumeGomez:cg_gcc-tests, r=onur-ozkan
Run part of `rustc_codegen_gcc`'s tests in CI

Thanks to #112701 and `@bjorn3,` it made this much easier.

Also cc `@antoyo.`

r? `@bjorn3`
2023-11-03 02:05:06 +00:00
bors
2520ca8566 Auto merge of #117131 - compiler-errors:projection-oops, r=lcnr
Add all RPITITs when augmenting param-env with GAT bounds in `check_type_bounds`

When checking that associated type definitions actually satisfy their associated type bounds in `check_type_bounds`, we construct a "`normalize_param_env`" which adds a projection predicate that allows us to assume that we can project the GAT to the definition we're checking. For example, in:

```rust
type Foo {
  type Bar: Display = i32;
}
```

We would add `<Self as Foo>::Bar = i32` as a projection predicate when checking that `i32: Display` holds.

That `normalize_param_env` was, for some reason, only being used to normalize the predicate before it was registered. This is sketchy, because a nested obligation may require the GAT bound to hold, and also the projection cache is broken and doesn't differentiate projection cache keys that differ by param-envs 😿.

This `normalize_param_env` is also not sufficient when we have nested RPITITs and default trait methods, since we need to be able to assume we can normalize both the RPITIT and all of its child RPITITs to sufficiently prove all of its bounds. This is the cause of #117104, which only starts to fail for RPITITs that are nested 3 and above due to the projection-cache bug above.[^1]

## First fix

Use the `normalize_param_env` everywhere in `check_type_bounds`. This is reflected in a test I've constructed that fixes a GAT-only failure.

## Second fix

For RPITITs, install projection predicates for each RPITIT in the same function in `check_type_bounds`. This fixes #117104.

not sure who to request, so...
r? `@lcnr` hehe feel free to reassign :3

[^1]: The projection cache bug specifically occurs because we try normalizing the `assumed_wf_types` with the non-normalization param-env. This causes us to insert a projection cache entry that keeps the outermost RPITIT rigid, and it trivially satisifes all its own bounds. Super sketchy![^2]

[^2]: I haven't actually gone and fixed the projection cache bug because it's only marginally related, but I could, and it should no longer be triggered here.
2023-11-03 00:02:44 +00:00
Guillaume Gomez
c890dd66b3 Set some environment variables value only if ENABLE_GCC_CODEGEN is set 2023-11-03 00:05:12 +01:00
bors
a2f5f9691b Auto merge of #117134 - lcnr:dropck_outlives-coroutine, r=compiler-errors
dropck_outlives check whether generator witness needs_drop

see https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23116242.3A.20Code.20no.20longer.20compiles.20after.20-Zdrop-tracking-mir.20.E2.80.A6/near/398311627 for an explanation.

Fixes #116242 (or well, the repro by `@jamuraa` in https://github.com/rust-lang/rust/issues/116242#issuecomment-1739802047). I did not add a regression test as it depends on other crates. We do have 1 test going from fail to pass, showing the intended behavior.

r? types
2023-11-02 22:03:38 +00:00
Michael Goulet
c83f642f12 Pretty print Fn traits in rustc_on_unimplemented 2023-11-02 20:57:05 +00:00
Michael Goulet
dd571e472a Add all RPITITs when augmenting param-env with GAT bounds in check_type_bounds 2023-11-02 20:47:10 +00:00
Michael Goulet
bb74d7e97d Use the normalizing param-env always in check_type_bounds 2023-11-02 20:47:05 +00:00
Nicholas Nethercote
94a36d2ce5 Use FxIndexSet in the symbol interner.
It makes the code a little nicer.

As part of this, the interner's `Default` impl is removed and `prefill`
is used in a test instead.
2023-11-03 07:19:41 +11:00
Guillaume Gomez
30a07094a6 Add comment explaining why the ENABLE_GCC_CODEGEN env variable is needed 2023-11-02 21:03:28 +01:00
Guillaume Gomez
2dbe7d8d5b Fix invalid enabling of gcc backend in run.sh 2023-11-02 21:03:27 +01:00
Guillaume Gomez
a141b6975b Rename SKIP_CODEGEN_TESTS into ENABLE_GCC_CODEGEN 2023-11-02 21:03:27 +01:00
Guillaume Gomez
25a96ca0e5 Don't include GCC backend if SKIP_CODEGEN_TESTS is not enabled 2023-11-02 21:03:27 +01:00
Guillaume Gomez
13f7f052d8 Run codegen tests outside if not llvm-15 2023-11-02 21:03:27 +01:00
Guillaume Gomez
260d91bd41 Add FIXME header for two comments in cg_gcc and cg_clif boostrap types 2023-11-02 21:03:27 +01:00
Guillaume Gomez
43290933a4 Remove libc dependency in cg_gcc alloc_system example 2023-11-02 21:03:27 +01:00
Guillaume Gomez
c5ff230b55 Skip codegen tests in llvm-15 CI check 2023-11-02 21:03:27 +01:00
Guillaume Gomez
a1902a81d9 Force mangling version for rustc_codegen_gcc 2023-11-02 21:03:27 +01:00
Guillaume Gomez
4b290d40a5 Only run cg_gcc tests on linux x86_64 2023-11-02 21:03:27 +01:00
Guillaume Gomez
edfd67b598 Pass --sysroot option 2023-11-02 21:03:27 +01:00
Guillaume Gomez
7f6aa4422c Add comment explaning when to uncomment the prepare command code 2023-11-02 21:03:27 +01:00
Guillaume Gomez
05a84760f6 Fix rustc_codegen_gcc lto issue 2023-11-02 21:03:27 +01:00
Guillaume Gomez
3c58feaa08 Fix config.sh script 2023-11-02 21:03:27 +01:00
Guillaume Gomez
ead5dffeec Fix missing error libgccjit in CI 2023-11-02 21:03:27 +01:00
Guillaume Gomez
ded81de066 Fix compilation errors in rustc_codegen_gcc examples 2023-11-02 21:03:27 +01:00
Guillaume Gomez
42bdc873e5 Disable master feature by default when building rustc_codegen_gcc 2023-11-02 21:03:27 +01:00
Guillaume Gomez
c6ace5c564 Run rustc_codegen_gcc tests in the CI 2023-11-02 21:03:27 +01:00
bors
e8418e092a Auto merge of #117471 - onur-ozkan:tmp-fix, r=clubby789
bootstrap: do not purge docs on CI environment

This is a temporary fix for #117430, for more information please read https://github.com/rust-lang/rust/issues/117430#issuecomment-1788160523.

Fixes #117430
2023-11-02 19:53:41 +00:00
onur-ozkan
6198e881d3 bootstrap: do not purge docs on CI environment
Temporary fix for https://github.com/rust-lang/rust/issues/117430

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-02 21:36:43 +03:00
Esteban Küber
9e7345be1f Fix incorrect trait bound restriction suggestion
Suggest

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
   |                      +++++++
```

instead of

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait + <T = B>, B>(a: A) -> B {
   |                      +++++++++
```

Fix #117501.
2023-11-02 18:04:41 +00:00
bors
b20f40dba9 Auto merge of #117521 - GuillaumeGomez:impl-on-foreign-order, r=notriddle
Fix order of implementations in the "implementations on foreign types" section

Fixes #117391.

We forgot to run the `sort_by_cached_key` on this section. This fixes it.

r? `@notriddle`
2023-11-02 17:54:29 +00:00
Michael Goulet
c5895c4caa oli.pause() 2023-11-02 17:23:15 +00:00
lcnr
dda5e32ab0 review + add tests 2023-11-02 18:16:37 +01:00
Guillaume Gomez
2e4a36bb53 Add GUI test to ensure that implementations on foreign types are in the expected order 2023-11-02 18:02:14 +01:00
Guillaume Gomez
aa9d1d87fa Fix order of implementations in the "implementations on foreign types" section 2023-11-02 18:02:14 +01:00
Philipp Krones
02562bfdf8
Update Cargo.lock 2023-11-02 17:50:52 +01:00
Philipp Krones
257147a779
Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyup 2023-11-02 17:35:56 +01:00