Commit Graph

108219 Commits

Author SHA1 Message Date
Vadim Petrochenkov
3fbb2549ce resolve: Legacy(Scope,Binding) -> MacroRules(Scope,Binding) 2020-03-16 00:29:42 +03:00
Vadim Petrochenkov
65bf4831d2 ast/hir: MacroDef::legacy -> MacroDef::macro_rules 2020-03-16 00:29:03 +03:00
bors
e0f5df0173 Auto merge of #70024 - Centril:rollup-cppmaxr, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #69528 (Add undo_leak to reset RefCell borrow state)
 - #69589 (ast: `Mac`/`Macro` -> `MacCall`)
 - #69661 (Implement From<&mut str> for String)
 - #69988 (rustc_metadata: Remove `rmeta::MacroDef`)
 - #70006 (resolve: Fix two issues in fresh binding disambiguation)
 - #70011 (def_collector: Fully visit async functions)
 - #70013 (Return feature gate as a `Symbol` )
 - #70018 (Fix "since" field for `Once::is_complete`'s `#[stable]` attribute)

Failed merges:

r? @ghost
2020-03-15 17:27:47 +00:00
Mazdak Farrokhzad
bde77af094
Rollup merge of #70018 - LukasKalbertodt:fix-once-is-complete-since, r=Centril
Fix "since" field for `Once::is_complete`'s `#[stable]` attribute

It was accidentally merged with the wrong version in #68945.  Thanks @jplatte for noticing.

This also needs to be beta backported.
2020-03-15 15:40:15 +01:00
Mazdak Farrokhzad
b46ef3dd03
Rollup merge of #70013 - ecstatic-morse:check-consts-feature-gate, r=oli-obk
Return feature gate as a `Symbol`

A minor refactoring that will be needed for #68940. That PR is blocked on me changing the error comments in a whole lot of UI tests.

r? @oli-obk
2020-03-15 15:40:13 +01:00
Mazdak Farrokhzad
d74c5cd07c
Rollup merge of #70011 - petrochenkov:asyncice, r=Centril
def_collector: Fully visit async functions

We forgot to visit attributes previously, it caused ICEs.

Special treatment of async functions is also moved from `visit_item` to `visit_fn` to reuse more of the default visitor.

Fixes https://github.com/rust-lang/rust/issues/67778.
2020-03-15 15:40:12 +01:00
Mazdak Farrokhzad
d986a706bd
Rollup merge of #70006 - petrochenkov:fresh, r=Centril
resolve: Fix two issues in fresh binding disambiguation

Prevent fresh bindings from shadowing ambiguity items.
Fixes https://github.com/rust-lang/rust/issues/46079

Correctly treat const generic parameters in fresh binding disambiguation.
Fixes https://github.com/rust-lang/rust/issues/68853
2020-03-15 15:40:10 +01:00
Mazdak Farrokhzad
8bca839fdf
Rollup merge of #69988 - petrochenkov:nomacrodef, r=Centril
rustc_metadata: Remove `rmeta::MacroDef`

And other related cleanups.

Follow-up to https://github.com/rust-lang/rust/pull/66364.
r? @Centril
2020-03-15 15:40:08 +01:00
Mazdak Farrokhzad
cc1623267b
Rollup merge of #69661 - lopopolo:string-from-mut-str, r=sfackler
Implement From<&mut str> for String

I ran into this missing impl when trying to do `String::from` on the result returned from this API in the `uuid` crate:

https://docs.rs/uuid/0.8.1/uuid/adapter/struct.Hyphenated.html#method.encode_lower

I wasn't sure what to put in the stability annotation. I'd appreciate some help with that :)
2020-03-15 15:40:07 +01:00
Mazdak Farrokhzad
d1e943f263
Rollup merge of #69589 - petrochenkov:maccall, r=Centril
ast: `Mac`/`Macro` -> `MacCall`

It's now obvious that these refer to macro calls rather than to macro definitions.

It's also a single name instead of two different names in different places.

`rustc_expand` usually calls macro calls in a wide sense (including attributes and derives) "macro invocations", but structures and variants renamed in this PR are only relevant to fn-like macros, so it's simpler and clearer to just call them calls.

cc https://github.com/rust-lang/rust/pull/63586#discussion_r314232513
r? @eddyb
2020-03-15 15:40:05 +01:00
Mazdak Farrokhzad
83aad6b9a8
Rollup merge of #69528 - HeroicKatora:finalize-ref-cell, r=dtolnay
Add undo_leak to reset RefCell borrow state

This method is complementary for the feature cell_leak added in an
earlier PR. It allows *safely* reverting the effects of leaking a borrow guard by
statically proving that such a guard could not longer exist. This was
not added to the existing `get_mut` out of concern of impacting the
complexity of the otherwise pure pointer cast and because the name
`get_mut` poorly communicates the intent of resetting remaining borrows.

This is a follow-up to #68712 and uses the same tracking issue, #69099,
as these methods deal with the same mechanism and the idea came up
[in a review comment](https://github.com/rust-lang/rust/pull/68712#discussion_r384670041).

@dtolnay who reviewed the prior PR.
cc @RalfJung
2020-03-15 15:40:03 +01:00
bors
5da2e53f47 Auto merge of #69961 - RalfJung:miri, r=RalfJung
update miri

r? @ghost
Cc @oli-obk

Fixes https://github.com/rust-lang/rust/issues/69855
2020-03-15 14:18:14 +00:00
bors
5a72ecf2c5 Auto merge of #70016 - Dylan-DPC:rollup-5k7lxs3, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #69357 (Emit 1-based column numbers in debuginfo)
 - #69471 (Remove `sip::Hasher::short_write`.)
 - #69498 (Change "method" to "associated function")
 - #69967 (Remove a few `Rc`s from RegionInferenceCtxt)
 - #69987 (Add self to .mailmap)
 - #69991 (fix E0117 message out of sync)
 - #69993 (Add long error explanation for E0693)

Failed merges:

r? @ghost
2020-03-15 10:52:37 +00:00
Ralf Jung
b8ac984129 update miri 2020-03-15 11:51:09 +01:00
Vadim Petrochenkov
78f01eca3f resolve: Prevent fresh bindings from shadowing ambiguity items
Correctly treat const generic parameters in fresh binding disambiguation
2020-03-15 12:35:48 +03:00
Lukas Kalbertodt
401a3f3762
Fix "since" field for Once::is_complete's #[stable] attribute
It was accidentally merged with the wrong version.
2020-03-15 10:19:26 +01:00
Dylan DPC
838884e022
Rollup merge of #69993 - ayushmishra2005:doc/61137-add-long-error-code-e0693, r=Dylan-DPC
Add long error explanation for E0693

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

r? @GuillaumeGomez
2020-03-15 02:44:23 +01:00
Dylan DPC
191a7965b1
Rollup merge of #69991 - contrun:fix-69980, r=Dylan-DPC
fix E0117 message out of sync

Closes https://github.com/rust-lang/rust/issues/69980
2020-03-15 02:44:22 +01:00
Dylan DPC
65f56dad14
Rollup merge of #69987 - kraai:mailmap, r=nikomatsakis
Add self to .mailmap

The variants are only used for [rust-lang/rust-clippy](https://github.com/rust-lang/rust-clippy), but it seems like <https://thanks.rust-lang.org/> only uses this `.mailmap`.
2020-03-15 02:44:20 +01:00
Dylan DPC
bf6e715fa0
Rollup merge of #69967 - mark-i-m:rinfctx, r=matthewjasper
Remove a few `Rc`s from RegionInferenceCtxt

fixes https://github.com/rust-lang/rust/issues/55853

r? @matthewjasper
2020-03-15 02:44:18 +01:00
Dylan DPC
f40272ca6f
Rollup merge of #69498 - mark-i-m:describe-it-2, r=matthewjasper
Change "method" to "associated function"

r? @matthewjasper

cc @Centril @eddyb #67742

I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it...

The relevant changes are the last two commits (it is rebased on top of #67742)
2020-03-15 02:44:17 +01:00
Dylan DPC
0619e4649d
Rollup merge of #69471 - nnethercote:rm-sip-Hasher-short_write, r=dtolnay
Remove `sip::Hasher::short_write`.

`sip::Hasher::short_write` is currently unused. It is called by
`sip::Hasher::write_{u8,usize}`, but those methods are also unused,
because `DefaultHasher`, `SipHasher` and `SipHasher13` don't implement
any of the `write_xyz` methods, so all their write operations end up
calling `sip::Hasher::write`.

(I confirmed this by inserting a `panic!` in `sip::Hasher::short_write`
and running the tests -- they all passed.)

The alternative would be to add all the missing `write_xyz` methods.
This does give some significant speed-ups, but it hurts compile times a
little in some cases. See #69152 for details. This commit does the
conservative thing and doesn't change existing behaviour.

r? @rust-lang/libs
2020-03-15 02:44:15 +01:00
Dylan DPC
62c0579116
Rollup merge of #69357 - tmiasko:debuginfo-column, r=michaelwoerister
Emit 1-based column numbers in debuginfo

* Use byte offsets instead of char position offsets. Resolves #67360.
* Use 1-based offsets instead of 0-based ones. Resolves #65437.
* Consistently omit column information for msvc targets, matching clang behaviour (previously columns have been omitted from `DILocation`, but not from `DILexicalBlock`).
2020-03-15 02:44:13 +01:00
Vadim Petrochenkov
2093d83afc def_collector: Fully visit async functions 2020-03-15 03:15:47 +03:00
Dylan MacKenzie
d7e6649326 Return feature gate as a Symbol 2020-03-14 16:04:42 -07: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
Ayush Kumar Mishra
1c88052fa0 Add long error explanation for E0693 #61137 2020-03-14 08:41:05 +05:30
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
YI
47f6d63e10 fix E0117 message out of sync 2020-03-14 09:23:59 +08: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
Vadim Petrochenkov
01a0c6d441 rustc_metadata: Remove rmeta::MacroDef
Use `ast::MacroDef` instead.

Also remove `Session::imported_macro_spans`, external macros have spans now.
2020-03-14 00:27:13 +03: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
KRAAI, MATTHEW [VISUS]
40ffcc2911 Add self to .mailmap 2020-03-13 12:03:53 -07: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