Commit graph

132616 commits

Author SHA1 Message Date
Mara Bos
10d2843604
Rollup merge of #78093 - camelid:as-cleanup, r=jyn514
Clean up docs for 'as' keyword
2020-11-05 10:29:38 +01:00
Mara Bos
55f4b802fb
Rollup merge of #76718 - poliorcetics:vec-ui-to-unit-test, r=jyn514
Move Vec UI tests to unit tests when possible

Helps with #76268.

I'm moving the tests using `Vec` or `VecDeque`.

````@rustbot```` modify labels: A-testsuite C-cleanup T-libs
2020-11-05 10:29:35 +01:00
bors
8c20701219 Auto merge of #78754 - pietroalbini:checkout-v2, r=Mark-Simulacrum
Bump actions/checkout to version 2

This was recommended by GitHub Support to try reducing the things that could've caused #78743. I checked the changelog and there should be no practical impact for us (we already set an explicit fetch-depth).

r? `@Mark-Simulacrum`
2020-11-05 05:14:53 +00:00
Camelid
d8afe98eba Clean up docs for 'as' keyword 2020-11-04 16:05:55 -08:00
Pietro Albini
308dbdd9fe
ci: bump actions/checkout to version 2
This was recommended by GitHub Support to try reducing the things that
could've caused #78743. I checked the changelog and there should be no
practical impact for us (we already set an explicit fetch-depth).
2020-11-05 00:05:20 +01:00
bors
0fb00251a5 Auto merge of #78662 - sexxi-goose:add_expr_id_to_delegate, r=nikomatsakis
Provide diagnostic suggestion in ExprUseVisitor Delegate

The [Delegate trait](981346fc07/compiler/rustc_typeck/src/expr_use_visitor.rs (L28-L38)) currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.

Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.

Eg:

```
let arr : [String; 5];

let [a, ...]     =   arr;
 ^^^ E1 ^^^      =  ^^E2^^
 ```

 Here `arr` is moved because of the binding created E1. However, when we
 point to E1 in diagnostics with the message `arr` was moved, it can be
 confusing.  Rather we would like to report E2 to the user.

 Closes: https://github.com/rust-lang/project-rfc-2229/issues/20

r? `@ghost`
2020-11-04 22:45:15 +00:00
bors
f2bbdd0a32 Auto merge of #78740 - pietroalbini:no-more-legacy, r=Mark-Simulacrum
Remove legacy promote-release support from build-manifestg

Now that we're not running the [legacy `promote-release`](https://github.com/rust-lang/rust-central-station/tree/master/promote-release) anymore, this PR removes support from it from `bootstrap` and `build-manifest`.

r? `@Mark-Simulacrum`
2020-11-04 20:02:08 +00:00
bors
89631663b7 Auto merge of #78280 - bugadani:span, r=lcnr
Codegen: Query span as late as possible
2020-11-04 17:17:01 +00:00
bors
75f1db1102 Auto merge of #77227 - oli-obk:const_val_🌳_prelude, r=RalfJung
Refactorings in preparation for const value trees

cc #72396

This PR changes the `Scalar::Bits { data: u128, size: u8 }` variant to `Scalar::Bits(ScalarInt)` where `ScalarInt` contains the same information, but is `repr(packed)`. The reason for using a packed struct is to allow enum variant packing to keep the original size of `Scalar` instead of adding another word to its size due to padding.
Other than that the PR just gets rid of all the inspection of the internal fields of `Scalar::Bits` which were frankly scary. These fields have invariants that we need to uphold and we can't do that without making the fields private.

r? `@ghost`
2020-11-04 14:26:03 +00:00
Oli Scherer
332750f9eb
Update compiler/rustc_target/src/abi/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 15:13:06 +01:00
Oli Scherer
5f087f089f
Update compiler/rustc_target/src/abi/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 15:12:44 +01:00
oli
6e6c8a86e9 u64::try_from will now fail if ScalarInt isn't exactly 64 bits, thus we use to_bits with the correct size 2020-11-04 13:59:11 +00:00
oli
97bfff1f56 Make ScalarInt entirely independent of MIR interpretation 2020-11-04 13:55:29 +00:00
oli
2e53625421 Document an unwrap 2020-11-04 13:44:17 +00:00
oli
abacaf2aef u128 truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
bors
601c13c6fd Auto merge of #78677 - Aaron1011:fix/capture-inner-attrs, r=petrochenkov
Use reparsed `TokenStream` if we captured any inner attributes

Fixes #78675

We now bail out of `prepend_attrs` if we ended up capturing any inner
attributes (which can happen in several places, due to token capturing
for `macro_rules!` arguments.
2020-11-04 11:37:36 +00:00
oli
e67c768110 Move ZST constant to the top of the impl block 2020-11-04 10:15:54 +00:00
Oli Scherer
cb1cf6ae95 Update compiler/rustc_middle/src/ty/consts/int.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 10:15:40 +00:00
oli
98b70c9ac0 Simplify assert_bits impl 2020-11-04 10:15:09 +00:00
oli
dad0036cb4 Do not raise interp errors from the scalar int module 2020-11-04 10:14:40 +00:00
oli
500af76831 Add helper for getting an int out of a Scalar 2020-11-04 10:13:59 +00:00
oli
f03b18b99b Add is_null helper
This is cheaper than creating a null-`ScalarInt` and comparing
and then just throwing it away.
2020-11-04 10:13:22 +00:00
oli
0347ca7d02 Explain why we forward to self-printing during self-printing 2020-11-04 10:13:09 +00:00
oli
d1074edb64 catch conversion errors during ptr_sized_op 2020-11-04 10:12:55 +00:00
oli
8282d526e0 Replace Scalar::zst with a Scalar::ZST constant 2020-11-04 10:12:41 +00:00
oli
b8751c1fbb No need for a zst constructor method when we can have a constant 2020-11-04 10:12:27 +00:00
oli
3ef9dfdd42 Update comment 2020-11-04 10:12:13 +00:00
oli
1eb300ede1 Unaligned reads are UB in Rust irrelevant on which platform we are 2020-11-04 10:11:59 +00:00
oli
e5258e6143 Remove outdated FIXME 2020-11-04 10:11:45 +00:00
oli
df4d717d0b s/Scalar::Raw/Scalar::Int 2020-11-04 10:11:31 +00:00
oli
3a7970848c Fix cranelift build 2020-11-04 10:10:44 +00:00
oli
c478574786 Explain the use of blocks around self.data accesses 2020-11-04 10:10:04 +00:00
oli
02131f4dcd Use packed struct instead of manually packing into an array 2020-11-04 10:09:10 +00:00
Oliver Scherer
ed7a4adeb3 32 bit platforms don't have 64 bit pointers 2020-11-04 09:58:59 +00:00
Oliver Scherer
eac309984f Encode ScalarInt::bytes as u128 instead of [u8; 16] to see if that caused the performance regression 2020-11-04 09:58:59 +00:00
Oliver Scherer
362123dd75 Split the "raw integer bytes" part out of Scalar 2020-11-04 09:58:59 +00:00
Dhruv Jauhar
c9d9359b00 Address Pr comments regarding docstrings 2020-11-04 02:54:00 -05:00
bors
56293097f7 Auto merge of #78711 - m-ou-se:rollup-pxqnny7, r=m-ou-se
Rollup of 7 pull requests

Successful merges:

 - #77950 (Add support for SHA256 source file hashing)
 - #78624 (Sync rustc_codegen_cranelift)
 - #78626 (Improve errors about #[deprecated] attribute)
 - #78659 (Corrected suggestion for generic parameters in `function_item_references` lint)
 - #78687 (Suggest library/std when running all stage 0 tests)
 - #78699 (Show more error information in lldb_batchmode)
 - #78709 (Fix panic in bootstrap for non-workspace path dependencies.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-03 18:58:06 +00:00
Mara Bos
a65507b47d
Rollup merge of #78709 - ehuss:fix-in_tree_crates-non-member, r=Mark-Simulacrum
Fix panic in bootstrap for non-workspace path dependencies.

If you add a `path` dependency to a `Cargo.toml` that is located outside of the workspace, then the `in_tree_crates` function can panic because it finds a path dependency that is not defined (since it uses `cargo metadata --no-deps`).  This fixes it by skipping over those entries, which are usually not things you select on the command-line.

Fixes #78617
2020-11-03 19:32:44 +01:00
Mara Bos
f9dd8d37c2
Rollup merge of #78699 - pietroalbini:lldb-error, r=jyn514
Show more error information in lldb_batchmode

Even more information to try and debug #78665.
2020-11-03 19:32:42 +01:00
Mara Bos
8a1f9e09a1
Rollup merge of #78687 - jyn514:bootstrap-help, r=Mark-Simulacrum
Suggest library/std when running all stage 0 tests

r? ``@Mark-Simulacrum``
cc ``@ijackson``

For context, this came out of a discord conversation where ``@ijackson`` was running `test --stage 1` when they were only adding doc-tests to the standard library.
2020-11-03 19:32:40 +01:00
Mara Bos
f347dab47c
Rollup merge of #78659 - ayrtonm:fn-ref-lint-fix, r=oli-obk
Corrected suggestion for generic parameters in `function_item_references` lint

This commit handles functions with generic type parameters like you pointed out as well as const generics. Also this is probably a minor thing, but the type alias you used in the example doesn't show up so the suggestion right now would be `size_of::<[u8; 16]> as fn() ->`. This is because the lint checker works with MIR instead of HIR. I don't think we can get the alias at that point, but let me know if I'm wrong and there's a way to fix this. Also I put you as the reviewer, but I'm not sure if you want to review it or if it makes more sense to ask one of the original reviewers of this lint.
closes #78571
2020-11-03 19:32:38 +01:00
Mara Bos
f0112928cb
Rollup merge of #78626 - fusion-engineering-forks:deprecated-trait-impl, r=estebank
Improve errors about #[deprecated] attribute

This change:

1. Turns `#[deprecated]` on a trait impl block into an error, which fixes #78625;
2. Changes these and other errors about `#[deprecated]` to use the span of the attribute instead of the item; and
3. Turns this error into a lint, to make sure it can be capped with `--cap-lints` and doesn't break any existing dependencies.

Can be reviewed per commit.

---
Example:
```rust
struct X;

#[deprecated = "a"]
impl Default for X {
    #[deprecated = "b"]
    fn default() -> Self {
        X
    }
}
```

Before:
```
error: This deprecation annotation is useless
 --> src/main.rs:6:5
  |
6 | /     fn default() -> Self {
7 | |         X
8 | |     }
  | |_____^
```

After:
```
error: this `#[deprecated]' annotation has no effect
 --> src/main.rs:3:1
  |
3 | #[deprecated = "a"]
  | ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute
  |
  = note: `#[deny(useless_deprecated)]` on by default

error: this `#[deprecated]' annotation has no effect
 --> src/main.rs:5:5
  |
5 |     #[deprecated = "b"]
  |     ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute
```
2020-11-03 19:32:36 +01:00
Mara Bos
39f5563e73
Rollup merge of #78624 - bjorn3:update_cg_clif-2020-11-01, r=jyn514
Sync rustc_codegen_cranelift

This fixes bootstrapping of rustc using cg_clif again. It regressed a while before #77975 got merged.

Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/743
2020-11-03 19:32:34 +01:00
Mara Bos
52405f7c0c
Rollup merge of #77950 - arlosi:sha256, r=eddyb
Add support for SHA256 source file hashing

Adds support for `-Z src-hash-algorithm sha256`, which became available in LLVM 11.

Using an older version of LLVM will cause an error `invalid checksum kind` if the hash algorithm is set to sha256.

r? `@eddyb`
cc #70401 `@est31`
2020-11-03 19:32:26 +01:00
Eric Huss
2172adbd5c Fix panic in bootstrap for non-workspace path dependencies. 2020-11-03 09:54:11 -08:00
bors
5cdf5b882d Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiser
Properly handle lint spans after MIR inlining

The first commit shows what happens when we apply mir inlining and then cause lints on the inlined MIR.
The second commit fixes that.

r? `@wesleywiser`
2020-11-03 16:32:34 +00:00
bors
0cd1516696 Auto merge of #78597 - RalfJung:raw-retag, r=oli-obk
Retagging: do not retag 'raw reborrows'

When doing `&raw const (*raw_ptr).field`, we do not want any retagging; the original provenance should be fully preserved.

Fixes https://github.com/rust-lang/miri/issues/1608
Test added by https://github.com/rust-lang/miri/pull/1614

Not sure whom to ask for review on this... `@oli-obk` can you have a look? Or maybe highfive makes a good choice.^^
2020-11-03 13:48:54 +00:00
Pietro Albini
7704d35acc
build-manifest: remove legacy promote-release support
This commit removes support for the legacy promote-release, as that's
not executed anymore on the nightly channel.
2020-11-03 12:15:06 +01:00
Pietro Albini
c32de757cd
lldb_batchmode: show more error information
Even more information to try and debug #78665.
2020-11-03 12:01:46 +01:00