Commit Graph

75224 Commits

Author SHA1 Message Date
Guillaume Gomez
aec653536c
Rollup merge of #47833 - Aaron1011:final_auto_trait, r=GuillaumeGomez
Generate documentation for auto-trait impls

A new section is added to both both struct and trait doc pages.

On struct/enum pages, a new 'Auto Trait Implementations' section displays any synthetic implementations for auto traits. Currently, this is only done for Send and Sync.

![Auto trait implementations for Cloned](https://i.imgur.com/XtTV6IJ.png)

On trait pages, a new 'Auto Implementors' section displays all types which automatically implement the trait. Effectively, this is a list of all public types in the standard library.

![Auto trait implementors for Send](https://i.imgur.com/3GRBpTy.png)

Synthesized impls for a particular auto trait ('synthetic impls') take generic bounds into account. For example, a type
```rust
struct Foo<T>(T)
```
 will have 'impl<T> Send for Foo<T> where T: Send' generated for it.

Manual implementations of auto traits are also taken into account. If we have
the following types:

```rust
struct Foo<T>(T)
struct Wrapper<T>(Foo<T>)
unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes this sound somehow
```

Then Wrapper will have the following impl generated:
```rust
impl<T> Send for Wrapper<T>
```
reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send' to hold

Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are taken into account by synthetic impls:

![A ridiculous demonstration type](https://i.imgur.com/TkZMWuN.png)

However, if a type can *never* implement a particular auto trait (e.g. `struct MyStruct<T>(*const T)`), then a negative impl will be generated (in this case, `impl<T> !Send for MyStruct<T>`)

All of this means that a user should be able to copy-paste a syntheticimpl into their code, without any observable changes in behavior (assuming the rest of the program remains unchanged).
2018-02-21 16:29:46 +01:00
Guillaume Gomez
2a32060fb6
Rollup merge of #47379 - da-x:master, r=sfackler
Derive std::cmp::Reverse as Copy or Clone

If the type parameter is Copy or Clone, then `Reverse` should be too.
2018-02-21 16:29:45 +01:00
Hidehito Yabuuchi
7e51e7ddd6 Take 2^5 as examples in document of pow() (fixes #48396)
Current document takes 2^4, which is equal to 4^2.
This example is not very helpful for those unfamiliar with math words in English and thus rely on example codes.
2018-02-21 22:34:45 +09:00
Artyom Pavlov
a33c1da861
typo fix 2018-02-21 09:59:28 +03:00
Esteban Küber
20bc72e693 Handle custom diagnostic for &str + String 2018-02-20 22:46:51 -08:00
Niko Matsakis
a47fd3df89 make #[unwind] attribute specify expectations more clearly
You can now choose between the following:

- `#[unwind(allowed)]`
- `#[unwind(aborts)]`

Per rust-lang/rust#48251, the default is `#[unwind(allowed)]`, though
I think we should change this eventually.
2018-02-20 19:12:52 -05:00
boats
5949d8b2d7
Fix internal references to bad_style in test code. 2018-02-20 15:57:16 -08:00
boats
21e2a5e8d8
Fix filepath in lint test. 2018-02-20 14:44:39 -08:00
boats
6fe5f42e37
Fix carets. 2018-02-20 13:38:46 -08:00
boats
cf6e2f53ba
Add nonstandard_style alias for bad_style. 2018-02-20 13:28:51 -08:00
Vitali Lovich
14b403c91a Fix doc compile error 2018-02-20 13:07:21 -08:00
Vitaly _Vi Shukela
df1b9a8584
rustdoc: On mobile: hide §, adjust [+] position 2018-02-20 22:46:24 +03:00
Guillaume Gomez
5cbf9aedb8 Fix rustdoc test ICE 2018-02-20 20:30:29 +01:00
Guillaume Gomez
8d51c331c7 Remove theme button outline 2018-02-20 20:13:17 +01:00
Guillaume Gomez
5b61b615f5 Allow to not switch to a theme if it doesn't exist 2018-02-20 20:11:58 +01:00
Guillaume Gomez
2d3f31df8b Change local storage name for rustdoc because of conflicts with mdbook 2018-02-20 19:29:13 +01:00
John Kåre Alsaker
9d3719bcfa Do not run the default panic hook inside procedural macros. Fixes #47812 2018-02-20 19:16:49 +01:00
Mark Simulacrum
33f5ceee1f stage0 cfg cleanup 2018-02-20 08:52:33 -07:00
Mark Simulacrum
24b485b918 Bootstrap from the 1.25 beta 2018-02-20 08:52:33 -07:00
QuietMisdreavus
8d893c1e9e review nits 2018-02-20 09:26:44 -06:00
newpavlov
4c6b9bcaa9 features in alphabetic order 2018-02-20 16:08:22 +03:00
newpavlov
98d8fc192d added rdrand feature and removed rdrnd feature 2018-02-20 16:05:25 +03:00
Mazdak Farrokhzad
819d57abc9 core::iter::Iterator::flatten: improve docs wrt. deep vs. shallow flatten per @clarcharr's review 2018-02-20 08:29:07 +01:00
Mazdak Farrokhzad
3d74c74fa0 core::iter::Iterator::flatten: tracking issue is #48213 2018-02-20 08:28:54 +01:00
Mazdak Farrokhzad
0e394010e6 core::iter::Flatten: update FlatMap & Flatten according to discussion 2018-02-20 08:28:33 +01:00
Mazdak Farrokhzad
36be763d0e Iterator::flatten: fix tracking issue number on FusedIterator for Flatten 2018-02-20 08:27:59 +01:00
Mazdak Farrokhzad
6af23f977c add Iterator::flatten and redefine flat_map(f) in terms of map(f).flatten() 2018-02-20 08:27:32 +01:00
Esteban Küber
1aad320974 When encountering invalid token after unsafe, mention { 2018-02-19 21:58:36 -08:00
Mazdak Farrokhzad
bde855518b RefCell: document panics in Clone, PartialEq, PartialOrd, Ord. Fixes #47400 2018-02-20 05:52:26 +01:00
Aaron Hill
44d07df1cc
Sort synthetic impls bounds before rendering
This removes the implicit dependency on the iteration
order of FxHashMap
2018-02-19 20:27:28 -05:00
Eduard-Mihai Burtescu
c9fcedeb4c rustc_mir: optimize the deaggregator's expansion of statements. 2018-02-20 02:50:26 +02:00
Eduard-Mihai Burtescu
d773d95880 rustc_mir: don't run the deaggregator on arrays for now. 2018-02-20 02:50:26 +02:00
Eduard-Mihai Burtescu
6195ad8654 test: use the right amount of CGUs in sepcomp-cci-copies to ensure deterministic splitting. 2018-02-20 02:50:26 +02:00
Eduard-Mihai Burtescu
6e5dacbd5e rustc_mir: always run the deaggregator. 2018-02-20 02:50:26 +02:00
Eduard-Mihai Burtescu
e598bdfaa0 rustc_mir: do not remove dead user variables if debuginfo needs them. 2018-02-20 02:50:26 +02:00
Eduard-Mihai Burtescu
b88180f74c rustc_mir: handle all aggregate kinds in the deaggregator. 2018-02-20 02:50:26 +02:00
Eduard-Mihai Burtescu
3922dd72fe rustc_mir: use the "idiomatic" optimization gating in the deaggregator. 2018-02-20 02:50:26 +02:00
Josh Stone
8174c0d659 rustbuild: make libdir_relative a method 2018-02-19 16:08:36 -08:00
Josh Stone
80970e6953 rustbuild: Restore Config.libdir_relative
This re-introduces a `Config.libdir_relative` field, now derived from
`libdir` and made relative to `prefix` if necessary.

This fixes a regression from #46592 when `--libdir` is given an absolute
path.  `Builder::sysroot_libdir` should always use a relative path so
its callers don't clobber system locations, and `librustc` also asserts
that `CFG_LIBDIR_RELATIVE` is really relative.
2018-02-19 14:17:31 -08:00
Gil Cottle
3f931515df
Fix count usize link typo in docs 2018-02-19 20:51:48 +00:00
Vitaly _Vi Shukela
bf03dd0ca7
rustdoc: Reposition the § per GuillaumeGomez request 2018-02-19 23:22:08 +03:00
Jeffrey Seyfried
1e037f4172 Update tests. 2018-02-19 10:49:25 -08:00
Jeffrey Seyfried
8715b81f37 Add test. 2018-02-19 10:49:24 -08:00
Andreas Streichardt
f0a968eada Add missing link 2018-02-19 17:19:30 +01:00
Michael Woerister
89b3ef3e8e Allow for instantiating statics from upstream crates. 2018-02-19 16:49:20 +01:00
Michael Woerister
1be7f966e0 Rename is_translated_fn query to is_translated_item and make it support statics. 2018-02-19 16:47:59 +01:00
Michael Woerister
8ff633cc3b Implement describe_def query for LOCAL_CRATE 2018-02-19 16:46:40 +01:00
varkor
c0e87f13a4 Make ".e0" not parse as 0.0
This forces floats to have either a digit before the separating point, or after. Thus ".e0" is invalid like ".", when using `parse()`.
2018-02-19 14:53:30 +00:00
Jakub Adam Wieczorek
56512971e0 Update .mailmap with my real name 2018-02-19 13:21:47 +00:00
Michael Woerister
15ff0adcde Use DefId instead of NodeId in MonoItem::Static. 2018-02-19 13:29:22 +01:00