Commit Graph

73644 Commits

Author SHA1 Message Date
Manish Goregaokar
4f10f676d9 Handle relative paths 2018-01-22 15:24:29 +05:30
Manish Goregaokar
8166b59c74 Use correct item for links in modules 2018-01-22 15:24:28 +05:30
Manish Goregaokar
d6dcc47f0d Handle errors for intra doc link path lookup 2018-01-22 15:24:28 +05:30
Manish Goregaokar
140e77f71d Make resolve_hir_path and resolve_str_path fallible 2018-01-22 15:24:28 +05:30
Manish Goregaokar
f951d74389 Don't return early and discard the link in hoedown mode 2018-01-22 15:24:28 +05:30
QuietMisdreavus
30fca0919c add basic test for rustdoc intra links 2018-01-22 15:24:28 +05:30
QuietMisdreavus
c4a4d3a031 parse path ambiguity markers 2018-01-22 15:24:28 +05:30
QuietMisdreavus
ef4587b270 fix error_index_generator 2018-01-22 15:24:28 +05:30
QuietMisdreavus
9d5b1ae763 add intra-links support to hoedown 2018-01-22 15:24:27 +05:30
QuietMisdreavus
611866f3cf cleanup 2018-01-22 15:24:27 +05:30
Manish Goregaokar
e8dd5df69b Add LinkReplacer pass for pulldown 2018-01-22 15:24:27 +05:30
Manish Goregaokar
dae2e22e81 Make correct resolver available in rustdoc 2018-01-22 15:24:23 +05:30
Manish Goregaokar
fe0c10019d Split out creation of the resolver arena in phase_2_configure_and_expand 2018-01-22 15:21:29 +05:30
Manish Goregaokar
d18b344afb Move resolve arenas/crate loader outside of the core of phase_2_configure_and_expand 2018-01-22 15:21:28 +05:30
Manish Goregaokar
f7a8a97b69 DRY std_path 2018-01-22 15:21:28 +05:30
QuietMisdreavus
31ca2322a0 abort documenting on resolution errors 2018-01-22 15:21:28 +05:30
QuietMisdreavus
c3d0d5a4bb resolve paths when cleaning docs 2018-01-22 15:21:28 +05:30
QuietMisdreavus
76f831647a add a rustc_resolve::Resolver to DocContext 2018-01-22 15:21:28 +05:30
QuietMisdreavus
d9c1a17eec give render_text a generic return type 2018-01-22 15:21:28 +05:30
QuietMisdreavus
5db40f7754 add RenderType to DocContext 2018-01-22 15:21:28 +05:30
QuietMisdreavus
473fcfd49a new function to pull the links from a chunk of markdown 2018-01-22 15:21:27 +05:30
bors
bc072ed0ca 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.
2018-01-22 05:30:37 +00:00
bors
ff2a7c8575 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:
2018-01-21 22:38:29 +00:00
Guillaume Gomez
dcbf0bf5f5 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.
2018-01-21 23:11:45 +01:00
Guillaume Gomez
05f77ac5c2 Rollup merge of #47633 - pietroalbini:fix-ice-use-self, r=nagisa
Fix ICE with `use self;`

Closes #47623
2018-01-21 23:11:44 +01:00
Guillaume Gomez
6e6ab1e994 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
2018-01-21 23:11:43 +01:00
Guillaume Gomez
50e3836502 Rollup merge of #47625 - astraw:btreeset-doctest-fix, r=kennytm
fix doctests for BTreeSet to use BTreeSet (not BTreeMap)

This fixes #47624
2018-01-21 23:11:42 +01:00
Guillaume Gomez
c354bb8174 Rollup merge of #47595 - PieterPenninckx:master, r=shepmaster
Small improvements to the documentation of VecDeque.

Some small improvements to the documentation of `VecDeque`.
2018-01-21 23:11:41 +01:00
Guillaume Gomez
35221d8d68 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.
2018-01-21 23:11:40 +01:00
Guillaume Gomez
a1c3449a9c 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.
2018-01-21 23:11:39 +01:00
Guillaume Gomez
ab54a9c73c 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
2018-01-21 23:11:38 +01:00
Guillaume Gomez
6bb1b0dd37 Rollup merge of #47247 - estebank:suggest-cast, r=petrochenkov
Suggest casting on numeric type error

Re #47168.
2018-01-21 23:11:37 +01:00
bors
97520ccb10 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.
2018-01-21 16:52:09 +00:00
Russell Mackenzie
9a562866b3 Fix mailmap duplicates, Carol and Brian. 2018-01-21 15:21:36 +00:00
Pieter Penninckx
ea814b8463 Revert change to docs in panic section of VecDeque::split_off 2018-01-21 15:05:53 +01:00
bors
3001ab10b9 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
2018-01-21 12:05:49 +00:00
Pietro Albini
e9d0141fa9
Fix ICE with use self; 2018-01-21 12:26:01 +01:00
Sebastian Dröge
1756f680b0 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
2018-01-21 11:20:19 +02:00
bors
9368a1e3e2 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
2018-01-21 09:17:26 +00:00
bors
8d3e93beae 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:
2018-01-21 06:32:03 +00:00
bors
b85aefbc60 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
2018-01-21 03:38:34 +00:00
Andrew Straw
4d08d054c7 fix doctests for BTreeSet to use BTreeSet (not BTreeMap)
This fixes #47624
2018-01-20 23:39:12 +01:00
Guillaume Gomez
4074893acd 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.
2018-01-20 22:32:50 +01:00
Guillaume Gomez
a9672c2360 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.
2018-01-20 22:32:49 +01:00
Guillaume Gomez
40ba599365 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.
2018-01-20 22:32:48 +01:00
Guillaume Gomez
ea65bad080 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).
2018-01-20 22:32:47 +01:00
Guillaume Gomez
0f84ab4a41 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.
2018-01-20 22:32:46 +01:00
Guillaume Gomez
b21499e768 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`.
2018-01-20 22:32:45 +01:00
Guillaume Gomez
5381dfb7d9 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
2018-01-20 22:32:44 +01:00
Guillaume Gomez
d3176efa78 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.
2018-01-20 22:32:43 +01:00