Commit Graph

198968 Commits

Author SHA1 Message Date
Nicholas Nethercote
78f83f0b46 Inline attrs. 2022-08-29 20:25:48 +10:00
bors
7a42ca942c Auto merge of #100786 - sunshowers:macos-posix-chdir, r=sunshowers
Use posix_spawn for absolute paths on macOS

Currently, on macOS, Rust never uses the fast posix_spawn path if a
directory change is requested, due to a bug in Apple's libc. However, the
bug is only triggered if the program is a relative path.

This PR makes it so that the fast path continues to work if the program
is an absolute path or a lone filename.

This was an alternative proposed in https://github.com/rust-lang/rust/pull/80537#issue-776674009, and it makes a measurable performance difference in some of my code that spawns thousands of processes.
2022-08-29 07:54:06 +00:00
Weihang Lo
ae1764c507
Update cargo
5 commits in 6da726708a4406f31f996d813790818dce837161..4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5
2022-08-23 21:39:56 +0000 to 2022-08-27 18:41:39 +0000
- doc: pause, for readability (rust-lang/cargo#11027)
- Bump git2 to 0.15 and libgit2-sys to 0.14 (rust-lang/cargo#11004)
- Fix typo (rust-lang/cargo#11025)
- Update cargo-toml-vs-cargo-lock.md (rust-lang/cargo#11021)
- Apply GitHub fast path even for partial hashes (rust-lang/cargo#10807)
2022-08-29 07:16:00 +01:00
Nicholas Nethercote
c768617f6f Improve parse_dot_or_call_expr_with.
Avoid all the extra work in the very common case where `attrs` is empty.
2022-08-29 15:42:16 +10:00
Nicholas Nethercote
b38106b6d8 Replace rustc_data_structures::thin_vec::ThinVec with thin_vec::ThinVec.
`rustc_data_structures::thin_vec::ThinVec` looks like this:
```
pub struct ThinVec<T>(Option<Box<Vec<T>>>);
```
It's just a zero word if the vector is empty, but requires two
allocations if it is non-empty. So it's only usable in cases where the
vector is empty most of the time.

This commit removes it in favour of `thin_vec::ThinVec`, which is also
word-sized, but stores the length and capacity in the same allocation as
the elements. It's good in a wider variety of situation, e.g. in enum
variants where the vector is usually/always non-empty.

The commit also:
- Sorts some `Cargo.toml` dependency lists, to make additions easier.
- Sorts some `use` item lists, to make additions easier.
- Changes `clean_trait_ref_with_bindings` to take a
  `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this
  avoid some unnecessary allocations.
2022-08-29 15:42:13 +10:00
bors
94b2b15e63 Auto merge of #101143 - matthiaskrgr:rollup-g8y5k0g, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #94890 (Support parsing IP addresses from a byte string)
 - #96334 (socket `set_mark` addition.)
 - #99027 (Replace `Body::basic_blocks()` with field access)
 - #100437 (Improve const mismatch `FulfillmentError`)
 - #100843 (Migrate part of rustc_infer to session diagnostic)
 - #100897 (extra sanity check against consts pointing to mutable memory)
 - #100959 (translations: rename warn_ to warning)
 - #101111 (Use the declaration's SourceInfo for FnEntry retags, not the outermost)
 - #101116 ([rustdoc] Remove Attrs type alias)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-29 05:12:53 +00:00
Matthias Krüger
fa177a9db2
Rollup merge of #101116 - GuillaumeGomez:rm-attrs-ty-alias, r=notriddle
[rustdoc] Remove Attrs type alias

When working on https://github.com/rust-lang/rust/pull/101006, I was quite confused because of this type alias as I'm used to having rustdoc types into `clean/types.rs`. Anyway, considering how few uses of it we have, I simply removed it.

r? `````@notriddle`````
2022-08-29 06:34:49 +02:00
Matthias Krüger
3e5be57de8
Rollup merge of #101111 - saethlin:better-fnentry-spans, r=RalfJung
Use the declaration's SourceInfo for FnEntry retags, not the outermost

This addresses a long-standing `// FIXME` in the pass that adds retags.

The changes to Miri's UI tests will look like this:
```
   --> $DIR/aliasing_mut1.rs:LL:CC
    |
 LL | pub fn safe(_x: &mut i32, _y: &mut i32) {}
<   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
>   |                           ^^ not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
    |
```

r? ````@RalfJung````
2022-08-29 06:34:48 +02:00
Matthias Krüger
6667754694
Rollup merge of #100959 - LuisCardosoOliveira:translation-rename-attr-warning, r=davidtwco
translations: rename warn_ to warning

## Description

This MR renames the the macro `warn_` to `warning`.

To give a little bit of context, as [explained](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295074146) by ```````@davidtwco``````` in the Zulip channel, `warn_`  was named like that because the keyword `warn` is a built-in attribute and at the time this macro was created the word `warning` was also
taken.

However, it is no longer the case and we can rename `warn_` to `warning`.
2022-08-29 06:34:47 +02:00
Matthias Krüger
d814fdd3f9
Rollup merge of #100897 - RalfJung:const-not-to-mutable, r=lcnr
extra sanity check against consts pointing to mutable memory

This should be both unreachable and redundant (since we already ensure that validation only reads from read-only memory, when validating consts), but I feel like we cannot be paranoid enough here, and also if this ever fails it'll be a nicer error than the "cannot read from mutable memory" error.
2022-08-29 06:34:46 +02:00
Matthias Krüger
a3c965f5fe
Rollup merge of #100843 - IntQuant:issue-100717-infer, r=compiler-errors
Migrate part of rustc_infer to session diagnostic
2022-08-29 06:34:45 +02:00
Matthias Krüger
26c86c6993
Rollup merge of #100437 - compiler-errors:better-const-mismatch-err, r=oli-obk
Improve const mismatch `FulfillmentError`

Fixes #100414
2022-08-29 06:34:44 +02:00
Matthias Krüger
d182081de1
Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk
Replace `Body::basic_blocks()` with field access

Since the refactoring in #98930, it is possible to borrow the basic blocks
independently from other parts of MIR by accessing the `basic_blocks` field
directly.

Replace unnecessary `Body::basic_blocks()` method with a direct field access,
which has an additional benefit of borrowing the basic blocks only.
2022-08-29 06:34:43 +02:00
Matthias Krüger
a96b44c9e2
Rollup merge of #96334 - devnexen:socket_mark, r=dtolnay
socket `set_mark` addition.

to be able to set a marker/id on the socket for network filtering
 (iptables/ipfw here) purpose.
2022-08-29 06:34:42 +02:00
Matthias Krüger
52016a1005
Rollup merge of #94890 - marmeladema:ip-addr-try-from-bytes, r=joshtriplett
Support parsing IP addresses from a byte string

Fixes #94821

The goal is to be able to parse addresses from a byte string without requiring to do any utf8 validation. Since internally the parser already works on byte strings, this should be possible and I personally already needed this in the past too.

~~I used the proposed approach from the issue by implementing `TryFrom<&'a [u8]>` for all 6 address types (3 ip address types and 3 socket address types). I believe implementing stable traits for stable types is insta-stable so this will probably need an FCP?~~

Switched to an unstable inherent method approach called `parse_ascii` as requested.

cc ``````@jyn514``````
2022-08-29 06:34:41 +02:00
Michael Goulet
72fe79244d Simplify get_trait_ref a bit 2022-08-29 04:19:14 +00:00
Rain
bd8b4b9c15 Use posix_spawn for absolute paths on macOS
Currently, on macOS, Rust never uses the fast posix_spawn path if a
directory change is requested due to a bug in Apple's libc. However, the
bug is only triggered if the program is a relative path.

This PR makes it so that the fast path continues to work if the program
is an absolute path or a lone filename.

This was an alternative proposed in
https://github.com/rust-lang/rust/pull/80537#issue-776674009, and it
makes a measurable performance difference in some of my code that spawns
thousands of processes.
2022-08-28 19:31:09 -07:00
bors
7c142a6137 Auto merge of #100908 - lnicola:rust-analyzer-2022-08-23, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-08-29 02:16:57 +00:00
bors
28ec27b33a Auto merge of #9388 - Jarcho:rustup, r=Jarcho
Rustup

Hopefully this is done right.

changelog: None
2022-08-29 01:51:23 +00:00
Jason Newcomb
e5507390b7 Disable incremental compilation on CI 2022-08-28 19:22:46 -04:00
Nixon Enraght-Moony
891ebf90a5 check_missing_items.py: Check imports 2022-08-29 00:15:10 +01:00
Nixon Enraght-Moony
8050c1993b Rustdoc-Json: Retain Stripped Modules when they are imported, not when they have items.
Fixes #101103
Fixes #100973
2022-08-29 00:15:10 +01:00
bors
1ea4efd065 Auto merge of #100578 - Urgau:float-next-up-down, r=scottmcm
Add next_up and next_down for f32/f64 - take 2

This is a revival of https://github.com/rust-lang/rust/pull/88728 which staled due to inactivity of the original author. I've address the last review comment.

---

This is a pull request implementing the features described at https://github.com/rust-lang/rfcs/pull/3173.

`@rustbot` label +T-libs-api -T-libs
r? `@scottmcm`
cc `@orlp`
2022-08-28 22:31:19 +00:00
Noah Lev
2df5afe622 Stabilize std::io::read_to_string 2022-08-28 13:23:19 -07:00
bors
ce36e88256 Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillot
Avoid cloning a collection only to iterate over it

`@rustbot` label: +C-cleanup
2022-08-28 18:31:08 +00:00
Ralf Jung
f29c3c421b entirely get rid of NeedsRfc CTFE errors 2022-08-28 13:40:24 -04:00
Ralf Jung
a9f9145b09 CTFE: exposing pointers and calling extern fn doesn't need an RFC, it is just impossible 2022-08-28 13:32:48 -04:00
Ralf Jung
c46e803aaf improve OFFSET_IS_ADDR docs 2022-08-28 13:05:34 -04:00
Ralf Jung
1a1220c5e4 validation should only catch UB errors 2022-08-28 11:49:32 -04:00
Ben Kimock
cd1a42a95d Use the declaration's SourceInfo for FnEntry retags, not the outermost 2022-08-28 11:40:10 -04:00
bors
223d16ebbd Auto merge of #100201 - RalfJung:thread-local-key, r=thomcc
std: use realstd fast key when building tests

Under `cfg(test)`, the `std` crate is not the actual standard library, just any old crate we are testing. It imports the real standard library as `realstd`, and then does some careful `cfg` magic so that the crate built for testing uses the `realstd` global state rather than having its own copy of that.

However, this was not done for all global state hidden in std: the 'fast' version of thread-local keys, at least on some platforms, also involves some global state. Specifically its macOS version has this [`static REGISTERED`](bc63d5a26a/library/std/src/sys/unix/thread_local_dtor.rs (L62)) that would get duplicated. So this PR imports the 'fast' key type from `realstd` rather than using the local copy, to ensure its internal state (and that of the functions it calls) does not get duplicated.

I also noticed that the `__OsLocalKeyInner` is unused under `cfg(target_thread_local)`, so I removed it for that configuration. There was a comment saying macOS picks between `__OsLocalKeyInner` and `__FastLocalKeyInner` at runtime, but I think that comment is outdated -- I found no trace of such a runtime switching mechanism, and the library still check-builds on apple targets with this PR. (I don't have a Mac so I cannot actually run it.)
2022-08-28 15:12:31 +00:00
Maybe Waffle
7a433e4d00 fill-in tracking issue for feature(drain_keep_rest) 2022-08-28 17:02:37 +04:00
Maybe Waffle
8c4e0d42b2 add examples to vec::Drain{,Filter}::keep_rest docs 2022-08-28 16:58:06 +04:00
bors
ee285eab69 Auto merge of #96324 - berendjan:set_tcp_quickack, r=dtolnay
Add setter and getter for TCP_QUICKACK on TcpStream for Linux

Reference issue #96256

Setting TCP_QUICKACK on TcpStream for Linux
2022-08-28 12:26:37 +00:00
Yuki Okushi
382fa62426
Remove register_attr-related tests
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-28 21:23:39 +09:00
Yuki Okushi
76dd5c58a0
Remove register_attr feature
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-28 21:23:23 +09:00
bors
4e31c8cab4 Auto merge of #9389 - lukaslueg:penmacro, r=llogiq
Don't lint literal `None` from expansion

This addresses https://github.com/rust-lang/rust-clippy/pull/9288#issuecomment-1229398524: If the literal `None` is from expansion, we never lint. This is correct because e.g. replacing the call to `option_env!` with whatever that macro expanded to at the time of linting is certainly wrong.

changelog: Don't lint [`partialeq_to_none`] for macro-expansions
2022-08-28 10:59:16 +00:00
Jason Newcomb
9790a3291b Fixes for latest nightly 2022-08-28 06:44:22 -04:00
Jason Newcomb
278b0920d8 Bump nightly version -> 2022-08-27 2022-08-28 06:44:22 -04:00
Jason Newcomb
3ad398d9b0 Merge branch 'master' into rustup 2022-08-28 06:44:13 -04:00
Lukas Lueg
c542f1fe3f Don't lint literal None from expansion 2022-08-28 12:18:50 +02:00
bors
e8e598f641 Auto merge of #13133 - Veykril:diag-hack, r=Veykril
Move empty diagnostics workaround back into the server

This only touches on the diagnostics in one place instead of multiple as was previously done, since all published diagnostics will go through this code path anyways.

Closes https://github.com/rust-lang/rust-analyzer/issues/13130
2022-08-28 09:56:06 +00:00
Lukas Wirth
9ad0a8c467 Move empty diagnostics workaround back into the server 2022-08-28 11:54:46 +02:00
bors
3fdd578d72 Auto merge of #101115 - matthiaskrgr:rollup-iy14ztr, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 - #97015 (std::io: migrate ReadBuf to BorrowBuf/BorrowCursor)
 - #98301 (Add GDB/LLDB pretty-printers for NonZero types)
 - #99570 (Box::from(slice): Clarify that contents are copied)
 - #100296 (Add standard C error function aliases to last_os_error)
 - #100520 (Add mention of `BufReader` in `Read::bytes` docs)
 - #100885 (Export Cancel from std::os::fortanix_sgx::usercalls::raw)
 - #100955 (Some papercuts on error::Error)
 - #101002 (Provide structured suggestion for `hashmap[idx] = val`)
 - #101038 (no alignment check during interning)
 - #101055 (Use smaller span for suggestions)
 - #101091 (Extend attrs if local_def_id exists)
 - #101098 (rustc_middle: Remove `Visibility::Invisible`)
 - #101102 (unstable-book-gen: use std::fs::write)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-28 09:45:27 +00:00
Hirochika Matsumoto
152913767a Support method calls 2022-08-28 17:51:28 +09:00
Guillaume Gomez
1e005af31b Remove Attrs type alias 2022-08-28 10:34:19 +02:00
Matthias Krüger
b3a4bc51d7
Rollup merge of #101102 - est31:unstable_book_gen_write, r=Mark-Simulacrum
unstable-book-gen: use std::fs::write

I wrote this code in 2017 back when std::fs::write wasn't available.
Also, use the t macro from tidy.
2022-08-28 09:35:23 +02:00
Matthias Krüger
0335909b4f
Rollup merge of #101098 - petrochenkov:noinvis, r=TaKO8Ki
rustc_middle: Remove `Visibility::Invisible`

It had a different meaning in the past, but now it's only used as an implementation detail of import resolution.
2022-08-28 09:35:22 +02:00
Matthias Krüger
c2f294a73f
Rollup merge of #101091 - TaKO8Ki:fix-101076, r=notriddle
Extend attrs if local_def_id exists

Fixes #101076
2022-08-28 09:35:21 +02:00
Matthias Krüger
3142996a46
Rollup merge of #101055 - TaKO8Ki:use-smaller-span, r=compiler-errors
Use smaller span for suggestions
2022-08-28 09:35:20 +02:00