Commit Graph

162804 Commits

Author SHA1 Message Date
bors
9c3a3e3d5b Auto merge of #93697 - the8472:fix-windows-path-hash, r=Mark-Simulacrum
Fix hashing for windows paths containing a CurDir component

* the logic only checked for / but not for \
* verbatim paths shouldn't skip items at all since they don't get normalized
* the extra branches get optimized out on unix since is_sep_byte is a trivial comparison and is_verbatim is always-false
* tests lacked windows coverage for these cases

That lead to equal paths not having equal hashes and to unnecessary collisions.
2022-02-12 14:01:13 +00:00
The 8472
1d21ce723c ignore test on wasm32
A fix applied to std::Path::hash triggers a miscompilation/assert in LLVM in this test on wasm32.
The miscompilation appears to pre-existing. Reverting some previous changes done std::Path also trigger it
and slight modifications such as changing the test path from "a" to "ccccccccccc" also make it pass, indicating
it's very flaky.
Since the fix is for a higher-tier platform than wasm it takes precedence.
2022-02-12 12:54:25 +01:00
bors
f8f175199e Auto merge of #93933 - matthiaskrgr:rollup-1hjae6g, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #91908 (Add 2 tests)
 - #93595 (fix ICE when parsing lifetime as function argument)
 - #93757 (Add some known GAT bugs as tests)
 - #93759 (Pretty print ItemKind::Use in rustfmt style)
 - #93897 (linkchecker: fix panic on directory symlinks)
 - #93898 (tidy: Extend error code check)
 - #93928 (Add missing release notes for #85200)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-12 11:48:53 +00:00
Matthias Krüger
0e3ecd28fd
Rollup merge of #93928 - nsunderland1:master, r=Mark-Simulacrum
Add missing release notes for #85200

Fixes #93894
2022-02-12 09:26:26 +01:00
Matthias Krüger
16f490f354
Rollup merge of #93898 - GuillaumeGomez:error-code-check, r=Mark-Simulacrum
tidy: Extend error code check

We discovered in https://github.com/rust-lang/rust/pull/93845 that the error code tidy check didn't check everything: if you remove an error code from the listing even if it has an explanation, then it should error.

It also allowed me to put back `E0192` in that listing as well.

r? ```@Mark-Simulacrum```
2022-02-12 09:26:25 +01:00
Matthias Krüger
475b45f9f1
Rollup merge of #93897 - schopin-pro:linkchecker-symlink, r=Mark-Simulacrum
linkchecker: fix panic on directory symlinks

In Debian and Ubuntu, there are some patches that change the rustc/fonts
directory to a symlink to the system fonts. This triggers a latent bug
in linkchecker, as the DirEntry filetype isn't a dir but later on the
file itself, when opened, is one, triggering an unreachable!() clause.

This patch fixes the situation by using std::fs::metadata, which goes
through symlinks.

I'd have added a test case but `tidy` doesn't seem to like symlinks, and
moreover I'm not sure how Git deals with symlinks on Windows.

Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
2022-02-12 09:26:24 +01:00
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
nsunderland1
56d43a28fe Add missing release notes for #85200 2022-02-11 18:07:12 -08: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
Guillaume Gomez
087fb23dc9 Add missing E0192 in the error code listing 2022-02-12 00:43:09 +01: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
Guillaume Gomez
9322d099af Check that error code explanations are listed in error_codes.rs 2022-02-11 12:06:13 +01:00
Simon Chopin
3a1ffead36 linkchecker: fix panic on directory symlinks
In Debian and Ubuntu, there are some patches that change the rustc/fonts
directory to a symlink to the system fonts. This triggers a latent bug
in linkchecker, as the DirEntry filetype isn't a dir but later on the
file itself, when opened, is one, triggering an unreachable!() clause.

This patch fixes the situation by using std::fs::metadata, which goes
through symlinks.

I'd have added a test case but `tidy` doesn't seem to like symlinks, and
moreover I'm not sure how Git deals with symlinks on Windows.

Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
2022-02-11 10:45:59 +01: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