Commit Graph

84459 Commits

Author SHA1 Message Date
Murarth
d60290fc63 Fix undefined behavior in Rc/Arc allocation
Manually calculate allocation layout for `Rc`/`Arc` to avoid undefined behavior
2018-11-05 10:33:30 -07:00
bors
423d810986 Auto merge of #54871 - u32i64:master, r=frewsxcv
Remove unnecessary comma in `libstd/thread/mod.rs` doc comment

Fix typo in `libstd/thread/mod.rs` doc comment: remove unnecessary comma.
2018-10-08 12:17:36 +00:00
bors
96734ae0d4 Auto merge of #54865 - pietroalbini:1.29.2-notes, r=pietroalbini
Backport 1.29.2 release notes to master

r? @ghost
2018-10-08 09:29:59 +00:00
bors
25a75a4d86 Auto merge of #54847 - ljedrz:kill_graphviz_intocow, r=pnkfelix
Cleanup: remove graphviz::IntoCow

It's just `Into<Cow<...>>` and the applicable methods already exist for `Vec`/`[T]` and `String`/`str`.
2018-10-08 06:50:25 +00:00
bors
ef5c00d0ca Auto merge of #54700 - frewsxcv:frewsxcv-binary-search, r=GuillaumeGomez
Clarify docs for when binary_search has many matches.

Fixes https://github.com/rust-lang/rust/issues/51817.
2018-10-08 03:04:50 +00:00
bors
aefe9b099a Auto merge of #54609 - kzys:404-search, r=GuillaumeGomez
Add the library search box on the 404 page

It actually has a link to search already, but it would be better to
have the search "box" as like index.md to be consistent.

<style> can be shared with index.md, but these pages currently
use https://doc.rust-lang.org/rust.css directly.

Fixes #14572.
2018-10-08 00:33:19 +00:00
bors
b9adc3327e Auto merge of #53517 - phungleson:fix-impl-from-for-error, r=frewsxcv
Add doc for impl From for Error

As part of issue #51430 (cc @skade).

The impl is very simple, let me know if we need to go into any details.
2018-10-07 22:00:04 +00:00
bors
b2d6ea98b0 Auto merge of #54810 - 1aim:unused-impl-trait, r=oli-obk
Fix dead code lint for functions using impl Trait

Fixes https://github.com/rust-lang/rust/issues/54754

This is a minimal fix that doesn't add any new queries or touches unnecessary code. Please nominate for beta backport if wanted.
2018-10-07 19:30:24 +00:00
bors
0ee045ea09 Auto merge of #54835 - oli-obk:mögen_konstante_funktionen_doch_bitte_endlich_stabil_sein, r=Centril
Stabilize `min_const_fn`

tracking issue: #53555

r? @Centril
2018-10-07 13:37:07 +00:00
Corey Farwell
b5c64e2e26 Clarify docs for when binary_search has many matches.
Fixes https://github.com/rust-lang/rust/issues/51817.
2018-10-07 08:46:22 -04:00
bors
5a6f122126 Auto merge of #54813 - petrochenkov:uilocale, r=alexcrichton
Fix two UI tests with locale-dependent output

Closes https://github.com/rust-lang/rust/issues/54719
2018-10-07 11:10:39 +00:00
bors
987a50bab3 Auto merge of #54823 - euclio:needs-test, r=alexcrichton
Add tests for some E-needstest issues

Fixes #28134.
Fixes #24338.
Fixes #29743.
2018-10-07 08:32:19 +00:00
bors
13429136b8 Auto merge of #54451 - alexcrichton:no-mangle-extern-linkage, r=michaelwoerister
rustc: Allow `#[no_mangle]` anywhere in a crate

This commit updates the compiler to allow the `#[no_mangle]` (and
`#[export_name]` attributes) to be located anywhere within a crate.
These attributes are unconditionally processed, causing the compiler to
always generate an exported symbol with the appropriate name.

After some discussion on #54135 it was found that not a great reason
this hasn't been allowed already, and it seems to match the behavior
that many expect! Previously the compiler would only export a
`#[no_mangle]` symbol if it were *publicly reachable*, meaning that it
itself is `pub` and it's otherwise publicly reachable from the root of
the crate. This new definition is that `#[no_mangle]` *is always
reachable*, no matter where it is in a crate or whether it has `pub` or
not.

This should make it much easier to declare an exported symbol with a
known and unique name, even when it's an internal implementation detail
of the crate itself. Note that these symbols will persist beyond LTO as
well, always making their way to the linker.

Along the way this commit removes the `private_no_mangle_functions` lint
(also for statics) as there's no longer any need to lint these
situations. Furthermore a good number of tests were updated now that
symbol visibility has been changed.

Closes #54135
2018-10-07 03:07:16 +00:00
bors
dbecb7a644 Auto merge of #54782 - pnkfelix:issue-54556-semi-on-tail-diagnostic, r=nikomatsakis
NLL: temps in block tail expression diagnostic

This change adds a diagnostic that explains when temporaries in a block tail expression live longer than block local variables that they borrow, and attempts to suggest turning the tail expresion into a statement (either by adding a semicolon at the end, when its result value is clearly unused, or by introducing a `let`-binding for the result value and then returning that).

Fix #54556
2018-10-07 00:28:26 +00:00
Alex Crichton
d7d7045374 rustc: Allow #[no_mangle] anywhere in a crate
This commit updates the compiler to allow the `#[no_mangle]` (and
`#[export_name]` attributes) to be located anywhere within a crate.
These attributes are unconditionally processed, causing the compiler to
always generate an exported symbol with the appropriate name.

After some discussion on #54135 it was found that not a great reason
this hasn't been allowed already, and it seems to match the behavior
that many expect! Previously the compiler would only export a
`#[no_mangle]` symbol if it were *publicly reachable*, meaning that it
itself is `pub` and it's otherwise publicly reachable from the root of
the crate. This new definition is that `#[no_mangle]` *is always
reachable*, no matter where it is in a crate or whether it has `pub` or
not.

This should make it much easier to declare an exported symbol with a
known and unique name, even when it's an internal implementation detail
of the crate itself. Note that these symbols will persist beyond LTO as
well, always making their way to the linker.

Along the way this commit removes the `private_no_mangle_functions` lint
(also for statics) as there's no longer any need to lint these
situations. Furthermore a good number of tests were updated now that
symbol visibility has been changed.

Closes #54135
2018-10-06 13:57:30 -07:00
bors
4efdc04a5d Auto merge of #54756 - ljedrz:cleanup_middle, r=michaelwoerister
Cleanup rustc/middle

- improve allocations
- use `Cow<'static, str>` where applicable
- improve some patterns
- whitespace & formatting fixes
2018-10-06 20:04:18 +00:00
Artem Varaksa
ddcec08a54 Fix typo in libstd/thread/mod.rs: remove unnecessary comma 2018-10-06 20:09:54 +03:00
bors
7ec50f4659 Auto merge of #54854 - matthiaskrgr:clippy_update, r=Manishearth
submodules: update clippy to 22d37b53af to fix tests.

Should fix clippy toolstate.
2018-10-06 15:40:13 +00:00
Corey Farwell
4f3896d8ef
'a' → 'an' in front of vowel sounds. 2018-10-06 11:21:53 -04:00
bors
b4d9835f6c Auto merge of #54766 - alexcrichton:wasm-all-symbols, r=michaelwoerister
wasm: Explicitly export all symbols with LLD

This commit fixes an oddity on the wasm target where LTO can produce
working executables but plain old optimizations doesn't. The compiler
already knows what set of symbols it would like to export, but LLD only
discovers this list transitively through symbol visibilities. LLD may
not, however, always find all the symbols that we'd like to export.

For example if you depend on an rlib with a `#[no_mangle]` symbol, then
if you don't actually use anything from the rlib then the symbol won't
appear in the final artifact! It will appear, however, with LTO. This
commit attempts to rectify this situation by ensuring that all symbols
rustc would otherwise preserve through LTO are also preserved through
the linking process with LLD by default.
2018-10-06 10:44:11 +00:00
Pietro Albini
d927da12bc
Update release notes for 1.29.2 2018-10-06 12:26:46 +02:00
ljedrz
786b86ef5d rustc/middle: whitespace & formatting fixes 2018-10-06 10:25:59 +02:00
ljedrz
96736f215f rustc/middle: improve allocations 2018-10-06 10:24:54 +02:00
ljedrz
a256a66305 rustc/middle: use Cow<'static, str> where applicable 2018-10-06 10:24:53 +02:00
ljedrz
c2b3aa9939 rustc/middle: improve some patterns 2018-10-06 10:24:52 +02:00
Matthias Krüger
22d37b53af submodules: update clippy to 32b1d1fc15 to fix tests. 2018-10-06 08:39:46 +02:00
bors
ac841e7450 Auto merge of #54859 - pietroalbini:rollup, r=pietroalbini
Rollup of 11 pull requests

Successful merges:

 - #54078 (Expand the documentation for the `std::sync` module)
 - #54717 (Cleanup rustc/ty part 1)
 - #54781 (Add examples to `TyKind::FnDef` and `TyKind::FnPtr` docs)
 - #54787 (Only warn about unused `mut` in user-written code)
 - #54804 (add suggestion for inverted function parameters)
 - #54812 (Regression test for #32382.)
 - #54833 (make `Parser::parse_foreign_item()` return a foreign item or error)
 - #54834 (rustdoc: overflow:auto doesn't work nicely on small screens)
 - #54838 (Fix typo in src/libsyntax/parse/parser.rs)
 - #54851 (Fix a regression in 1.30 by reverting #53564)
 - #54853 (Remove unneccessary error from test, revealing NLL error.)

Failed merges:

r? @ghost
2018-10-06 00:44:11 +00:00
Pietro Albini
51334c96b3
Rollup merge of #54853 - davidtwco:issue-52663-missing-lifetime-suggestion-test, r=nikomatsakis
Remove unneccessary error from test, revealing NLL error.

Part of #52663.

Removes unnecessary type mismatch error from test that was hiding
borrow check error from NLL stderr.

r? @nikomatsakis
2018-10-05 22:33:22 +02:00
Pietro Albini
402c69950b
Rollup merge of #54851 - alexcrichton:revert-optimize, r=sfackler
Fix a regression in 1.30 by reverting #53564

Investigation on #54477 revealed https://github.com/rust-lang/rust/pull/53564 as the culprit in the regression for that crate. I've reproduced the regression with the [detailed test cases provided](https://github.com/rust-lang/rust/issues/54477#issuecomment-427398456). While we figure out how to fix the regression this commit reverts the current culprit.
2018-10-05 22:33:21 +02:00
Pietro Albini
42fcde8abb
Rollup merge of #54838 - 11Takanori:fix-typo, r=petrochenkov
Fix typo in src/libsyntax/parse/parser.rs

contast -> contrast
2018-10-05 22:33:19 +02:00
Pietro Albini
f1b42c5ca7
Rollup merge of #54834 - kzys:fix-small-screen, r=GuillaumeGomez
rustdoc: overflow:auto doesn't work nicely on small screens

This property was introduced by 3f92ff34b5, but looks it doesn't
overwrap even without the property.

Fixes #54672.
2018-10-05 22:33:18 +02:00
Pietro Albini
a95a6e287a
Rollup merge of #54833 - abonander:issue-54441, r=petrochenkov
make `Parser::parse_foreign_item()` return a foreign item or error

Fixes `Parser::parse_foreign_item()` to follow the convention of `parse_trait_item()` and `parse_impl_item()` in that it *must* parse an item or return an error, and then the caller is responsible for detecting the closing delimiter.

This prevents it from looping endlessly on an unexpected token in `ext/expand.rs` where it was also leaking memory by continually pushing to `Parser::expected_tokens` via `Parser::check_keyword()`.

closes #54441

r? @petrochenkov
cc @dtolnay
2018-10-05 22:33:17 +02:00
Pietro Albini
08af25fb27
Rollup merge of #54812 - pnkfelix:issue-32382-index-assoc-type-with-lifetime, r=nikomatsakis
Regression test for #32382.
2018-10-05 22:33:16 +02:00
Pietro Albini
ee745d6abf
Rollup merge of #54804 - euclio:inverted-parameters, r=estebank
add suggestion for inverted function parameters

Fixes #54065.
2018-10-05 22:33:15 +02:00
Pietro Albini
3810657ae3
Rollup merge of #54787 - varkor:unused-mut-in-desugaring, r=nikomatsakis
Only warn about unused `mut` in user-written code

Fixes https://github.com/rust-lang/rust/issues/54586.

r? @pnkfelix
cc @blitzerr
2018-10-05 22:33:13 +02:00
Pietro Albini
9e8f522e80
Rollup merge of #54781 - phansch:master, r=varkor
Add examples to `TyKind::FnDef` and `TyKind::FnPtr` docs

This adds two examples to the docs of `TyKind::FnDef` and `TyKind::FnPtr`.

I found these two types a bit confusing when I learned about them and I think adding these examples might help others.
2018-10-05 22:33:12 +02:00
Pietro Albini
5efac03f34
Rollup merge of #54717 - ljedrz:cleanup_ty_p1, r=davidtwco
Cleanup rustc/ty part 1

Part 2 will follow soon; I wouldn't want these changes to rot too quickly.

- improve stack shifting and remove related allocations
- move a faster early return up
- improve allocations
- use Cow<str> where applicable
- simplify common patterns
- whitespace fixes
2018-10-05 22:33:11 +02:00
Pietro Albini
6b24de1edd
Rollup merge of #54078 - GabrielMajeri:expand-sync-docs, r=steveklabnik
Expand the documentation for the `std::sync` module

I've tried to expand the documentation for Rust's synchronization primitives. The module level documentation explains why synchronization is required when working with a multiprocessor system,
and then links to the appropiate structure in this module.

Fixes #29377, since this should be the last item on the checklist (documentation for `Atomic*` was fixed in #44854, but not ticked off the checklist).
2018-10-05 22:33:10 +02:00
bors
fddcd316af Auto merge of #54743 - ljedrz:cleanup_ty_p2, r=zackmdavis
Cleanup rustc/ty part 2

The second part of cleanups and minor improvements for rustc/ty.
- improve allocations
- calculate span after a possible early continue
- simplify some patterns
- mark a comment as FIXME
- whitespace fixes

The PR is independent from from the first part.
2018-10-05 19:32:14 +00:00
David Wood
c07b712d2c
Simplify test.
Removes unnecessary type mismatch error from test that was hiding
borrow check error from NLL stderr.
2018-10-05 18:35:23 +02:00
Alex Crichton
70ae43fee7 Revert "Slightly refactor VecDeque implementation"
This reverts commit 6ce76acae4.
2018-10-05 09:15:57 -07:00
Alex Crichton
90b9469121 Revert "Optimize VecDeque::append"
This reverts commit 11e488b64f.
2018-10-05 09:15:52 -07:00
Alex Crichton
9a41cfabba Revert "Add docs and debug asserts"
This reverts commit 1a1a7f6167.
2018-10-05 09:15:48 -07:00
Alex Crichton
54441484d1 Revert "Fix tidy"
This reverts commit 1908892d3f.
2018-10-05 09:15:44 -07:00
Alex Crichton
8d81c03b65 Revert "Add another assert"
This reverts commit 21d2a6c986.
2018-10-05 09:15:39 -07:00
Kazuyoshi Kato
23af6bb4e3 dro -> duckduckgo
dro means "doc.rust-lang.org", but it is too cryptic.
2018-10-05 08:52:44 -07:00
bors
2155f27b64 Auto merge of #54741 - oli-obk:impl_trait_hierarchy, r=cramertj
Nest the `impl Trait` existential item inside the return type

fixes #54045

r? @cramertj
2018-10-05 15:32:19 +00:00
Andy Russell
f5db411410
add suggestion for inverted function parameters
Fixes #54065.
2018-10-05 10:33:19 -04:00
bors
60c846046e Auto merge of #54336 - petrochenkov:preuni, r=alexcrichton
resolve: Some refactorings in preparation for uniform paths 2.0

The main result is that in-scope resolution performed during macro expansion / import resolution is now consolidated in a single function (`fn early_resolve_ident_in_lexical_scope`), which can now be used for resolving first import segments as well when uniform paths are enabled.

r? @ghost
2018-10-05 12:52:53 +00:00
ljedrz
c30ce35705 Remove graphviz::IntoCow 2018-10-05 14:16:10 +02:00