Commit Graph

243428 Commits

Author SHA1 Message Date
Michael Goulet
3799568895 More comments 2024-01-10 16:29:23 +00:00
Michael Goulet
f49b0dcce2 Check reveal and can_define_opaque_ty in try_normalize_ty_recur 2024-01-10 16:21:58 +00:00
Simonas Kazlauskas
837be0de5f bootstrap: exclude link_jobs from check_ci_llvm! checks
This option is largely there to help people to manage the memory usage
on their systems during the LLVM build. The linking phase is as usual
are the heaviest part of the build and if in an unlucky conincidence the
circumstances align to kick off N_CORES links at the same time, not even
hundreds of GiB of memory may suffice. It makes a lot of sense for
developers to set&forget this option unconditionally.

Not to mention, this option does not, in any way, affect the generated
code (at least as far as I know.) It really doesn’t matter what
option the CI build LLVM used here and/or if it matches with the user’s
configuration.

Finally, 0 actual link jobs implied by `download-ci-llvm` is guaranteed
to stay within the limits that are reasonable to set with this option.
2024-01-10 17:06:36 +02:00
Nadrieril
dee657f9f9 Add test case for #119778 2024-01-10 14:50:48 +01:00
Thayne McCombs
1ed855dedf Stabilize mutex_unpoison feature
Closes #96469

@rustbot +T-libs-api
2024-01-10 02:34:34 -07:00
Oli Scherer
0e82aaeb67 Avoid follow up errors 2024-01-10 08:52:44 +00:00
Oli Scherer
972c95a6e2 Turn some free functions into methods 2024-01-10 08:52:44 +00:00
Oli Scherer
ba27e22f67 Use a ty::Error instead of patching up a type after erroring 2024-01-10 08:52:44 +00:00
Nikita Popov
9ff3083b27 Update LLVM submodule 2024-01-10 09:35:29 +01:00
bors
e927184629 Auto merge of #119797 - matthiaskrgr:rollup-nn2lt39, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #106893 (Explain base expression for struct update syntax)
 - #119769 (rustdoc: offset generic args of cross-crate trait object types when cleaning)
 - #119772 (Fix an ICE that occurs after an error has already been reported)
 - #119782 (rint intrinsics: caution against actually trying to check for floating-point exceptions)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-10 07:10:57 +00:00
Matthias Krüger
3fcddf19e7
Rollup merge of #119782 - RalfJung:rint, r=cuviper
rint intrinsics: caution against actually trying to check for floating-point exceptions
2024-01-10 06:28:45 +01:00
Matthias Krüger
4571ef9152
Rollup merge of #119772 - oli-obk:whackamole, r=compiler-errors
Fix an ICE that occurs after an error has already been reported

fixes #117491

cc `@jswrenn`
2024-01-10 06:28:45 +01:00
Matthias Krüger
7c378d0058
Rollup merge of #119769 - fmease:rustdoc-off-by-one-dyn-trait-def-gen-args, r=GuillaumeGomez
rustdoc: offset generic args of cross-crate trait object types when cleaning

Fixes #119529.

This PR contains several refactorings apart from the bug fix.
Best reviewed commit by commit.
r? GuillaumeGomez
2024-01-10 06:28:44 +01:00
Matthias Krüger
33f27d32a9
Rollup merge of #106893 - clubby789:struct-update-help, r=compiler-errors
Explain base expression for struct update syntax

Fixes #106890

`@rustbot` label +A-diagnostics
2024-01-10 06:28:44 +01:00
bors
9273d63f07 Auto merge of #119794 - weihanglo:update-cargo, r=weihanglo
Update cargo

14 commits in 2ce45605d9db521b5fd6c1211ce8de6055fdb24e..3e428a38a34e820a461d2cc082e726d3bda71bcb
2024-01-04 18:04:13 +0000 to 2024-01-09 20:46:36 +0000
- refactor: replace `iter_join` with `itertools::join` (rust-lang/cargo#13275)
- docs(unstable): doc comments for items and fields (rust-lang/cargo#13274)
- crates-io: Set `Content-Type: application/json` only for requests with a body payload (rust-lang/cargo#13264)
- fix: only inherit workspace package table if the new package is a member (rust-lang/cargo#13261)
- feat(cli): add colors to `-Zhelp` console output (rust-lang/cargo#13269)
- chore(deps): update msrv (rust-lang/cargo#13266)
- refactor(toml): Make it more obvious to update package-dependent fields (rust-lang/cargo#13267)
- chore(ci): Fix MSRV:3 updates (rust-lang/cargo#13268)
- chore(ci): Shot-in-the-dark fix for MSRV updating (rust-lang/cargo#13265)
- fix: set OUT_DIR for all units with build scripts (rust-lang/cargo#13204)
- fix(manifest): Provide unused key warnings for lints table (rust-lang/cargo#13262)
- test(manifest): Verify we warn on unused workspace.package fields (rust-lang/cargo#13263)
- docs(changelog): Call out cargo-new lockfile change (rust-lang/cargo#13260)
- chore: Add dependency dashboard (rust-lang/cargo#13255)

r? ghost
2024-01-10 05:12:46 +00:00
Brian Cain
d5c39d0638 Update compiler_builtins to 0.1.105
This provides the builtins for the hexagon architecture.
2024-01-09 20:30:56 -08:00
Weihang Lo
5b4b7b7cf8
Update cargo 2024-01-09 22:32:55 -05:00
bors
e899684254 Auto merge of #12105 - GuillaumeGomez:useless-asf-extension, r=llogiq
Extend `useless_asref` lint on `map(clone)`

If you have code like:

```rust
Some(String::new()).as_ref().map(Clone::clone)
```

the `as_ref` call is unneeded.

Interestingly enough, this lint and `map_clone` are starting to share a same "space" where both lints warn about different things for the same code. Not sure what's the policy about such cases though...

r? `@llogiq`

changelog: Extend `useless_asref` lint on `map(clone)`
2024-01-10 01:13:42 +00:00
Mark Rousskov
1d2005be71 Remove more needless leb128 coding for enum variants
This removes emit_enum_variant and the emit_usize calls that resulted
in. In libcore this eliminates 17% of leb128, taking us from 8964488 to
7383842 leb128's serialized.
2024-01-09 20:08:44 -05:00
Mark Rousskov
5e8f67bbc9 u8 tags for smaller enums
100% of the serialized enums during libcore compilation fit into the
smaller tag, and this eliminates hitting the leb128 code for
coding/decoding when we can statically guarantee that's not required.

30% of all leb128 integers serialized in libcore (12981183 total) come
from the usize's removed here.
2024-01-09 20:08:44 -05:00
Celina G. Val
af3c2c9f6d Fix all_trait* methods to return all trait available
Also provide a mechanism to retrieve traits and implementations for a
given crate.
2024-01-09 15:45:03 -08:00
mj10021
894d1d4a25
change function name in comments 2024-01-09 18:39:53 -05:00
bors
94807670a6 Auto merge of #117449 - oli-obk:query_merge_immobile_game, r=matthewjasper
Avoid silencing relevant follow-up errors

r? `@matthewjasper`

This PR only adds new errors to tests that are already failing and fixes one ICE.

Several tests were changed to not emit new errors. I believe all of them were faulty tests, and not explicitly testing for the code that had new errors.
2024-01-09 22:50:49 +00:00
Kleinmarb
e49442bf98 fix typo 2024-01-09 22:44:32 +01:00
Ralf Jung
fa5bef849e rint intrinsics: caution against actually trying to check for floating-point exceptions 2024-01-09 22:19:25 +01:00
Oli Scherer
0978f6e010 Avoid silencing relevant follow-up errors 2024-01-09 21:08:16 +00:00
bors
190f4c9611 Auto merge of #116846 - krtab:slice_compare_no_memcmp_opt, r=the8472
A more efficient slice comparison implementation for T: !BytewiseEq

(This is a follow up PR on #113654)

This PR changes the implementation for `[T]` slice comparison when `T: !BytewiseEq`. The previous implementation using zip was not optimized properly by the compiler, which didn't leverage the fact that both length were equal. Performance improvements are for example 20% when testing that `[Some(0_u64); 4096].as_slice() == [Some(0_u64); 4096].as_slice()`.
2024-01-09 20:52:34 +00:00
Nicholas Nethercote
700a396520 Add missing DiagnosticBuilder::eager_diagnostic method.
This lets us avoid the use of `DiagnosticBuilder::into_diagnostic` in
miri, when then means that `DiagnosticBuilder::into_diagnostic` can
become private, being now only used by `stash` and `buffer`.
2024-01-10 07:40:44 +11:00
Nicholas Nethercote
beeaee9785 Rename consuming chaining methods on DiagnosticBuilder.
In #119606 I added them and used a `_mv` suffix, but that wasn't great.

A `with_` prefix has three different existing uses.
- Constructors, e.g. `Vec::with_capacity`.
- Wrappers that provide an environment to execute some code, e.g.
  `with_session_globals`.
- Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`.

The third case is exactly what we want, so this commit changes
`DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`.

Thanks to @compiler-errors for the suggestion.
2024-01-10 07:40:00 +11:00
Nicholas Nethercote
ed76b0b882 Rename consuming chaining methods on DiagnosticBuilder.
In #119606 I added them and used a `_mv` suffix, but that wasn't great.

A `with_` prefix has three different existing uses.
- Constructors, e.g. `Vec::with_capacity`.
- Wrappers that provide an environment to execute some code, e.g.
  `with_session_globals`.
- Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`.

The third case is exactly what we want, so this commit changes
`DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`.

Thanks to @compiler-errors for the suggestion.
2024-01-10 07:40:00 +11:00
Nicholas Nethercote
2ea7a37e11 Add DiagCtxt::delayed_bug.
We have `span_delayed_bug` and often pass it a `DUMMY_SP`. This commit
adds `delayed_bug`, which matches pairs like `err`/`span_err` and
`warn`/`span_warn`.
2024-01-10 07:33:07 +11:00
Nicholas Nethercote
3c4f1d85af Rename {create,emit}_warning as {create,emit}_warn.
For consistency with `warn`/`struct_warn`, and also `{create,emit}_err`,
all of which use an abbreviated form.
2024-01-10 07:33:06 +11:00
Nicholas Nethercote
ff40ad4107 Shorten some error invocations.
- `struct_foo` + `emit` -> `foo`
- `create_foo` + `emit` -> `emit_foo`

I have made recent commits in other PRs that have removed some of these
shortcuts for combinations with few uses, e.g.
`struct_span_err_with_code`. But for the remaining combinations that
have high levels of use, we might as well use them wherever possible.
2024-01-10 07:33:06 +11:00
Nicholas Nethercote
4864cb8aef Rename struct_span_err! as struct_span_code_err!.
Because it takes an error code after the span. This avoids the confusing
overlap with the `DiagCtxt::struct_span_err` method, which doesn't take
an error code.
2024-01-10 07:33:04 +11:00
Nicholas Nethercote
99b1b0f85c Fix incorrect comment. 2024-01-10 07:17:55 +11:00
clubby789
f1b8b7d7ae Add error code for missing base expression in struct update syntax 2024-01-09 19:25:54 +00:00
Urgau
15078c25d6 Add explicit none() value variant in check-cfg 2024-01-09 19:03:06 +01:00
bors
ae9d24de80 Auto merge of #119777 - GuillaumeGomez:rollup-mf82vow, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #118241 (Making `User<T>` and `User<[T]>` `Send`)
 - #118645 (chore: Bump compiler_builtins)
 - #118680 (Add support for shell argfiles)
 - #119721 (`~const` trait and projection bounds do not imply their non-const counterparts)
 - #119768 (core: panic: fix broken link)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-09 17:19:52 +00:00
Guillaume Gomez
f7ef9a6f1f Fix dogfood and add code comments 2024-01-09 18:03:55 +01:00
Guillaume Gomez
d61b92f154
Rollup merge of #119768 - ojeda:panic-link, r=Nilstrieb
core: panic: fix broken link
2024-01-09 17:52:22 +01:00
Guillaume Gomez
f4d06256d8
Rollup merge of #119721 - compiler-errors:constness-implication, r=fee1-dead
`~const` trait and projection bounds do not imply their non-const counterparts

This PR removes the hack where we install a non-const trait and projection bound for every `const_trait` and `~const` projection bound we have in the AST. It ends up messing up more things than it fixes, see words below.

Fixes #119718

cc `@fmease` `@fee1-dead` `@oli-obk`
r? fee1-dead or one of y'all i don't care

---

My understanding is that this hack was added to support the following code:

```rust
pub trait Owo<X = <Self as Uwu>::T> {}

#[const_trait]
pub trait Uwu: Owo {}
```

Which is concretely lifted from in the `FromResidual` and `Try` traits. Since within the param-env of `trait Uwu`, we only know that `Self: ~const Uwu` and not `Self: Uwu`, the projection `<Self as Uwu>::T` is not satsifyable.

This causes problems such as #119718, since instantiations of `FnDef` types coming from `const fn` really do **only** implement one of `FnOnce` or `const FnOnce`!

---

In the long-term, I believe that such code should really look something more like:

```rust
#[const_trait]
pub trait Owo<X = <Self as ~const Uwu>::T> {}

#[const_trait]
pub trait Uwu: Owo {}
```

... and that we should introduce some sort of `<T as ~const Foo>::Bar` bound syntax, since due to the fact that `~const` bounds can be present in item bounds, e.g.

```rust
#[const_trait] trait Foo { type Bar: ~const Destruct; }
```

It's easy to see that `<T as Foo>::Bar` and `<T as ~const Foo>::Bar` (or `<T as const Foo>::Bar`) can be distinct types with distinct item bounds!

**Admission**: I know I've said before that I don't like `~const` projection syntax, I do at this point believe they're necessary to fully express bounds and types in a maybe-const world.
2024-01-09 17:52:21 +01:00
Guillaume Gomez
3da96aed94
Rollup merge of #118680 - djkoloski:shell_argfiles, r=compiler-errors
Add support for shell argfiles

Closes https://github.com/rust-lang/compiler-team/issues/684
2024-01-09 17:52:21 +01:00
Guillaume Gomez
87b0de6cb7
Rollup merge of #118645 - Patryk27:bump-compiler-builtins, r=Nilstrieb,dtolnay
chore: Bump compiler_builtins

Actually closes https://github.com/rust-lang/rust/issues/118079.
2024-01-09 17:52:20 +01:00
Guillaume Gomez
5e75d46b67
Rollup merge of #118241 - fortanix:raoul/gh-530-make_userspace_types_send, r=Nilstrieb,dtolnay
Making `User<T>` and `User<[T]>` `Send`

All `User` types in SGX point to owned memory in userspace. Special care is always needed when accessing this memory as it must be assumed that an attacker is always able to change its content. Therefore, we can also easily transfer this memory between thread boundaries.

cc: ``@mzohreva`` ``@vn971`` ``@belalH`` ``@jethrogb``
2024-01-09 17:52:19 +01:00
Guillaume Gomez
103e8881c6 Add tests to ensure that map_clone is not emitted if as_ref().clone() is present 2024-01-09 17:39:51 +01:00
Guillaume Gomez
83ae5edd50 Don't lint with map_clone if current type is Option or Result and method call is as_ref. 2024-01-09 17:39:51 +01:00
Guillaume Gomez
e90eea7894 Clean up code in map_clone and useless_asref lints 2024-01-09 17:39:36 +01:00
León Orell Valerian Liehr
2d010bc634
Move variables closer to their usage sites 2024-01-09 17:30:52 +01:00
León Orell Valerian Liehr
aa1a5e3b6f
Simplify elision of default generic arguments 2024-01-09 17:28:35 +01:00
León Orell Valerian Liehr
4b859e68aa
Don't arena-allocate extended generic args 2024-01-09 17:12:08 +01:00