Commit Graph

164373 Commits

Author SHA1 Message Date
Tomasz Miąsko
b6f845f225 Use SmallStr when building target-features LLVM attribute 2022-03-04 16:57:34 +01:00
Tomasz Miąsko
725c11ef3c Add SmallStr 2022-03-04 16:57:34 +01:00
Tomasz Miąsko
ea0a31ff0c Inline SmallCStr::deref 2022-03-04 16:57:34 +01:00
Jeff
b363f13069 Add suggested changes to the docs 2022-03-04 09:48:51 -05:00
Jeff
5f34c04de6 Make use statement visible 2022-03-04 09:45:18 -05:00
bors
b4bf56cd66 Auto merge of #94570 - shampoofactory:reopen-91719, r=workingjubilee
Reopen 91719

Reopened #91719, which was closed inadvertently due to technical difficulties.
2022-03-04 13:06:14 +00:00
Hans Kratz
735f60c34f Integrate macos x86-64 remove_dir_all() impl. Step 2: readd 2022-03-04 13:47:50 +01:00
Hans Kratz
41b4423cdf Integrate macos x86-64 remove_dir_all() impl. Step 1: remove 2022-03-04 13:47:36 +01:00
Hans Kratz
e427333071 remove_dir_all(): try recursing first instead of trying to unlink()
This only affects the `slow` code path, if there is no `dirent.d_type` or if
the type is `DT_UNKNOWN`.

POSIX specifies that calling `unlink()` or `unlinkat(..., 0)` on a directory can
succeed:
> "The _path_ argument shall not name a directory unless the process has
> appropriate privileges and the implementation supports using _unlink()_ on
> directories."
This however can cause orphaned directories requiring an fsck e.g. on Illumos
UFS, so we have to avoid that in the common case. We now just try to recurse
into it first and unlink() if we can't open it as a directory.
2022-03-04 13:33:35 +01:00
Loïc BRANSTETT
976fdb18c9 Enable conditional compilation checking on the Rust codebase 2022-03-04 12:14:29 +01:00
Mara Bos
9099353ea8
Use '_ for irrelevant lifetimes in Debug impl.
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2022-03-04 10:41:39 +00:00
bors
047f9c4bc4 Auto merge of #94539 - tmiasko:string-attributes, r=nikic
Pass LLVM string attributes as string slices
2022-03-04 10:38:11 +00:00
Loïc BRANSTETT
a93c7abc69 Add #![allow(unexpected_cfgs)] in preparation of global --check-cfg 2022-03-04 11:34:51 +01:00
Loïc BRANSTETT
08e1e67b49 Remove invalid #[cfg(tests)] in index_map 2022-03-04 11:34:50 +01:00
csmoe
6d41565726 add address sanitizer fo android 2022-03-04 10:21:43 +00:00
Loïc BRANSTETT
4aa92aff05 Add well known values to --check-cfg implementation 2022-03-04 11:15:38 +01:00
est31
18528a2ddb Use if let instead of manual match 2022-03-04 10:35:56 +01:00
bors
62ff2bcf94 Auto merge of #94159 - erikdesjardins:align-load, r=nikic
Add !align metadata on loads of &/&mut/Box

Note that this refers to the alignment of what the loaded value points
to, _not_ the alignment of the loaded value itself.

r? `@ghost` (blocked on #94158)
2022-03-04 08:14:31 +00:00
bors
65f6d33b77 Auto merge of #94096 - cjgillot:ensure-stability, r=lcnr
Ensure stability directives are checked in all cases

Split off  #93017

Stability and deprecation were not checked in all cases, for instance if a type error happened.
This PR moves the check earlier in the pipeline to ensure the errors are emitted in all cases.

r? `@lcnr`
2022-03-04 05:49:14 +00:00
Takayuki Maeda
068a233d4d fix invalid unresolved imports errors the asterisk wildcard syntax causes
use a path variabale
2022-03-04 14:06:27 +09:00
Nixon Enraght-Moony
a424f42e97 rustdoc-json: Make the fns/generics.rs test much more robust 2022-03-04 05:54:12 +01:00
Martin Nordholts
aa763fcf42 rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSON
The rustdoc JSON for

```
pub fn f(_: impl Clone) {}
```

will effectively be

```
pub fn f<impl Clone: Clone>(_: impl Clone)
```

where a synthetic generic parameter called `impl Clone` with generic
trait bound `Clone` is added to the function declaration.

The generated HTML filters out these generic parameters by doing
`self.params.iter().filter(|p| !p.is_synthetic_type_param())`, because
the synthetic generic parameter is not of interest to regular users.

For the same reason, we should expose whether or not a generic parameter
is synthetic or not also in the rustdoc JSON, so that rustdoc JSON
clients can also have the option to hide synthetic generic parameters.
2022-03-04 05:54:12 +01:00
Michael Goulet
8af683de34 delay bug instead of skipping check_expr 2022-03-03 20:39:50 -08:00
reez12g
bca67fe02f Add #[track_caller] to track callers when initializing poisoned Once 2022-03-03 22:41:27 -05:00
bors
8fa5d74a7c Auto merge of #94588 - Dylan-DPC:rollup-7pxd0i3, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #88805 (Clarification of default socket flags)
 - #93418 (rustdoc & doc: no `shortcut` for `rel="icon"`)
 - #93913 (Remove the everybody loops pass)
 - #93965 (Make regular stdio lock() return 'static handles)
 - #94339 (ARM: Only allow using d16-d31 with asm! when supported by the target)
 - #94404 (Make Ord and PartialOrd opt-out in `newtype_index`)
 - #94466 (bootstrap: correct reading of flags for llvm)
 - #94572 (Use `HandleOrNull` and `HandleOrInvalid` in the Windows FFI bindings.)
 - #94575 (CTFE SwitchInt: update comment)
 - #94582 (Fix a bug in `x.py fmt` that prevents some files being formatted.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-04 02:53:40 +00:00
Esteban Kuber
004f2ed219 Do not recover from Ty? in macro parsing
Follow up to #92746. Address #94510.
2022-03-04 02:03:55 +00:00
Dylan DPC
733a1a8ca4
Rollup merge of #94582 - nnethercote:fix-x-fmt-bug, r=Mark-Simulacrum
Fix a bug in `x.py fmt` that prevents some files being formatted.

If you have a file in the repository root with the same name as a file
somewhere within a directory, the latter currently won't get formatted.

I have experienced this multiple times and not understood what was
happening; I finally figured out the problem today. This commit fixes
the problem.

r? ```@Mark-Simulacrum```
2022-03-04 02:06:44 +01:00
Dylan DPC
72c0c08445
Rollup merge of #94575 - RalfJung:switchint-comment, r=oli-obk
CTFE SwitchInt: update comment

I just wondered why this doesn't use `binary_op`.

r? ```@oli-obk```
2022-03-04 02:06:43 +01:00
Dylan DPC
308efafc77
Rollup merge of #94572 - sunfishcode:sunfishcode/handle-or, r=joshtriplett
Use `HandleOrNull` and `HandleOrInvalid` in the Windows FFI bindings.

Use the new `HandleOrNull` and `HandleOrInvalid` types that were introduced
as part of [I/O safety] in a few functions in the Windows FFI bindings.

This factors out an `unsafe` block and two `unsafe` function calls in the
Windows implementation code.

And, it helps test `HandleOrNull` and `HandleOrInvalid`, and indeed, it
turned up a bug: `OwnedHandle` also needs to be `#[repr(transparent)]`,
as it's used inside of `HandleOrNull` and `HandleOrInvalid` which are also
`#[repr(transparent)]`.

r? ```@joshtriplett```

[I/O safety]: https://github.com/rust-lang/rust/issues/87074
2022-03-04 02:06:42 +01:00
Dylan DPC
958bd0268c
Rollup merge of #94466 - jonhoo:bootstrap-proper-env-flags, r=Mark-Simulacrum
bootstrap: correct reading of flags for llvm

First, this reverts the `CFLAGS`/`CXXFLAGS` of #93918. Those flags are
already read by `cc` and populated into `Build` earlier on in the
process. We shouldn't be overriding that based on `CFLAGS`, since `cc`
also respects overrides like `CFLAGS_{TARGET}` and `HOST_CFLAGS`, which
we want to take into account.

Second, this adds the same capability to specify target-specific
versions of `LDFLAGS` as we have through `cc` for the `C*` flags:
https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables
2022-03-04 02:06:41 +01:00
Dylan DPC
aede21f42f
Rollup merge of #94404 - pierwill:newtype-index-noord-2, r=Aaron1011
Make Ord and PartialOrd opt-out in `newtype_index`

Part of work on #90317. This will allow us to do

```diff
rustc_index::newtype_index! {
    /// A unique ID associated with a macro invocation and expansion.
    pub struct LocalExpnId {
        ENCODABLE = custom
        DEBUG_FORMAT = "expn{}"
+       ORD_IMPL = off
    }
}
```
2022-03-04 02:06:41 +01:00
Dylan DPC
79c71d1f9e
Rollup merge of #94339 - Amanieu:arm-d32, r=nagisa
ARM: Only allow using d16-d31 with asm! when supported by the target

Support can be determined by checking for the "d32" LLVM feature.

r? ```````````````@nagisa```````````````
2022-03-04 02:06:40 +01:00
Dylan DPC
cdfb39ef07
Rollup merge of #93965 - Mark-Simulacrum:owned-stdio, r=dtolnay
Make regular stdio lock() return 'static handles

This also deletes the unstable API surface area previously added to expose this
functionality on new methods rather than built into the current set.

Closes #86845 (tracking issue for unstable API needed without this)

r? ``````@dtolnay`````` to kick off T-libs-api FCP
2022-03-04 02:06:39 +01:00
Dylan DPC
c1585a17a3
Rollup merge of #93913 - bjorn3:remove_everybody_loops, r=jackh726
Remove the everybody loops pass

It isn't used anymore by rustdoc.

Split out of https://github.com/rust-lang/rust/pull/92895. There has been some previous discussion there.
2022-03-04 02:06:38 +01:00
Dylan DPC
c695de05f2
Rollup merge of #93418 - ojeda:no-shortcut, r=camelid
rustdoc & doc: no `shortcut` for `rel="icon"`

According to https://html.spec.whatwg.org/multipage/links.html#rel-icon:

> For historical reasons, the `icon` keyword may be preceded by the keyword "`shortcut`".

And to https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types:

> **Warning:** The `shortcut` link type is often seen before `icon`, but this link type is non-conforming, ignored and **web authors must not use it anymore.**

While it was removed from the Rust logo case a while ago in commit 085679c ("Use theme-adaptive SVG favicon from other Rust sites"), it is still there for the custom logo case.

Also updated a few other instances.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-03-04 02:06:38 +01:00
Dylan DPC
4c70200476
Rollup merge of #88805 - krhancoc:master, r=dtolnay
Clarification of default socket flags

This PR outlines the decision to disable inheritance of socket objects when possible to child processes in the documentation.
2022-03-04 02:06:37 +01:00
Jeff
c956fe5cea Document new recommended use of method 2022-03-03 19:45:53 -05:00
bors
6d7684101a Auto merge of #94009 - compiler-errors:gat-rustdoc, r=GuillaumeGomez
Support GATs in Rustdoc

Implements:
1. Rendering GATs in trait definitions and impl blocks
2. Rendering GATs in types (e.g. in the return type of a function)

Fixes #92341

This is my first rustdoc PR, so I have absolutely no idea how to produce tests for this. Advice from the rustdoc team would be wonderful!

I tested locally and things looked correct:
![image](https://user-images.githubusercontent.com/3674314/153988325-9732cbf3-0645-4e1a-9e64-ddfd93877b55.png)
2022-03-04 00:27:23 +00:00
Dan Gohman
86b4658c56 Generalize get_nullable_type to allow types where null is all-ones.
Generalize get_nullable_type to accept types that have an all-ones bit
pattern as their sentry "null" value.

This will allow [`OwnedFd`], [`BorrowedFd`], [`OwnedSocket`], and
[`BorrowedSocket`] to be marked with
`#[rustc_nonnull_optimization_guaranteed]`, which will allow
`Option<OwnedFd>`, `Option<BorrowedFd>`, `Option<OwnedSocket>`, and
`Option<BorrowedSocket>` to be used in FFI declarations, as described
in the [I/O safety RFC].

For example, it will allow a function like `open` on Unix and `WSASocketW`
on Windows to be declared using `Option<OwnedFd>` and `Option<OwnedSocket>`
return types, respectively.

The actual change to add `#[rustc_nonnull_optimization_guaranteed]`
to the abovementioned types will be a separate PR, as it'll depend on
having this patch in the stage0 compiler.

Also, update the diagnostics to mention that "niche optimizations" are
used in libstd as well as libcore, as `rustc_layout_scalar_valid_range_start`
and `rustc_layout_scalar_valid_range_end` are already in use in libstd.

[`OwnedFd`]: c9dc44be24/library/std/src/os/fd/owned.rs (L49)
[`BorrowedFd`]: c9dc44be24/library/std/src/os/fd/owned.rs (L29)
[`OwnedSocket`]: c9dc44be24/library/std/src/os/windows/io/socket.rs (L51)
[`BorrowedSocket`]: c9dc44be24/library/std/src/os/windows/io/socket.rs (L29)
[I/O safety RFC]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md#ownedfd-and-borrowedfdfd-1
2022-03-03 16:20:13 -08:00
David Tolnay
5b28c3873d
Add a team for '@rustbot ping fuchsia' 2022-03-03 15:33:05 -08:00
Nicholas Nethercote
fc142ebaf8 Fix a bug in x.py fmt that prevents some files being formatted.
If you have a file in the repository root with the same name as a file
somewhere within a directory, the latter currently won't get formatted.

I have experienced this multiple times and not understood what was
happening; I finally figured out the problem today. This commit fixes
the problem.
2022-03-04 09:30:12 +11:00
xFrednet
700ec66aed
Emit unused_attributes if a level attr only has a reason 2022-03-03 23:21:41 +01:00
bors
40d3040ae1 Auto merge of #94571 - matthiaskrgr:rollup-4ul5ydb, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #92697 (Use cgroup quotas for calculating `available_parallelism`)
 - #94057 (improve comments for `simplify_type`)
 - #94547 (`parse_tt` cleanups)
 - #94550 (rustdoc: Add test for higher kinded functions generated by macros)
 - #94551 (Doc: Fix use of quote instead of backstick in Adapter::map.)
 - #94554 (Fix invalid lint_node_id being put on a removed stmt)
 - #94555 (all: fix some typos)
 - #94563 (Remove a unnecessary `..` pattern)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-03 21:40:28 +00:00
Esteban Kuber
98752776b8 Tweak move error
Point at method definition that causes type to be consumed.

Fix #94056.
2022-03-03 21:21:57 +00:00
Michael Goulet
0e57a16c88 add tests 2022-03-03 13:01:35 -08:00
Michael Goulet
9f21514426 don't forget generics for GATs in impls 2022-03-03 13:01:35 -08:00
Michael Goulet
aefc0a223a make generic projection types print correctly 2022-03-03 13:01:35 -08:00
Ralf Jung
50e7450bac only disable SIMD for doctests in Miri (not for the stdlib build itself) 2022-03-03 15:11:06 -05:00
Ralf Jung
e9149b6773 Miri can run this test now 2022-03-03 14:54:18 -05:00
Ralf Jung
d233570fab fix a warning when building core tests with cfg(miri) 2022-03-03 14:54:18 -05:00