Commit Graph

206497 Commits

Author SHA1 Message Date
Dylan DPC
609152aa8a
Rollup merge of #102342 - jmillikin:nonzero-negation, r=scottmcm
Add negation methods for signed non-zero integers.

Performing negation with defined wrapping semantics (such as `wrapping_neg()`) on a non-zero integer currently requires unpacking to a primitive and re-wrapping. Since negation of non-zero signed integers always produces a non-zero result, it is safe to implement the various `*_neg()` methods for `NonZeroI{N}`.

I'm not sure what to do about the `#[unstable(..., issue = "none")]` here -- should I file a tracking issue, or is that handled by the Rust dev team?

ACP: https://github.com/rust-lang/libs-team/issues/105
2022-09-29 18:13:19 +05:30
Dylan DPC
1be9ec5443
Rollup merge of #102336 - compiler-errors:issue-102333, r=jackh726
Fix associated type bindings with anon const in GAT position

The first commit formats `type_of.rs`, which is really hard to maintain since it uses a bunch of features like `let`-chains and `if let` match arm bindings. Best if you just review the second two diffs.

Fixes #102333
2022-09-29 18:13:19 +05:30
Ralf Jung
1377bab12e make tidy dependency error less confusing 2022-09-29 13:42:57 +02:00
bors
c5bbf36a31 Auto merge of #102461 - oli-obk:split_collect_rs, r=lcnr
Split collect.rs

This file was way too big (adding a few lines of code caused tidy to trigger)
2022-09-29 10:44:29 +00:00
Oli Scherer
f22f149dbd Some path updates 2022-09-29 09:33:30 +00:00
Oli Scherer
6367e69929 Split collect.rs 2022-09-29 09:31:46 +00:00
bors
8a497b7181 Auto merge of #102328 - cuviper:ibm-stack-probes, r=nagisa
Enable inline stack probes on PowerPC and SystemZ

The LLVM PowerPC and SystemZ targets have both supported `"probe-stack"="inline-asm"` for longer than our current minimum LLVM 13 requirement, so we can turn this on for all `powerpc`, `powerpc64`, `powerpc64le`, and `s390x` targets in Rust. These are all tier-2 or lower, so CI does not run their tests, but I have confirmed that their `linux-gnu` variants do pass on RHEL.

cc #43241
2022-09-29 08:00:54 +00:00
bors
1536a53ea4 Auto merge of #102450 - JohnTitor:rollup-ahleg93, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #98368 (Make `std::os::fd` public.)
 - #102085 (Code refactoring smart_resolve_report_errors)
 - #102351 (Improve E0585 help)
 - #102368 (Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`)
 - #102393 (Add regression test for issue 94923)
 - #102399 (Account for use of index-based lifetime names in print of binder)
 - #102416 (remove FIXME, improve documentation)
 - #102433 (env::temp_dir: fix a typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-29 05:12:30 +00:00
Gabe Koss
06624e8c5a fix minor ungrammatical sentence 2022-09-29 00:20:05 -04:00
Michael Howell
0b9b4b7068 rustdoc: add method spacing to trait methods
More cleanup for 8846c0853d, this time in trait
layouts when things are collapsed.
2022-09-28 21:11:40 -07:00
Yuki Okushi
5c731cd796
Rollup merge of #102433 - RalfJung:temp-dir-typo, r=thomcc
env::temp_dir: fix a typo
2022-09-29 11:42:06 +09:00
Yuki Okushi
80e009ceba
Rollup merge of #102416 - lcnr:specialization-fixme, r=compiler-errors
remove FIXME, improve documentation

r? types
2022-09-29 11:42:06 +09:00
Yuki Okushi
039e9e2160
Rollup merge of #102399 - b-naber:binder-print-ice, r=lcnr
Account for use of index-based lifetime names in print of binder

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

r? ```@lcnr```

cc ```@steffahn```
2022-09-29 11:42:06 +09:00
Yuki Okushi
cf158a410a
Rollup merge of #102393 - Rageking8:add-regression-test-for-issue-94923, r=JohnTitor
Add regression test for issue 94923

Fixes #94923
2022-09-29 11:42:05 +09:00
Yuki Okushi
8e4869e862
Rollup merge of #102368 - beetrees:nano-niche, r=joshtriplett
Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`

As the nanoseconds fields is always between `0` and `(NANOS_PER_SEC - 1)` inclusive, use the `rustc_layout_scalar_valid_range` attributes to create a niche in the nanosecond field of `Duration` and `Timespec` (which is used to implement unix `SystemTime` and non-apple unix `Instant`; windows `Instant` is implemented with `Duration` and therefore will also benefit). This change has the benefit of making `Option<T>` the same size as `T` for the previously mentioned types. Also shrinks the nanoseconds field of `Timespec` to a `u32` as nanoseconds do not need the extra range of an `i64`, shrinking `Timespec` by 4 bytes on 32-bit platforms.

r? ```@joshtriplett```
2022-09-29 11:42:05 +09:00
Yuki Okushi
19e84b91e5
Rollup merge of #102351 - Rageking8:improve-E0585, r=wesleywiser
Improve E0585 help
2022-09-29 11:42:04 +09:00
Yuki Okushi
852a152206
Rollup merge of #102085 - chenyukang:code-refactor, r=cjgillot
Code refactoring smart_resolve_report_errors

`smart_resolve_report_errors` 4ecfdfac51/compiler/rustc_resolve/src/late/diagnostics.rs (L143)
is almost 600 lines of code, we should do some code refactoring.
2022-09-29 11:42:03 +09:00
Yuki Okushi
7cd4780c91
Rollup merge of #98368 - sunfishcode:sunfishcode/std-os-fd, r=joshtriplett
Make `std::os::fd` public.

`std::os::fd` defines types like `OwnedFd` and `RawFd` and is common
between Unix and non-Unix platforms that share a basic file-descriptor
concept. Rust currently uses this internally to simplify its own code,
but it would be useful for external users in the same way, so make it
public.

This means that `OwnedFd` etc. will all appear in three places, for
example on unix platforms:
 - `std::os::fd::OwnedFd`
 - `std::os::unix::io::OwnedFd`
 - `std::os::unix::prelude::OwnedFd`

r? `````@joshtriplett`````
2022-09-29 11:42:03 +09:00
bors
bf40408165 Auto merge of #101833 - jyn514:cross-compile-compiler-builtins, r=Mark-Simulacrum
Make the `c` feature for `compiler-builtins` an explicit opt-in

Its build script doesn't support cross-compilation. I tried fixing it, but the cc crate itself doesn't appear to support cross-compiling to windows either unless you use the -gnu toolchain:
```
  error occurred: Failed to find tool. Is `lib.exe` installed?
```

Fixes https://github.com/rust-lang/rust/issues/101172.
2022-09-29 02:28:50 +00:00
Ellis Hoag
01439c93b8 print <signal> when ranlib failed without an exit code 2022-09-28 19:02:38 -07:00
Michael Howell
3f21f07e72 rustdoc: remove bad CSS font-weight on .impl, .method, etc
This line was added in c494a06064, because at
the time, the headers had these classes on them. Now, the headers are
children of the `<section>` with the class on it.

This commit also adds a test case, to make sure the srclink font weight does
not regress again.
2022-09-28 16:18:12 -07:00
Nicholas Nethercote
269ff92975 Use let-chaining in WhileTrue::check_expr.
This has been bugging me for a while.
2022-09-29 09:10:57 +10:00
Guillaume Gomez
49b25d3412 Improve example of Iterator::reduce 2022-09-29 00:44:53 +02:00
Nicholas Nethercote
f07d4efc45 Shrink hir::def::Res.
`Res::SelfTy` currently has two `Option`s. When the second one is `Some`
the first one is never consulted. So we can split it into two variants,
`Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res`
from 24 bytes to 12. This then shrinks `hir::Path` and
`hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-29 08:44:52 +10:00
Michael Howell
f55ea418c3 rustdoc: clean up "normalize.css 8" input override CSS
These rules were copied from normalize.css 3, and are mostly redundant.

* `optgroup` isn't used in rustdoc at all
* `textarea` is only used for the "copy" button, so it's not visible
* The remaining buttons and inputs mostly have styles set anyway.
* We should never be setting `color` without also setting the
  background to something. Otherwise, you get white-on-gray
  text. That seems to be [the reason] why `normalize.css` changed this.

[the reason]: https://github.com/necolas/normalize.css/pull/502
2022-09-28 15:39:27 -07:00
John Millikin
ceb53a3c4f nonzero_negation_ops: inline(always) -> inline. 2022-09-29 07:33:26 +09:00
John Millikin
cdae82c5fc nonzero_negation_ops: Set issue = "102443". 2022-09-29 07:32:15 +09:00
bors
b30c88623c Auto merge of #102384 - camelid:extrainfo, r=GuillaumeGomez
rustdoc: Remove `clean::TraitWithExtraInfo` and queryify `is_notable_trait`

cc `@notriddle` `@GuillaumeGomez`
2022-09-28 22:15:28 +00:00
Michael Howell
b707eff5cc rustdoc: cut margin-top from first header in docblock
Fixes a regression caused by 8846c0853d, where
a header's top margin used to be collapsed, but isn't any more.
2022-09-28 14:33:56 -07:00
Nicholas Nethercote
a8d5c00d46 Inline two Ident methods. 2022-09-29 07:05:34 +10:00
Nicholas Nethercote
2aa028d30d Inline <Token as PartialEq<TokenKind>>::eq. 2022-09-29 07:05:34 +10:00
Nicholas Nethercote
5f29a13a5b Change the "dummy self type".
Because this is the only occurrence of a `Res::SelfTy` with `None` and
`None` fields, and the next commit will rely on those not being present.
2022-09-29 06:57:53 +10:00
Cassaundra Smith
e5096d4cba
Fix span of byte-escaped left format args brace
Fix #102057.
2022-09-28 13:47:17 -07:00
Ralf Jung
5baceaf796 env::temp_dir: fix a typo 2022-09-28 21:51:09 +02:00
bors
ce7f0f1aa0 Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiser
Add `#[rustc_safe_intrinsic]`

This PR adds the `#[rustc_safe_intrinsic]` attribute as mentionned on Zulip. The goal of this attribute is to avoid keeping a list of symbols as the source for stable intrinsics, and instead rely on an attribute. This is similar to `#[rustc_const_stable]` and `#[rustc_const_unstable]`, which among other things, are used to mark the constness of intrinsic functions.
2022-09-28 19:07:50 +00:00
Dan Gohman
284c94257f Don't export __wasm_init_memory on WebAssembly.
Since #72889, the Rust wasm target doesn't use --passive-segments, so
remove the `--export=__wasm_init_memory`.

As documented in the [tool-conventions Linking convention],
`__wasm_init_memory` is not intended to be exported.

[tool-conventions Linking convention]: 7c064f3048/Linking.md (shared-memory-and-passive-segments)
2022-09-28 11:13:51 -07:00
beetrees
a913277829
Add a niche to Duration, unix SystemTime, and non-apple Instant 2022-09-28 18:15:10 +01:00
Rageking8
2ee2ffa9a7 improve E0585 help 2022-09-29 00:34:31 +08:00
lcnr
9ccb851182 update fixme 2022-09-28 17:04:29 +02:00
bors
307dd938d7 Auto merge of #101454 - cjgillot:concat-binders, r=estebank
Do not overwrite lifetime binders for another HirId.

This PR makes higher-ranked bounds in where clauses a bit more principled.
We used to conflate `for<'a> T: Trait` with `(for<'a> T): Trait`.
This PR separates both binders.

This caused issued with fn types, which have their own binder, causing us to overwrite the predicates's binders with `fn`'s binders, ICEing.

Fixes https://github.com/rust-lang/rust/issues/98594
2022-09-28 14:42:55 +00:00
bors
09ae7846a2 Auto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwco
Migrate more of rustc_parse to SessionDiagnostic

Still far from complete, but I thought I'd add a checkpoint here because rebasing was starting to get annoying.
2022-09-28 11:11:42 +00:00
b-naber
a670897920 add test 2022-09-28 12:31:19 +02:00
b-naber
4fdc78e6bf account for use of index-based lifetime names in print of binder 2022-09-28 12:31:08 +02:00
Rageking8
356a52cca8 add regression test 2022-09-28 16:55:00 +08:00
Joshua Nelson
3acb505ee5 Make the c feature for compiler-builtins opt-in instead of inferred
The build script for `compiler_builtins` doesn't support cross-compilation. I tried fixing it, but the cc crate itself
doesn't appear to support cross-compiling to windows either unless you use the -gnu toolchain:
```
  error occurred: Failed to find tool. Is `lib.exe` installed?
```

Rather than trying to fix it or special-case the platforms without bugs,
make it opt-in instead of automatic.
2022-09-28 03:21:36 -05:00
bors
6201eabde8 Auto merge of #102302 - nnethercote:more-lexer-improvements, r=matklad
More lexer improvements

A follow-up to #99884.

r? `@matklad`
2022-09-28 08:14:04 +00:00
Arthur Cohen
b1b86491f1 rustc_safe_intrinsic: Add UI test 2022-09-28 09:40:03 +02:00
Arthur Cohen
37bf8f888c rustc_safe_intrinsic: Keep list of safe intrinsics within the compiler 2022-09-28 09:40:02 +02:00
bors
837bf370de Auto merge of #102388 - JohnTitor:rollup-mbyw6fl, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #100747 (Add long description and test for E0311)
 - #102232 (Stabilize bench_black_box)
 - #102288 (Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.)
 - #102338 (Deny associated type bindings within associated type bindings)
 - #102347 (Unescaping cleanups)
 - #102348 (Tweak `FulfillProcessor`.)
 - #102378 (Use already resolved `self_ty` in `confirm_fn_pointer_candidate`)
 - #102380 (rustdoc: remove redundant mobile `.source > .sidebar` CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-28 04:18:19 +00:00
Yuki Okushi
ce15514df9
Rollup merge of #102380 - notriddle:notriddle/rustdoc-source-sidebar, r=camelid
rustdoc: remove redundant mobile `.source > .sidebar` CSS

When the source sidebar and standard sidebar had most of their code merged in 07e3f998b1, the properties `z-index: 11`, `margin: 0`, and `position: fixed` were already being set on the `.sidebar` class, so no need to repeat them.

57ee5cf5a9/src/librustdoc/html/static/css/rustdoc.css (L1742-L1754)
2022-09-28 13:07:20 +09:00