Commit Graph

122937 Commits

Author SHA1 Message Date
Manish Goregaokar
62ba1bf1f1
Rollup merge of #73969 - davidtwco:issue-73914-checkedadd-temp-generator-interior, r=matthewjasper
mir: mark mir construction temporaries as internal

Fixes #73914.

This PR marks temporaries from MIR construction as internal such that they are skipped in `sanitize_witness` (where each MIR local is checked to have been contained within the generator interior computed during typeck). This resolves an ICE whereby the construction of checked addition introduced a `(u64, bool)` temporary which was not in the HIR and thus not in the generator interior.

r? @matthewjasper
2020-07-06 17:45:26 -07:00
Manish Goregaokar
ca5b64d2d2
Rollup merge of #73962 - ryr3:unsafe_tcp, r=LukasKalbertodt
libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]

Enclose unsafe operations in unsafe blocks for net/tcp.rs. Fixes part of #73904.
2020-07-06 17:45:24 -07:00
Manish Goregaokar
e74ab50d07
Rollup merge of #73953 - JohnTitor:audit-hidden-sugg, r=estebank
Audit hidden/short code suggestions

Should fix #73641.
Audit uses of `span_suggestion_short` and `tool_only_span_suggestion` (`span_suggestion_hidden` is already tested with `run-rustfix`). Leave some FIXMEs for futher improvements/fixes.
r? @estebank
2020-07-06 17:45:22 -07:00
Manish Goregaokar
7942d9a65a
Rollup merge of #73870 - sexxi-goose:projection-ty, r=nikomatsakis
typeck: adding type information to projection

This commit modifies the Place as follow:
* remove 'ty' from ProjectionKind
* add type information into to Projection
* replace 'ty' in Place with 'base_ty'
* introduce 'ty()' in `Place` to return the final type of the `Place`
* introduce `ty_before_projection()` in `Place` to return the type of
  a `Place` before i'th projection is applied

Closes https://github.com/rust-lang/project-rfc-2229/issues/5
2020-07-06 17:45:20 -07:00
Manish Goregaokar
3f90287bb6
Rollup merge of #73856 - pierwill:pierwill-lexer-doc, r=jonas-schievink
Edit librustc_lexer top-level docs

Minor edit, and adds link to librustc_parse::lexer.
2020-07-06 17:45:17 -07:00
Manish Goregaokar
218d96ed6b
Rollup merge of #70563 - GuillaumeGomez:page-hash-handling, r=ollie27,kinnison
[rustdoc] Page hash handling

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

A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3

After the change, it actually goes to the target element (and change the page hash to something more clear for the users).

r? @kinnison

cc @ollie27
2020-07-06 17:45:15 -07:00
pierwill
36e50a0fb3 Edit librustc_lexer top-level docs
Add link to librustc_parse::lexer
2020-07-06 16:01:47 -07:00
bors
0c03aee8b8 Auto merge of #74073 - Manishearth:rollup-faqo9lx, r=Manishearth
Rollup of 12 pull requests

Successful merges:

 - #72688 (added .collect() into String from Box<str>)
 - #73787 (Add unstable docs for rustc_attrs)
 - #73834 (Some refactoring around intrinsic type checking)
 - #73871 (Fix try_print_visible_def_path for Rust 2018)
 - #73937 (Explain exhaustive matching on {usize,isize} maximum values)
 - #73973 (Use `Span`s to identify unreachable subpatterns in or-patterns)
 - #74000 (add `lazy_normalization_consts` feature gate)
 - #74025 (Remove unnecessary release from Arc::try_unwrap)
 - #74027 (Convert more `DefId`s to `LocalDefId`s)
 - #74055 (Fix spacing in Iterator fold doc)
 - #74057 (expected_found `&T` -> `T`)
 - #74064 (variant_count: avoid incorrect dummy implementation)

Failed merges:

r? @ghost
2020-07-05 23:08:08 +00:00
Manish Goregaokar
e62436333e
Rollup merge of #74064 - RalfJung:variant-count-bootstrap, r=kennytm
variant_count: avoid incorrect dummy implementation

This also avoids a stage 0 doctest failure.
2020-07-05 16:07:39 -07:00
Manish Goregaokar
b4710bde3d
Rollup merge of #74057 - lcnr:expected_found, r=davidtwco
expected_found `&T` -> `T`
2020-07-05 16:07:37 -07:00
Manish Goregaokar
4591b0f40c
Rollup merge of #74055 - pickfire:patch-1, r=jonas-schievink
Fix spacing in Iterator fold doc
2020-07-05 16:07:35 -07:00
Manish Goregaokar
a1c076fa75
Rollup merge of #74027 - lcnr:ConstCx-local-def-id, r=varkor
Convert more `DefId`s to `LocalDefId`s
2020-07-05 16:07:34 -07:00
Manish Goregaokar
aef2ca6681
Rollup merge of #74025 - tmiasko:try-unwrap, r=Amanieu
Remove unnecessary release from Arc::try_unwrap

The thread that recovers the unique access to Arc inner value (e.g., drop
when ref-count strong reaches zero, successful try_unwrap), ensures that
other operations on Arc inner value happened before by synchronizing
with release operations performed when decrementing the reference counter.

When try_unwrap succeeds, the current thread recovers the unique access
to Arc inner value, so release is unnecessary.

r? @Amanieu
2020-07-05 16:07:32 -07:00
Manish Goregaokar
0eadeda945
Rollup merge of #74000 - lcnr:lazy_normalisation_consts, r=varkor
add `lazy_normalization_consts` feature gate

In #71973 I underestimated the amount of code which is influenced by lazy normalization of consts
and decided against having a separate feature flag for this.

Looking a bit more into this, the following issues are already working with lazy norm in its current state #47814 #57739 #73980

I therefore think it is worth it to enable lazy norm separately. Note that `#![feature(const_generics)]` still automatically activates
this feature, so using `#![feature(const_generics, lazy_normalization_consts)]` is redundant.

r? @varkor @nikomatsakis
2020-07-05 16:07:30 -07:00
Manish Goregaokar
e450646e97
Rollup merge of #73973 - Nadrieril:fix-71977, r=matthewjasper
Use `Span`s to identify unreachable subpatterns in or-patterns

Fixes #71977
2020-07-05 16:07:28 -07:00
Manish Goregaokar
a1ac4d66d3
Rollup merge of #73937 - JohnTitor:note-exhaustive-sized-int, r=varkor
Explain exhaustive matching on {usize,isize} maximum values

The wording is taken from https://github.com/rust-lang/rfcs/blob/master/text/2591-exhaustive-integer-pattern-matching.md#reference-level-explanation.
Fixes #73919

r? @varkor
2020-07-05 16:07:27 -07:00
Manish Goregaokar
3e78eac206
Rollup merge of #73871 - da-x:private-types-2018-no-extern, r=petrochenkov
Fix try_print_visible_def_path for Rust 2018

The recursive check of `try_print_visible_def_path` did not properly handle the Rust 2018 case of crate-paths without 'extern crate'. Instead, it returned a "not found" via (false, self).

 This fixes #56175.
2020-07-05 16:07:25 -07:00
Manish Goregaokar
fed20132a6
Rollup merge of #73834 - oli-obk:safe_intrinsics, r=ecstatic-morse
Some refactoring around intrinsic type checking

So... This PR went a bit overboard. I wanted to make the `rustc_peek` intrinsic safe (cc @ecstatic-morse ), and remembered a long-standing itch of mine. So I made that huge `&str` match for the intrinsic name a match on `Symbol`s (so basically `u32`s). This is unlikely to have a positive perf effect, even if it likely has better codegen (intrinsics are used rarely, mostly once in their wrapper), so it's mostly a consistency thing since other places actually match on the symbol name of the intrinsics.
2020-07-05 16:07:23 -07:00
Manish Goregaokar
e2ae88d4a6
Rollup merge of #73787 - pickfire:rustc-attrs, r=RalfJung
Add unstable docs for rustc_attrs

r? @RalfJung
2020-07-05 16:07:21 -07:00
Manish Goregaokar
5311daa136
Rollup merge of #72688 - djugei:master, r=Amanieu
added .collect() into String from Box<str>

I have not created an rfc, because i felt like this is a very minor change.

i have just set a random feature name and rust version as stability attribute, i expect to have to change that, i just don't know what the policy on that is. all guides i could find focused on contributing to the compiler, not contributing to the standard library.

drawbacks: more code in the standard library, could be replaced with specialization: base-implementation for AsRef\<str> and specialization for String and Cow. i can write that code if ppl want it.

advantages: using "real strings" i.e. Box\<str> is as ergonomic as string slices (&str) and string buffers (String) with iterators.
2020-07-05 16:07:19 -07:00
bors
2753fab7ce Auto merge of #73879 - ecstatic-morse:discr-switch-uninit, r=oli-obk
Handle inactive enum variants in `MaybeUninitializedPlaces`

Resolves the first part of #69715.

This is the equivalent of #68528 but for `MaybeUninitializedPlaces`. Because we now notify drop elaboration that inactive enum variants might be uninitialized, some drops get marked as ["open" that were previously "static"](e0e5d82e16/src/librustc_mir/transform/elaborate_drops.rs (L191)). Unlike in #69715, this isn't strictly better: An "open" drop expands to more MIR than a simple call to the drop shim. However, because drop elaboration considers each field of an "open" drop separately, it can sometimes eliminate unnecessary drops of moved-from or unit-like enum variants. This is the case for `Option::unwrap`, which is reflected in the `mir-opt` test.

cc @eddyb
r? @oli-obk
2020-07-05 18:01:47 +00:00
Ralf Jung
9cb1ffdd4f variant_count: avoid incorrect dummy implementation 2020-07-05 18:12:21 +02:00
Bastian Kauschke
016e9f8157 expected found &T -> T 2020-07-05 11:38:39 +02:00
Ivan Tham
bc0d619325
Fix spacing in Iterator fold doc 2020-07-05 15:23:42 +08:00
Nadrieril
3cb31b6699 Fix #71977 2020-07-04 21:21:07 +01:00
Yuki Okushi
b93ecc1dac
Address code reviews 2020-07-05 03:43:43 +09:00
Yuki Okushi
dcbe85abad
Explain exhaustive matching on {usize,isize} maximum values 2020-07-05 02:10:57 +09:00
Oliver Scherer
394b8cdfb7 Match on Symbol instead of &str for type-checking intrinsics. 2020-07-04 18:37:52 +02:00
Oliver Scherer
66fb778acc Make rustc_peek a safe intrinsic 2020-07-04 18:30:54 +02:00
Bastian Kauschke
f5305c3d16
nit
Co-authored-by: varkor <github@varkor.com>
2020-07-04 16:20:27 +02:00
Bastian Kauschke
dbcabc248c instantiate_opaque_types LocalDefId 2020-07-04 14:37:03 +02:00
Bastian Kauschke
20d6941be7 ConstCx to LocalDefId 2020-07-04 14:02:41 +02:00
Tomasz Miąsko
8900502a88 Remove unnecessary release from Arc::try_unwrap
The thread that recovers the unique access to Arc inner value (e.g., drop
when ref-count strong reaches zero, successful try_unwrap), ensures that
other operations on Arc inner value happened before by synchronizing
with release operations performed when decrementing the reference counter.

When try_unwrap succeeds, the current thread recovers the unique access
to Arc inner value, so release is unnecessary.
2020-07-04 11:40:27 +02:00
Bastian Kauschke
7a3081baaf add lazy_normalization_consts feature gate 2020-07-04 10:50:14 +02:00
bors
0cd7ff7ddf Auto merge of #72978 - matklad:ship-rust-analyzer, r=Mark-Simulacrum
ship rust analyzer

This successfully  builds rust-analyzer as a part of rust repo. I haven't yet added required changes to dist.rs -- seems like I just have to copy-paste quite a bit of code I don't really understand :-)
2020-07-04 04:54:27 +00:00
bors
dbf3ae7c3b Auto merge of #74019 - Manishearth:rollup-2st3jsk, r=Manishearth
Rollup of 12 pull requests

Successful merges:

 - #73140 (Fallback to xml.etree.ElementTree)
 - #73670 (Add `format_args_capture` feature)
 - #73693 (Use exhaustive match in const_prop.rs)
 - #73845 (Use &raw in A|Rc::as_ptr)
 - #73861 (Create E0768)
 - #73881 (Standardize bibliographic citations in rustc API docs)
 - #73925 (Improve comments from #72617, as suggested by RalfJung)
 - #73949 ([mir-opt] Fix mis-optimization and other issues with the SimplifyArmIdentity pass)
 - #73984 (Edit docs for rustc_data_structures::graph::scc)
 - #73985 (Fix "getting started" link)
 - #73997 (fix typo)
 - #73999 (Bump mingw-check CI image from Ubuntu 16.04 to 18.04.)

Failed merges:

 - #74000 (add `lazy_normalization_consts` feature gate)

r? @ghost
2020-07-04 01:09:09 +00:00
Manish Goregaokar
d69a8468fa
Rollup merge of #73999 - eddyb:svv-prereq, r=Mark-Simulacrum
Bump mingw-check CI image from Ubuntu 16.04 to 18.04.

I chose 18.04 because we use it for other builders, and it's enough to get a version of MinGW that can build `libssh2-sys`.

This is a prereq for #73902, where `libssh2-sys` shows up as an indirect dependency of `x.py check src/tools/semverver` (through `src/tools/cargo`, which we don't currently `x.py check` because it's not in-tree). See also https://github.com/rust-lang/rust/pull/73902#issuecomment-652414502.

r? @Mark-Simulacrum cc @mati865
2020-07-03 17:17:10 -07:00
Manish Goregaokar
e005c97255
Rollup merge of #73997 - rust-lang:lcnr-patch-1, r=jonas-schievink
fix typo

r? @Dylan-DPC
2020-07-03 17:17:09 -07:00
Manish Goregaokar
e4c505b879
Rollup merge of #73985 - e00E:fix-getting-started-link, r=jonas-schievink
Fix "getting started" link

The previous link is 404.
2020-07-03 17:17:07 -07:00
Manish Goregaokar
70c4b2ff60
Rollup merge of #73984 - pierwill:pierwill-tarjan, r=jonas-schievink
Edit docs for rustc_data_structures::graph::scc

- Add newline to provide concise module summary
- Add wikipedia link
- Italicize O notation
2020-07-03 17:17:05 -07:00
Manish Goregaokar
60cad20b41
Rollup merge of #73949 - wesleywiser:simplify_try_fixes, r=oli-obk
[mir-opt] Fix mis-optimization and other issues with the SimplifyArmIdentity pass

This does not yet attempt re-enabling the pass, but it does resolve a number of issues with the pass.

r? @oli-obk

I believe this closes #73223.
2020-07-03 17:17:03 -07:00
Manish Goregaokar
9d0ca3806f
Rollup merge of #73925 - eduardosm:improve-pr72617-comments, r=RalfJung
Improve comments from #72617, as suggested by RalfJung

r? @RalfJung
2020-07-03 17:17:01 -07:00
Manish Goregaokar
d46de1052d
Rollup merge of #73881 - pierwill:pierwill-citations, r=jonas-schievink
Standardize bibliographic citations in rustc API docs

See #73877.
2020-07-03 17:16:59 -07:00
Manish Goregaokar
6339abd338
Rollup merge of #73861 - GuillaumeGomez:create-e0767, r=Dylan-DPC
Create E0768

r? @Dylan-DPC
2020-07-03 17:16:58 -07:00
Manish Goregaokar
9a659c54e5
Rollup merge of #73845 - CAD97:weak-as-unsized-ptr, r=RalfJung
Use &raw in A|Rc::as_ptr

This PR uses `&raw` for offsetting `*mut [A]RcInner<T> -> *mut T`.

Additionally, this updates the implementation of `Weak::as_ptr` to support unsized `T`, though it does not yet relax the bounds of `Weak::as_ptr`/`into_raw`/`from_raw` to accept unsized `T`.
2020-07-03 17:16:56 -07:00
Manish Goregaokar
50dcefca78
Rollup merge of #73693 - wesleywiser:const_prop_exhaustive_match, r=oli-obk
Use exhaustive match in const_prop.rs

Addresses a comment left by @RalfJung on #73613

r? @RalfJung
2020-07-03 17:16:54 -07:00
Manish Goregaokar
4a8d9ea80f
Rollup merge of #73670 - davidhewitt:format-args-capture, r=varkor
Add `format_args_capture` feature

This is the initial implementation PR for [RFC 2795](https://github.com/rust-lang/rfcs/pull/2795).

Note that, as dicussed in the tracking issue (#67984), the feature gate has been called `format_args_capture`.

Next up I guess I need to add documentation for this feature. I've not written any docs before for rustc / std so I would appreciate suggestions on where I should add docs.
2020-07-03 17:16:52 -07:00
Manish Goregaokar
df8f551e79
Rollup merge of #73140 - tmiasko:element-tree, r=GuillaumeGomez
Fallback to xml.etree.ElementTree

The xml.etree.cElementTree has been deprecated since Python 3.3
and removed in Python 3.9 https://bugs.python.org/issue36543.
2020-07-03 17:16:50 -07:00
Guillaume Gomez
6970c923d3 Update UI tests 2020-07-04 00:15:32 +02:00
Guillaume Gomez
d64a4b57ae Create new E0768 error code for "no valid digits found for number" error 2020-07-04 00:15:29 +02:00