Commit graph

149190 commits

Author SHA1 Message Date
bors
dc08641128 Auto merge of #85819 - CDirkx:is_unicast_link_local_strict, r=joshtriplett
Remove `Ipv6Addr::is_unicast_link_local_strict`

Removes the unstable method `Ipv6Addr::is_unicast_link_local_strict` and keeps the behaviour of `Ipv6Addr::is_unicast_link_local`, see also #85604 where I have tried to summarize related discussion so far.

My intent is for `is_unicast_link_local`, `is_unicast_site_local` and `is_unicast_global` to have the semantics of checking if an address has Link-Local, Site-Local or Global scope, see also #85696 which changes the behaviour of `is_unicast_global` and renames these methods to `has_unicast_XXX_scope` to reflect this.

For checking Link-Local scope we currently have two methods: `is_unicast_link_local` and `is_unicast_link_local_strict`. This is because of what appears to be conflicting definitions in [IETF RFC 4291](https://datatracker.ietf.org/doc/html/rfc4291).

From [IETF RFC 4291 section 2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4): "Link-Local unicast" (`FE80::/10`)
```text
Address type         Binary prefix        IPv6 notation   Section
------------         -------------        -------------   -------
Unspecified          00...0  (128 bits)   ::/128          2.5.2
Loopback             00...1  (128 bits)   ::1/128         2.5.3
Multicast            11111111             FF00::/8        2.7
Link-Local unicast   1111111010           FE80::/10       2.5.6
Global Unicast       (everything else)
```

From [IETF RFC 4291 section 2.5.6](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.6): "Link-Local IPv6 Unicast Addresses" (`FE80::/64`)
```text
| 10 bits  |         54 bits         |          64 bits           |
+----------+-------------------------+----------------------------+
|1111111010|           0             |       interface ID         |
+----------+-------------------------+----------------------------+
```

With `is_unicast_link_local` checking `FE80::/10` and `is_unicast_link_local_strict` checking `FE80::/64`.

There is also [IETF RFC 5156 section 2.4](https://datatracker.ietf.org/doc/html/rfc5156#section-2.4) which defines "Link-Scoped Unicast" as `FE80::/10`.

It has been pointed out that implementations in other languages and the linux kernel all use `FE80::/10` (https://github.com/rust-lang/rust/pull/76098#issuecomment-706916840, https://github.com/rust-lang/rust/pull/76098#issuecomment-705928605).

Given all of this I believe the correct interpretation to be the following: All addresses in `FE80::/10` are defined as having Link-Local scope, however currently only the block `FE80::/64` has been allocated for "Link-Local IPv6 Unicast Addresses". This might change in the future however; more addresses in `FE80::/10` could be allocated and those will have Link-Local scope. I therefore believe the current behaviour of `is_unicast_link_local` to be correct (if interpreting it to have the semantics of `has_unicast_link_local_scope`) and `is_unicast_link_local_strict` to be unnecessary, confusing and even a potential source of future bugs:

Currently there is no real difference in checking `FE80::/10` or `FE80::/64`, since any address in practice will be `FE80::/64`. However if an application uses `is_unicast_link_local_strict` to implement link-local (so non-global) behaviour, it will be incorrect in the future if addresses outside of `FE80::/64` are allocated.

r? `@joshtriplett` as reviewer of all the related PRs
2021-05-31 05:03:26 +00:00
bors
b348385da1 Auto merge of #85597 - 0yoyoyo:fix-issue-71563-remove-redundant-args, r=petrochenkov
Fix span of redundant generic arguments

Fixes #71563

Above issue is about lifetime arguments, but generic arguments also have same problem.
This PR fixes both help messages.
2021-05-31 01:59:20 +00:00
bors
aab93ca37f Auto merge of #85559 - 12101111:sanitizer-crt-static, r=nagisa
Diagnose use sanitizers with crt-static

Fix: https://github.com/rust-lang/rust/issues/85459
2021-05-30 23:38:10 +00:00
bors
c1e8f3a585 Auto merge of #85838 - GuillaumeGomez:rollup-rk2rh7m, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #85285 (Add eslint checks to CI)
 - #85709 (Use correct edition when parsing `:pat` matchers)
 - #85762 (Do not try to build LLVM with Zlib on Windows)
 - #85770 (Remove `--print unversioned-files` from rustdoc )
 - #85781 (Add documentation for aarch64-apple-ios-sim target)
 - #85801 (Add `String::extend_from_within`)
 - #85817 (Fix a typo)
 - #85818 (Don't drop `PResult` without handling the error)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-30 20:20:44 +00:00
Guillaume Gomez
71a7f8f188
Rollup merge of #85818 - LeSeulArtichaut:85794-diag-drop-ice, r=petrochenkov
Don't drop `PResult` without handling the error

Fixes #85794.
2021-05-30 21:06:53 +02:00
Guillaume Gomez
980a4a725e
Rollup merge of #85817 - r00ster91:patch-9, r=dtolnay
Fix a typo

See also: #85737
2021-05-30 21:06:52 +02:00
Guillaume Gomez
b0f2a4c660
Rollup merge of #85801 - WaffleLapkin:master, r=joshtriplett
Add `String::extend_from_within`

This PR adds `String::extend_from_within` function under the `string_extend_from_within` feature gate similar to the [`Vec::extend_from_within`] function.

```rust
// String
pub fn extend_from_within<R>(&mut self, src: R)
where
    R: RangeBounds<usize>;
```

[`Vec::extend_from_within`]: https://github.com/rust-lang/rust/issues/81656
2021-05-30 21:06:51 +02:00
Guillaume Gomez
2d30bc78da
Rollup merge of #85781 - badboy:document-aarch-ios-sim-support, r=Amanieu
Add documentation for aarch64-apple-ios-sim target

Documentation as requested for [MCP 428](https://github.com/rust-lang/compiler-team/issues/428) to promote this target to Tier 2.

Currently it calls out that it's Tier 3. That should be changed if this target is promoted, but this PR could also land before that.

Note: probably should get signoff from the compiler team based on that MCP.
2021-05-30 21:06:47 +02:00
Guillaume Gomez
f7fb29b59d
Rollup merge of #85770 - Bobo1239:set_locale_for_sort, r=jyn514
Remove `--print unversioned-files` from rustdoc

This flag isn't needed anymore. See #83784.
2021-05-30 21:06:46 +02:00
Guillaume Gomez
957badbcc4
Rollup merge of #85762 - mati865:disable-zlib-on-windows, r=Mark-Simulacrum
Do not try to build LLVM with Zlib on Windows

Fixes https://github.com/rust-lang/rust/issues/85422
Fixes https://github.com/rust-lang/rust/issues/85624

We do not install Zlib on the CI but recent builds somehow started picking it's shared version.
To avoid relying on CI binaries so let's explicitly disable it.
2021-05-30 21:06:45 +02:00
Guillaume Gomez
bdd70622e2
Rollup merge of #85709 - Aaron1011:fix-pat-crate-edition, r=petrochenkov
Use correct edition when parsing `:pat` matchers

As described in issue #85708, we currently do not properly decode
`SyntaxContext::root()` and `ExpnId::root()` from foreign crates. As a
result, when we decode a span from a foreign crate with
`SyntaxContext::root()`, we end up up considering it to have the edition
of the *current* crate, instead of the foreign crate where it was
originally created.

A full fix for this issue will be a fairly significant undertaking.
Fortunately, it's possible to implement a partial fix, which gives us
the correct edition-dependent behavior for `:pat` matchers when the
macro is loaded from another crate. Since we have the edition of the
macro's defining crate available, we can 'recover' from seeing a
`SyntaxContext::root()` and use the edition of the macro's defining
crate.

Any solution to issue #85708 must reproduce the behavior of this
targeted fix - properly preserving a foreign `SyntaxContext::root()`
means (among other things) preserving its edition, which by definition
is the edition of the foreign crate itself. Therefore, this fix moves us
closer to the correct overall solution, and does not expose any new
incorrect behavior to macros.
2021-05-30 21:06:44 +02:00
Guillaume Gomez
9c873c1240
Rollup merge of #85285 - GuillaumeGomez:eslint-check, r=jsha,Mark-Simulacrum
Add eslint checks to CI

It also allowed me to fix some potential issues that went unnoticed. Having this process automated will hopefully prevent us to add more errors. :)

cc `@Mark-Simulacrum` (for the add in the CI).
r? `@jsha`
2021-05-30 21:06:43 +02:00
Guillaume Gomez
558b073c4c Fix eslint error in sidebar-items.js 2021-05-30 20:20:59 +02:00
Guillaume Gomez
b4148e926a Add eslint checks in CI 2021-05-30 20:19:59 +02:00
bors
758c00ea40 Auto merge of #85362 - jsgf:fix-emit-metadata, r=estebank
Use command line metadata path if provided

If the command-line has `--emit metadata=some/path/libfoo.rmeta` then
use that.

Closes #85356

I couldn't find any existing tests for the `--emit TYPE=PATH` command line syntax, so I wasn't sure how to test this aside from ad-hoc manual testing. Is there a ui test type for "generated output file with expected name"?
2021-05-30 17:39:45 +00:00
bors
59579907ab Auto merge of #85804 - bjorn3:merge_crate_disambiguator, r=cjgillot
Merge CrateDisambiguator into StableCrateId

This simplifies the code and potentially improves performance by reducing the amount of hashed data.

Fixes https://github.com/rust-lang/rust/issues/85795
2021-05-30 14:48:26 +00:00
0yoyoyo
0edf4da043 Fix span of redundant generic arguments 2021-05-30 22:46:06 +09:00
bors
2023cc3aa1 Auto merge of #84586 - GuillaumeGomez:enforce-rustdoc-gui-test-suite-run, r=Mark-Simulacrum
Enforce rustdoc-gui test-suite run

Part of https://github.com/rust-lang/rust/issues/84550
2021-05-30 12:32:41 +00:00
bjorn3
e0e0cfa649 Update mir opt tests 2021-05-30 12:51:36 +02:00
bjorn3
c76b1b0317 Update tests 2021-05-30 12:51:36 +02:00
bjorn3
3abdebe79d Fix test 2021-05-30 12:51:36 +02:00
bjorn3
d0ec85d3fb Merge CrateDisambiguator into StableCrateId 2021-05-30 12:51:34 +02:00
bors
f60a670256 Auto merge of #85319 - cjgillot:query-simp, r=Mark-Simulacrum
Simplification of query forcing

Extracted from #78780
2021-05-30 10:11:23 +00:00
bors
d93b6a4598 Auto merge of #85786 - GuillaumeGomez:error-code-checker-improvement, r=Mark-Simulacrum
Error code checker improvement

Just realized that some error codes shouldn't be ignored anymore. So I updated the script to ensure that if an error code is tested and ignored, it will trigger an error.
2021-05-30 07:25:38 +00:00
bors
bff138dbd9 Auto merge of #85754 - the8472:revert-83770, r=Mark-Simulacrum
Revert "Auto merge of #83770 - the8472:tra-extend, r=Mark-Simulacrum"

Due to a performance regression that didn't show up in the original perf run
this reverts commit 9111b8ae97 (#83770), reversing
changes made to 9a700d2947.

Since since is expected to have the inverse impact it should probably be rollup=never.

r? `@Mark-Simulacrum`
2021-05-30 04:12:44 +00:00
bors
9a72afa7dd Auto merge of #83772 - jhpratt:revamp-step-trait, r=Mark-Simulacrum
Make `Step` trait safe to implement

This PR makes a few modifications to the `Step` trait that I believe better position it for stabilization in the short term. In particular,

1. `unsafe trait TrustedStep` is introduced, indicating that the implementation of `Step` for a given type upholds all stated invariants (which have remained unchanged). This is gated behind a new `trusted_step` feature, as stabilization is realistically blocked on min_specialization.
2. The `Step` trait is internally specialized on the `TrustedStep` trait, which avoids a serious performance regression.
3. `TrustedLen` is implemented for `T: TrustedStep` as the latter's invariants subsume the former's.
4. The `Step` trait is no longer `unsafe`, as the invariants must not be relied upon by unsafe code (unless the type implements `TrustedStep`).
5. `TrustedStep` is implemented for all types that implement `Step` in the standard library and compiler.
6. The `step_trait_ext` feature is merged into the `step_trait` feature. I was unable to find any reasoning for the features being split; the `_unchecked` methods need not necessarily be stabilized at the same time, but I think it is useful to have them under the same feature flag.

All existing implementations of `Step` will be broken, as it is not possible to `unsafe impl` a safe trait. Given this trait only exists on nightly, I feel this breakage is acceptable. The blanket `impl<T: Step> TrustedLen for T` will likely cause some minor breakage, but this should be covered by the equivalent impl for `TrustedStep`.

Hopefully these changes are sufficient to place `Step` in decent position for stabilization, which would allow user-defined types to be used with `a..b` syntax.
2021-05-30 01:21:39 +00:00
bors
84b1005bfd Auto merge of #85390 - Mark-Simulacrum:fast-bridge, r=petrochenkov
Optimize proc macro bridge

This optimizes the proc macro bridge code for a win of 0.7% instruction counts on the diesel-check benchmark (non-incr, full). These wins are small, but hopefully not limited to just the diesel benchmark; the code is also not seriously impacted by the changes here.
2021-05-29 22:55:40 +00:00
Christiaan Dirkx
c1f0c15382 Remove is_unicast_link_local_strict 2021-05-30 00:32:17 +02:00
LeSeulArtichaut
b237f90ab9 Don't drop PResult without handling the error 2021-05-30 00:08:42 +02:00
r00ster
8d70f40b31
Fix a typo 2021-05-30 00:06:27 +02:00
Camille GILLOT
f3ed997254 Move reconstruct test inwards. 2021-05-29 22:38:51 +02:00
bors
b663c0f4f6 Auto merge of #85698 - ehuss:incremental-session-panic, r=estebank
Don't panic when failing to initialize incremental directory.

This removes a panic when rustc fails to initialize the incremental directory. This can commonly happen on various filesystems that don't support locking (often various network filesystems). Panics can be confusing and scary, and there are already plenty of issues reporting this.

This has been panicking since 1.22 due to I think #44502 which was a major rework of how things work. Previously, things were simpler and the [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.21.0/src/librustc_incremental/persist/load.rs#L43-L65) function would emit an error and then continue on without panicking. With 1.22, [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.22.0/src/librustc_incremental/persist/load.rs#L44) was changed so that it assumes it can load the data without errors. Today, the problem is that it calls [`prepare_session_directory`](fbf1b1a719/compiler/rustc_interface/src/passes.rs (L175-L179)) and then immediately calls `garbage_collect_session_directories` which will panic since the session is `IncrCompSession::NotInitialized`.

The solution here is to have `prepare_session_directory` return an error that must be handled so that compilation stops if it fails.

Some other options:

* Ignore directory lock failures.
* Print a warning on directory lock failure, but otherwise continue with incremental enabled.
* Print a warning on directory lock failure, and disable incremental.
* Provide a different locking mechanism.

Cargo ignores lock errors if locking is not supported, so that would be a precedent for the first option. These options would require quite a bit more changes, but I'm happy to entertain any of them, as I think they all have valid justifications.

There is more discussion on the many issues where this is reported: #49773, #59224, #66513, #76251. I'm not sure if this can be considered closing any of those, though, since I think there is some value in discussing if there is a way to avoid the error altogether. But I think it would make sense to at least close all but one to consolidate them.
2021-05-29 19:27:53 +00:00
Aaron Hill
d874ecc84f
Use correct edition when parsing :pat matchers
As described in issue #85708, we currently do not properly decode
`SyntaxContext::root()` and `ExpnId::root()` from foreign crates. As a
result, when we decode a span from a foreign crate with
`SyntaxContext::root()`, we end up up considering it to have the edition
of the *current* crate, instead of the foreign crate where it was
originally created.

A full fix for this issue will be a fairly significant undertaking.
Fortunately, it's possible to implement a partial fix, which gives us
the correct edition-dependent behavior for `:pat` matchers when the
macro is loaded from another crate. Since we have the edition of the
macro's defining crate available, we can 'recover' from seeing a
`SyntaxContext::root()` and use the edition of the macro's defining
crate.

Any solution to issue #85708 must reproduce the behavior of this
targeted fix - properly preserving a foreign `SyntaxContext::root()`
means (among other things) preserving its edition, which by definition
is the edition of the foreign crate itself. Therefore, this fix moves us
closer to the correct overall solution, and does not expose any new
incorrect behavior to macros.
2021-05-29 13:09:14 -05:00
Mark Rousskov
8c2080886f Write primitive types via array buffers
This allows a more efficient implementation (avoiding a fallback to memmove,
which is not optimal for short writes).

This saves 0.29% on diesel.
2021-05-29 12:52:06 -04:00
Mark Rousskov
92b2894d31 Switch to reserve over extend_from_slice
This is a 0.15% win on diesel.
2021-05-29 12:45:07 -04:00
Mark Rousskov
299ac75894 Specialize single-element writes to buffer
copy_from_slice generally falls back to memcpy/memmove, which is much more expensive
than we need to write a single element in.

This saves 0.26% instructions on the diesel benchmark.
2021-05-29 12:45:07 -04:00
bors
ff5522fc1a Auto merge of #85540 - GuillaumeGomez:better-result-dom-generation, r=jsha
Better result dom generation

First commit is from https://github.com/rust-lang/rust/pull/85506.

We realized in https://github.com/rust-lang/rust/pull/85506#issuecomment-844984162 thanks to `@dns2utf8` that in some cases, the generated search result DOM was invalid. This was not strict enough and the DOM was inserted as a big string, which wasn't great.

r? `@jsha`
2021-05-29 16:27:14 +00:00
Eric Huss
4c550bc014 Fix incremental-session-fail to work when run as root. 2021-05-29 08:54:51 -07:00
bors
9f75dbfa69 Auto merge of #85767 - lqd:stackless_span_stacks, r=oli-obk
A bit more polish on const eval errors

This PR adds a bit more polish to the const eval errors:
- a slight improvement to the PME messages from #85633: I mentioned there that the erroneous item's paths were dependent on the environment, and could be displayed fully qualified or not. This can obscure the items when they come from a dependency. This PR uses the pretty-printing code ensuring the items' paths are not trimmed.
- whenever there are generics involved in an item where const evaluation errors out, the error message now displays the instance and its const arguments, so that we can see which instantiated item and compile-time values lead to the error.

So we get this slight improvement for our beloved `stdarch` example, on nightly:
```
error[E0080]: evaluation of constant value failed
 --> ./stdarch/crates/core_arch/src/macros.rs:8:9
  |
8 |         assert!(IMM >= MIN && IMM <= MAX, "IMM value not in expected range");
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'IMM value not in expected range', /rustc/9111b8ae9793f18179a1336417618fc07a9cac85/library/core/src/../../stdarch/crates/core_arch/src/macros.rs:8:9
  |
```

to this PR's:

```
error[E0080]: evaluation of `core::core_arch::macros::ValidateConstImm::<51_i32, 0_i32, 15_i32>::VALID` failed
 --> ./stdarch/crates/core_arch/src/macros.rs:8:9
  |
8 |         assert!(IMM >= MIN && IMM <= MAX, "IMM value not in expected range");
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'IMM value not in expected range', ./stdarch/crates/core_arch/src/macros.rs:8:9
  |
```

with this PR.

Of course this is an idea from Oli, so maybe r? `@oli-obk` if they have the time.
2021-05-29 13:34:20 +00:00
Jan-Erik Rediger
aa1b127281 tier-check: Check for lines with '[' such as those containing links 2021-05-29 14:43:12 +02:00
Jan-Erik Rediger
2f1372bbd3 Add documentation for aarch64-apple-ios-sim target 2021-05-29 14:43:12 +02:00
bors
f77b1a5973 Auto merge of #85798 - hyd-dev:miri, r=RalfJung
Update Miri

Fixes #85780.
2021-05-29 09:07:33 +00:00
Waffle
23f9b92c5e Add String::extend_from_within
This patch adds `String::extend_from_within` function under the
`string_extend_from_within` feature gate similar to the
`Vec::extend_from_within` function.
2021-05-29 10:36:30 +03:00
Jeremy Fitzhardinge
b14b7c6085 Add test for --emit TYPE=path 2021-05-28 22:52:59 -07:00
Jeremy Fitzhardinge
2835351feb Use command line metadata path if provided
If the command-line has `--emit metadata=some/path/libfoo.rmeta` then
use that.

Closes #85356
2021-05-28 22:24:24 -07:00
bors
6166929741 Auto merge of #85703 - clarfonthey:unchecked_shift, r=scottmcm
Add inherent unchecked_shl, unchecked_shr to integers

Tracking issue: #85122.

Adding more of these methods, since these are missing.
2021-05-29 05:16:09 +00:00
ltdk
2a40f2423a Add inherent unchecked_shl, unchecked_shr to integers 2021-05-28 22:54:39 -04:00
bors
4664725ae0 Auto merge of #85790 - ehuss:nvptx-no-std, r=nagisa
Fix typo on nvptx support

I made a minor mistake in https://github.com/rust-lang/rust-forge/pull/356 setting nvptx as std instead of no-std.
2021-05-29 01:01:13 +00:00
hyd-dev
fc6e4af963
Update Miri 2021-05-29 08:52:58 +08:00
Eric Huss
e7411a26e4 Add specific help for *how* to fix an incremental lock error. 2021-05-28 16:40:22 -07:00