Commit Graph

162793 Commits

Author SHA1 Message Date
Matthias Krüger
f30f6def0f
Rollup merge of #93759 - dtolnay:usetree, r=nagisa
Pretty print ItemKind::Use in rustfmt style

This PR backports the formatting for `use` items from https://github.com/dtolnay/prettyplease into rustc_ast_pretty.

Before:

```rust
use core::{cmp::{Eq, Ord, PartialEq, PartialOrd},
    convert::{AsMut, AsRef, From, Into},
    iter::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator,
    IntoIterator, Iterator},
    marker::{Copy as Copy, Send as Send, Sized as Sized, Sync as Sync, Unpin
    as U}, ops::{*, Drop, Fn, FnMut, FnOnce}};
```

After:

```rust
use core::{
    cmp::{Eq, Ord, PartialEq, PartialOrd},
    convert::{AsMut, AsRef, From, Into},
    iter::{
        DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator,
        IntoIterator, Iterator,
    },
    marker::{
        Copy as Copy, Send as Send, Sized as Sized, Sync as Sync, Unpin as U,
    },
    ops::{*, Drop, Fn, FnMut, FnOnce},
};
```
2022-02-12 09:26:23 +01:00
Matthias Krüger
36461e0447
Rollup merge of #93757 - jackh726:gat-bug-tests, r=nikomatsakis
Add some known GAT bugs as tests

In the spirit of rust-lang/compiler-team#476

These tests are marked as "check-fail", but also commented with "this should pass". This many of the open GAT issues that are accepted bugs.

r? ``@nikomatsakis``
2022-02-12 09:26:22 +01:00
Matthias Krüger
602898a305
Rollup merge of #93595 - compiler-errors:ice-on-lifetime-arg, r=jackh726
fix ICE when parsing lifetime as function argument

I don't really like this, but we basically need to emit an error instead of just delaying an bug, because there are too many places in the AST that aren't covered by my previous PRs...

cc: https://github.com/rust-lang/rust/issues/93282#issuecomment-1028052945
2022-02-12 09:26:21 +01:00
Matthias Krüger
661be4c782
Rollup merge of #91908 - matthiaskrgr:ices, r=jackh726
Add 2 tests

fixes #91139
fixes #91069
2022-02-12 09:26:20 +01:00
Jack Huey
ba4221567b
Fix line number
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2022-02-12 00:57:16 -05:00
bors
9cdefd763b Auto merge of #93691 - compiler-errors:mir-tainted-by-errors, r=oli-obk
Implement `tainted_by_errors` in MIR borrowck, use it to skip CTFE

Putting this up for initial review. The issue that I found is when we're evaluating a const, we're doing borrowck, but doing nothing with the fact that borrowck fails.

This implements a `tainted_by_errors` field for MIR borrowck like we have in infcx, so we can use that information to return an `Err` during const eval if our const fails to borrowck.

This PR needs some cleaning up. I should probably just use `Result` in more places, instead of `.expect`ing in the places I am, but I just wanted it to compile so I could see if it worked!

Fixes #93646

r? `@oli-obk`
feel free to reassign
2022-02-12 05:19:33 +00:00
bors
fc323035ac Auto merge of #93671 - Kobzol:stable-hash-const, r=the8472
Use const generics in SipHasher128's short_write

This was proposed by `@michaelwoerister` [here](https://github.com/rust-lang/rust/pull/93615#discussion_r799485554).
A few comments:
1) I tried to pass `&[u8; LEN]` instead of `[u8; LEN]`. Locally, it resulted in small icount regressions (about 0.5 %). When passing by value, there were no regressions (and no improvements).
2) I wonder if we should use `to_ne_bytes()` in `SipHasher128` to keep it generic and only use `to_le_bytes()` in `StableHasher`. However, currently `SipHasher128` is only used in `StableHasher` and the `short_write` method was private, so I couldn't use it directly from `StableHasher`. Using `to_le()` in the `StableHasher` was breaking this abstraction boundary before slightly.

```rust
debug_assert!(LEN <= 8);
```
This could be done at compile time, but actually I think that now we can remove this assert altogether.

r? `@the8472`
2022-02-12 02:05:11 +00:00
Michael Goulet
5be9e79ae0
Update expr.rs
Revert spurious changes included in PR
2022-02-11 17:48:06 -08:00
bors
f19851069e Auto merge of #93921 - matthiaskrgr:rollup-wn3jlxj, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #90955 (Rename `FilenameTooLong` to `InvalidFilename` and also use it for Windows' `ERROR_INVALID_NAME`)
 - #91607 (Make `span_extend_to_prev_str()` more robust)
 - #92895 (Remove some unused functionality)
 - #93635 (Add missing platform-specific information on current_dir and set_current_dir)
 - #93660 (rustdoc-json: Add some tests for typealias item)
 - #93782 (Split `pauth` target feature)
 - #93868 (Fix incorrect register conflict detection in asm!)
 - #93888 (Implement `AsFd` for `&T` and `&mut T`.)
 - #93909 (Fix typo: explicitely -> explicitly)
 - #93910 (fix mention of moved function in `rustc_hir` docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-11 23:01:50 +00:00
Matthias Krüger
9b17e2d14d Add 2 tests
fixes #91139
fixes #91069
2022-02-11 22:07:33 +01:00
Matthias Krüger
de0feb30bd
Rollup merge of #93910 - rosehuds:master, r=cjgillot
fix mention of moved function in `rustc_hir` docs

The function was moved from `Crate` to `Map` in db9fea508a but these docs weren't updated
2022-02-11 21:48:52 +01:00
Matthias Krüger
0986b2d0e3
Rollup merge of #93909 - saschanaz:patch-2, r=petrochenkov
Fix typo: explicitely -> explicitly
2022-02-11 21:48:51 +01:00
Matthias Krüger
34997f0114
Rollup merge of #93888 - sunfishcode:sunfishcode/impl-asfd-for-ref, r=joshtriplett
Implement `AsFd` for `&T` and `&mut T`.

Add implementations of `AsFd` for `&T` and `&mut T`, so that users can
write code like this:

```rust
pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
```

with `fd: F` rather than `fd: &F`.

And similar for `AsHandle` and `AsSocket` on Windows.

Also, adjust the `fchown` example to pass the file by reference. The
code can work either way now, but passing by reference is more likely
to be what users will want to do.

This is an alternative to #93869, and is a simpler way to achieve the
same goals: users don't need to pass borrowed-`BorrowedFd` arguments,
and it prevents a pitfall in the case where users write `fd: F` instead
of `fd: &F`.

r? ```@joshtriplett```
2022-02-11 21:48:50 +01:00
Matthias Krüger
db7124839c
Rollup merge of #93868 - Amanieu:asm_reg_conflict, r=cjgillot
Fix incorrect register conflict detection in asm!

This would previously incorrectly reject two subregisters that were
distinct but part of the same larger register, for example `al` and
`ah`.
2022-02-11 21:48:49 +01:00
Matthias Krüger
13d636dff2
Rollup merge of #93782 - adamgemmell:dev/adagem01/split-pauth, r=Amanieu
Split `pauth` target feature

Per discussion on https://github.com/rust-lang/rust/issues/86941 we'd like to split `pauth` into `paca` and `pacg` in order to better support possible future environments that only have the keys available for address or generic authentication. At the moment LLVM has the one `pauth` target_feature while Linux presents separate `paca` and `pacg` flags for feature detection.

Because the use of [target_feature](https://rust-lang.github.io/rfcs/2045-target-feature.html) will "allow the compiler to generate code under the assumption that this code will only be reached in hosts that support the feature", it does not make sense to simply translate `paca` into the LLVM feature `pauth`, as it will generate code as if `pacg` is available.

To accommodate this we error if only one of the two features is present. If LLVM splits them in the future we can remove this restriction without making a breaking change.

r? ```@Amanieu```
2022-02-11 21:48:48 +01:00
Matthias Krüger
ffa8d6b47d
Rollup merge of #93660 - aDotInTheVoid:rustdoc-type-tests, r=CraftSpider
rustdoc-json: Add some tests for typealias item

r? ```@CraftSpider```

Improves https://github.com/rust-lang/rust/issues/81359

The test's arn't pretty, and I think eventually we need a better way of doing repeated tests on a deeply nested path,
without repeating the way to get to that path

```@rustbot``` modify labels: +A-rustdoc-json +T-rustdoc +A-rustdoc +A-testsuite
2022-02-11 21:48:47 +01:00
Matthias Krüger
15d71cff2d
Rollup merge of #93635 - GuillaumeGomez:missing-platform-spec-info, r=Amanieu
Add missing platform-specific information on current_dir and set_current_dir

Fixes #93598.
2022-02-11 21:48:46 +01:00
Matthias Krüger
642414e804
Rollup merge of #92895 - bjorn3:simplifications, r=jackh726
Remove some unused functionality

* Remove the `alt_std_name` option
* Remove the everybody loops pass
* Make two functions private
2022-02-11 21:48:44 +01:00
Matthias Krüger
b7c48b4691
Rollup merge of #91607 - FabianWolff:issue-91560-const-span, r=jackh726
Make `span_extend_to_prev_str()` more robust

Fixes #91560. The logic in `span_extend_to_prev_str()` is currently quite brittle and fails if there is extra whitespace or something else in between, and it also should return an `Option` but doesn't currently.
2022-02-11 21:48:43 +01:00
Matthias Krüger
ce4df92c8c
Rollup merge of #90955 - JohnTitor:os-error-123-as-invalid-input, r=m-ou-se
Rename `FilenameTooLong` to `InvalidFilename` and also use it for Windows' `ERROR_INVALID_NAME`

Address https://github.com/rust-lang/rust/issues/90940#issuecomment-970157931
`ERROR_INVALID_NAME` (i.e. "The filename, directory name, or volume label syntax is incorrect") happens if we pass an invalid filename, directory name, or label syntax, so mapping as `InvalidInput` is reasonable to me.
2022-02-11 21:48:42 +01:00
Michael Goulet
67ad0ffdf8 use body.tainted_by_error to skip loading MIR 2022-02-11 12:45:51 -08:00
Michael Goulet
a431174c23 add tainted_by_errors to mir::Body 2022-02-11 12:45:51 -08:00
Michael Goulet
29c2bb51c0 rework borrowck errors so that it's harder to not set tainted 2022-02-11 12:45:51 -08:00
Michael Goulet
8b7b0a0e49 always cache result from mir_borrowck 2022-02-11 12:45:51 -08:00
Michael Goulet
06eb912e76 fix tests, add new tests checking borrowck CFTE ICE 2022-02-11 12:45:51 -08:00
Michael Goulet
77dae2d25d skip const eval if we have an error in borrowck 2022-02-11 12:45:51 -08:00
Michael Goulet
4ad272b282 implement tainted_by_errors in mir borrowck 2022-02-11 12:45:51 -08:00
bors
e789f3a3a3 Auto merge of #90271 - adamgemmell:dev/feat-detect-stabilise, r=Amanieu
Stabilise `is_aarch64_feature_detected!` under `simd_aarch64` feature

Initial implementation, looking for feedback on the approach here. https://github.com/rust-lang/rust/issues/86941

One point I noticed was that I haven't seen different "since" versions for the same feature - does this mean that other features can't be added to to the `simd_aarch64` feature once this is in stable? If so it might need a more specific name.

r? `@Amanieu`
2022-02-11 20:41:51 +00:00
bjorn3
7ba4110012 Make two functions private 2022-02-11 20:28:38 +01:00
bjorn3
55ceed81fe Remove the alt_std_name option
This option introduced in #15820 allows a custom crate to be imported in
the place of std, but with the name std. I don't think there is any
value to this. At most it is confusing users of a driver that uses this option. There are no users of
this option on github. If anyone still needs it, they can emulate it
injecting #![no_core] in addition to their own prelude.
2022-02-11 20:28:38 +01:00
bors
6499c5e7fc Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk
Revert lazy TAIT PR

Revert https://github.com/rust-lang/rust/pull/92306 (sorry `@Aaron1011,` will include your changes in the fix PR)
Revert https://github.com/rust-lang/rust/pull/93783
Revert https://github.com/rust-lang/rust/pull/92007

fixes https://github.com/rust-lang/rust/issues/93788
fixes https://github.com/rust-lang/rust/issues/93794
fixes https://github.com/rust-lang/rust/issues/93821
fixes https://github.com/rust-lang/rust/issues/93831
fixes https://github.com/rust-lang/rust/issues/93841
2022-02-11 17:39:34 +00:00
Kagami Sascha Rosylight
f9cb01f802 Fix typo: explicitely->explicitly 2022-02-11 17:33:27 +01:00
Rose Hudson
45dc8ebb7c fix mention of moved function in rustc_hir docs
the function was moved from `Crate` to `Map` in db9fea508a but the
docs weren't updated
2022-02-11 15:38:31 +00:00
Guillaume Gomez
22a24c98d3 Add missing platform-specific information on current_dir and set_current_dir 2022-02-11 16:33:02 +01:00
bors
78450d2d60 Auto merge of #93891 - matthiaskrgr:rollup-xadut8w, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #92242 (Erase regions before calculating layout for packed field capture)
 - #93443 (Add comment on stable_hash_impl for OwnerNodes)
 - #93742 (Drop rustc-docs from complete profile)
 - #93852 (rustdoc: remove support for multi-query search)
 - #93853 (Make all `hir::Map` methods consistently by-value)
 - #93861 (Fix ICE if no trait assoc const eq)
 - #93862 (Split x86_64-apple builder into two)
 - #93864 (Remove ArchiveBuilder::update_symbols)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-11 15:16:09 +00:00
Oli Scherer
d54195db22 Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"
This reverts commit e7cc3bddbe, reversing
changes made to 734368a200.
2022-02-11 07:18:06 +00:00
Oli Scherer
2d8b8f3593 Revert "Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk"
This reverts commit 1f0a96862a, reversing
changes made to bf242bb119.
2022-02-11 07:17:16 +00:00
Oli Scherer
7a71b7a99e Revert "Fix regression from lazy opaque types"
This reverts commit 239f1e716d.
2022-02-11 07:14:58 +00:00
Matthias Krüger
c543f7dbd4
Rollup merge of #93864 - bjorn3:cleanup_archive_handling, r=petrochenkov
Remove ArchiveBuilder::update_symbols

All paths to an ArchiveBuilder::build call update_symbols first.
2022-02-11 07:48:10 +01:00
Matthias Krüger
219fc8f9f0
Rollup merge of #93862 - Mark-Simulacrum:apple-split, r=pietroalbini
Split x86_64-apple builder into two

This splits out roughly 20-25 minutes of work, which should result in roughly parity with some of the other apple builders at approximately 2.2-2.4 hours per successful build.

r? `@pietroalbini`
2022-02-11 07:48:09 +01:00
Matthias Krüger
a59d312280
Rollup merge of #93861 - JulianKnodt:notraitace, r=wesleywiser
Fix ICE if no trait assoc const eq

Fixes #93835
2022-02-11 07:48:08 +01:00
Matthias Krüger
ddba967855
Rollup merge of #93853 - steffahn:map_by_value, r=wesleywiser
Make all `hir::Map` methods consistently by-value

`hir::Map` only consists of a single reference (as part of the contained `TyCtxt`) anyways, so copying is literally zero overhead compared to passing a reference
2022-02-11 07:48:06 +01:00
Matthias Krüger
b97ccebc7c
Rollup merge of #93852 - GuillaumeGomez:remove-multi-query, r=jsha
rustdoc: remove support for multi-query search

This is needed by https://github.com/rust-lang/rust/pull/90630 to make feature changes non-existent.

cc `@camelid`
r? `@jsha`
2022-02-11 07:48:05 +01:00
Matthias Krüger
b8da6f4ce4
Rollup merge of #93742 - Mark-Simulacrum:skip-rustc-docs-complete, r=pietroalbini
Drop rustc-docs from complete profile

Addresses #75833, but does not fully fix it -- we should support side-by-side installation of these ideally, but that's not currently possible.

r? `@pietroalbini`
2022-02-11 07:48:04 +01:00
Matthias Krüger
8611e292e4
Rollup merge of #93443 - spastorino:add-stable-hash-impl-doc, r=cjgillot
Add comment on stable_hash_impl for OwnerNodes

r? `@cjgillot`

cc `@oli-obk`

`@bors` rollup=always
2022-02-11 07:48:03 +01:00
Matthias Krüger
664255b168
Rollup merge of #92242 - compiler-errors:layout-modulo-regions, r=matthewjasper
Erase regions before calculating layout for packed field capture

Self-explanatory. We just erase region inferencing because we don't need that for layout computation... Q: layouts are always equal modulo regions, right?

Fixes #92240
2022-02-11 07:48:02 +01:00
bors
e273fca380 Auto merge of #93865 - flip1995:clippyup, r=Manishearth,flip1995
Update Clippy

r? `@Manishearth`
2022-02-11 06:26:47 +00:00
Dan Gohman
1f98ef7793 Implement AsFd for &T and &mut T.
Add implementations of `AsFd` for `&T` and `&mut T`, so that users can
write code like this:

```rust
pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
```

with `fd: F` rather than `fd: &F`.

And similar for `AsHandle` and `AsSocket` on Windows.

Also, adjust the `fchown` example to pass the file by reference. The
code can work either way now, but passing by reference is more likely
to be what users will want to do.

This is an alternative to #93869, and is a simpler way to achieve the
same goals: users don't need to pass borrowed-`BorrowedFd` arguments,
and it prevents a pitfall in the case where users write `fd: F` instead
of `fd: &F`.
2022-02-10 18:26:12 -08:00
Mark Rousskov
a023be99c6 Split x86_64 apple builder into two 2022-02-10 15:27:00 -05:00
bors
e646f3d2a9 Auto merge of #93860 - ehuss:update-rls, r=ehuss
Update rls

2 commits in f37425e33c864c697af06df66e7473444605c149..3df74381f37617ec800537c11fb0c3130f5f3616
2022-01-15 18:07:20 +0100 to 2022-02-10 07:33:33 -0800
- chore: Upgrade cargo (rust-lang/rls#1764)
- Bump rls-analysis version
2022-02-10 19:48:52 +00:00