Commit Graph

119569 Commits

Author SHA1 Message Date
Ralf Jung
c7eb91652f deduplicate warnings 2020-04-30 19:42:14 +02:00
Ralf Jung
9273962aef remove no longer needed feature flags 2020-04-30 19:34:58 +02:00
Ralf Jung
e2c99f0deb unleashed Miri: open all the gates 2020-04-30 18:58:50 +02:00
Ralf Jung
30b32c6570 Miri: port error backtraces to std::backtrace 2020-04-30 18:26:51 +02:00
Bastian Kauschke
a08bccb3c1 handle ByRef in relate 2020-04-30 17:44:24 +02:00
Bastian Kauschke
01b3637f6e coerce documentation 2020-04-30 17:44:24 +02:00
bors
be8589fc31 Auto merge of #71675 - pietroalbini:ci-fix-shrink-regression, r=Mark-Simulacrum
ci: use bash when executing the "bors build finished" jobs

We don't clone the repository in those builders, so the default shell (`src/ci/exec-with-shell.py`) is not present there. This fixes a GHA regression introduced in #71434.

r? @Mark-Simulacrum
2020-04-30 15:35:16 +00:00
Oliver Scherer
8079dd8afe A test now fails during check instead of build 2020-04-30 17:27:33 +02:00
Oliver Scherer
9cdc9321fd Address review comments 2020-04-30 17:06:11 +02:00
Oliver Scherer
a91bad6542 Highlight an error that can only happen in CTFE 2020-04-30 17:06:11 +02:00
Oliver Scherer
b2395a5ea6 Add a convenience function for testing whether a static is #[thread_local] 2020-04-30 17:06:11 +02:00
Oliver Scherer
582d52f0bd Separate miri/ctfe unsupported operations 2020-04-30 17:06:11 +02:00
bors
eece58a8e3 Auto merge of #71707 - Dylan-DPC:rollup-hk8itvo, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71205 (rustc: fix check_attr() for methods, closures and foreign functions)
 - #71540 (Suggest deref when coercing `ty::Ref` to `ty::RawPtr`)
 - #71655 (Miri: better document and fix dynamic const pattern soundness checks)
 - #71672 (document missing stable counterparts of intrinsics)
 - #71692 (Add clarification on std::cfg macro docs v. #[cfg] attribute)

Failed merges:

r? @ghost
2020-04-30 12:17:15 +00:00
Dylan DPC
8f6eabfbae
Rollup merge of #71692 - dfreese:cfgdocs, r=kennytm
Add clarification on std::cfg macro docs v. #[cfg] attribute

The wording was discussed, to a limited degree in #71679.  This tries to
address some confusion I as well as someone else had independently when
looking at this macro.

Fixes #71679
2020-04-30 14:07:58 +02:00
Dylan DPC
e2333a974a
Rollup merge of #71672 - lcnr:instrinsics-wow, r=Dylan-DPC
document missing stable counterparts of intrinsics

Notes the stable counterpart of each intrinsic in case one exists.

Implements #34338

r? @Dylan-DPC
2020-04-30 14:07:57 +02:00
Dylan DPC
71bf986f4b
Rollup merge of #71655 - RalfJung:const-pattern-soundness, r=oli-obk
Miri: better document and fix dynamic const pattern soundness checks

https://github.com/rust-lang/const-eval/issues/42 got me thinking about soundness for consts being used in patterns, and I found a hole in our existing dynamic checks: a const referring to a mutable static *in a different crate* was not caught. This PR fixes that. It also adds some comments that explain which invariants are crucial for soundness of const-patterns.

Curiously, trying to weaponize this soundness hole failed: pattern matching compilation ICEd when encountering the cross-crate static, saying "expected allocation ID alloc0 to point to memory". I don't know why that would happen, statics *should* be entirely normal memory for pattern matching to access.

r? @oli-obk
Cc @rust-lang/wg-const-eval
2020-04-30 14:07:55 +02:00
Dylan DPC
58d955e6cc
Rollup merge of #71540 - ldm0:ref2ptr, r=oli-obk
Suggest deref when coercing `ty::Ref` to `ty::RawPtr`

Fixes #32122

Currently we do autoderef when casting `ty::Ref` ->`ty::Ref`, but we don't autoderef when casting `ty::Ref` -> `ty::RawPtr`. This PR make the compiler suggests deref when coercing `ty::Ref` to `ty::RawPtr`
2020-04-30 14:07:53 +02:00
Dylan DPC
4e6772b52b
Rollup merge of #71205 - NeoRaider:check_attr, r=jonas-schievink
rustc: fix check_attr() for methods, closures and foreign functions

This fixes an issue that previously turned up for methods in https://github.com/rust-lang/rust/pull/69274, but also exists for closures and foreign function: `check_attr` does not call `codegen_fn_attrs()` for these types when it should, meaning that incorrectly used function attributes are not diagnosed without codegen.

The issue affects our UI tests, as they run with `--emit=metadata` by default, but as it turns out, this is not the only case: Function attributes are not checked on any dead code without this fix!

This makes the fix a **breaking change**. The following very silly Rust programs compiles fine on stable Rust when it should not, which is fixed by this PR.
```rust
fn main() {
    #[target_feature(enable = "sse2")]
    || {};
}
```

I assume any real-world program which may trigger this issue would at least emit a dead code warning, but of course that is no guarantee that such code does not exist...

Fixes #70307
2020-04-30 14:07:52 +02:00
cohenarthur
eda7f8fdff rename-unique: Rename Unique::empty() to Unique::dangling()
rename-unique: Change calls and doc in raw_vec.rs

rename-unique: Change empty() -> dangling() in const-ptr-unique-rpass.rs
2020-04-30 11:00:45 +02:00
bors
bf459752d4 Auto merge of #70175 - Amanieu:remove_nlp, r=pnkfelix
Remove -Z no-landing-pads flag

Since #67502, `-Z no-landing-pads` will cause all attempted unwinds to abort since we don't generate a `try` / `catch`. This previously worked because `__rust_try` was located in libpanic_unwind which is always compiled with `-C panic=unwind`, but `__rust_try` is now directly inline into the crate that uses `catch_unwind`.

As such, `-Z no-landing-pads` is now mostly useless and people should use `-C panic=abort` instead.
2020-04-30 07:04:43 +00:00
bors
7c8dbd969d Auto merge of #71687 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/71632
r? @ghost
Cc @rust-lang/miri
2020-04-30 03:48:47 +00:00
bors
1357af3a55 Auto merge of #71528 - alexcrichton:no-more-bitcode, r=nnethercote
Store LLVM bitcode in object files, not compressed

This commit is an attempted resurrection of #70458 where LLVM bitcode
emitted by rustc into rlibs is stored into object file sections rather
than in a separate file. The main rationale for doing this is that when
rustc emits bitcode it will no longer use a custom compression scheme
which makes it both easier to interoperate with existing tools and also
cuts down on compile time since this compression isn't happening.

The blocker for this in #70458 turned out to be that native linkers
didn't handle the new sections well, causing the sections to either
trigger bugs in the linker or actually end up in the final linked
artifact. This commit attempts to address these issues by ensuring that
native linkers ignore the new sections by inserting custom flags with
module-level inline assembly.

Note that this does not currently change the API of the compiler at all.
The pre-existing `-C bitcode-in-rlib` flag is co-opted to indicate
whether the bitcode should be present in the object file or not.

Finally, note that an important consequence of this commit, which is also
one of its primary purposes, is to enable rustc's `-Clto` bitcode
loading to load rlibs produced with `-Clinker-plugin-lto`. The goal here
is that when you're building with LTO Cargo will tell rustc to skip
codegen of all intermediate crates and only generate LLVM IR. Today
rustc will generate both object code and LLVM IR, but the object code is
later simply thrown away, wastefully.
2020-04-29 23:47:27 +00:00
bors
fa51f810e5 Auto merge of #71689 - Dylan-DPC:rollup-8nyuwm1, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #71507 (Document unsafety in core::ptr)
 - #71572 (test iterator chain type length blowup)
 - #71617 (Suggest `into` instead of `try_into` if possible with int types)
 - #71627 (Fix wrong argument in autoderef process)
 - #71678 (Add an index page for nightly rustc docs.)
 - #71680 (Fix doc link to Eq trait from PartialEq trait)

Failed merges:

 - #71597 (Rename Unique::empty() -> Unique::dangling())

r? @ghost
2020-04-29 20:32:41 +00:00
bors
0a53ed2d8e Auto merge of #5547 - CrazyRoka:fix-clone-double-ref-suggestion, r=flip1995
Fixed incorrect suggestion of `clone_double_ref` lint

- Added `<_>` to suggestion
- Changed help message
- Added new tests
Closes #5494

changelog: Improve suggestion of [`clone_double_ref`]
2020-04-29 20:05:18 +00:00
CrazyRoka
20c069beec Fixed incorrect suggestion of clone_double_ref lint
- Added `<_>` to suggestion
- Changed help message
2020-04-29 22:40:57 +03:00
Dylan MacKenzie
0592976f7e Bless tests 2020-04-29 12:18:30 -07:00
David Freese
610f944231
Update src/libcore/macros/mod.rs
Co-Authored-By: kennytm <kennytm@gmail.com>
2020-04-29 12:16:32 -07:00
Alex Crichton
ef89cc8f04 Store LLVM bitcode in object files, not compressed
This commit is an attempted resurrection of #70458 where LLVM bitcode
emitted by rustc into rlibs is stored into object file sections rather
than in a separate file. The main rationale for doing this is that when
rustc emits bitcode it will no longer use a custom compression scheme
which makes it both easier to interoperate with existing tools and also
cuts down on compile time since this compression isn't happening.

The blocker for this in #70458 turned out to be that native linkers
didn't handle the new sections well, causing the sections to either
trigger bugs in the linker or actually end up in the final linked
artifact. This commit attempts to address these issues by ensuring that
native linkers ignore the new sections by inserting custom flags with
module-level inline assembly.

Note that this does not currently change the API of the compiler at all.
The pre-existing `-C bitcode-in-rlib` flag is co-opted to indicate
whether the bitcode should be present in the object file or not.

Finally, note that an important consequence of this commit, which is also
one of its primary purposes, is to enable rustc's `-Clto` bitcode
loading to load rlibs produced with `-Clinker-plugin-lto`. The goal here
is that when you're building with LTO Cargo will tell rustc to skip
codegen of all intermediate crates and only generate LLVM IR. Today
rustc will generate both object code and LLVM IR, but the object code is
later simply thrown away, wastefully.
2020-04-29 11:57:26 -07:00
David Freese
4813a81432 Add clarification on std::cfg macro docs v. #[cfg] attribute
The wording was discussed, to a limited degree in #71679.  This tries to
address some confusion I as well as someone else had independently when
looking at this macro.

Fixes #71679
2020-04-29 11:50:23 -07:00
Dylan MacKenzie
a1aff18689 Allow Unreachable terminators unconditionally 2020-04-29 10:53:28 -07:00
Dylan DPC
d11b5597f8
Rollup merge of #71680 - nicholasbishop:bishop-fix-eq-link, r=Mark-Simulacrum
Fix doc link to Eq trait from PartialEq trait

The `Eq` link was incorrectly going to the `eq` method of `PartialEq`
instead of to the `Eq` trait.
2020-04-29 19:39:37 +02:00
Dylan DPC
3286436e32
Rollup merge of #71678 - ehuss:rustc-doc-index, r=Mark-Simulacrum
Add an index page for nightly rustc docs.

This adds an `index.html` page at the root of the nightly-rustc docs so that the URL https://doc.rust-lang.org/nightly/nightly-rustc/ should have a landing page that lists all the crates.
2020-04-29 19:39:36 +02:00
Dylan DPC
75561a56ac
Rollup merge of #71627 - ldm0:autoderefarg, r=Dylan-DPC
Fix wrong argument in autoderef process

The `overloaded_deref_ty` is a function for derefencing a type which overloads the `Deref` trait. But actually this function never uses the parameter pushed in until this PR. -_-
2020-04-29 19:39:34 +02:00
Dylan DPC
e3bf8709db
Rollup merge of #71617 - samrat:suggest-int-into, r=ecstatic-morse
Suggest `into` instead of `try_into` if possible with int types

If it is possible to convert an integer type into another using `into`, don't suggest `try_into`. This commit changes the suggested method to convert from one integer type to another for the following cases:

- u{n} -> i{m} where n < m
- u8 -> isize
- i{n} -> isize where n <= 16
- u{n} -> usize where n <= 16

Fixes #71580
2020-04-29 19:39:33 +02:00
Dylan DPC
843ffb8e8a
Rollup merge of #71572 - lcnr:type_length, r=Dylan-DPC
test iterator chain type length blowup

Adds a regression test. closes #58952

r? @Dylan-DPC
2020-04-29 19:39:30 +02:00
Dylan DPC
d9761daa57
Rollup merge of #71507 - CohenArthur:document-unsafe-libcore-ptr, r=Mark-Simulacrum
Document unsafety in core::ptr

Contributes to #66219

I have yet to document all the `unsafe` blocks in the lib and would like to know if I'm headed in the right direction

r? @steveklabnik
2020-04-29 19:39:28 +02:00
Dylan MacKenzie
bd8a6d7911 Allow Downcast projections unconditionally 2020-04-29 10:30:00 -07:00
Ralf Jung
a430bd5549 update Miri 2020-04-29 19:25:32 +02:00
bors
c50bd7e402 Auto merge of #71674 - flip1995:clippyup, r=Dylan-DPC
Update Clippy

Fixes #71608
2020-04-29 17:13:33 +00:00
Eric Huss
1776de948c Bump pulldown-cmark 2020-04-29 09:30:16 -07:00
Nicholas Bishop
f408a4e9bd Fix doc link to Eq trait from PartialEq trait
The `Eq` link was incorrectly going to the `eq` method of `PartialEq`
instead of to the `Eq` trait.
2020-04-29 12:06:32 -04:00
Eric Huss
d6336dfe01 Add an index page for nightly rustc docs. 2020-04-29 08:16:39 -07:00
Pietro Albini
fde5811d74
ci: use bash when executing the "bors build finished" jobs
We don't clone the repository in those builders, so the default shell
(src/ci/exec-with-shell.py) is not present there.
2020-04-29 16:32:32 +02:00
Donough Liu
a985879113 Suggest deref when coercing ty::Ref to ty::RawPtr 2020-04-29 22:21:33 +08:00
flip1995
891b0e2dff
Update Clippy 2020-04-29 16:09:04 +02:00
bors
28197b6226 Auto merge of #5545 - flip1995:rustup, r=flip1995
Rustup to rust-lang/rust#71518

changelog: none
2020-04-29 13:59:30 +00:00
bors
36d13cb01b Auto merge of #67343 - ecstatic-morse:qualif-structural-match, r=pnkfelix
Const qualification for `StructuralEq`

Furthers #62411. Resolves #62614.

The goal of this PR is to implement the logic in #67088 on the MIR instead of the HIR. It uses the `Qualif` trait to track `StructuralPartialEq`/`StructuralEq` in the final value of a `const`. Then, if we encounter a constant during HAIR lowering whose value may not be structurally matchable, we emit the `indirect_structural_match` lint.

This PR contains all the tests present in #67088 and emits the proper warnings for the corner cases. This PR does not handle #65466, which would require that we be [more aggressive](42abbd8878/src/librustc_mir_build/hair/pattern/const_to_pat.rs (L126-L130)) when checking matched types for `PartialEq`. I think that should be done separately.

Because this works on MIR and uses dataflow, this PR should accept more cases than #67088. Notably, the qualifs in the final value of a const are encoded cross-crate, so matching on a constant whose value is defined in another crate to be `Option::<TyWithCustomEqImpl>::None` should work. Additionally, if a `const` has branching/looping, we will only emit the warning if any possible control flow path could result in a type with a custom `PartialEq` impl ending up as the final value of a `const`. I'm not sure how #67088 handled this.

AFAIK, it's not settled that these are the semantics we actually want: it's just how the `Qualif` framework happens to work. If the cross-crate part is undesirable, it would be quite easy to change the result of `mir_const_qualif().custom_eq` to `true` before encoding it in the crate metadata. This way, other crates would have to assume that all publicly exported constants may not be safe for matching.

r? @pnkfelix
cc @eddyb
2020-04-29 13:59:22 +00:00
Bastian Kauschke
827d6f6c3d document stable counterparts of intrinsics 2020-04-29 15:50:21 +02:00
flip1995
cd3480991a
Rustup to rust-lang/rust#71518 2020-04-29 15:48:43 +02:00
Ralf Jung
07772fcf6f expand comment in memory.rs with extra soundness concerns 2020-04-29 14:56:40 +02:00