Commit Graph

132596 Commits

Author SHA1 Message Date
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
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
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
c32de757cd
lldb_batchmode: show more error information
Even more information to try and debug #78665.
2020-11-03 12:01:46 +01:00
bjorn3
216c4ae463 Merge commit '03f01bbe901d60b71cf2c5ec766aef5e532ab79d' into update_cg_clif-2020-11-01 2020-11-03 11:00:04 +01:00
bors
8e8939b804 Auto merge of #78489 - bugadani:array, r=estebank
Minor cleanup around incremental compilation

* Remove some short lived vectors
* Fix some typos
* Avoid some reallocations
2020-11-03 09:19:01 +00:00
bors
d662f80855 Auto merge of #78697 - JohnTitor:rollup-q0fchpv, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #78376 (Treat trailing semicolon as a statement in macro call)
 - #78400 (Fix unindent in doc comments)
 - #78575 (Add a test for compiletest rustc-env & unset-rustc-env directives)
 - #78616 (Document -Zinstrument-coverage)
 - #78663 (Fix ICE when a future-incompat-report has its command-line level capped)
 - #78664 (Fix intrinsic size_of stable link)
 - #78668 (inliner: Remove redundant loop)
 - #78676 (add mipsel-unknown-none target)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-03 06:56:46 +00:00
Yuki Okushi
1cb137b3e9
Rollup merge of #78676 - kiffie:embedded-bare-mipsr2, r=jonas-schievink
add mipsel-unknown-none target

This adds a target for bare MIPS32r2, little endian, softfloat. This target can be used for PIC32 microcontrollers (or possibly for other devices that have a MIPS MCU core such as the M4K core).

Tried to find a name for the target that is in line with the naming scheme apparently used for the other MIPS targets.

r? `@jonas-schievink`
2020-11-03 15:27:21 +09:00
Yuki Okushi
cf062179a8
Rollup merge of #78668 - tmiasko:inline, r=oli-obk
inliner: Remove redundant loop

No functional changes intended.
2020-11-03 15:27:19 +09:00
Yuki Okushi
9d4cdbbfcd
Rollup merge of #78664 - pickfire:patch-4, r=jonas-schievink
Fix intrinsic size_of stable link

I noticed that it is pointing to the same link when I was reading
https://github.com/rust-lang/rust-clippy/issues/2997
2020-11-03 15:27:18 +09:00
Yuki Okushi
8894c903cb
Rollup merge of #78663 - Aaron1011:fix/cap-future-compat, r=tmandry
Fix ICE when a future-incompat-report has its command-line level capped

Fixes #78660

With PR https://github.com/rust-lang/rust/pull/75534 merged, we now run
more lint-related code for future-incompat-report, even when their final
level is Allow. Some lint-related code was not expecting `Level::Allow`,
and had an explicit panic.

This PR explicitly tracks the lint level set on the command line before
`--cap-lints` is applied. This is used to emit a more precise error
note (e.g. we don't say that `-W lint-name` was specified on the
command line just because a lint was capped to Warn). As a result, we
can now correctly emit a note that `-A` was used if we got
`Level::Allow` from the command line (before the cap is applied).
2020-11-03 15:27:16 +09:00
Yuki Okushi
416dd6757b
Rollup merge of #78616 - richkadel:unstable-book-instr-cov, r=tmandry
Document -Zinstrument-coverage

r? ``@tmandry``
FYI ``@wesleywiser``

Here is my proposed document for LLVM source-based code coverage.

I based it on the `profile.md` page, in the same directory, and on the Clang guide for LLVM source-based coverage.
2020-11-03 15:27:13 +09:00
Yuki Okushi
54d9a67ba5
Rollup merge of #78575 - tmiasko:compiletest-rustc-env, r=Aaron1011
Add a test for compiletest rustc-env & unset-rustc-env directives

... and move compiletest meta tests into a separate directory.
2020-11-03 15:27:11 +09:00
Yuki Okushi
e731a5a7f5
Rollup merge of #78400 - GuillaumeGomez:fix-unindent, r=jyn514
Fix unindent in doc comments

Fixes #70732

r? ``@jyn514``
2020-11-03 15:27:05 +09:00
Yuki Okushi
0716724a0b
Rollup merge of #78376 - Aaron1011:feature/consistent-empty-expr, r=petrochenkov
Treat trailing semicolon as a statement in macro call

See #61733 (comment)

We now preserve the trailing semicolon in a macro invocation, even if
the macro expands to nothing. As a result, the following code no longer
compiles:

```rust
macro_rules! empty {
    () => { }
}

fn foo() -> bool { //~ ERROR mismatched
    { true } //~ ERROR mismatched
    empty!();
}
```

Previously, `{ true }` would be considered the trailing expression, even
though there's a semicolon in `empty!();`

This makes macro expansion more token-based.
2020-11-03 15:27:03 +09:00
bors
7b5a9e9cd2 Auto merge of #78448 - rylev:cache-foreign_modules, r=wesleywiser
foreign_modules query hash table lookups

When compiling a large monolithic crate we're seeing huge times in the `foreign_modules` query due to repeated iteration over foreign modules (in order to find a module by its id). This implements hash table lookups so that which massively reduces time spent in that query in this particular case. We'll need to see if the overhead of creating the hash table has a negative impact on performance in more normal compilation scenarios.

I'm working with `@wesleywiser` on this.
2020-11-03 04:27:27 +00:00