Commit Graph

122971 Commits

Author SHA1 Message Date
Dennis Hamester
87895251ea test: rustdoc-ui: issue-74134: Shorten a too long line 2020-07-11 10:31:27 +02:00
Dennis Hamester
97048595e1 test: rustdoc-ui: Expand issue-74134 to cover types in a private module 2020-07-11 10:02:18 +02:00
Dennis Hamester
689e360d82 test: rustdoc-ui: Add issue-74134, replacing test/rustdoc/issue-74134-*
As per the discussion in PR #74147, the 4 individual tests are replaced by a
single one.

The test is expanded to cover all 4 public/private cases, each with and without
--document-private-items.
2020-07-11 09:26:26 +02:00
Dennis Hamester
c8b16cdbd0 rustdoc: Allow linking from private items to private types
Fixes #74134

After PR #72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
2020-07-08 08:15:34 +02:00
bors
8ac1525e09 Auto merge of #74006 - euclio:sys-unix-static-mut, r=oli-obk
libstd: remove some mutable statics in sys::unix

My understanding is that this achieves the same behavior and performance with safe code.
2020-07-07 19:35:26 +00:00
bors
e1beee4992 Auto merge of #74059 - RalfJung:miri-uninit-validation, r=oli-obk
Miri value validation: fix handling of uninit memory

Fixes https://github.com/rust-lang/miri/issues/1456
Fixes https://github.com/rust-lang/miri/issues/1467

r? @oli-obk
2020-07-07 14:21:18 +00:00
bors
51eeabf505 Auto merge of #73562 - poliorcetics:e0432-to-edition2018, r=GuillaumeGomez
Update E0432 long description with the separate behaviors of editions 2015 and 2018

Fixes #64668.

I restarted from the work done in #71413.
2020-07-07 09:22:57 +00:00
bors
70f9d23b91 Auto merge of #74117 - Manishearth:rollup-ds7z0kx, r=Manishearth
Rollup of 14 pull requests

Successful merges:

 - #70563 ([rustdoc] Page hash handling)
 - #73856 (Edit librustc_lexer top-level docs)
 - #73870 (typeck: adding type information to projection)
 - #73953 (Audit hidden/short code suggestions)
 - #73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)])
 - #73969 (mir: mark mir construction temporaries as internal)
 - #73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr))
 - #74067 (rustdoc: Restore underline text decoration on hover for FQN in header)
 - #74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.)
 - #74078 (Always resolve type@primitive as a primitive, not a module)
 - #74089 (Add rust-analyzer to the build manifest)
 - #74090 (Remove unused RUSTC_DEBUG_ASSERTIONS)
 - #74102 (Fix const prop ICE)
 - #74112 (Expand abbreviation in core::ffi description)

Failed merges:

r? @ghost
2020-07-07 00:56:44 +00:00
Manish Goregaokar
73f2069d52
Rollup merge of #74112 - pierwill:patch-2, r=sfackler
Expand abbreviation in core::ffi description
2020-07-06 17:45:41 -07:00
Manish Goregaokar
38f5151d3f
Rollup merge of #74102 - oli-obk:const_prop_icde, r=wesleywiser
Fix const prop ICE

we used to erase the local just before we tried to read it for diagnostics

fixes #73993

r? @wesleywiser
2020-07-06 17:45:39 -07:00
Manish Goregaokar
50e22bddcf
Rollup merge of #74090 - tmiasko:rustc-debug-assertions, r=RalfJung
Remove unused RUSTC_DEBUG_ASSERTIONS

Since #73374 the rustc wrapper no longer configures debug assertions
based on RUSTC_DEBUG_ASSERTIONS environment variable.

r? @RalfJung
2020-07-06 17:45:37 -07:00
Manish Goregaokar
caa858ba48
Rollup merge of #74089 - matklad:ship-rust-analyzer-some-more, r=pietroalbini
Add rust-analyzer to the build manifest

Does not die locally, produces `rust-analyzer-0.1.0-dev-x86_64-unknown-linux-gnu.tar.gz.sha256` and add something about rust-analyzer to some `.toml` file. Seems like a success?
2020-07-06 17:45:35 -07:00
Manish Goregaokar
ecc6f5683b
Rollup merge of #74078 - jyn514:lut, r=Manishearth
Always resolve type@primitive as a primitive, not a module

Previously, if there were a module in scope with the same name as the
primitive, that would take precedence. Coupled with
https://github.com/rust-lang/rust/issues/58699, this made it impossible
to link to the primitive when that module was in scope.

This approach could be extended so that `struct@foo` would no longer resolve
to any type, etc. However, it could not be used for glob imports:

```rust
pub mod foo {
  pub struct Bar;
}

pub enum Bar {}
use foo::*;

// This is expected to link to `inner::Bar`, but instead it will link to the enum.
/// Link to [struct@Bar]
pub struct MyDocs;
```

The reason for this is that this change does not affect the resolution
algorithm of rustc_resolve at all. The only reason we could special-case
primitives is because we have a list of all possible primitives ahead of time.

Closes https://github.com/rust-lang/rust/issues/74063

r? @Manishearth
2020-07-06 17:45:34 -07:00
Manish Goregaokar
86f8c5350f
Rollup merge of #74074 - sunfishcode:windows-openoptionsext-return-type, r=LukasKalbertodt
Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.

This adjusts the return type of Windows' `OpenOptionsExt::security_qos_flags`
to be consistent with the other functions in the trait.
2020-07-06 17:45:32 -07:00
Manish Goregaokar
3199aeb654
Rollup merge of #74067 - rye:rustdoc-fqn-hover-underline, r=GuillaumeGomez
rustdoc: Restore underline text decoration on hover for FQN in header

This causes the components of FQN's (e.g. `std`, `net`, and `Ipv4Addr` of the FQN `std::net::Ipv4Addr`) to behave similarly to other links in the contents of rustdoc-styled pages. When the user hovers over them, more clearly indicating that they can be used for navigation.

I (and I hope others at least in part) have found the prior design to be somewhat confusing, as it is not clear (upon hovering) that the various parts of the FQN are actually links that the user can navigate to.

<details><summary>📸 Before, mouse hovered over "net" in the FQN</summary>
<img alt="A rustdoc page with the mouse hovered over the fully-qualified name in the page header, producing no visual change" src="https://user-images.githubusercontent.com/1566689/86538363-4c827000-bebb-11ea-8291-5ea6b85d7e19.png" />
</details>
<details><summary>📸 After, mouse hovered over "net" in the FQN</summary>
<img alt="A rustdoc page with the mouse hovered over the fully-qualified name in the page header, now with an underline showing up under the word hovered over by the mouse" src="https://user-images.githubusercontent.com/1566689/86538471-d3374d00-bebb-11ea-9bb3-7aa2d7a4800b.png" />
</details>
2020-07-06 17:45:30 -07:00
Manish Goregaokar
7d7b3e637c
Rollup merge of #73974 - CAD97:rc-no-weak, r=dtolnay
Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr)

These were stabilized alongside the Weak versions, but having `feature = "weak_.."` on a fn definition for the non-weak pointers is potentially very misleading, especially in a review context where the impl header may not be immediately visible.

r? @RalfJung
@bors rollup=always
2020-07-06 17:45:28 -07:00
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
Andy Russell
792f2dedd7
libstd: remove some mutable statics in sys::unix 2020-07-06 20:13:54 -04:00
pierwill
36e50a0fb3 Edit librustc_lexer top-level docs
Add link to librustc_parse::lexer
2020-07-06 16:01:47 -07:00
pierwill
7610ab36f8
Expand abbreviation in core::ffi description 2020-07-06 14:30:37 -07:00
bors
8981dbbc36 Auto merge of #73978 - Mark-Simulacrum:shrink-paramenv, r=nnethercote
Shrink ParamEnv to 16 bytes

r? @nnethercote

x.py check passes but I haven't tried running perf or tests
2020-07-06 20:44:16 +00:00
Aleksey Kladov
fdd39a343e Add rust-analyzer to the build manifest 2020-07-06 11:13:27 +02:00
Joshua Nelson
e46c18768e Always resolve type@primitive as a primitive, not a module
Previously, if there were a module in scope with the same name as the
primitive, that would take precedence. Coupled with
https://github.com/rust-lang/rust/issues/58699, this made it impossible
to link to the primitive when that module was in scope.

This approach could be extended so that `struct@foo` would no longer resolve
to any type, etc. However, it could not be used for glob imports:

```rust
pub mod foo {
  pub struct Bar;
}

pub enum Bar {}
use foo::*;

// This is expected to link to `inner::Bar`, but instead it will link to the enum.
/// Link to [struct@Bar]
pub struct MyDocs;
```

The reason for this is that this change does not affect the resolution
algorithm of rustc_resolve at all. The only reason we could special-case
primitives is because we have a list of all possible primitives ahead of time.
2020-07-05 21:40:02 -04: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
Dan Gohman
6196eaa0b1 Fix the return type of Windows' OpenOptionsExt::security_qos_flags.
This adjusts the return type of Windows' `OpenOptionsExt::security_qos_flags`
to be consistent with the other functions in the trait.
2020-07-05 16:04:27 -07:00
Tomasz Miąsko
5fa19ad2bb Remove unused RUSTC_DEBUG_ASSERTIONS
Since #73374 the rustc wrapper no longer configures debug assertions
based on RUSTC_DEBUG_ASSERTIONS environment variable.
2020-07-06 00:16:12 +02: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
Kristofer Rye
2f314268b8
rustdoc: Restore underline text decoration on hover for FQN in header
This causes the components of FQN's to behave similarly to other links
in the contents of rustdoc-styled pages.

I (and I hope others at least in part) have found the prior design to be
somewhat confusing, as it is not clear (upon hovering) that the various
parts of the FQN are actually links that the user can navigate to.

In short, this patch makes links in the FQN have an underline when the
user hovers over them, more clearly indicating that they can be used for
navigation.

Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
2020-07-05 12:25:26 -05:00
Ralf Jung
9cb1ffdd4f variant_count: avoid incorrect dummy implementation 2020-07-05 18:12:21 +02:00
Ralf Jung
319c7f77de fmt 2020-07-05 16:01:18 +02:00
Mark Rousskov
8512d2efde Avoid deconstructing pointer for hashing 2020-07-05 09:51:42 -04:00
Mark Rousskov
aae1215f7f Shrink ParamEnv to 16 bytes 2020-07-05 09:51:42 -04:00
Ralf Jung
751b594cc8 const validation: add test for uninit bool 2020-07-05 13:48:06 +02:00