Commit graph

74808 commits

Author SHA1 Message Date
Aaron Hill
0c6ad46bcb
Don't generate auto trait impls for type aliases 2018-02-18 16:29:25 -05:00
Aaron Hill
298d703506
Remove extra whitespace 2018-02-18 16:29:25 -05:00
Aaron Hill
64a1f6fbfd
Fix inlining 2018-02-18 16:29:25 -05:00
Aaron Hill
94fd4f360b
More formatting fixups 2018-02-18 16:29:25 -05:00
Aaron Hill
0bfbe24fd9
More formatting fixes 2018-02-18 16:29:25 -05:00
Aaron Hill
1531fbe9be
Cleanup formatting 2018-02-18 16:29:25 -05:00
Aaron Hill
9d7165fcb1
Fix merge conflicts 2018-02-18 16:29:24 -05:00
Aaron Hill
6728f21d85
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.

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.

Synthesized impls for a particular auto trait ('synthetic impls') take
into account generic bounds. For example, a type '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:

'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:
'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

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 synthetic
impl into their code, without any observable changes in behavior
(assuming the rest of the program remains unchanged).
2018-02-18 16:29:24 -05:00
bors
27a046e933 Auto merge of #48322 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests

- Successful merges: #48194, #48273, #48274, #48275, #48282, #48312
- Failed merges:
2018-02-18 17:50:21 +00:00
Corey Farwell
872c782a55 Mark doc examples w/ extern blocks as ignore.
Fixes https://github.com/rust-lang/rust/issues/48218.
2018-02-18 10:27:45 -05:00
Guillaume Gomez
cc20de3993
Rollup merge of #48312 - frewsxcv:frewsxcv-section-headings, r=QuietMisdreavus
Unify 'Platform-specific behavior' documentation headings.

None
2018-02-18 13:21:03 +01:00
Guillaume Gomez
04256e7b9d
Rollup merge of #48282 - Centril:spelling-fix/iter-repeat-with, r=kennytm
Fix spelling in core::iter::repeat_with: s/not/note

Fixes spelling error in https://github.com/rust-lang/rust/pull/48156#discussion_r168718452.
Tracking issue: https://github.com/rust-lang/rust/issues/48169
2018-02-18 13:21:02 +01:00
Guillaume Gomez
af140ecdbc
Rollup merge of #48275 - matthiaskrgr:codespell, r=kennytm,varkor
fix more typos found by codespell.
2018-02-18 13:21:01 +01:00
Guillaume Gomez
b7791b0c7e
Rollup merge of #48274 - GuillaumeGomez:remove-hoedown, r=QuietMisdreavus
Remove hoedown from rustdoc

Finally the time has come!

r? @QuietMisdreavus
2018-02-18 13:20:59 +01:00
Guillaume Gomez
715030fd01
Rollup merge of #48273 - alercah:file-warning, r=joshtriplett
Add a warning to File about mutability.

Fixes #47708.
2018-02-18 13:20:58 +01:00
Guillaume Gomez
8093b20201
Rollup merge of #48194 - GuillaumeGomez:doc-test-command, r=Mark-Simulacrum
Doc test command

r? @Mark-Simulacrum
2018-02-18 13:20:57 +01:00
bors
1ad094d81c Auto merge of #47687 - SimonSapin:panic-impl, r=sfackler
RFC 2070 part 1: PanicInfo and Location API changes

This implements part of https://rust-lang.github.io/rfcs/2070-panic-implementation.html
Tracking issue: https://github.com/rust-lang/rust/issues/44489

* Move `std::panic::PanicInfo` and `std::panic::Location` to a new `core::panic` module. The two types and the `std` module were already `#[stable]` and stay that way, the new `core` module is `#[unstable]`.
* Add a new `PanicInfo::message(&self) -> Option<&fmt::Arguments>` method, which is `#[unstable]`.
* Implement `Display` for `PanicInfo` and `Location`
2018-02-18 06:02:35 +00:00
Jeffrey Seyfried
4294528b5d Improve hygiene when privacy-checking struct expression or struct constructor fields. 2018-02-17 21:48:35 -08:00
Jeffrey Seyfried
ba8d6d18d0 Fix span bug. 2018-02-17 21:48:35 -08:00
Michael Lamparski
42df8c56cc unused_unsafe: don't label irrelevant fns 2018-02-17 22:31:14 -05:00
bors
e8f03b9438 Auto merge of #47544 - U007D:master, r=nikomatsakis
Relax termination_trait's error bound

As per [this conversation](https://github.com/withoutboats/failure/issues/130#issuecomment-358572413) with @withoutboats and @bkchr
2018-02-18 03:12:14 +00:00
csmoe
4370a5877c fix tyvar_behind_raw_pointer error code 2018-02-18 11:07:52 +08:00
Corey Farwell
472dcdb4ec Fix broken documentation link. 2018-02-17 20:57:00 -05:00
Corey Farwell
0a798bd952 Unify 'Platform-specific behavior' documentation headings. 2018-02-17 20:54:26 -05:00
QuietMisdreavus
d8d4c583be fix E0260 error index doctest 2018-02-17 16:51:39 -06:00
QuietMisdreavus
b3d6597855 move manual "extern crate" statements outside auto "fn main" in doctests 2018-02-17 16:51:39 -06:00
Guillaume Gomez
6661ebb4bd Remove useless comment 2018-02-17 23:47:45 +01:00
bors
5313e8728f Auto merge of #47408 - eddyb:deref-danger, r=nikomatsakis
Don't promote to 'static the result of dereferences.

This is a **breaking change**, removing copies out of dereferences from rvalue-to-`'static` promotion.

With miri we won't easily know whether the dereference itself would see the same value at runtime as miri (e.g. after mutating a `static`) or even if it can be interpreted (e.g. integer pointers).
One alternative to this ban is defining at least *some* of those situations as UB, i.e. you shouldn't have a reference in the first place, and you should work through raw pointers instead, to avoid promotion.

**EDIT**: The other *may seem* to be to add some analysis which whitelists references-to-constant-values and assume any values produced by arbitrary computation to not be safe to promote dereferences thereof - but that means producing a reference from an associated constant or `const fn` would necessarily obscure it, and in the former case, this could still impact code that runs on stable today. What we do today to track "references to statics" only works because we restrict taking a reference to a `static` at all to other `static`s (which, again, are currently limited in that they can't be read at compile-time) and to runtime-only `fn`s (*not* `const fn`s).

I'm primarily opening this PR with a conservative first approximation (e.g. `&(*r).a` is not allowed, only reborrows are, and in the old borrow only implicit ones from adjustments, at that) for cratering.

r? @nikomatsakis
2018-02-17 19:32:25 +00:00
Vitaly _Vi Shukela
3c83596f04
rustdoc: Fix position of collapse-toggle on small screens 2018-02-17 20:54:00 +03:00
Vitaly _Vi Shukela
644258044d
rustdoc: Remove visual overlap between § and [+] 2018-02-17 20:46:06 +03:00
Mark Mansi
6ad328ca77 Move macro-at-most-once-rep-ambig test to ui test 2018-02-17 11:42:11 -06:00
Guillaume Gomez
c5be497888 Fix unstable book 2018-02-17 18:27:46 +01:00
Vitali Lovich
d549db8031 Fix tidy violation 2018-02-17 09:17:58 -08:00
Matthias Krüger
4452446292 fix more typos found by codespell. 2018-02-17 17:38:49 +01:00
Guillaume Gomez
8e46927235 Add command to launch only doc tests 2018-02-17 16:58:14 +01:00
Guillaume Gomez
de8b429420 Update to last repository version 2018-02-17 16:31:07 +01:00
Seiichi Uchida
8e9fa57055 Revert unintentional submodule updates 2018-02-18 00:21:33 +09:00
Seiichi Uchida
291c51b9c8 Fix up tests and typos 2018-02-18 00:10:40 +09:00
Seiichi Uchida
b5099a708d Replace dummy spans with empty spans 2018-02-18 00:10:40 +09:00
Seiichi Uchida
d6bdf296a4 Change ast::Visibility to Spanned type 2018-02-18 00:10:40 +09:00
Seiichi Uchida
0bddba9248 Add a span field to Visibility::Restricted
This span covers the whole visibility expression: e.g. `pub (in path)`.
2018-02-18 00:10:40 +09:00
Seiichi Uchida
01a70c6589 Add a closing parenthesis to the span of Visibility::Crate 2018-02-18 00:10:40 +09:00
bors
f6216b2d55 Auto merge of #48294 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 8 pull requests

- Successful merges: #48095, #48152, #48234, #48239, #48243, #48260, #48284, #48286
- Failed merges:
2018-02-17 14:31:32 +00:00
moe
2cf683edc0
Merge branch 'master' into inform_type_annotations 2018-02-17 22:22:26 +08:00
csmoe
0be2dc8d9b fix stderr 2018-02-17 14:18:53 +00:00
Alexis Hunt
ec905975b8 Wording fixes from review for File. 2018-02-17 08:47:03 -05:00
Guillaume Gomez
47db61a3c3
Rollup merge of #48286 - SergioBenitez:master, r=BurntSushi
Clarify contiguity of Vec's elements.

Small doc changes for clarity.
2018-02-17 14:45:28 +01:00
Guillaume Gomez
c4f0011353
Rollup merge of #48284 - crawford:string, r=sfackler
Remove unneeded string allocations
2018-02-17 14:45:27 +01:00
Guillaume Gomez
7dd8c090e4
Rollup merge of #48260 - dns2utf8:add_link_to_yield, r=kennytm
[doc] Add link to yield_now

A convenient link.
2018-02-17 14:45:26 +01:00
Guillaume Gomez
01c7f3a345
Rollup merge of #48243 - rust-lang:steveklabnik-patch-1, r=kennytm
spelling fix in comment

r? @Manishearth
2018-02-17 14:45:24 +01:00