Commit Graph

108179 Commits

Author SHA1 Message Date
Matthew Jasper 0bbbe719e8 Implement soundness check for min_specialization 2020-03-15 13:22:58 +00:00
Matthew Jasper 32d330df30 Avoid ICEs when we emit errors constructing the specialization graph 2020-03-15 13:22:34 +00:00
Matthew Jasper c24b4bf410 Add attributes to allow specializing on traits 2020-03-15 12:44:25 +00:00
Matthew Jasper a62dd0e3ba Add `min_specialization` feature
Currently the only difference between it and `specialization` is that
it only allows specializing functions.
2020-03-15 12:44:25 +00:00
bors 7cdbc87a49 Auto merge of #69999 - RalfJung:miri-unwind, r=oli-obk
adjust Miri to needs of changed unwinding strategy

As expected, https://github.com/rust-lang/rust/pull/67502 broke unwinding in Miri. To fix it we have to adjust parts of the engine and the panic runtime, which this PR does. The Miri-side changes are in https://github.com/rust-lang/miri/pull/1227.

Cc @oli-obk @Aaron1011 @Mark-Simulacrum @Amanieu
2020-03-14 19:54:23 +00:00
bors 131772c5e0 Auto merge of #69076 - cjgillot:split_trait, r=matthewjasper
Split librustc::{traits,infer} to their respective crates

Followup on #67953.

I tried to follow the existing module structures.

cc @eddyb
r? @Zoxc
2020-03-14 16:43:20 +00:00
bors 0f1e814c11 Auto merge of #69923 - matthiaskrgr:submodule_upd, r=Dylan-DPC
submodules: update clippy from 329923ed to fdce47ba

Changes:
````
add CR feedback
Improve documentation
Use `edition:2018` flag more widely
Update tests/ui/needless_doc_main.rs
Move links to the end of each chapter on adding_lints
Move links to the end of each chapter on CONTRIBUTING
Clean-up adding_lints.md
Clean-up CONTRIBUTING.md
needless_doc_main: only check rust code
Use `node_type_opt` over `node_type`
Fix doc
Fix ICE with trivial_bounds feature
clippy_lints: readme: don't mention crates.io since it is no longer used to publish clippy.
update rust-lang.github.io to rustc-dev-guide.rust-lang.org
Improve placeholder in map_unit_fn
Fix match single binding when in a let stmt
Improve error messages for {option,result}_map_unit_fn
Mention the setup instructions in CONTRIBUTING
redundant_pattern: take binding (ref, ref mut) into account in suggestion.
check_pat: delay creation of the "normal" vec until we reach the branch where is is actually needed
deps: bump itertools 0.8 -> 0.9
add lint on File::read_to_string and File::read_to_end
transition rustc-guide to rustc-dev-guide
Rename macro_use_import -> macro_use_imports
warn on macro_use attr
Fix deploy script for tag deploys
````

Fixes rust-lang#69957
2020-03-14 13:28:50 +00:00
Camille GILLOT 0144a97946 Trim dependencies and features. 2020-03-14 14:18:15 +01:00
Camille GILLOT 1fcdc52f70 Make downstream crates compile. 2020-03-14 14:17:43 +01:00
Camille GILLOT 0535dd3721 Split librustc_infer. 2020-03-14 14:17:13 +01:00
Camille GILLOT c1e3d556bf Move rustc_infer::traits to new crate rustc_trait_selection. 2020-03-14 14:15:50 +01:00
Camille GILLOT 21d4e063bc Mode ProjectionCache to its own module. 2020-03-14 14:15:14 +01:00
Camille GILLOT 796ca64e9a Move traits::query::outlives_bounds::explicit_outlives_bounds to infer::outlives. 2020-03-14 14:14:51 +01:00
Camille GILLOT 98444ca53e Move opaque_types::unexpected_hidden_region_diagnostic to error_reporting. 2020-03-14 14:14:13 +01:00
Camille GILLOT 3e5259d3eb Move IntercrateAmbiguityCause back to rustc::traits::select. 2020-03-14 14:10:56 +01:00
Ralf Jung b450e1baf4 fix comment, rustfmt 2020-03-14 13:09:02 +01:00
Ralf Jung b5938adb4d adjust Miri to needs of changed unwinding strategy 2020-03-14 11:51:27 +01:00
Ralf Jung 4452843720 update panicking comments in libstd 2020-03-14 11:36:40 +01:00
Ralf Jung 9c5d8e9b52 adjust Miri interaction with panic runtime 2020-03-14 11:24:11 +01:00
Ralf Jung 62087439a4 add Scalar::from methods for signed integers 2020-03-14 11:12:32 +01:00
bors 42ce9b4e90 Auto merge of #69744 - ecstatic-morse:fix-enum-discr-effect-test, r=oli-obk
Add `mir-opt` test for more precise drop elaboration

Depends on #69676. This test should ensure that the problem fixed in that PR does not reoccur.

This has been split out from #69676 since the test fails on certain targets where no cleanup blocks are emitted. I have to find the correct `ignore` directives.

r? @oli-obk
2020-03-14 08:26:54 +00:00
bors 5ed3453af9 Auto merge of #69716 - jonas-schievink:generator-size, r=tmandry
Don't store locals in generators that are immediately overwritten with the resume argument

This fixes https://github.com/rust-lang/rust/issues/69672 and makes https://github.com/rust-lang/rust/pull/69033 pass the async fn size tests again (in other words, there will be no size regression of async fn if both this and https://github.com/rust-lang/rust/pull/69033 land).

~~This is a small botch and I'd rather have a more precise analysis, but that seems much harder to pull off, so this special-cases `Yield` terminators that store the resume argument into a simple local (ie. without any field projections) and explicitly marks that local as "not live" in the suspend point of that yield. We know that this local does not need to be stored in the generator for this suspend point because the next resume would immediately overwrite it with the passed-in resume argument anyways. The local might still end up in the state if it is used across another yield.~~ (this now properly updates the dataflow framework to handle this case)
2020-03-14 02:04:49 +00:00
bors be055d96c4 Auto merge of #67502 - Mark-Simulacrum:opt-catch, r=Mark-Simulacrum
Optimize catch_unwind to match C++ try/catch

This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown.

https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is *exactly the same* if `-Cpanic=abort` is passed, which is clearly not great.

This PR, on the other hand, generates the following assembly:

```asm
# -Cpanic=unwind:
	push   rbx
	mov    ebx,0x2a
	call   QWORD PTR [rip+0x1c53c]        # <happy>
	mov    eax,ebx
	pop    rbx
	ret
	mov    rdi,rax
	call   QWORD PTR [rip+0x1c537]        # cleanup function call
	call   QWORD PTR [rip+0x1c539]        # <unfortunate>
	mov    ebx,0xd
	mov    eax,ebx
	pop    rbx
	ret

# -Cpanic=abort:
	push   rax
	call   QWORD PTR [rip+0x20a1]        # <happy>
	mov    eax,0x2a
	pop    rcx
	ret
```

Fixes #64224, and resolves #64222.
2020-03-13 22:43:06 +00:00
bors 1572c433ee Auto merge of #69986 - JohnTitor:rollup-h0809mf, r=JohnTitor
Rollup of 12 pull requests

Successful merges:

 - #69403 (Implement `Copy` for `IoSlice`)
 - #69460 (Move some `build-pass` tests to `check-pass`)
 - #69723 (Added doc on keyword Pub.)
 - #69802 (fix more clippy findings)
 - #69809 (remove lifetimes that can be elided (clippy::needless_lifetimes))
 - #69947 (Clean up E0423 explanation)
 - #69949 (triagebot.toml: add ping aliases)
 - #69954 (rename panic_if_ intrinsics to assert_)
 - #69960 (miri engine: fix treatment of abort intrinsic)
 - #69966 (Add more regression tests)
 - #69973 (Update stable-since version for const_int_conversion)
 - #69974 (Clean up E0434 explanation)

Failed merges:

r? @ghost
2020-03-13 19:16:03 +00:00
Yuki Okushi 1d8f5f0ff5
Rollup merge of #69974 - GuillaumeGomez:cleanup-e0434, r=Dylan-DPC
Clean up E0434 explanation

r? @Dylan-DPC
2020-03-14 04:03:37 +09:00
Yuki Okushi b0d1fc57eb
Rollup merge of #69973 - tspiteri:const-int-conversion-since, r=dtolnay
Update stable-since version for const_int_conversion

Since #69373 was not merged in time for 1.43.0 beta, update to `since = "1.44.0"`.
2020-03-14 04:03:36 +09:00
Yuki Okushi 93da9d7fe1
Rollup merge of #69966 - JohnTitor:more-more-tests, r=Centril
Add more regression tests

Closes #58490, closes #60390, closes #62504, closes #67739, closes #69092

r? @Centril
2020-03-14 04:03:34 +09:00
Yuki Okushi f2af2cff0f
Rollup merge of #69960 - RalfJung:abort, r=oli-obk
miri engine: fix treatment of abort intrinsic

I screwed up in https://github.com/rust-lang/rust/pull/69830 and added `abort` to the wrong block of intrinsics, namely the one that actually has a return place. So that branch was never actually reached.

r? @oli-obk
2020-03-14 04:03:33 +09:00
Yuki Okushi 77263db96f
Rollup merge of #69954 - RalfJung:panic_if-assert, r=Centril,eddyb
rename panic_if_ intrinsics to assert_

[Suggested by @eddyb](https://github.com/rust-lang/miri/issues/1222#issuecomment-598087523)
2020-03-14 04:03:31 +09:00
Yuki Okushi 995e584678
Rollup merge of #69949 - rust-lang:triagebot-ping-alias, r=Mark-Simulacrum
triagebot.toml: add ping aliases

I think I got the syntax right.
Closes https://github.com/rust-lang/triagebot/issues/402.

r? @Mark-Simulacrum
cc @pnkfelix
2020-03-14 04:03:29 +09:00
Yuki Okushi 78d722f0c7
Rollup merge of #69947 - GuillaumeGomez:cleanup-e0423, r=Dylan-DPC
Clean up E0423 explanation

r? @Dylan-DPC
2020-03-14 04:03:28 +09:00
Yuki Okushi c13548dccd
Rollup merge of #69809 - matthiaskrgr:lifetimes, r=eddyb
remove lifetimes that can be elided (clippy::needless_lifetimes)
2020-03-14 04:03:26 +09:00
Yuki Okushi 8e17c8366c
Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPC
fix more clippy findings

* reduce references on match patterns (clippy::match_ref_pats)
* Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::write_with_newline)
* libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string)
* remove unneeded mutable references (cippy::unnecessary_mut_passed)
* libtest: declare variables as floats instead of casting them (clippy::unnecessary_cast)
* rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes)
* call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref)
* iterate over a maps values directly. (clippy::for_kv_map)
* rustdoc: simplify boolean condition (clippy::nonminimal_bool)
* Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently)
* rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some)
* rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)
2020-03-14 04:03:24 +09:00
Yuki Okushi 35df9cca7c
Rollup merge of #69723 - sjud:sjud-doc-request, r=Mark-Simulacrum
Added doc on keyword Pub.

Hi, this is my first pull request. I hope it's OK. Please let me know if it would benefit from any changes. Thank you.
2020-03-14 04:03:23 +09:00
Yuki Okushi 913a933202
Rollup merge of #69460 - LeSeulArtichaut:move-compile-pass, r=RalfJung
Move some `build-pass` tests to `check-pass`

Helps with #62277.

r? @cramertj cc @Centril
2020-03-14 04:03:22 +09:00
Yuki Okushi 5d90154886
Rollup merge of #69403 - LeSeulArtichaut:copy-ioslice, r=sfackler
Implement `Copy` for `IoSlice`

Resolves #69395

r? @sfackler
2020-03-14 04:03:20 +09:00
bors d6072319a9 Auto merge of #69155 - chrissimpkins:llvm-globals, r=eddyb
Add support for LLVM globals corresponding to miri allocations should be named alloc123

Adds support for this request from @eddyb in #69134:

> That is, if -Zfewer-names is false (usually only because of --emit=llvm-ir), we should use the same name for LLVM globals we generate out of miri allocs as #67133 does in MIR output (allocN).
>
>This way, we can easily see the mapping between MIR and LLVM IR (and it shouldn't be any costlier for regular compilation, which would continue to use unnamed globals).

r? @eddyb
cc @oli-obk
2020-03-13 16:10:20 +00:00
sjud 87f8ee675e Add documentation for pub keyword 2020-03-13 11:12:59 -04:00
Guillaume Gomez a36bf9c1b8 Clean up E0434 explanation 2020-03-13 14:36:14 +01:00
Trevor Spiteri 08a7fa6dd8 update stable-since version for const_int_conversion 2020-03-13 14:25:35 +01:00
Ralf Jung 13ea774513 bless tests 2020-03-13 08:52:04 +01:00
Ralf Jung f61fb53af4 adjust enum naming 2020-03-13 08:43:27 +01:00
Yuki Okushi 7c987eb020
Add test for issue-69092 2020-03-13 16:06:09 +09:00
Yuki Okushi 3609bac340
Add test for issue-67739 2020-03-13 16:06:08 +09:00
Yuki Okushi a2c41e9cdc
Add test for issue-62504 2020-03-13 16:06:08 +09:00
Yuki Okushi 0efc2cf547
Add test for issue-60390 2020-03-13 16:06:08 +09:00
Yuki Okushi 081e32baba
Add test for issue-58490 2020-03-13 16:06:07 +09:00
Matthias Krüger 66949a72d1 submodules: update clippy from 329923ed to 8485d40a
Changes:
````
Rustup to rust-lang/rust#69674
Use visit_place
Check for mutation
Only fires on temporaries
Extend `redundant_clone` to the case that cloned value is not consumed
add CR feedback
Improve documentation
Use `edition:2018` flag more widely
Update tests/ui/needless_doc_main.rs
Move links to the end of each chapter on adding_lints
Move links to the end of each chapter on CONTRIBUTING
Clean-up adding_lints.md
Clean-up CONTRIBUTING.md
needless_doc_main: only check rust code
Use `node_type_opt` over `node_type`
Fix doc
Fix ICE with trivial_bounds feature
clippy_lints: readme: don't mention crates.io since it is no longer used to publish clippy.
update rust-lang.github.io to rustc-dev-guide.rust-lang.org
Improve placeholder in map_unit_fn
Fix match single binding when in a let stmt
Improve error messages for {option,result}_map_unit_fn
Mention the setup instructions in CONTRIBUTING
redundant_pattern: take binding (ref, ref mut) into account in suggestion.
check_pat: delay creation of the "normal" vec until we reach the branch where is is actually needed
deps: bump itertools 0.8 -> 0.9
add lint on File::read_to_string and File::read_to_end
transition rustc-guide to rustc-dev-guide
Rename macro_use_import -> macro_use_imports
warn on macro_use attr
Fix deploy script for tag deploys
````

Fixes #69957
2020-03-12 21:49:29 +01:00
Ralf Jung e9c96570d6 miri engine: fix treatment of abort intrinsic 2020-03-12 21:22:22 +01:00
Matthias Krüger 7b1b08cfee remove lifetimes that can be elided (clippy::needless_lifetimes) 2020-03-12 20:03:09 +01:00