Commit Graph

127124 Commits

Author SHA1 Message Date
Joshua Nelson
cd72d9029f Find the first segment that failed to resolve for _any_ namespace
Moves this detection into `resolution_failure` to avoid doing
unnecessary work and make the control flow a little easier to work with.
2020-09-05 13:56:57 -04:00
Joshua Nelson
8318a185f3 x.py bless 2020-09-05 13:56:57 -04:00
Joshua Nelson
efdc3facdf Give a much better error message when an item has a macro disambiguator
Previously, this called `check_full_res` for values and types, but not
macros. This would result in not showing when there was a partial
resolution for a parent of the item.

This now calls `check_full_res`. Additionally, it checks if there was a
disambiguator, and if so, says that specific kind wasn't found instead
of saying generically 'associated item'.
2020-09-05 13:56:57 -04:00
Joshua Nelson
ee683ef853 Say 'prefix with kind@' instead of 'prefix with the item kind'
This is both more specific and easier to read.
2020-09-05 13:56:55 -04:00
Vadim Petrochenkov
8754884b78 rustbuild: Do not use rust-mingw component when bootstrapping windows-gnu targets 2020-09-05 20:49:59 +03:00
Joshua Nelson
d67eb1f148 Don't suggest \[ \] if there's a :: in the path 2020-09-05 13:48:20 -04:00
Joshua Nelson
f2826d9e9b Show the first path segment which failed to resolve.
Before, it would arbitrarily pick the third-to-last if the last three or
more did not resolve.
2020-09-05 13:48:19 -04:00
Joshua Nelson
bb9d157604 Address my own review comments
- Remove unneeded lifetime parameter
- Comment why some code doesn't use `check_full_res`
2020-09-05 13:48:19 -04:00
Joshua Nelson
2ca6f11663 Fix rebase conflicts 2020-09-05 13:48:19 -04:00
Joshua Nelson
418f6089e9 Give a better error message when linking to a macro with the wrong disambiguator
Before:

```
warning: unresolved link to `m`
 --> m.rs:1:6
  |
1 | /// [value@m]
  |      ^^^^^^^
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
  = note: no item named `m` is in scope
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
```

After:

```
warning: unresolved link to `m`
 --> m.rs:1:6
  |
1 | /// [value@m]
  |      ^^^^^^^ help: to link to the macro, use its disambiguator: `m!`
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
  = note: this link resolves to the macro `m`, which is not in the value namespace
```
2020-09-05 13:48:19 -04:00
Joshua Nelson
6875220e1a Use rustc_resolve's descr() instead of rewriting it 2020-09-05 13:48:19 -04:00
Joshua Nelson
ebc8cb470f Turn NoParentItem from a panic into an ICE 2020-09-05 13:48:19 -04:00
Joshua Nelson
19d100278d Fix failures to resolve primitives
Previously, when looking for the associated items for primitives,
rustdoc would look for primitives in the current namespace.
But all primitives are in the type namespace. To fix this, rustdoc now
always looks for primitives in the namespace when considering them as a
stepping stone to the associated item.

However, fixing that bug caused several duplicate errors because rustdoc
now reports the same error in each namespace. To avoid this, rustdoc now
ignores all duplicate errors when issuing them.
2020-09-05 13:48:19 -04:00
Joshua Nelson
e2d69f2eb1 Make errors more concise and helpful
Before:
```
   = note: this link partially resolves to the struct `S`
   = note: no `fmt` in `S`
```

After:
```
   = note: the struct `S` has no field or associated item named `fmt`
```
2020-09-05 13:48:19 -04:00
Joshua Nelson
7b8d0befd6 Remove some TODOs 2020-09-05 13:48:19 -04:00
Joshua Nelson
002d3a922c Don't give misleading errors for f::A, where f is in the value namespace 2020-09-05 13:48:19 -04:00
Joshua Nelson
f4e6ebd11a Fix tests and improve error message if :: isn't found 2020-09-05 13:48:19 -04:00
Joshua Nelson
42bed03500 Pass on the DefId so rustdoc can name it in suggestions
Look at this beauty:

```rust
error: unresolved link to `S::h`
  --> intra-link-errors.rs:51:6
   |
51 | /// [type@S::h]
   |      ^^^^^^^^^ help: to link to the associated function, use its disambiguator: `S::h()`
   |
   = note: this link resolves to the associated function `h`, which is not in the type namespace
```
2020-09-05 13:48:19 -04:00
Joshua Nelson
fcb21999a7 Report if the thing exists in another namespace 2020-09-05 13:48:19 -04:00
Joshua Nelson
4ace4e7520 Use fewer .to_string()s 2020-09-05 13:48:19 -04:00
Joshua Nelson
f45e7b5862 Update .stderr 2020-09-05 13:48:19 -04:00
Joshua Nelson
3797f29aad [WIP] give better errors for broken intra doc links 2020-09-05 13:48:19 -04:00
Vadim Petrochenkov
4fff14d3d8 rustbuild: Remove Mode::Codegen 2020-09-05 20:34:03 +03:00
bors
04f44fb923 Auto merge of #75872 - mati865:pgo-tests, r=petrochenkov
Enable some of profiler tests on Windows-gnu

CC https://github.com/rust-lang/rust/issues/61266

Because of force-push GitHub didn't let me reopen https://github.com/rust-lang/rust/pull/75184

Because of the GCC miscompilation, generated binaries either segfault or `.profraw` is malformed. Clang works fine but we can't use it on the CI.
However we can still test the IR for the proper instrumentation so let's do it.
2020-09-05 17:18:26 +00:00
Ralf Jung
35068326b5 document remaining unsafety in maybe_uninit.rs 2020-09-05 17:24:22 +02:00
Ralf Jung
cff5f56886 rename MaybeUninit slice methods
first_ptr -> slice_as_ptr
first_ptr_mut -> slice_as_mut_ptr
slice_get_ref -> slice_assume_init_ref
slice_get_mut -> slice_assume_init_mut
2020-09-05 17:24:22 +02:00
Takayuki Nakata
96b31a5b36 Fix FP when coercion kicks in 2020-09-06 00:02:35 +09:00
bors
7d289aeade Auto merge of #76376 - Dylan-DPC:rollup-8chsbw9, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #75695 (Add a regression test for issue-72793)
 - #75741 (Refactor byteorder to std in rustc_middle)
 - #75954 (Unstable Book: add links to tracking issues for FFI features)
 - #75994 (`impl Rc::new_cyclic`)
 - #76060 (Link vec doc to & reference)
 - #76078 (Remove disambiguators from intra doc link text)
 - #76082 (Fix intra-doc links on pub re-exports)
 - #76254 (Fold length constant in Rvalue::Repeat)
 - #76258 (x.py check checks tests/examples/benches)
 - #76263 (inliner: Check for codegen fn attributes compatibility)
 - #76285 (Move jointness censoring to proc_macro)

Failed merges:

r? @ghost
2020-09-05 14:59:32 +00:00
Dylan DPC
85cee57fd7
Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov
Move jointness censoring to proc_macro

Proc-macro API currently exposes jointness in `Punct` tokens. That is,
`+` in `+one` is **non** joint.

Our lexer produces jointness info for all tokens, so we need to censor
it *somewhere*

Previously we did this in a lexer, but it makes more sense to do this
in a proc-macro server.

r? @petrochenkov
2020-09-05 16:28:36 +02:00
Dylan DPC
b4d3873024
Rollup merge of #76263 - tmiasko:inline-codegen-fn-attrs, r=ecstatic-morse
inliner: Check for codegen fn attributes compatibility

* Check for target features compatibility
* Check for no_sanitize attribute compatibility

Fixes #76259.
2020-09-05 16:28:34 +02:00
Dylan DPC
45bdee8fde
Rollup merge of #76258 - Mark-Simulacrum:check-tests, r=ehuss
x.py check checks tests/examples/benches

This also adds a check for bootstrap to x.py.

r? @ehuss
2020-09-05 16:28:32 +02:00
Dylan DPC
79b8f59185
Rollup merge of #76254 - tmiasko:fold-len, r=wesleywiser
Fold length constant in Rvalue::Repeat

Fixes #76248.
2020-09-05 16:28:30 +02:00
Dylan DPC
f1eb5f800f
Rollup merge of #76082 - jyn514:top-level-links, r=ollie27,GuillaumeGomez
Fix intra-doc links on pub re-exports

Partial fix for https://github.com/rust-lang/rust/issues/76073 - This removes the incorrect error, but doesn't show the documentation anywhere.
r? @GuillaumeGomez
2020-09-05 16:28:28 +02:00
Dylan DPC
ed39e6d60a
Rollup merge of #76078 - jyn514:no-disambiguator, r=manishearth
Remove disambiguators from intra doc link text

Closes https://github.com/rust-lang/rust/issues/65354.
r? @Manishearth

The commits are mostly atomic, but there might be some mix between them here and there. I recommend reading 'refactor ItemLink' and 'refactor RenderedLink' on their own though, lots of churn without any logic changes.
2020-09-05 16:28:26 +02:00
Dylan DPC
86cf7976e2
Rollup merge of #76060 - pickfire:patch-12, r=jyn514
Link vec doc to & reference

It is not always obvious that people could see the docs for `&`
especially for beginners, it also helps learnability.
2020-09-05 16:28:24 +02:00
Dylan DPC
4bd3f266b0
Rollup merge of #75994 - mental32:impl-rc-new-cyclic, r=KodrAus
`impl Rc::new_cyclic`

References #75861

r? @Dylan-DPC
2020-09-05 16:28:22 +02:00
Dylan DPC
c3a09fba84
Rollup merge of #75954 - ArekPiekarz:unstable_book_ffi_tracking_issues, r=steveklabnik
Unstable Book: add links to tracking issues for FFI features
2020-09-05 16:28:20 +02:00
Dylan DPC
e160d2b3e0
Rollup merge of #75741 - workingjubilee:refactor-byteorder, r=matthewjasper
Refactor byteorder to std in rustc_middle

Use std::io::{Read, Write} and {to, from}_{le, be}_bytes methods in
order to remove byteorder from librustc_middle's dependency graph.
2020-09-05 16:28:17 +02:00
Dylan DPC
cb33a15c3e
Rollup merge of #75695 - JohnTitor:regression-test, r=Dylan-DPC
Add a regression test for issue-72793

Adds a regression test for #72793, which is fixed by #75443. Note that this won't close the issue as the snippet still shows ICE with `-Zmir-opt-level=2`. But it makes sense to add a test anyway.
2020-09-05 16:28:16 +02:00
Mara Bos
e56ea68db5 Add compile_fail test for SyncOnceCell's dropck issue. 2020-09-05 15:55:20 +02:00
Ivan Tham
d80415a3bf
Improve ayu doc source line number contrast
Improve contrast of foreground line number.
2020-09-05 21:08:35 +08:00
Mara Bos
578e714393 Fix dropck issue of SyncOnceCell.
Fixes #76367.
2020-09-05 14:10:10 +02:00
Ayush Kumar Mishra
5a0a58bbef Added str tests in library 2020-09-05 17:18:45 +05:30
bors
81a769f261 Auto merge of #75584 - RalfJung:union-no-deref, r=matthewjasper
do not apply DerefMut on union field

This implements the part of [RFC 2514](https://github.com/rust-lang/rfcs/blob/master/text/2514-union-initialization-and-drop.md) about `DerefMut`. Unlike described in the RFC, we only apply this warning specifically when doing `DerefMut` of a `ManuallyDrop` field; that is really the case we are worried about here.

@matthewjasper suggested I patch `convert_place_derefs_to_mutable` and `convert_place_op_to_mutable` for this, but I could not find anything to do in `convert_place_op_to_mutable` and this is sufficient to make the test pass. However, maybe there are some other cases this misses? I have no familiarity with this code.

This is a breaking change *in theory*, if someone used `ManuallyDrop<T>` in a union field and relied on automatic `DerefMut`. But on stable this means `T: Copy`, so the `ManuallyDrop` is rather pointless.

Cc https://github.com/rust-lang/rust/issues/55149
2020-09-05 11:47:01 +00:00
Mateusz Mikuła
5a51293f4b Update llvm submodule 2020-09-05 12:31:16 +02:00
Mateusz Mikuła
ad69e66517 Ignore failing PGO/coverage tests on MinGW 2020-09-05 12:31:16 +02:00
bors
02fe30971e Auto merge of #75888 - GuillaumeGomez:trait-impl-assoc-const-doc-alias, r=ollie27
Add check for doc alias on assoc const in trait impl

Fixes #73721.

r? @ollie27
2020-09-05 09:35:17 +00:00
Mara Bos
61ac138b5c Disable atomics on avr target.
`max_atomic_width` was missing in the spec, which means it fell back to
the pointer width of 16 bits.
2020-09-05 11:35:01 +02:00
bors
3cecdc9cdd Auto merge of #6009 - Ryan1729:show-line_count-and-max_lines-in-too_many_lines-lint-message, r=phansch
Show line count and max lines in too_many_lines lint message

This PR adds the current amount of lines and the current maximum number of lines in the message for the `too_many_lines` lint, in a similar way as the `too_many_arguments` lint currently does.

changelog: show the line count and the maximum lines in the message for the `too_many_lines` lint.
2020-09-05 06:05:29 +00:00
Jubilee Young
2df552b406 Fix big endian read/write
Co-authored-by: matthewjasper <mjjasper1@gmail.com>
2020-09-04 21:51:29 -07:00