Commit Graph

149277 Commits

Author SHA1 Message Date
bors
016e9b5e33 Auto merge of #84988 - alexcrichton:safe-target-feature-wasm, r=joshtriplett
rustc: Allow safe #[target_feature] on wasm

This commit updates the compiler's handling of the `#[target_feature]`
attribute when applied to functions on WebAssembly-based targets. The
compiler in general requires that any functions with `#[target_feature]`
are marked as `unsafe` as well, but this commit relaxes the restriction
for WebAssembly targets where the attribute can be applied to safe
functions as well.

The reason this is done is that the motivation for this feature of the
compiler is not applicable for WebAssembly targets. In general the
`#[target_feature]` attribute is used to enhance target CPU features
enabled beyond the basic level for the rest of the compilation. If done
improperly this means that your program could execute an instruction
that the CPU you happen to be running on does not understand. This is
considered undefined behavior where it is unknown what will happen (e.g.
it's not a deterministic `SIGILL`).

For WebAssembly, however, the target is different. It is not possible
for a running WebAssembly program to execute an instruction that the
engine does not understand. If this were the case then the program would
not have validated in the first place and would not run at all. Even if
this were allowed in some hypothetical future where engines have some
form of runtime feature detection (which they do not right now) any
implementation of such a feature would generate a trap if a module
attempts to execute an instruction the module does not understand. This
deterministic trap behavior would still not fall into the category of
undefined behavior because the trap is deterministic.

For these reasons the `#[target_feature]` attribute is now allowed on
safe functions, but only for WebAssembly targets. This notably enables
the wasm-SIMD intrinsics proposed for stabilization in #74372 to be
marked as safe generally instead of today where they're all `unsafe` due
to the historical implementation of `#[target_feature]` in the compiler.
2021-06-03 05:12:31 +00:00
bors
19579c6564 Auto merge of #84834 - GuillaumeGomez:sidebar-unification, r=jsha
Sidebar unification

This PR does a few things:
 * Put crates list at all levels (before, it was only on the "top" items)
 * Fix bug in module sidebar: the list of items was from the parent module.

The other changes (on bootstrap mostly) were to allow to generate multiple crates in a same folder so that we can ensure that clicking on the crates in the sidebar works as expected.

I added a rustdoc-gui test to ensure everything is where it should be.

r? `@jyn514`
2021-06-03 02:31:44 +00:00
bors
da865095cf Auto merge of #84703 - GuillaumeGomez:cleanup-dom, r=jsha
Clean up dom

The commits come from #84480.

They were errors reported by the `tidy` script that we will use to ensure that the HTML generated by rustdoc is valid.

I checked carefully that there were no difference so in principle it should be exactly the same rendering but a double-check would be very appreciated in case I missed something.

Extra note: `<h4>` and some `<h3>` tags were replaced by `<div>` because they're not supposed to contain tags as they currently do.

r? `@jsha`
2021-06-02 23:11:41 +00:00
bors
dbe459dedd Auto merge of #85904 - cjgillot:one-name, r=petrochenkov
Restrict access to crate_name.

Also remove original_crate_name, which had the exact same implementation.

Part of #85153
2021-06-02 20:23:37 +00:00
Guillaume Gomez
0daf8ac41f Replace h3 for notable traits with div 2021-06-02 21:16:33 +02:00
Guillaume Gomez
14fe83f7e4 Update rustdoc tests 2021-06-02 20:30:18 +02:00
Jacob Hoffman-Andrews
fab6814ff3 Remove data-level selectors from CSS. 2021-06-02 20:30:17 +02:00
Camille GILLOT
0e71283495 Restrict access to crate_name.
Also remove original_crate_name, which had the exact same implementation
2021-06-02 18:35:32 +02:00
bors
2f601ef527 Auto merge of #85337 - cjgillot:less-anon, r=michaelwoerister
Avoid creating anonymous nodes with zero or one dependency.

Anonymous nodes are only useful to encode dependencies, and cannot be replayed from one compilation session to another.
As such, anonymous nodes without dependency are always green.
Anonymous nodes with only one dependency are equivalent to this dependency.

cc #45408
cc `@michaelwoerister`
2021-06-02 13:11:41 +00:00
bors
1e13a9bb33 Auto merge of #85892 - tmiasko:i, r=oli-obk
Miscellaneous inlining improvements
2021-06-02 10:47:58 +00:00
bors
7350f655ef Auto merge of #85908 - cjgillot:private-dep-query, r=Aaron1011
Make is_private_dep a query.

Part of #85153

r? `@Aaron1011`
2021-06-02 08:06:45 +00:00
Tomasz Miąsko
c1f6495b8e Miscellaneous inlining improvements 2021-06-02 08:49:58 +02:00
bors
d20b9add05 Auto merge of #85905 - cjgillot:one-trait-map, r=Aaron1011
Only compute the trait map once

Part of #85153

r? `@Aaron1011`
2021-06-02 05:25:41 +00:00
bors
c4f186f0ea Auto merge of #85687 - m-ou-se:new-prelude, r=yaahc
New prelude

RFC: rust-lang/rfcs#3114
Tracking issue: https://github.com/rust-lang/rust/issues/85684
2021-06-02 02:36:44 +00:00
bors
153f22a906 Auto merge of #85331 - cjgillot:dirty-dancing, r=Aaron1011
Make rustc_dirty/clean annotations exhaustive by default

Fixes #45009
2021-06-01 23:02:52 +00:00
bors
625d5a693e Auto merge of #85829 - bjorn3:simplify_crate_num, r=jackh726
Remove CrateNum::ReservedForIncrCompCache

It's only use is easily replaceable with `Option<CrateNum>`.
2021-06-01 20:09:03 +00:00
Camille GILLOT
93b25bd293 Make trait_map an Option. 2021-06-01 21:59:48 +02:00
Camille GILLOT
b51f24f021 Make the reasoning more explicit. 2021-06-01 21:46:30 +02:00
Camille GILLOT
3a6d5c2beb Avoid creating anonymous nodes with zero or one dependency. 2021-06-01 21:43:30 +02:00
Guillaume Gomez
98a9b02e92 Don't generate impl-items div container if there is none 2021-06-01 21:36:03 +02:00
Guillaume Gomez
93389b5568 Remove invalid usage of aria-level 2021-06-01 21:19:28 +02:00
Guillaume Gomez
9077d540da Replace h3 and h4 containing invalid DOM 2021-06-01 21:19:28 +02:00
Guillaume Gomez
42312501d0 Add missing <title> in redirection page <head> 2021-06-01 21:19:27 +02:00
Guillaume Gomez
7414d28e0b Replace empty href with "#" 2021-06-01 21:19:27 +02:00
Camille GILLOT
28afaeec17 Make is_private_dep a query. 2021-06-01 21:03:55 +02:00
Camille GILLOT
0839cd5e9a Rename take_trait_map. 2021-06-01 20:53:04 +02:00
Camille GILLOT
c11691b460 Check that trait_map is not moved twice. 2021-06-01 20:53:04 +02:00
Camille GILLOT
273778086c Remove StableVec. 2021-06-01 20:53:04 +02:00
Camille GILLOT
e291be3649 Only compute the trait_map once. 2021-06-01 20:43:50 +02:00
bjorn3
5ab25ab682 Fix test 2021-06-01 17:00:54 +02:00
bors
7f9ab0300c Auto merge of #85886 - GuillaumeGomez:rollup-l3yr3np, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #85473 (fix split-debuginfo error message)
 - #85622 (Remove toggle for "undocumented items.")
 - #85826 (Mention "null pointer optimization" in option docs.)
 - #85860 (Fix details rustdoc toggle for blanket impl)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-01 12:10:15 +00:00
Guillaume Gomez
82b84bfca4
Rollup merge of #85860 - pickfire:patch-5, r=GuillaumeGomez
Fix details rustdoc toggle for blanket impl

In the meantime, allow all of the details to have the same top.

Before

![image](https://user-images.githubusercontent.com/4687791/120214139-a673ed00-c266-11eb-9154-3a8148199c8f.png)
![image](https://user-images.githubusercontent.com/4687791/120214232-c5727f00-c266-11eb-8bda-871e6e04819e.png)

After

![image](https://user-images.githubusercontent.com/4687791/120214121-9d831b80-c266-11eb-8c33-db1317c42375.png)
![image](https://user-images.githubusercontent.com/4687791/120214273-d4f1c800-c266-11eb-89ee-0f2b7c2e5bdb.png)

I stumbled across this while wanting to do a details button for the layout.
2021-06-01 11:29:45 +02:00
Guillaume Gomez
f4d3f32f45
Rollup merge of #85826 - jsha:npo, r=joshtriplett
Mention "null pointer optimization" in option docs.

I had seen people discuss "null pointer optimization," but when I tried to find official documentation (using Google), the `std::option` page didn't show up, because it doesn't use that term. Hopefully adding the term will help others find it in the future.
2021-06-01 11:29:44 +02:00
Guillaume Gomez
085691b137
Rollup merge of #85622 - jsha:untoggle-undocumented, r=GuillaumeGomez
Remove toggle for "undocumented items."

Per discussion in #84326. For trait implementations, this was
misleading: the items actually do have documentation (but it comes from
the trait definition).

For both trait implementations and trait implementors, this was
redundant: in both of those cases, the items are default-hidden by
different toggle at the level above.

Update tests: Remove XPath selectors that over-specified on details tag,
in cases that weren't testing toggles. Add an explicit test for toggles
on methods. Rename item-hide-threshold to toggle-item-contents for
consistency.

Demo:
https://hoffman-andrews.com/rust/untoggle-undocumented/std/string/struct.String.html
https://hoffman-andrews.com/rust/untoggle-undocumented/std/io/trait.Read.html
2021-06-01 11:29:43 +02:00
Guillaume Gomez
2ffe87a434
Rollup merge of #85473 - infinity0:master, r=jackh726
fix split-debuginfo error message
2021-06-01 11:29:42 +02:00
bors
1160cf864f Auto merge of #85884 - rust-lang:revert-85153-qresolve, r=michaelwoerister
Revert "Reduce the amount of untracked state in TyCtxt"

Reverts rust-lang/rust#85153
Fixes https://github.com/rust-lang/rust/issues/85878

The performance hit is massive, and was not visible in the in-review perf run.

r? `@Aaron1011`
2021-06-01 09:22:01 +00:00
Camille Gillot
0f0f3138cb
Revert "Reduce the amount of untracked state in TyCtxt" 2021-06-01 09:05:22 +02:00
bors
80af6b091f Auto merge of #85859 - pickfire:patch-3, r=CraftSpider
Add title for copy to clipboard button in rustdoc

This button
![image](https://user-images.githubusercontent.com/4687791/120210874-da4d1380-c262-11eb-9987-9145c4354029.png)
2021-06-01 06:40:57 +00:00
bors
c9c1f8be3f Auto merge of #85856 - lnicola:rust-analyzer-2021-05-31, r=jonas-schievink
⬆️ rust-analyzer
2021-06-01 04:01:10 +00:00
bors
41278062c8 Auto merge of #85153 - cjgillot:qresolve, r=Aaron1011
Reduce the amount of untracked state in TyCtxt

Access to untracked global state may generate instances of #84970.

The GlobalCtxt contains the lowered HIR, the resolver outputs and interners.
By wrapping the resolver inside a query, we make sure those accesses are properly tracked.
As a no_hash query, all dependent queries essentially become `eval_always`,
what they should have been from the beginning.
2021-06-01 00:51:00 +00:00
bors
d2091147b1 Auto merge of #85866 - Aaron1011:miriup-const-err, r=RalfJung
Bump Miri for const_err changes

Fixes https://github.com/rust-lang/rust/issues/85861
r? `@RalfJung`
2021-05-31 22:33:54 +00:00
bors
657bc01888 Auto merge of #85702 - Aaron1011:no-vec-sort, r=michaelwoerister
Don't sort a `Vec` before computing its `DepTrackingHash`

Previously, we sorted the vec prior to hashing, making the hash
independent of the original (command-line argument) order. However, the
original vec was still always kept in the original order, so we were
relying on the rest of the compiler always working with it in an
'order-independent' way.

This assumption was not being upheld by the `native_libraries` query -
the order of the entires in its result depends on the order of entries
in `Options.libs`. This lead to an 'unstable fingerprint' ICE when the
`-l` arguments were re-ordered.

This PR removes the sorting logic entirely. Re-ordering command-line
arguments (without adding/removing/changing any arguments) seems like a
really niche use case, and correctly optimizing for it would require
additional work. By always hashing arguments in their original order, we
can entirely avoid a cause of 'unstable fingerprint' errors.
2021-05-31 20:03:18 +00:00
Aaron Hill
a258feb6eb
Bump Miri for const_err changes
r? @RalfJung
2021-05-31 12:05:22 -05:00
bors
6a3dce99f6 Auto merge of #85814 - steffahn:fix_linked_list_itermut_debug, r=m-ou-se
Fix unsoundness of Debug implementation for linked_list::IterMut

Fix #85813, new `marker` field follows the example of `linked_list::Iter`.
2021-05-31 15:22:51 +00:00
Ivan Tham
2970479412
Fix details rustdoc toggle for blanket impl
In the meantime, allow all of the details to have the same top.
2021-05-31 23:18:53 +08:00
Ivan Tham
0c5ed2cb95
Add title for copy to clipboard button in rustdoc 2021-05-31 22:51:59 +08:00
Laurențiu Nicola
6b6a16d413 ⬆️ rust-analyzer 2021-05-31 16:53:42 +03:00
Guillaume Gomez
9b637fa72e Improve display of the separation between page items and siblings in the sidebar 2021-05-31 15:20:45 +02:00
Guillaume Gomez
a2ba9ef1ff Only list crates on the crate page 2021-05-31 15:20:45 +02:00
bors
d9feaaa548 Auto merge of #85704 - Aaron1011:const-panic-hard-err, r=RalfJung
Emit a hard error when a panic occurs during const-eval

Previous, a panic during const evaluation would go through the
`const_err` lint. This PR ensures that such a panic always causes
compilation to fail.
2021-05-31 12:41:55 +00:00