]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoMake PanicInfo::message available for std::panic! with a formatting string.
Simon Sapin [Tue, 23 Jan 2018 17:19:21 +0000 (18:19 +0100)]
Make PanicInfo::message available for std::panic! with a formatting string.

This enables PanicInfo’s Display impl to show the panic message in those cases.

6 years agoImplement Display for PanicInfo and Location
Simon Sapin [Tue, 23 Jan 2018 16:49:43 +0000 (17:49 +0100)]
Implement Display for PanicInfo and Location

Due to being in libcore,
this impl cannot access PanicInfo::payload if it’s a String.

6 years agoAdd an unstable PanicInfo::message(&self) -> Option<&fmt::Arguments> method
Simon Sapin [Tue, 23 Jan 2018 16:24:19 +0000 (17:24 +0100)]
Add an unstable PanicInfo::message(&self) -> Option<&fmt::Arguments> method

6 years agoMove PanicInfo and Location to libcore
Simon Sapin [Tue, 23 Jan 2018 15:31:53 +0000 (16:31 +0100)]
Move PanicInfo and Location to libcore

Per https://rust-lang.github.io/rfcs/2070-panic-implementation.html

6 years agoAuto merge of #47046 - Manishearth:intra-doc-links, r=eddyb,GuillaumeGomez,QuietMisdr...
bors [Tue, 23 Jan 2018 07:38:53 +0000 (07:38 +0000)]
Auto merge of #47046 - Manishearth:intra-doc-links, r=eddyb,GuillaumeGomez,QuietMisdreavus,Manishearth

Implement RFC 1946 - intra-rustdoc links

https://github.com/rust-lang/rfcs/pull/1946 https://github.com/rust-lang/rust/issues/43466

Note for reviewers: The plain line counts are a little inflated because of how the markdown link parsing was done. [Read the file diff with "whitespace only" changes removed](https://github.com/rust-lang/rust/pull/47046/files?w=1) to get a better view of what actually changed there.

This pulls the name/path resolution mechanisms out of the compiler and runs it on the markdown in a crate's docs, so that links can be made to `SomeStruct` directly rather than finding the folder path to `struct.SomeStruct.html`. Check the `src/test/rustdoc/intra-paths.rs` test in this PR for a demo. The change was... a little invasive, but unlocks a really powerful mechanism for writing documentation that doesn't care about where an item was written to on the hard disk.

Items included:

 - [x] Make work with the hoedown renderer
 - [x] Handle relative paths
 - [x] Parse out the "path ambiguities" qualifiers (`[crate foo]`, `[struct Foo]`, `[foo()]`, `[static FOO]`, `[foo!]`, etc)
 - [x] Resolve foreign macros
 - [x] Resolve local macros
 - [x] Handle the use of inner/outer attributes giving different resolution scopes (handling for non-modules pushed to different PR)

Items not included:

 - [ ] Make sure cross-crate inlining works (blocked on refactor described in https://github.com/rust-lang/rust/pull/47046#issuecomment-354824520)
 - [ ] Implied Shortcut Reference Links (where just doing `[::std::iter::Iterator][]` without a reference anchor will resolve using the reference name rather than the link target) (requires modifying the markdown parser - blocked on Hoedown/Pulldown switch and https://github.com/google/pulldown-cmark/issues/121)
 - [ ] Handle enum variants and UFCS methods (Enum variants link to the enum page, associated methods don't link at all)
 - [ ] Emit more warnings/errors when things fail to resolve (linking to a value-namespaced item without a qualifier will emit an error, otherwise the link is just treated as a url, not a rust path)
 - [ ] Give better spans for resolution errors (currently the span for the first doc comment is used)
 - [ ] Check for inner doc comments on things that aren't modules

I'm making the PR, but it should be noted that most of the work was done by Misdreavus :smile:

(Editor's note: This has become a lie, check that commit log, Manish did a ton of work after this PR was opened `>_>`)

6 years agoAuto merge of #47373 - wesleywiser:incr_cache_hashing, r=michaelwoerister
bors [Mon, 22 Jan 2018 23:32:16 +0000 (23:32 +0000)]
Auto merge of #47373 - wesleywiser:incr_cache_hashing, r=michaelwoerister

[Incremental] Cache hashes for AdDef and ty::Slice<T>

r? @michaelwoerister

6 years agodon't process code blocks when scanning for links
QuietMisdreavus [Mon, 22 Jan 2018 23:04:55 +0000 (17:04 -0600)]
don't process code blocks when scanning for links

6 years agoAuto merge of #47507 - alexcrichton:rerun-bat-scripts, r=michaelwoerister
bors [Mon, 22 Jan 2018 20:30:14 +0000 (20:30 +0000)]
Auto merge of #47507 - alexcrichton:rerun-bat-scripts, r=michaelwoerister

rustc: Lower link args to `@`-files on Windows more

When spawning a linker rustc has historically been known to blow OS limits for
the command line being too large, notably on Windows. This is especially true of
incremental compilation where there can be dozens of object files per
compilation. The compiler currently has logic for detecting a failure to spawn
and instead passing arguments via a file instead, but this failure detection
only triggers if a process actually fails to spawn.

Unfortunately on Windows we've got something else to worry about which is
`cmd.exe`. The compiler may be running a linker through `cmd.exe` where
`cmd.exe` has a limit of 8192 on the command line vs 32k on `CreateProcess`.
Moreso rustc actually succeeds in spawning `cmd.exe` today, it's just that after
it's running `cmd.exe` fails to spawn its child, which rustc doesn't currently
detect.

Consequently this commit updates the logic for the spawning the linker on
Windows to instead have a heuristic to see if we need to pass arguments via a
file. This heuristic is an overly pessimistic and "inaccurate" calculation which
just calls `len` on a bunch of `OsString` instances (where `len` is not
precisely the length in u16 elements). This number, when exceeding the 6k
threshold, will force rustc to always pass arguments through a file.

This strategy should avoid us trying to parse the output on Windows of the
linker to see if it successfully spawned yet failed to actually sub-spawn the
linker. We may just be passing arguments through files a little more commonly
now...

The motivation for this commit was a recent bug in Gecko [1] when beta testing,
notably when incremental compilation was enabled it blew out the limit on
`cmd.exe`. This commit will also fix #46999 as well though as emscripten uses a
bat script as well (and we're blowing the limit there).

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1430886

Closes #46999

6 years agoTemporary fix missing escape_href in hoedown_link by copying pulldown's code
Manish Goregaokar [Mon, 22 Jan 2018 16:53:08 +0000 (22:23 +0530)]
Temporary fix missing escape_href in hoedown_link by copying pulldown's code

6 years agoAuto merge of #47353 - nikomatsakis:nll-issue-47189, r=pnkfelix+nmatsakis
bors [Mon, 22 Jan 2018 11:11:47 +0000 (11:11 +0000)]
Auto merge of #47353 - nikomatsakis:nll-issue-47189, r=pnkfelix+nmatsakis

renumber regions in generators

This fixes #47189, but I think we still have to double check various things around how to treat generators in MIR type check + borrow check (e.g., what borrows should be invalidated by a `Suspend`? What consistency properties should type check be enforcing anyway around the "interior" type?)

Also fixes #47587 thanks to @spastorino's commit.

r? @pnkfelix

6 years agoUpdate to new commonmark arg
Manish Goregaokar [Mon, 22 Jan 2018 10:55:59 +0000 (16:25 +0530)]
Update to new commonmark arg

6 years agoReview fixes
Manish Goregaokar [Mon, 22 Jan 2018 09:59:34 +0000 (15:29 +0530)]
Review fixes

6 years agoMove macro_resolve() into a function
Manish Goregaokar [Fri, 19 Jan 2018 12:43:50 +0000 (18:13 +0530)]
Move macro_resolve() into a function

6 years agoMove resolve() into a function
Manish Goregaokar [Fri, 19 Jan 2018 12:27:10 +0000 (17:57 +0530)]
Move resolve() into a function

6 years agoAdd ambiguity errors for macros
Manish Goregaokar [Fri, 19 Jan 2018 12:13:08 +0000 (17:43 +0530)]
Add ambiguity errors for macros

6 years agoMove the figuring out of the 'kind' of def out into functions
Manish Goregaokar [Fri, 19 Jan 2018 11:57:18 +0000 (17:27 +0530)]
Move the figuring out of the 'kind' of def out into functions

6 years agoAllow macros to be resolved with ambiguous idents too
Manish Goregaokar [Fri, 19 Jan 2018 11:49:01 +0000 (17:19 +0530)]
Allow macros to be resolved with ambiguous idents too

6 years agoAllow function@, value@, macro@
Manish Goregaokar [Fri, 19 Jan 2018 11:15:48 +0000 (16:45 +0530)]
Allow function@, value@, macro@

6 years agoError only in the case of overlap
Manish Goregaokar [Wed, 10 Jan 2018 05:36:51 +0000 (11:06 +0530)]
Error only in the case of overlap

6 years agoUse the registered def id (makes enum variants link to the enum page instead of not...
Manish Goregaokar [Tue, 9 Jan 2018 06:25:28 +0000 (11:55 +0530)]
Use the registered def id (makes enum variants link to the enum page instead of not at all)

6 years agoBetter error message
Manish Goregaokar [Tue, 9 Jan 2018 05:20:52 +0000 (10:50 +0530)]
Better error message

6 years agovalue-namespace items require a marker, so emit an error
QuietMisdreavus [Mon, 8 Jan 2018 19:20:19 +0000 (13:20 -0600)]
value-namespace items require a marker, so emit an error

6 years agoresolve module docs based on inner/outer attributes
QuietMisdreavus [Mon, 8 Jan 2018 17:10:50 +0000 (11:10 -0600)]
resolve module docs based on inner/outer attributes

6 years agoclean module docs while its module ID is still on the stack
QuietMisdreavus [Mon, 8 Jan 2018 16:07:16 +0000 (10:07 -0600)]
clean module docs while its module ID is still on the stack

6 years agoadd ambiguity markers to the intra-links test
QuietMisdreavus [Mon, 8 Jan 2018 15:33:27 +0000 (09:33 -0600)]
add ambiguity markers to the intra-links test

6 years agouse @ instead of space for link ambiguity markers
QuietMisdreavus [Mon, 8 Jan 2018 15:23:12 +0000 (09:23 -0600)]
use @ instead of space for link ambiguity markers

since spaces aren't allowed in link targets in commonmark, a new symbol
is needed to separate the marker from the rest of the path. hence, @

6 years agoadd a macro to the intra-links test
QuietMisdreavus [Sun, 7 Jan 2018 23:09:16 +0000 (17:09 -0600)]
add a macro to the intra-links test

6 years agoStore a list of local macros on the resolver; use for resolving intra-doc macro links
Manish Goregaokar [Sat, 6 Jan 2018 11:53:33 +0000 (17:23 +0530)]
Store a list of local macros on the resolver; use for resolving intra-doc macro links

6 years agoResolve foreign macros
Manish Goregaokar [Sat, 6 Jan 2018 08:31:54 +0000 (14:01 +0530)]
Resolve foreign macros

6 years agoRegister definitions
Manish Goregaokar [Sat, 6 Jan 2018 10:15:44 +0000 (15:45 +0530)]
Register definitions

6 years agoFix unit tests
Manish Goregaokar [Wed, 3 Jan 2018 08:41:54 +0000 (14:11 +0530)]
Fix unit tests

6 years agoFix tidy
Manish Goregaokar [Wed, 3 Jan 2018 06:03:04 +0000 (11:33 +0530)]
Fix tidy

6 years agoExit early for non-linky things
Manish Goregaokar [Mon, 1 Jan 2018 08:52:28 +0000 (14:22 +0530)]
Exit early for non-linky things

6 years agoHandle relative paths
Manish Goregaokar [Mon, 1 Jan 2018 07:31:19 +0000 (13:01 +0530)]
Handle relative paths

6 years agoUse correct item for links in modules
Manish Goregaokar [Mon, 1 Jan 2018 06:26:07 +0000 (11:56 +0530)]
Use correct item for links in modules

6 years agoHandle errors for intra doc link path lookup
Manish Goregaokar [Fri, 29 Dec 2017 08:22:30 +0000 (13:52 +0530)]
Handle errors for intra doc link path lookup

6 years agoMake resolve_hir_path and resolve_str_path fallible
Manish Goregaokar [Fri, 29 Dec 2017 08:06:32 +0000 (13:36 +0530)]
Make resolve_hir_path and resolve_str_path fallible

6 years agoDon't return early and discard the link in hoedown mode
Manish Goregaokar [Fri, 29 Dec 2017 06:35:42 +0000 (12:05 +0530)]
Don't return early and discard the link in hoedown mode

6 years agoadd basic test for rustdoc intra links
QuietMisdreavus [Thu, 28 Dec 2017 22:48:30 +0000 (16:48 -0600)]
add basic test for rustdoc intra links

6 years agoparse path ambiguity markers
QuietMisdreavus [Thu, 28 Dec 2017 22:46:13 +0000 (16:46 -0600)]
parse path ambiguity markers

6 years agofix error_index_generator
QuietMisdreavus [Thu, 28 Dec 2017 19:35:10 +0000 (13:35 -0600)]
fix error_index_generator

6 years agoadd intra-links support to hoedown
QuietMisdreavus [Thu, 28 Dec 2017 17:41:00 +0000 (11:41 -0600)]
add intra-links support to hoedown

6 years agocleanup
QuietMisdreavus [Thu, 28 Dec 2017 16:52:40 +0000 (10:52 -0600)]
cleanup

6 years agoAdd LinkReplacer pass for pulldown
Manish Goregaokar [Thu, 28 Dec 2017 10:59:20 +0000 (16:29 +0530)]
Add LinkReplacer pass for pulldown

6 years agoMake correct resolver available in rustdoc
Manish Goregaokar [Mon, 25 Dec 2017 09:04:56 +0000 (14:34 +0530)]
Make correct resolver available in rustdoc

6 years agoSplit out creation of the resolver arena in phase_2_configure_and_expand
Manish Goregaokar [Mon, 25 Dec 2017 08:25:21 +0000 (13:55 +0530)]
Split out creation of the resolver arena in phase_2_configure_and_expand

6 years agoMove resolve arenas/crate loader outside of the core of phase_2_configure_and_expand
Manish Goregaokar [Mon, 25 Dec 2017 08:19:25 +0000 (13:49 +0530)]
Move resolve arenas/crate loader outside of the core of phase_2_configure_and_expand

6 years agoDRY std_path
Manish Goregaokar [Mon, 25 Dec 2017 06:07:55 +0000 (11:37 +0530)]
DRY std_path

6 years agoabort documenting on resolution errors
QuietMisdreavus [Mon, 25 Dec 2017 04:28:34 +0000 (22:28 -0600)]
abort documenting on resolution errors

6 years agoresolve paths when cleaning docs
QuietMisdreavus [Fri, 22 Dec 2017 19:12:54 +0000 (13:12 -0600)]
resolve paths when cleaning docs

6 years agoadd a rustc_resolve::Resolver to DocContext
QuietMisdreavus [Thu, 21 Dec 2017 21:16:29 +0000 (15:16 -0600)]
add a rustc_resolve::Resolver to DocContext

6 years agogive render_text a generic return type
QuietMisdreavus [Thu, 21 Dec 2017 21:15:48 +0000 (15:15 -0600)]
give render_text a generic return type

6 years agoadd RenderType to DocContext
QuietMisdreavus [Thu, 21 Dec 2017 21:15:07 +0000 (15:15 -0600)]
add RenderType to DocContext

6 years agonew function to pull the links from a chunk of markdown
QuietMisdreavus [Thu, 21 Dec 2017 20:54:16 +0000 (14:54 -0600)]
new function to pull the links from a chunk of markdown

6 years agoAuto merge of #47158 - rkruppe:repr-transparent, r=eddyb
bors [Mon, 22 Jan 2018 08:10:41 +0000 (08:10 +0000)]
Auto merge of #47158 - rkruppe:repr-transparent, r=eddyb

Implement repr(transparent)

r? @eddyb for the functional changes. The bulk of the PR is error messages and docs, might be good to have a doc person look over those.

cc #43036
cc @nox

6 years agoAuto merge of #47144 - estebank:moved-closure-arg, r=nikomatsakis
bors [Mon, 22 Jan 2018 05:30:37 +0000 (05:30 +0000)]
Auto merge of #47144 - estebank:moved-closure-arg, r=nikomatsakis

Custom error when moving arg outside of its closure

When given the following code:

```rust
fn give_any<F: for<'r> FnOnce(&'r ())>(f: F) {
    f(&());
}

fn main() {
    let mut x = None;
    give_any(|y| x = Some(y));
}
```

provide a custom error:

```
error: borrowed data cannot be moved outside of its closure
 --> file.rs:7:27
  |
6 |     let mut x = None;
  |         ----- borrowed data cannot be moved into here...
7 |     give_any(|y| x = Some(y));
  |              ---          ^ cannot be moved outside of its closure
  |              |
  |              ...because it cannot outlive this closure
```

instead of the generic lifetime error:

```
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
 --> file.rs:7:27
  |
7 |     give_any(|y| x = Some(y));
  |                           ^
  |
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:14...
 --> file.rs:7:14
  |
7 |     give_any(|y| x = Some(y));
  |              ^^^^^^^^^^^^^^^
note: ...so that expression is assignable (expected &(), found &())
 --> file.rs:7:27
  |
7 |     give_any(|y| x = Some(y));
  |                           ^
note: but, the lifetime must be valid for the block suffix following statement 0 at 6:5...
 --> file.rs:6:5
  |
6 | /     let mut x = None;
7 | |     give_any(|y| x = Some(y));
8 | | }
  | |_^
note: ...so that variable is valid at time of its declaration
 --> file.rs:6:9
  |
6 |     let mut x = None;
  |         ^^^^^
```

Fix #45983.

6 years agorustc: Lower link args to `@`-files on Windows more
Alex Crichton [Tue, 16 Jan 2018 23:30:57 +0000 (15:30 -0800)]
rustc: Lower link args to `@`-files on Windows more

When spawning a linker rustc has historically been known to blow OS limits for
the command line being too large, notably on Windows. This is especially true of
incremental compilation where there can be dozens of object files per
compilation. The compiler currently has logic for detecting a failure to spawn
and instead passing arguments via a file instead, but this failure detection
only triggers if a process actually fails to spawn.

Unfortunately on Windows we've got something else to worry about which is
`cmd.exe`. The compiler may be running a linker through `cmd.exe` where
`cmd.exe` has a limit of 8192 on the command line vs 32k on `CreateProcess`.
Moreso rustc actually succeeds in spawning `cmd.exe` today, it's just that after
it's running `cmd.exe` fails to spawn its child, which rustc doesn't currently
detect.

Consequently this commit updates the logic for the spawning the linker on
Windows to instead have a heuristic to see if we need to pass arguments via a
file. This heuristic is an overly pessimistic and "inaccurate" calculation which
just calls `len` on a bunch of `OsString` instances (where `len` is not
precisely the length in u16 elements). This number, when exceeding the 6k
threshold, will force rustc to always pass arguments through a file.

This strategy should avoid us trying to parse the output on Windows of the
linker to see if it successfully spawned yet failed to actually sub-spawn the
linker. We may just be passing arguments through files a little more commonly
now...

The motivation for this commit was a recent bug in Gecko [1] when beta testing,
notably when incremental compilation was enabled it blew out the limit on
`cmd.exe`. This commit will also fix #46999 as well though as emscripten uses a
bat script as well (and we're blowing the limit there).

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1430886

Closes #46999

6 years agoAuto merge of #47644 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sun, 21 Jan 2018 22:38:29 +0000 (22:38 +0000)]
Auto merge of #47644 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 9 pull requests

- Successful merges: #47247, #47334, #47512, #47582, #47595, #47625, #47632, #47633, #47637
- Failed merges:

6 years agoRollup merge of #47637 - russmack:fix-mailmap-dupes, r=steveklabnik
Guillaume Gomez [Sun, 21 Jan 2018 22:11:45 +0000 (23:11 +0100)]
Rollup merge of #47637 - russmack:fix-mailmap-dupes, r=steveklabnik

Fix mailmap duplicates, Carol and Brian.

This fix corrects the .mailmap file so that Carol (Nichols || Goulding) appears only once, and Brian Anderson also appears only once.

6 years agoRollup merge of #47633 - pietroalbini:fix-ice-use-self, r=nagisa
Guillaume Gomez [Sun, 21 Jan 2018 22:11:44 +0000 (23:11 +0100)]
Rollup merge of #47633 - pietroalbini:fix-ice-use-self, r=nagisa

Fix ICE with `use self;`

Closes #47623

6 years agoRollup merge of #47632 - sdroege:exact-chunks-docs-broken-links, r=kennytm
Guillaume Gomez [Sun, 21 Jan 2018 22:11:43 +0000 (23:11 +0100)]
Rollup merge of #47632 - sdroege:exact-chunks-docs-broken-links, r=kennytm

Fix broken links to other slice functions in chunks/chunks_mut/exact_…

…chunk/exact_chunks_mut docs

See https://github.com/rust-lang/rust/pull/47126#discussion_r162780492

6 years agoRollup merge of #47625 - astraw:btreeset-doctest-fix, r=kennytm
Guillaume Gomez [Sun, 21 Jan 2018 22:11:42 +0000 (23:11 +0100)]
Rollup merge of #47625 - astraw:btreeset-doctest-fix, r=kennytm

fix doctests for BTreeSet to use BTreeSet (not BTreeMap)

This fixes #47624

6 years agoRollup merge of #47595 - PieterPenninckx:master, r=shepmaster
Guillaume Gomez [Sun, 21 Jan 2018 22:11:41 +0000 (23:11 +0100)]
Rollup merge of #47595 - PieterPenninckx:master, r=shepmaster

Small improvements to the documentation of VecDeque.

Some small improvements to the documentation of `VecDeque`.

6 years agoRollup merge of #47582 - alexcrichton:auto-beta, r=kennytm
Guillaume Gomez [Sun, 21 Jan 2018 22:11:40 +0000 (23:11 +0100)]
Rollup merge of #47582 - alexcrichton:auto-beta, r=kennytm

Automaticaly calculate beta prerelease numbers

This is a forward-port of:

9426dda83d7a928d6ced377345e14b84b0f11c21
cbfb9858951da7aee22d82178405306fca9decb1

from the beta branch which is used to automatically calculate the beta number
based on the number of merges to the beta branch so far.

6 years agoRollup merge of #47512 - GuillaumeGomez:e0659, r=petrochenkov
Guillaume Gomez [Sun, 21 Jan 2018 22:11:39 +0000 (23:11 +0100)]
Rollup merge of #47512 - GuillaumeGomez:e0659, r=petrochenkov

Add E0659 for ambiguous names

Still on the tracks of the "no error without error code" road.

6 years agoRollup merge of #47334 - etaoins:only-call-res-init-on-gnu-unix, r=alexcrichton
Guillaume Gomez [Sun, 21 Jan 2018 22:11:38 +0000 (23:11 +0100)]
Rollup merge of #47334 - etaoins:only-call-res-init-on-gnu-unix, r=alexcrichton

Only link res_init() on GNU/*nix

To workaround a bug in glibc <= 2.26 lookup_host() calls res_init() based on the glibc version detected at runtime. While this avoids calling res_init() on platforms where it's not required we will still end up linking against the symbol.

This causes an issue on macOS where res_init() is implemented in a separate library (libresolv.9.dylib) from the main libc. While this is harmless for standalone programs it becomes a problem if Rust code is statically linked against another program. If the linked program doesn't already specify -lresolv it will cause the link to fail. This is captured in issue #46797

Fix this by hooking in to the glibc workaround in `cvt_gai` and only activating it for the "gnu" environment on Unix This should include all glibc platforms while excluding musl, windows-gnu, macOS, FreeBSD, etc.

This has the side benefit of removing the #[cfg] in sys_common; only unix.rs has code related to the workaround now.

Before this commit:
```shell
> cat main.rs
use std::net::ToSocketAddrs;

#[no_mangle]
pub extern "C" fn resolve_test() -> () {
    let addr_list = ("google.com.au", 0).to_socket_addrs().unwrap();
    println!("{:?}", addr_list);
}
> rustc --crate-type=staticlib main.rs
> clang libmain.a test.c -o combined
Undefined symbols for architecture x86_64:
  "_res_9_init", referenced from:
      std::net::lookup_host::h93c17fe9ad38464a in libmain.a(std-826c8d3b356e180c.std0.rcgu.o)
ld: symbol(s) not found for architecture x86_64
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
```

Afterwards:
```shell
> rustc --crate-type=staticlib main.rs
> clang libmain.a test.c -o combined
> ./combined
IntoIter([V4(172.217.25.131:0)])
```

Fixes  #46797

6 years agoRollup merge of #47247 - estebank:suggest-cast, r=petrochenkov
Guillaume Gomez [Sun, 21 Jan 2018 22:11:37 +0000 (23:11 +0100)]
Rollup merge of #47247 - estebank:suggest-cast, r=petrochenkov

Suggest casting on numeric type error

Re #47168.

6 years agoAuto merge of #47116 - estebank:non-accessible-ctor, r=petrochenkov
bors [Sun, 21 Jan 2018 16:52:09 +0000 (16:52 +0000)]
Auto merge of #47116 - estebank:non-accessible-ctor, r=petrochenkov

Tweaks to invalid ctor messages

 - Do not suggest using a constructor that isn't accessible
 - Suggest the appropriate syntax (`()`/`{}` as appropriate)
 - Add note when trying to use `Self` as a ctor

CC #22488, fix #47085.

6 years agoFix mailmap duplicates, Carol and Brian.
Russell Mackenzie [Sun, 21 Jan 2018 15:21:36 +0000 (15:21 +0000)]
Fix mailmap duplicates, Carol and Brian.

6 years agoRevert change to docs in panic section of VecDeque::split_off
Pieter Penninckx [Sun, 21 Jan 2018 14:05:53 +0000 (15:05 +0100)]
Revert change to docs in panic section of VecDeque::split_off

6 years agoAuto merge of #47001 - arielb1:private-match, r=nikomatsakis
bors [Sun, 21 Jan 2018 12:05:49 +0000 (12:05 +0000)]
Auto merge of #47001 - arielb1:private-match, r=nikomatsakis

check_match: fix handling of privately uninhabited types

the match-checking code used to use TyErr for signaling "unknown,
inhabited" types for a long time. It had been switched to using the
exact type in #38069, to handle uninhabited types.

However, in #39980, we discovered that we still needed the "unknown
inhabited" logic, but I used `()` instead of `TyErr` to handle that.
Revert to using `TyErr` to fix that problem.

Fixes #46964.

r? @nikomatsakis

6 years agoFix ICE with `use self;`
Pietro Albini [Sun, 21 Jan 2018 11:26:01 +0000 (12:26 +0100)]
Fix ICE with `use self;`

6 years agoFix broken links to other slice functions in chunks/chunks_mut/exact_chunk/exact_chun...
Sebastian Dröge [Sun, 21 Jan 2018 09:20:19 +0000 (11:20 +0200)]
Fix broken links to other slice functions in chunks/chunks_mut/exact_chunk/exact_chunks_mut docs

See https://github.com/rust-lang/rust/pull/47126#discussion_r162780492

6 years agoAuto merge of #45684 - bjorn3:runtime_choose_trans2, r=eddyb
bors [Sun, 21 Jan 2018 09:17:26 +0000 (09:17 +0000)]
Auto merge of #45684 - bjorn3:runtime_choose_trans2, r=eddyb

Allow runtime switching between trans backends

The driver callback after_llvm has been removed as it doesnt work with multiple backends.

r? @eddyb

6 years agoAuto merge of #47622 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sun, 21 Jan 2018 06:32:03 +0000 (06:32 +0000)]
Auto merge of #47622 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 10 pull requests

- Successful merges: #46938, #47193, #47508, #47510, #47532, #47535, #47559, #47568, #47573, #47578
- Failed merges:

6 years agoAuto merge of #47495 - nikomatsakis:nll-issue-47153, r=pnkfelix
bors [Sun, 21 Jan 2018 03:38:34 +0000 (03:38 +0000)]
Auto merge of #47495 - nikomatsakis:nll-issue-47153, r=pnkfelix

remove bogus assertion and comments

The code (incorrectly) assumed that constants could not have generics
in scope, but it's not really a problem if they do.

Fixes #47153

r? @pnkfelix

6 years agofix doctests for BTreeSet to use BTreeSet (not BTreeMap)
Andrew Straw [Sat, 20 Jan 2018 22:23:44 +0000 (23:23 +0100)]
fix doctests for BTreeSet to use BTreeSet (not BTreeMap)

This fixes #47624

6 years agoRollup merge of #47578 - arthurprs:btree-doc, r=alexcrichton
Guillaume Gomez [Sat, 20 Jan 2018 21:32:50 +0000 (22:32 +0100)]
Rollup merge of #47578 - arthurprs:btree-doc, r=alexcrichton

Update BTreeMap recommendation

Focus on the ordering / range(instead of all) benefit as it's the most important feature.

6 years agoRollup merge of #47573 - estebank:closures, r=nikomatsakis
Guillaume Gomez [Sat, 20 Jan 2018 21:32:49 +0000 (22:32 +0100)]
Rollup merge of #47573 - estebank:closures, r=nikomatsakis

Closure argument mismatch tweaks

 - use consistent phrasing for expected and found arguments
 - suggest changing arguments to tuple if possible
 - suggest changing single tuple argument to arguments if possible

Fix #44150.

6 years agoRollup merge of #47568 - EdSchouten:cloudabi-linker, r=alexcrichton
Guillaume Gomez [Sat, 20 Jan 2018 21:32:48 +0000 (22:32 +0100)]
Rollup merge of #47568 - EdSchouten:cloudabi-linker, r=alexcrichton

Give TargetOptions::linker a sane default value for CloudABI.

Though some parts of rust use cc-rs to invoke a compiler/linker, Cargo
seems to make use of the TargetOptions::linker property. Make the out of
the box experience for CloudABI a bit better by using the same compiler
name as cc-rs.

6 years agoRollup merge of #47559 - walinga:pr-link-fix, r=kennytm
Guillaume Gomez [Sat, 20 Jan 2018 21:32:47 +0000 (22:32 +0100)]
Rollup merge of #47559 - walinga:pr-link-fix, r=kennytm

Fix the "Github - About Pull Requests" link in CONTRIBUTING.md

Previously the text that is supposed to link to the Github Pull Requests page, instead linked to the same file (CONTRIBUTING.md).

6 years agoRollup merge of #47535 - Manishearth:ignore-target, r=kennytm
Guillaume Gomez [Sat, 20 Jan 2018 21:32:46 +0000 (22:32 +0100)]
Rollup merge of #47535 - Manishearth:ignore-target, r=kennytm

add target/ to ignored tidy dirs

Sometimes you get a target directory from running cargo in the rust repo (the root is `src/`), and it contains generated files. Just whitelist it since it causes tidy to spew warnings uncontrollably.

6 years agoRollup merge of #47532 - tbu-:pr_path_oddities, r=TimNN
Guillaume Gomez [Sat, 20 Jan 2018 21:32:45 +0000 (22:32 +0100)]
Rollup merge of #47532 - tbu-:pr_path_oddities, r=TimNN

Add some edge cases to the documentation of `Path`

Affected methods are `starts_with` and `strip_prefix`.

6 years agoRollup merge of #47510 - sfackler:deprecate-dns, r=alexcrichton
Guillaume Gomez [Sat, 20 Jan 2018 21:32:44 +0000 (22:32 +0100)]
Rollup merge of #47510 - sfackler:deprecate-dns, r=alexcrichton

Deprecate std::net::lookup_host

We intended to do this quite a while ago but it snuck through.

r? @alexcrichton

6 years agoRollup merge of #47508 - QuietMisdreavus:rbe-bookshelf, r=steveklabnik
Guillaume Gomez [Sat, 20 Jan 2018 21:32:43 +0000 (22:32 +0100)]
Rollup merge of #47508 - QuietMisdreavus:rbe-bookshelf, r=steveklabnik

add Rust By Example to the bookshelf

cc #46194

With #46196 freshly merged, we should add a link to the main docs distribution so people can find it! We discussed this at the docs team meeting today and decided to go ahead with adding it to the bookshelf.

6 years agoRollup merge of #47193 - cramertj:result-opts, r=TimNN
Guillaume Gomez [Sat, 20 Jan 2018 21:32:42 +0000 (22:32 +0100)]
Rollup merge of #47193 - cramertj:result-opts, r=TimNN

Add transpose conversions for nested Option and Result

These impls are useful when working with combinator
methods that expect an option or a result, but you
have a `Result<Option<T>, E>` instead of an `Option<Result<T, E>>`
or vice versa.

6 years agoRollup merge of #46938 - hellow554:rustdoc-kbd-style, r=GuillaumeGomez
Guillaume Gomez [Sat, 20 Jan 2018 21:32:41 +0000 (22:32 +0100)]
Rollup merge of #46938 - hellow554:rustdoc-kbd-style, r=GuillaumeGomez

add kbd style tag to main.css in rustdoc

Added css style for kbd tags so they actually look like keys.
Result preview and discussion was going on in #46900 .

6 years agoFix tests by keepeing needed suggestions
Esteban Küber [Sat, 20 Jan 2018 20:02:40 +0000 (12:02 -0800)]
Fix tests by keepeing needed suggestions

6 years agoRemove the 'extern "C"' in the right place
bjorn3 [Sat, 20 Jan 2018 16:27:00 +0000 (17:27 +0100)]
Remove the 'extern "C"' in the right place

6 years agoAuto merge of #46980 - zackmdavis:and_the_case_of_the_needlessly_parenthesized_argume...
bors [Sat, 20 Jan 2018 15:06:41 +0000 (15:06 +0000)]
Auto merge of #46980 - zackmdavis:and_the_case_of_the_needlessly_parenthesized_arguments, r=petrochenkov

in which the unused-parens lint comes to cover function and method args

Resolves #46137.

6 years agoAuto merge of #46952 - SimonSapin:nonnull, r=alexcrichton
bors [Sat, 20 Jan 2018 12:28:13 +0000 (12:28 +0000)]
Auto merge of #46952 - SimonSapin:nonnull, r=alexcrichton

Rename std::ptr::Shared to NonNull and stabilize it

This implements the changes proposed at https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629:

> * Rename `Shared<T>` to `NonNull<T>` and stabilize it. (Being in the `ptr` module is enough to say that it’s a pointer. I’m not very attached to this specific name though.)
> * Rename `Box<T>` methods ~~`from_unique`~~/`into_unique` to ~~`from_nonnull`~~/`into_nonnull` (or whatever names are deemed appropriate), replace `Unique<T>` with `NonNull<T>` in their signatures, and stabilize them.
> *  Replace `Unique<T>` with `NonNull<T>` in the signatures of methods of the `Alloc` trait.
> * Mark `Unique` “permanently-unstable” by replacing remaining occurrences of `#[unstable(feature = "unique", issue = "27730")]` with:
>
>   ```rust
>   #[unstable(feature = "ptr_internals", issue = "0", reason = "\
>       use NonNull instead and consider PhantomData<T> (if you also use #[may_dangle]), \
>       Send, and/or Sync")]
>   ```
>
>   (Maybe the `reason` string is only useful on the struct definition.) Ideally it would be made private to some crate instead, but it needs to be used in both liballoc and libstd.
> * (Leave `NonZero` and `Zeroable` unstable for now, and subject to future bikeshedding.)

6 years agoFix ICE
bjorn3 [Sat, 20 Jan 2018 10:55:55 +0000 (11:55 +0100)]
Fix ICE

6 years agoAssign its own tracking issue to Box::into_raw_non_null
Simon Sapin [Wed, 10 Jan 2018 20:11:55 +0000 (21:11 +0100)]
Assign its own tracking issue to Box::into_raw_non_null

https://github.com/rust-lang/rust/issues/47336

6 years agoRename NonNull::empty to dangling.
Simon Sapin [Wed, 10 Jan 2018 08:30:04 +0000 (09:30 +0100)]
Rename NonNull::empty to dangling.

6 years agoRevert Box::into_raw_non_null to unstable
Simon Sapin [Wed, 10 Jan 2018 08:25:11 +0000 (09:25 +0100)]
Revert Box::into_raw_non_null to unstable

6 years agoPreserve formatting options in Debug for NonNull/Unique
Simon Sapin [Wed, 10 Jan 2018 08:21:15 +0000 (09:21 +0100)]
Preserve formatting options in Debug for NonNull/Unique

6 years agoFix some doc-comment examples for earlier API refactor
Simon Sapin [Tue, 9 Jan 2018 10:25:22 +0000 (11:25 +0100)]
Fix some doc-comment examples for earlier API refactor

https://github.com/rust-lang/rust/pull/41064

6 years agoRename Box::into_non_null_raw to Box::into_raw_non_null
Simon Sapin [Wed, 27 Dec 2017 21:56:06 +0000 (22:56 +0100)]
Rename Box::into_non_null_raw to Box::into_raw_non_null

6 years agoRemove `Box::from_non_null_raw`
Simon Sapin [Wed, 27 Dec 2017 21:53:27 +0000 (22:53 +0100)]
Remove `Box::from_non_null_raw`

Per https://github.com/rust-lang/rust/pull/46952#issuecomment-353956225

6 years agoRename Box::*_nonnull_raw to *_non_null_raw
Simon Sapin [Fri, 22 Dec 2017 22:46:52 +0000 (23:46 +0100)]
Rename Box::*_nonnull_raw to *_non_null_raw