Commit Graph

162992 Commits

Author SHA1 Message Date
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
Deadbeef 12397ab48b
Report the selection error when possible 2022-02-12 19:24:43 +11:00
Deadbeef cccf4b2fc3
Adapt new change 2022-02-12 19:24:43 +11:00
Deadbeef d3acb9d00e
Handle Fn family trait call errror 2022-02-12 19:24:43 +11:00
Deadbeef 6d6314f878
Rebased and improved errors 2022-02-12 19:24:42 +11:00
Deadbeef b5235ea732
bless you 2022-02-12 19:24:41 +11:00
Deadbeef f7f0f843b7
Improve error messages even more 2022-02-12 19:24:08 +11:00
Deadbeef 1b0dcdc341
More informative error message for E0015 2022-02-12 19:24:04 +11: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
Erik Desjardins ae877003ec fix non-x64 tests 2022-02-12 00:13:10 -05:00
cyqsimon f6f93fd7ba
Add note on Windows path behaviour 2022-02-12 12:52:42 +08:00
yuhaixin.hx daa3c795dc add link to format_args! when being mentioned in doc 2022-02-12 12:35:30 +08:00
cyqsimon 160faf1b30
`Option::and_then` basic example: show failure 2022-02-12 12:23:38 +08:00
cyqsimon adfac00f45
`Result::and_then`: show type conversion 2022-02-12 12:19:03 +08:00
cyqsimon 7eaecc6508
`Result::and_then`: improve basic example 2022-02-12 12:12:11 +08: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
Camille GILLOT 10cf626d0e Bless nll tests. 2022-02-12 01:26:17 +01:00
Camille GILLOT c6a3f5d606 Update error code documentation. 2022-02-12 01:26:17 +01:00
Camille GILLOT 289216f281 Bless clippy test. 2022-02-12 01:26:17 +01:00
Camille GILLOT a3f2a326f5 Filter out anonymous generics in rustdoc. 2022-02-12 01:26:17 +01:00
Camille GILLOT a4da6308b7 Inherit lifetimes for async fn instead of duplicating them. 2022-02-12 01:26:11 +01:00
Jon Gjengset 36692741a2 bootstrap: -static-libstdc++ is a linker flag
Fixes #70468. Closes #89983.
2022-02-11 16:09:57 -08:00
Jon Gjengset 07dae5a97b bootstrap: make LLVM build respect *FLAGS envvars
This tidies up the logic in `src/bootstrap/native.rs` such that:

 - `CMAKE_*_LINKER_FLAGS` is not overridden if we add to it twice.
 - `CMAKE_*_FLAGS` also include the standard `*FLAGS` environment
   variables, which CMake respects when we _don't_ set `CMAKE_*_FLAGS`.
 - `llvm.ldflags` from `config.toml` appends to the ldflags Rust's
   bootstrap logic adds, rather than replacing them.

Fixes #93880.
2022-02-11 16:09:38 -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
Matthew Jasper caa10dc572 Renumber universes when canonicalizing for Chalk
This is required to avoid creating large numbers of universes from each
Chalk query, while still having enough universe information for lifetime
errors.
2022-02-11 21:38:17 +00:00
Matthew Jasper 1e6d38230f Reverse parameter to placeholder substitution in chalk results 2022-02-11 21:38:17 +00:00
Matthew Jasper d4fa173ed3 Fix more chalk lowering issues
- Implement lowering for subtype goals
- Use correct lang item for Generator trait
- Use `lower_into` for lowering `ty::Variance`
2022-02-11 21:38:17 +00:00
Matthew Jasper cb3cff3761 Stop using a placeholder for empty regions in Chalk 2022-02-11 21:38:16 +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