]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoUpdate `krate_attrs` and `get_module`
John Kåre Alsaker [Fri, 7 Feb 2020 15:43:36 +0000 (16:43 +0100)]
Update `krate_attrs` and `get_module`

4 years agoUpdate `body_owner` and `maybe_body_owned_by`
John Kåre Alsaker [Fri, 7 Feb 2020 15:10:50 +0000 (16:10 +0100)]
Update `body_owner` and `maybe_body_owned_by`

4 years agoUpdate `fn_decl_by_hir_id` and `fn_sig_by_hir_id`
John Kåre Alsaker [Fri, 7 Feb 2020 14:34:39 +0000 (15:34 +0100)]
Update `fn_decl_by_hir_id` and `fn_sig_by_hir_id`

4 years agoUpdate item functions
John Kåre Alsaker [Fri, 7 Feb 2020 14:17:05 +0000 (15:17 +0100)]
Update item functions

4 years agoCreate Map after TyCtxt
John Kåre Alsaker [Fri, 7 Feb 2020 12:13:35 +0000 (13:13 +0100)]
Create Map after TyCtxt

4 years agoCollect the new maps
John Kåre Alsaker [Fri, 7 Feb 2020 10:45:04 +0000 (11:45 +0100)]
Collect the new maps

4 years agoAdd HIR queries
John Kåre Alsaker [Fri, 7 Feb 2020 10:14:47 +0000 (11:14 +0100)]
Add HIR queries

4 years agoAuto merge of #69076 - cjgillot:split_trait, r=matthewjasper
bors [Sat, 14 Mar 2020 16:43:20 +0000 (16:43 +0000)]
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

4 years agoAuto merge of #69923 - matthiaskrgr:submodule_upd, r=Dylan-DPC
bors [Sat, 14 Mar 2020 13:28:50 +0000 (13:28 +0000)]
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

4 years agoTrim dependencies and features.
Camille GILLOT [Tue, 11 Feb 2020 21:39:02 +0000 (22:39 +0100)]
Trim dependencies and features.

4 years agoMake downstream crates compile.
Camille GILLOT [Tue, 11 Feb 2020 20:19:40 +0000 (21:19 +0100)]
Make downstream crates compile.

4 years agoSplit librustc_infer.
Camille GILLOT [Sat, 22 Feb 2020 10:44:18 +0000 (11:44 +0100)]
Split librustc_infer.

4 years agoMove rustc_infer::traits to new crate rustc_trait_selection.
Camille GILLOT [Tue, 11 Feb 2020 18:53:40 +0000 (19:53 +0100)]
Move rustc_infer::traits to new crate rustc_trait_selection.

4 years agoMode ProjectionCache to its own module.
Camille GILLOT [Tue, 11 Feb 2020 18:46:31 +0000 (19:46 +0100)]
Mode ProjectionCache to its own module.

4 years agoMove traits::query::outlives_bounds::explicit_outlives_bounds to infer::outlives.
Camille GILLOT [Mon, 10 Feb 2020 19:39:11 +0000 (20:39 +0100)]
Move traits::query::outlives_bounds::explicit_outlives_bounds to infer::outlives.

4 years agoMove opaque_types::unexpected_hidden_region_diagnostic to error_reporting.
Camille GILLOT [Mon, 10 Feb 2020 19:26:24 +0000 (20:26 +0100)]
Move opaque_types::unexpected_hidden_region_diagnostic to error_reporting.

4 years agoMove IntercrateAmbiguityCause back to rustc::traits::select.
Camille GILLOT [Mon, 10 Feb 2020 19:50:16 +0000 (20:50 +0100)]
Move IntercrateAmbiguityCause back to rustc::traits::select.

4 years agoAuto merge of #69744 - ecstatic-morse:fix-enum-discr-effect-test, r=oli-obk
bors [Sat, 14 Mar 2020 08:26:54 +0000 (08:26 +0000)]
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

4 years agoAuto merge of #69716 - jonas-schievink:generator-size, r=tmandry
bors [Sat, 14 Mar 2020 02:04:49 +0000 (02:04 +0000)]
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)

4 years agoAuto merge of #67502 - Mark-Simulacrum:opt-catch, r=Mark-Simulacrum
bors [Fri, 13 Mar 2020 22:43:06 +0000 (22:43 +0000)]
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.

4 years agoAuto merge of #69986 - JohnTitor:rollup-h0809mf, r=JohnTitor
bors [Fri, 13 Mar 2020 19:16:03 +0000 (19:16 +0000)]
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

4 years agoRollup merge of #69974 - GuillaumeGomez:cleanup-e0434, r=Dylan-DPC
Yuki Okushi [Fri, 13 Mar 2020 19:03:37 +0000 (04:03 +0900)]
Rollup merge of #69974 - GuillaumeGomez:cleanup-e0434, r=Dylan-DPC

Clean up E0434 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69973 - tspiteri:const-int-conversion-since, r=dtolnay
Yuki Okushi [Fri, 13 Mar 2020 19:03:36 +0000 (04:03 +0900)]
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"`.

4 years agoRollup merge of #69966 - JohnTitor:more-more-tests, r=Centril
Yuki Okushi [Fri, 13 Mar 2020 19:03:34 +0000 (04:03 +0900)]
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

4 years agoRollup merge of #69960 - RalfJung:abort, r=oli-obk
Yuki Okushi [Fri, 13 Mar 2020 19:03:33 +0000 (04:03 +0900)]
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

4 years agoRollup merge of #69954 - RalfJung:panic_if-assert, r=Centril,eddyb
Yuki Okushi [Fri, 13 Mar 2020 19:03:31 +0000 (04:03 +0900)]
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)

4 years agoRollup merge of #69949 - rust-lang:triagebot-ping-alias, r=Mark-Simulacrum
Yuki Okushi [Fri, 13 Mar 2020 19:03:29 +0000 (04:03 +0900)]
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

4 years agoRollup merge of #69947 - GuillaumeGomez:cleanup-e0423, r=Dylan-DPC
Yuki Okushi [Fri, 13 Mar 2020 19:03:28 +0000 (04:03 +0900)]
Rollup merge of #69947 - GuillaumeGomez:cleanup-e0423, r=Dylan-DPC

Clean up E0423 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69809 - matthiaskrgr:lifetimes, r=eddyb
Yuki Okushi [Fri, 13 Mar 2020 19:03:26 +0000 (04:03 +0900)]
Rollup merge of #69809 - matthiaskrgr:lifetimes, r=eddyb

remove lifetimes that can be elided (clippy::needless_lifetimes)

4 years agoRollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPC
Yuki Okushi [Fri, 13 Mar 2020 19:03:24 +0000 (04:03 +0900)]
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)

4 years agoRollup merge of #69723 - sjud:sjud-doc-request, r=Mark-Simulacrum
Yuki Okushi [Fri, 13 Mar 2020 19:03:23 +0000 (04:03 +0900)]
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.

4 years agoRollup merge of #69460 - LeSeulArtichaut:move-compile-pass, r=RalfJung
Yuki Okushi [Fri, 13 Mar 2020 19:03:22 +0000 (04:03 +0900)]
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

4 years agoRollup merge of #69403 - LeSeulArtichaut:copy-ioslice, r=sfackler
Yuki Okushi [Fri, 13 Mar 2020 19:03:20 +0000 (04:03 +0900)]
Rollup merge of #69403 - LeSeulArtichaut:copy-ioslice, r=sfackler

Implement `Copy` for `IoSlice`

Resolves #69395

r? @sfackler

4 years agoAuto merge of #69155 - chrissimpkins:llvm-globals, r=eddyb
bors [Fri, 13 Mar 2020 16:10:20 +0000 (16:10 +0000)]
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

4 years agoAdd documentation for pub keyword
sjud [Thu, 5 Mar 2020 00:14:27 +0000 (19:14 -0500)]
Add documentation for pub keyword

4 years agoClean up E0434 explanation
Guillaume Gomez [Fri, 13 Mar 2020 13:36:14 +0000 (14:36 +0100)]
Clean up E0434 explanation

4 years agoupdate stable-since version for const_int_conversion
Trevor Spiteri [Fri, 13 Mar 2020 13:25:35 +0000 (14:25 +0100)]
update stable-since version for const_int_conversion

4 years agobless tests
Ralf Jung [Fri, 13 Mar 2020 07:52:04 +0000 (08:52 +0100)]
bless tests

4 years agoadjust enum naming
Ralf Jung [Fri, 13 Mar 2020 07:43:27 +0000 (08:43 +0100)]
adjust enum naming

4 years agoAdd test for issue-69092
Yuki Okushi [Fri, 13 Mar 2020 00:04:27 +0000 (09:04 +0900)]
Add test for issue-69092

4 years agoAdd test for issue-67739
Yuki Okushi [Fri, 13 Mar 2020 00:04:14 +0000 (09:04 +0900)]
Add test for issue-67739

4 years agoAdd test for issue-62504
Yuki Okushi [Fri, 13 Mar 2020 00:03:58 +0000 (09:03 +0900)]
Add test for issue-62504

4 years agoAdd test for issue-60390
Yuki Okushi [Fri, 13 Mar 2020 00:03:44 +0000 (09:03 +0900)]
Add test for issue-60390

4 years agoAdd test for issue-58490
Yuki Okushi [Fri, 13 Mar 2020 00:03:30 +0000 (09:03 +0900)]
Add test for issue-58490

4 years agosubmodules: update clippy from 329923ed to 8485d40a
Matthias Krüger [Thu, 12 Mar 2020 20:47:47 +0000 (21:47 +0100)]
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

4 years agomiri engine: fix treatment of abort intrinsic
Ralf Jung [Thu, 12 Mar 2020 20:22:22 +0000 (21:22 +0100)]
miri engine: fix treatment of abort intrinsic

4 years agoremove lifetimes that can be elided (clippy::needless_lifetimes)
Matthias Krüger [Fri, 6 Mar 2020 23:56:32 +0000 (00:56 +0100)]
remove lifetimes that can be elided (clippy::needless_lifetimes)

4 years agorename panic_if_ intrinsics to assert_
Ralf Jung [Thu, 12 Mar 2020 18:38:09 +0000 (19:38 +0100)]
rename panic_if_ intrinsics to assert_

4 years agotriagebot.toml: add typo aliases
Mazdak Farrokhzad [Thu, 12 Mar 2020 17:06:40 +0000 (18:06 +0100)]
triagebot.toml: add typo aliases

4 years agoMove some more tests to `check-pass`
LeSeulArtichaut [Thu, 12 Mar 2020 16:22:44 +0000 (17:22 +0100)]
Move some more tests to `check-pass`

4 years agoAuto merge of #69950 - Centril:rollup-xh0hmvx, r=Centril
bors [Thu, 12 Mar 2020 16:20:52 +0000 (16:20 +0000)]
Auto merge of #69950 - Centril:rollup-xh0hmvx, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #68899 (Add Display and Error impls for proc_macro::LexError)
 - #69011 (Document unsafe blocks in core::fmt)
 - #69674 (Rename DefKind::Method and TraitItemKind::Method )
 - #69705 (Toolstate: remove redundant beta-week check.)
 - #69722 (Tweak output for invalid negative impl AST errors)
 - #69747 (Rename rustc guide)
 - #69792 (Implement Error for TryReserveError)
 - #69830 (miri: ICE on invalid terminators)
 - #69921 (rustdoc: remove unused import)
 - #69945 (update outdated comment)

Failed merges:

r? @ghost

4 years agoMove some const-eval `build-pass` tests to `check-pass`
LeSeulArtichaut [Thu, 12 Mar 2020 15:58:34 +0000 (16:58 +0100)]
Move some const-eval `build-pass` tests to `check-pass`

4 years agoRollup merge of #69945 - contrun:fix-outdated-comment, r=petrochenkov
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:27 +0000 (16:32 +0100)]
Rollup merge of #69945 - contrun:fix-outdated-comment, r=petrochenkov

update outdated comment

4 years agoRollup merge of #69921 - matthiaskrgr:rustdoc_import, r=Centril
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:25 +0000 (16:32 +0100)]
Rollup merge of #69921 - matthiaskrgr:rustdoc_import, r=Centril

rustdoc: remove unused import

```
    Checking rustdoc v0.0.0 (/home/matthias/vcs/github/rust/src/librustdoc)
warning: unused import: `rustc_span::symbol::sym`
  --> src/librustdoc/clean/inline.rs:15:5
   |
15 | use rustc_span::symbol::sym;
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default
```

4 years agoRollup merge of #69830 - RalfJung:miri-invalid-terminator, r=oli-obk
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:23 +0000 (16:32 +0100)]
Rollup merge of #69830 - RalfJung:miri-invalid-terminator, r=oli-obk

miri: ICE on invalid terminators

We've run a lot of MIR in Miri (including some generators) and never seen these.

@tmandry is it correct that `Yield` and `GeneratorDrop` get lowered away?

@eddyb @oli-obk what's with this `Abort` that does not seem to ever actually exist? Codegen *does* seem to handle it, so I wonder why Miri can get away without that. In fact, codegen handles it twice:

https://github.com/rust-lang/rust/blob/1d5241c96208ca7d925442b1a5fa45ad18717a6f/src/librustc_codegen_ssa/mir/block.rs#L796

https://github.com/rust-lang/rust/blob/1d5241c96208ca7d925442b1a5fa45ad18717a6f/src/librustc_codegen_ssa/mir/mod.rs#L296

4 years agoRollup merge of #69792 - LenaWil:try_reserve_error/impl-error, r=sfackler
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:21 +0000 (16:32 +0100)]
Rollup merge of #69792 - LenaWil:try_reserve_error/impl-error, r=sfackler

Implement Error for TryReserveError

I noticed that the Error trait wasn't implemented for TryReserveError. (#48043)

Not sure if the error messages and code style are 100% correct, it's my first time contributing to the Rust std.

4 years agoRollup merge of #69747 - spastorino:rename-rustc-guide, r=pietroalbini
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:19 +0000 (16:32 +0100)]
Rollup merge of #69747 - spastorino:rename-rustc-guide, r=pietroalbini

Rename rustc guide

This is in preparation for https://github.com/rust-lang/rustc-guide/issues/470
Needs to be merged after we actually rename the guide.

Have used this to rename:

`git grep -l 'rustc_guide' | xargs sed -i 's/rustc_guide/rustc_dev_guide/g'`
`git grep -l 'rustc-guide' | xargs sed -i 's/rustc-guide/rustc-dev-guide/g'`
`git grep -l 'rustc guide' | xargs sed -i 's/rustc guide/rustc dev guide/g'`

4 years agoRollup merge of #69722 - estebank:negative-impl-span-ast, r=Centril
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:17 +0000 (16:32 +0100)]
Rollup merge of #69722 - estebank:negative-impl-span-ast, r=Centril

Tweak output for invalid negative impl AST errors

Use more accurate spans for negative `impl` errors.

r? @Centril

4 years agoRollup merge of #69705 - ehuss:toolstate-remove-redundant-beta, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:15 +0000 (16:32 +0100)]
Rollup merge of #69705 - ehuss:toolstate-remove-redundant-beta, r=Mark-Simulacrum

Toolstate: remove redundant beta-week check.

I made a bit of a mistake in #69624.  The "beta regression" doesn't need to be checked twice.

I also rolled up #69693 to avoid merge conflicts.

4 years agoRollup merge of #69674 - mark-i-m:assoc-fn, r=matthewjasper
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:13 +0000 (16:32 +0100)]
Rollup merge of #69674 - mark-i-m:assoc-fn, r=matthewjasper

Rename DefKind::Method and TraitItemKind::Method

r? @eddyb, @Centril, or @matthewjasper

cc #69498 #60163

4 years agoRollup merge of #69011 - foeb:document-unsafe-core-fmt, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:11 +0000 (16:32 +0100)]
Rollup merge of #69011 - foeb:document-unsafe-core-fmt, r=Mark-Simulacrum

Document unsafe blocks in core::fmt

r? @RalfJung
CC: @rust-lang/wg-unsafe-code-guidelines
#66219

Sorry for the hiatus, but here's a few more files with the unsafe blocks documented! I think working on it smaller chunks like this will be easier for everyone.

4 years agoRollup merge of #68899 - kinseytamsin:lexerror-error-impl, r=Centril
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:32:07 +0000 (16:32 +0100)]
Rollup merge of #68899 - kinseytamsin:lexerror-error-impl, r=Centril

Add Display and Error impls for proc_macro::LexError

This should allow LexError to play much nicer with the `?` operator.

Fixes #68896.

(I'm not sure if I did the stability attributes right, so if I need to change them, please let me know!)

4 years agotriagebot.toml: add ping aliases
Mazdak Farrokhzad [Thu, 12 Mar 2020 15:22:12 +0000 (16:22 +0100)]
triagebot.toml: add ping aliases

4 years agosupport LLVM globals corresponding to miri allocations
Chris Simpkins [Thu, 12 Mar 2020 13:53:49 +0000 (09:53 -0400)]
support LLVM globals corresponding to miri allocations

4 years agoClean up E0423 explanation
Guillaume Gomez [Thu, 12 Mar 2020 12:11:07 +0000 (13:11 +0100)]
Clean up E0423 explanation

4 years agoupdate outdated comment
YI [Thu, 12 Mar 2020 10:43:51 +0000 (18:43 +0800)]
update outdated comment

4 years agoAuto merge of #68551 - Marwes:allocations_mir, r=ecstatic-morse
bors [Thu, 12 Mar 2020 09:16:53 +0000 (09:16 +0000)]
Auto merge of #68551 - Marwes:allocations_mir, r=ecstatic-morse

perf: Reuse a Vec in mir simplification

Just moves the vec out of the outer loop so it is reused every iteration

4 years agoAuto merge of #68191 - simlay:add-tvSO-target, r=nagisa
bors [Thu, 12 Mar 2020 04:01:02 +0000 (04:01 +0000)]
Auto merge of #68191 - simlay:add-tvSO-target, r=nagisa

Added tvOS as targets

This is a first attempt of adding support tvOS as described in #48862. It's got a lot of overlap with [src/librustc_target/spec/apple_ios_base.rs](https://github.com/rust-lang/rust/blob/31dd4f4acbcbdb02b0745d2136399ed664a28050/src/librustc_target/spec/apple_ios_base.rs).

I thought about refactoring `apple_ios_base.rs` to include this as well but that would require each of the ios and tvos targets to be of the something like the form `let base = opts(AppleOS::TV, Arch::Arm64)?;` I also did the same thing for watchOS because from what I can tell, all three targets (iOS, tvOS, and watchOS) have the same logic but have different parameters being sent to `xcrun`. Thoughts?

As far as the `data_layout` and other parameters to `Target`, I did as much research as I could but it really seems that processor in the [iPhone 11 is the same as the apple TV](https://en.wikipedia.org/wiki/Apple-designed_processors) so I didn't change any of those parameters.

I did get this to build and tested that it's actually running the the below logic (because the parameter to `xcrun` is `appletvos` not `tvos`).

I didn't manage to get it to actually compile a file with `fn main(){}` because I don't have the stdlib for `aarch64-apple-tvos` compiled it seems. Is there documentation for this?

Similar to the ending of https://github.com/rust-lang/rust/pull/63467, I'm not sure what to do next.

4 years agoGive LexError more descriptive Display impl
Kinsey Favre [Sat, 8 Feb 2020 16:51:54 +0000 (10:51 -0600)]
Give LexError more descriptive Display impl

4 years agoCorrect stability attribute for new LexError impls
Kinsey Favre [Sat, 8 Feb 2020 15:55:49 +0000 (09:55 -0600)]
Correct stability attribute for new LexError impls

4 years agoReformat match statement to make the check pass
Lena Wildervanck [Wed, 11 Mar 2020 16:55:14 +0000 (17:55 +0100)]
Reformat match statement to make the check pass

4 years agoFormat the match statement
Lena Wildervanck [Wed, 11 Mar 2020 16:30:04 +0000 (17:30 +0100)]
Format the match statement

4 years agoAdd Display and Error impls for proc_macro::LexError
Kinsey Favre [Thu, 6 Feb 2020 18:25:18 +0000 (12:25 -0600)]
Add Display and Error impls for proc_macro::LexError

This should allow LexError to play much nicer with the `?` operator.

4 years agoreview comments
Esteban Küber [Wed, 11 Mar 2020 16:17:55 +0000 (09:17 -0700)]
review comments

4 years agorustdoc: remove unused import
Matthias Krüger [Wed, 11 Mar 2020 13:24:07 +0000 (14:24 +0100)]
rustdoc: remove unused import

4 years agoAuto merge of #69919 - Centril:rollup-fxo33zs, r=Centril
bors [Wed, 11 Mar 2020 13:05:52 +0000 (13:05 +0000)]
Auto merge of #69919 - Centril:rollup-fxo33zs, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #66472 (--show-coverage json)
 - #69603 (tidy: replace `make check` with `./x.py test` in documentation)
 - #69760 (Improve expression & attribute parsing)
 - #69828 (fix memory leak when vec::IntoIter panics during drop)
 - #69850 (panic_bounds_check: use caller_location, like PanicFnLangItem)
 - #69876 (Add long error explanation for E0739)
 - #69888 ([Miri] Use a session variable instead of checking for an env var always)
 - #69893 (librustc_codegen_llvm: Use slices instead of 0-terminated strings)

Failed merges:

r? @ghost

4 years agoRollup merge of #69893 - tmiasko:cstr, r=petrochenkov
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:54 +0000 (14:03 +0100)]
Rollup merge of #69893 - tmiasko:cstr, r=petrochenkov

librustc_codegen_llvm: Use slices instead of 0-terminated strings

Changed functions:
* LLVMRustGetOrInsertFunction
* LLVMRustGetNamedValue
* LLVMRustBuildCall (removed unused name argument)
* LLVMRustInlineAsm
* LLVMRustInlineAsmVerify
* LLVMRustAppendModuleInlineAsm

4 years agoRollup merge of #69888 - wesleywiser:miri_exception_env_var_to_session_var, r=RalfJung
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:53 +0000 (14:03 +0100)]
Rollup merge of #69888 - wesleywiser:miri_exception_env_var_to_session_var, r=RalfJung

[Miri] Use a session variable instead of checking for an env var always

In CTFE heavy code, checking the env var everytime is inefficient. We
can do a lot better by using a `Session` variable instead.

r? @RalfJung

Part of #69297

4 years agoRollup merge of #69876 - ayushmishra2005:doc/61137-add-long-error-code-e0739, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:51 +0000 (14:03 +0100)]
Rollup merge of #69876 - ayushmishra2005:doc/61137-add-long-error-code-e0739, r=Dylan-DPC

Add long error explanation for E0739

Add long explanation for the E0739 error code
Part of #61137

r? @GuillaumeGomez

4 years agoRollup merge of #69850 - RalfJung:panic-bounds-check, r=eddyb
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:49 +0000 (14:03 +0100)]
Rollup merge of #69850 - RalfJung:panic-bounds-check, r=eddyb

panic_bounds_check: use caller_location, like PanicFnLangItem

The `PanicFnLangItem` got switched to using `#[caller_location]` at some point, but `PanicBoundsCheckFnLangItem` was kept in the old style. For consistency, switch that one over to use `#[caller_location]` as well.

This is also helpful for Miri as it means the `assert_panic` machine hook never needs to know the current `Span`.

4 years agoRollup merge of #69828 - RalfJung:vec-leak, r=kennytm
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:47 +0000 (14:03 +0100)]
Rollup merge of #69828 - RalfJung:vec-leak, r=kennytm

fix memory leak when vec::IntoIter panics during drop

Fixes https://github.com/rust-lang/rust/issues/69770

4 years agoRollup merge of #69760 - Centril:parse-expr-improve, r=estebank
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:45 +0000 (14:03 +0100)]
Rollup merge of #69760 - Centril:parse-expr-improve, r=estebank

Improve expression & attribute parsing

This PR includes misc improvements to expression and attribute parsing.

1. Some code simplifications
2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.)
3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.)
4. ^--- These are done so that code sharing in block parsing is increased.
5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.)
6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.)
7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.)
8. Simplified attribute parsing code & slightly improved diagnostics.
9. Added recovery for e.g., `Box<('a) + Trait>`.
10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`.

r? @estebank

4 years agoRollup merge of #69603 - chrissimpkins:tidy-docs-update, r=petrochenkov
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:44 +0000 (14:03 +0100)]
Rollup merge of #69603 - chrissimpkins:tidy-docs-update, r=petrochenkov

tidy: replace `make check` with `./x.py test` in documentation

This PR includes a minor documentation update for tidy.  It replaces the `make check` approach with `./x.py test` and describes how to execute the tidy checks (only) with ~~`./x.py test src/tools/tidy`~~ `./x.py test tidy`.

4 years agoRollup merge of #66472 - GuillaumeGomez:show-coverage-json, r=ollie27
Mazdak Farrokhzad [Wed, 11 Mar 2020 13:03:42 +0000 (14:03 +0100)]
Rollup merge of #66472 - GuillaumeGomez:show-coverage-json, r=ollie27

--show-coverage json

The purpose of this change is to be able to use it as a tool in docs.rs in order to provide some more stats to crates' owners. Eventually even create a badge or something along the line.

r? @QuietMisdreavus

4 years agoAuto merge of #69914 - Centril:rollup-wtmdinz, r=Centril
bors [Wed, 11 Mar 2020 09:37:19 +0000 (09:37 +0000)]
Auto merge of #69914 - Centril:rollup-wtmdinz, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #66059 (mem::zeroed/uninit: panic on types that do not permit zero-initialization)
 - #69373 (Stabilize const for integer {to,from}_{be,le,ne}_bytes methods)
 - #69591 (Use TypeRelating for instantiating query responses)
 - #69625 (Implement nth, last, and count for iter::Copied)
 - #69645 (const forget tests)
 - #69766 (Make Point `Copy` in arithmetic documentation)
 - #69825 (make `mem::discriminant` const)
 - #69859 (fix #62456)
 - #69891 (Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns)
 - #69896 (parse: Tweak the function parameter edition check)

Failed merges:

r? @ghost

4 years agoRollup merge of #69896 - petrochenkov:reqname2, r=Centril
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:33 +0000 (10:36 +0100)]
Rollup merge of #69896 - petrochenkov:reqname2, r=Centril

parse: Tweak the function parameter edition check

Follow-up to https://github.com/rust-lang/rust/pull/69801.

Edition of a code fragment is inferred from "the place where the code is written".
For individual tokens like edition-specific keywords it may be the span of the token itself ("uninterpolated" span), but for larger code fragments it's probably not, in the test example the trait method is obviously written in "2015 edition code".

r? @Centril

4 years agoRollup merge of #69891 - Centril:fix-69875, r=varkor
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:31 +0000 (10:36 +0100)]
Rollup merge of #69891 - Centril:fix-69875, r=varkor

Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns

> There's an implicit invariant that there should be no or-patterns directly in the first column of the matrix, but this invariant is broken exactly when an or-pattern has a child that is itself an or-pattern.

Here we preserve this broken invariant by recursively expanding `PatKind::Or`s in `Matrix::push`.
Fixes https://github.com/rust-lang/rust/issues/69875.

r? @varkor
cc @Nadrieril
cc https://github.com/rust-lang/rust/issues/54883

4 years agoRollup merge of #69859 - contrun:fix-62456, r=matthewjasper
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:29 +0000 (10:36 +0100)]
Rollup merge of #69859 - contrun:fix-62456, r=matthewjasper

fix #62456

closes https://github.com/rust-lang/rust/issues/62456

4 years agoRollup merge of #69825 - lcnr:discriminant, r=oli-obk
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:28 +0000 (10:36 +0100)]
Rollup merge of #69825 - lcnr:discriminant, r=oli-obk

make `mem::discriminant` const

implements #69821, which could be used as a tracking issue for `const_discriminant`.

Should this be added to the meta tracking issue #57563?
@Lokathor

4 years agoRollup merge of #69766 - skade:make-point-copy-in-add-documentation, r=shepmaster
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:26 +0000 (10:36 +0100)]
Rollup merge of #69766 - skade:make-point-copy-in-add-documentation, r=shepmaster

Make Point `Copy` in arithmetic documentation

Small composite types like `Point { x: i32, y: i32}` are plain
old data and we should encourage users to derive `Copy` on them.

This changes the semantics of the edited examples slightly: instead
of consuming the operands during addition, it will copy them. This
is desired behaviour.

4 years agoRollup merge of #69645 - DutchGhost:const-forget-tests, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:24 +0000 (10:36 +0100)]
Rollup merge of #69645 - DutchGhost:const-forget-tests, r=Dylan-DPC

const forget tests

Adds tests for https://github.com/rust-lang/rust/pull/69617

4 years agoRollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:22 +0000 (10:36 +0100)]
Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus

Implement nth, last, and count for iter::Copied

Implement nth, last and count for iter::Copied.

4 years agoRollup merge of #69591 - matthewjasper:query-response-relate, r=nikomatsakis
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:19 +0000 (10:36 +0100)]
Rollup merge of #69591 - matthewjasper:query-response-relate, r=nikomatsakis

Use TypeRelating for instantiating query responses

`eq` can add constraints to `RegionConstraintData`, which isn't allowed during borrow checking outside of a `CustomTypeOp`. Use `TypeRelating` instead to always push constraints to the obligations list.

closes #69490

4 years agoRollup merge of #69373 - tspiteri:const_int_conversion, r=oli-obk
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:18 +0000 (10:36 +0100)]
Rollup merge of #69373 - tspiteri:const_int_conversion, r=oli-obk

Stabilize const for integer {to,from}_{be,le,ne}_bytes methods

All of these functions can be implemented simply and naturally as const functions, e.g. `u32::from_le_bytes` can be implemented as
```rust
(bytes[0] as u32)
    | (bytes[1] as u32) << 8
    | (bytes[2] as u32) << 16
    | (bytes[3] as u32) << 24
```
So stabilizing the constness will not expose that internally they are implemented using transmute which is not const in stable.

4 years agoRollup merge of #66059 - RalfJung:panic-on-non-zero, r=eddyb
Mazdak Farrokhzad [Wed, 11 Mar 2020 09:36:16 +0000 (10:36 +0100)]
Rollup merge of #66059 - RalfJung:panic-on-non-zero, r=eddyb

mem::zeroed/uninit: panic on types that do not permit zero-initialization

r? @eddyb @oli-obk

Cc https://github.com/rust-lang/rust/issues/62825

Also see [this summary comment](https://github.com/rust-lang/rust/pull/66059#issuecomment-586734747)

4 years agolibrustc_codegen_llvm: Use slices instead of 0-terminated strings
Tomasz Miąsko [Tue, 10 Mar 2020 00:00:00 +0000 (00:00 +0000)]
librustc_codegen_llvm: Use slices instead of 0-terminated strings

Changed functions:
* LLVMRustGetOrInsertFunction
* LLVMRustGetNamedValue
* LLVMRustBuildCall (removed unused name argument)
* LLVMRustInlineAsm
* LLVMRustInlineAsmVerify
* LLVMRustAppendModuleInlineAsm

4 years agoreview comments
Esteban Küber [Wed, 11 Mar 2020 00:59:32 +0000 (17:59 -0700)]
review comments

4 years agoIgnore `mir-opt` test when panic=abort
Dylan MacKenzie [Thu, 5 Mar 2020 19:52:50 +0000 (11:52 -0800)]
Ignore `mir-opt` test when panic=abort

4 years agoAdd `mir-opt` test for better drop elaboration
Dylan MacKenzie [Tue, 3 Mar 2020 20:05:59 +0000 (12:05 -0800)]
Add `mir-opt` test for better drop elaboration

4 years ago[Miri] Use a session variable instead of checking for an env var always
Wesley Wiser [Mon, 17 Feb 2020 01:32:25 +0000 (20:32 -0500)]
[Miri] Use a session variable instead of checking for an env var always

In CTFE heavy code, checking the env var everytime is inefficient. We
can do a lot better by using a `Session` variable instead.