Commit Graph

171759 Commits

Author SHA1 Message Date
Michael Howell
a7c0c9f2bb rustdoc: add explanatory comment to width: 100% line 2022-07-02 08:41:46 -07:00
Michael Howell
c147c0daa3 rustdoc: make source sidebar toggle a real button
This fixes tab focus, so that you can open and close the sidebar
from keyboard.
2022-07-02 08:41:45 -07:00
Ralf Jung
d31cbb5150 make AllocRef APIs more consistent 2022-07-02 11:41:16 -04:00
Ralf Jung
c36572c11e add AllocRange Debug impl; remove redundant AllocId Display impl 2022-07-02 11:41:16 -04:00
Gimgim
de9b1da22a feat: Add a documentation problem issue template 2022-07-02 20:39:20 +05:30
bors
6a10920564 Auto merge of #97235 - nbdd0121:unwind, r=Amanieu
Fix FFI-unwind unsoundness with mixed panic mode

UB maybe introduced when an FFI exception happens in a `C-unwind` foreign function and it propagates through a crate compiled with `-C panic=unwind` into a crate compiled with `-C panic=abort` (#96926).

To prevent this unsoundness from happening, we will disallow a crate compiled with `-C panic=unwind` to be linked into `panic-abort` *if* it contains a call to `C-unwind` foreign function or function pointer. If no such call exists, then we continue to allow such mixed panic mode linking because it's sound (and stable). In fact we still need the ability to do mixed panic mode linking for std, because we only compile std once with `-C panic=unwind` and link it regardless panic strategy.

For libraries that wish to remain compile-once-and-linkable-to-both-panic-runtimes, a `ffi_unwind_calls` lint is added (gated under `c_unwind` feature gate) to flag any FFI unwind calls that will cause the linkable panic runtime be restricted.

In summary:
```rust
#![warn(ffi_unwind_calls)]

mod foo {
    #[no_mangle]
    pub extern "C-unwind" fn foo() {}
}

extern "C-unwind" {
    fn foo();
}

fn main() {
    // Call to Rust function is fine regardless ABI.
    foo::foo();
    // Call to foreign function, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    unsafe { foo(); }
    //~^ WARNING call to foreign function with FFI-unwind ABI
    let ptr: extern "C-unwind" fn() = foo::foo;
    // Call to function pointer, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    ptr();
    //~^ WARNING call to function pointer with FFI-unwind ABI
}
```

Fix #96926

`@rustbot` label: T-compiler F-c_unwind
2022-07-02 14:06:27 +00:00
bors
0075bb4fad Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obk
Enable MIR inlining

Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.`

#82280 has shown nice compile time wins could be obtained by enabling MIR inlining.
Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed,
except the interaction with polymorphization which is worked around specifically.

I believe we can proceed with enabling MIR inlining in the near future
(preferably just after beta branching, in case we discover new issues).

Steps before merging:
- [x] figure out the interaction with polymorphization;
- [x] figure out how miri should deal with extern types;
- [x] silence the extra arithmetic overflow warnings;
- [x] remove the codegen fulfilment ICE;
- [x] remove the type normalization ICEs while compiling nalgebra;
- [ ] tweak the inlining threshold.
2022-07-02 11:24:17 +00:00
Guillaume Gomez
b17cf7a493 Remove unwanted trailing whitespaces for long declarations 2022-07-02 12:43:07 +02:00
bors
aedf78e56b Auto merge of #98802 - Dylan-DPC:rollup-u6mwx27, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #98639 (Factor out `hir::Node::Binding`)
 - #98653 (Add regression test for #79494)
 - #98763 (bootstrap: illumos platform flags for split-debuginfo)
 - #98766 (cleanup mir visitor for `rustc::pass_by_value`)
 - #98783 (interpret: make a comment less scary)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-02 08:39:20 +00:00
Chris Denton
ee3e518291
Add #95469 to the release notes 2022-07-02 08:51:59 +01:00
Joshua Nelson
17da4e06f2 Fix bug in rustdoc -Whelp
Previously, this printed the debugging options, not the lint options,
and only handled `-Whelp`, not `-A/-D/-F`.

This also fixes a few other misc issues:
- Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests
- Add lint headers for tool lints, not just builtin lints
- Remove duplicate run-make test
2022-07-02 02:11:49 -05:00
Dylan DPC
7a4f33bec9
Rollup merge of #98783 - RalfJung:jumpscares, r=fee1-dead
interpret: make a comment less scary

This slipped past my review: "has no meaning" could be read as "is undefined behavior". That is certainly not what we mean so be more clear.
2022-07-02 12:23:42 +05:30
Dylan DPC
05aebf8f69
Rollup merge of #98766 - lcnr:mir-visit-pass_by_value, r=oli-obk
cleanup mir visitor for `rustc::pass_by_value`

by changing `& $($mutability)?` to `$(& $mutability)?`

I also did some formatting changes because I started doing them for the visit methods I changed and then couldn't get myself to stop xx, I hope that's still fairly easy to review.
2022-07-02 12:23:41 +05:30
Dylan DPC
5fe0997b54
Rollup merge of #98763 - citrus-it:illumos-split-debuginfo, r=Mark-Simulacrum
bootstrap: illumos platform flags for split-debuginfo

Bootstrap currently provides `-Zunstable-options` for platforms
when using split debuginfo - this commit adds it for the illumos
target too.
2022-07-02 12:23:40 +05:30
Dylan DPC
83dde88fbd
Rollup merge of #98653 - TaKO8Ki:add-regression-test-for-79494, r=Mark-Simulacrum
Add regression test for #79494

closes #79494
2022-07-02 12:23:39 +05:30
Dylan DPC
d287726aa0
Rollup merge of #98639 - camsteffen:no-node-binding, r=compiler-errors
Factor out `hir::Node::Binding`
2022-07-02 12:23:38 +05:30
bors
4118ad24d6 Auto merge of #98791 - cuviper:rogue-binary, r=compiler-errors
Remove the rogue ./suggest-blanket-impl-local-trait

This executable was added in #97488, presumably just a `git add` mistake.
2022-07-02 05:56:23 +00:00
Mark Rousskov
45b87fb75c Lint against executable files in the root directory
This avoids accidental introduction (such as in #97488).
2022-07-01 22:12:29 -04:00
Josh Stone
5f7aeb8f07 Remove the rogue ./suggest-blanket-impl-local-trait 2022-07-01 17:22:22 -07:00
Michael Goulet
a368830d10 Improve spans for specialization error 2022-07-01 23:56:15 +00:00
Michael Howell
b80979416d rustdoc: add test cases for :focus on sidebar details elements 2022-07-01 16:16:03 -07:00
bors
9a6fa4f118 Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #97249 (`<details>`/`<summary>` UI fixes)
 - #98418 (Allow macOS to build LLVM as shared library)
 - #98460 (Use CSS variables to handle theming)
 - #98497 (Improve some inference diagnostics)
 - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests)

Failed merges:

 - #98761 (more `need_type_info` improvements)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-01 22:55:22 +00:00
Michael Howell
180f83605a rustdoc: add spacing to the source view sidebar
https://user-images.githubusercontent.com/1593513/176974336-20cecdc3-1885-402a-a6d5-81a8dd03a45d.png
2022-07-01 15:29:47 -07:00
Mark Rousskov
d8bfae4f99 Adjust for rustfmt order change 2022-07-01 18:13:55 -04:00
Ralf Jung
65944ce522 interpret: make a comment less scary 2022-07-01 17:57:32 -04:00
Guillaume Gomez
00d68a7890
Rollup merge of #98708 - pinkforest:rustdoc-fix-98690, r=GuillaumeGomez
rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests

Closes #98690 for rustdoc panic

I changed this to do eprintln and orderly panic instead of unwrap doing unhandled panic

~/gg/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc --test -Z unstable-options --persist-doctests /tmp/foobar main.rs
Couldn't create directory for doctest executables: Permission denied (os error 13)
2022-07-01 23:39:10 +02:00
Guillaume Gomez
b0935b1ddf
Rollup merge of #98497 - compiler-errors:span-inference-note, r=lcnr
Improve some inference diagnostics

- Properly point out point location where "type must be known at this point", or else omit the note if it's not associated with a useful span.
- Fix up some type ambiguity diagnostics, errors shouldn't say "cannot infer type for reference `&'a ()`" when the given type has no inference variables.
2022-07-01 23:39:09 +02:00
Guillaume Gomez
bda659e873
Rollup merge of #98460 - GuillaumeGomez:css-simplification, r=jsha
Use CSS variables to handle theming

This is the start for our simplification of theming. Considering how big the diff quickly becomes, I think it's better to do it in multiple parts.

(The 3 first commits come from https://github.com/rust-lang/rust/pull/98297 so once it's merged, they'll disappear).

Normally they shouldn't be any UI changes. You can check it [here](https://rustdoc.crud.net/imperio/css-simplification/doc/foo/index.html).

cc `@notriddle`
r? `@jsha`
2022-07-01 23:39:08 +02:00
Guillaume Gomez
01aa10c2ff
Rollup merge of #98418 - topjohnwu:macos-dylib, r=jyn514
Allow macOS to build LLVM as shared library

Inspired by how [homebrew](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/llvm.rb) builds and distributes llvm, here we manually create a symlink with a versioned dylib path to make `llvm-config` work properly. Note, the resulting `rustc` executable and `librustc_driver-<hash>.dylib` still links to the un-versioned `libLLVM.dylib` as expected when distributed in the final output. I have confirmed this by checking `otool -L` on both binaries.

After the change, enabling `llvm.link-shared` and `llvm.thin-lto` will be possible on macOS.
2022-07-01 23:39:07 +02:00
Guillaume Gomez
194764fdc0
Rollup merge of #97249 - GuillaumeGomez:details-summary-fixes, r=notriddle
`<details>`/`<summary>` UI fixes

With images it's easier to understand:

![Screenshot from 2022-05-21 14-10-42](https://user-images.githubusercontent.com/3050060/169653038-9c58de67-589a-4986-a8ff-dbdddaf136a4.png)
![Screenshot from 2022-05-21 14-08-49](https://user-images.githubusercontent.com/3050060/169653042-56e87258-13fe-4f80-9858-4e15c318c3fb.png)

The headings in `<summary>` should not have bottom border so I removed it as well alongside the other fixes.

r? `@jsha`
2022-07-01 23:39:07 +02:00
Michael Howell
83f22885ae Improve click behavior of the source code mobile full-screen "sidebar"
On desktop, if you open the source code sidebar, it stays open even when you
move from page to page. It used to do the same thing on mobile, but I think
that's stupid. Since the file list fills the entire screen on mobile, and you
can't really do anything with the currently selected file other than dismiss
the "sidebar" to look at it, it's safe to assume that anybody who clicks a
file in that list probably wants the list to go away so they can see it.
2022-07-01 14:33:34 -07:00
bors
46b8c23f3e Auto merge of #93967 - cjgillot:short-struct-span, r=petrochenkov
Shorten def_span for more items.

The `def_span` query only returns the signature span for functions.
Struct/enum/union definitions can also have a very long body.
This PR shortens the associated span.
2022-07-01 20:14:34 +00:00
Michael Howell
1f621fba2d rustdoc cleanup: remove unused function 2022-07-01 13:03:05 -07:00
Michael Howell
2852443f48 rustdoc: use <details> tag for the source code sidebar
This fixes the extremely poor accessibility of the old system, making it
possible to navigate the sidebar by keyboard, and also implicitly gives the
sidebar items the correct ARIA roles.
2022-07-01 12:01:36 -07:00
Michael Goulet
6711313f76 Move Sized check before first error is created 2022-07-01 17:38:34 +00:00
Michael Goulet
12ab6bfafd Don't point at Self type if we can't find an infer variable in ambiguous trait predicate 2022-07-01 17:38:34 +00:00
Michael Goulet
ca0105ba4e Show source of ambiguity in a few more places 2022-07-01 17:38:34 +00:00
Michael Goulet
f44ae98cee Only label place where type is needed if span is meaningful 2022-07-01 17:38:34 +00:00
bors
5018181c79 Auto merge of #98767 - Dylan-DPC:rollup-j1gq5sr, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #97488 (Suggest blanket impl to the local traits)
 - #98585 (Make `ThinBox<T>` covariant in `T`)
 - #98644 (fix ICE with -Wrust-2021-incompatible-closure-captures)
 - #98739 (fix grammar in useless doc comment lint)
 - #98741 (Many small deriving cleanups)
 - #98756 (Use const instead of function and make it private)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-01 17:33:42 +00:00
Camille GILLOT
cbbf06b0cd Amend codegen test. 2022-07-01 17:45:13 +02:00
Camille GILLOT
a3e1a2b7ce Bless recursion test. 2022-07-01 17:45:13 +02:00
Camille GILLOT
2f35392383 Ignore test with panic=abort. 2022-07-01 17:45:13 +02:00
Camille GILLOT
42e4eee893 Shorten def_span for more items. 2022-07-01 17:39:19 +02:00
Cameron Steffen
ec82bc1996 Factor out hir::Node::Binding 2022-07-01 10:04:19 -05:00
Dylan DPC
6404620f18
Rollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dylan-DPC
Use const instead of function and make it private
2022-07-01 20:19:21 +05:30
Dylan DPC
c0cf363ca1
Rollup merge of #98741 - nnethercote:deriving-cleanups, r=Mark-Simulacrum
Many small deriving cleanups

These commits remove lots of little unnecessary things, and clarifies other things.

r? `@Mark-Simulacrum`
2022-07-01 20:19:20 +05:30
Dylan DPC
528202fec2
Rollup merge of #98739 - euclio:useless-comment-plural, r=Dylan-DPC
fix grammar in useless doc comment lint
2022-07-01 20:19:19 +05:30
Dylan DPC
90b296d770
Rollup merge of #98644 - matthiaskrgr:drp_loc_span_err__2021_inc_clos_cap, r=lcnr
fix ICE with -Wrust-2021-incompatible-closure-captures

Fixes #93117
Fixes #96258
2022-07-01 20:19:18 +05:30
Dylan DPC
9dd3288557
Rollup merge of #98585 - cuviper:covariant-thinbox, r=thomcc
Make `ThinBox<T>` covariant in `T`

Just like `Box<T>`, we want `ThinBox<T>` to be covariant in `T`, but the
projection in `WithHeader<<T as Pointee>::Metadata>` was making it
invariant. This is now hidden as `WithOpaqueHeader`, which we type-cast
whenever the real `WithHeader<H>` type is needed.

Fixes the problem noted in <https://github.com/rust-lang/rust/issues/92791#issuecomment-1104636249>.
2022-07-01 20:19:17 +05:30
Dylan DPC
e2ed8d7ed1
Rollup merge of #97488 - vincenzopalazzo:macros/blanket_sugg, r=compiler-errors
Suggest blanket impl to the local traits

This PR will add additional suggestion regarding the blanket implementation when it is possible, by generation a new help message + suggestion.

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

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-07-01 20:19:16 +05:30