Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #47572

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
176624f
add kbd style tag to main.css in rustdoc
hellow554 Dec 21, 2017
6e741df
moved colors of kbd tag into main.css
hellow554 Dec 22, 2017
38e5d30
extended dt with kbd tags
hellow554 Jan 15, 2018
090a968
Only link res_init() on GNU/*nix
etaoins Jan 10, 2018
0e1ecbe
add Rust By Example to the bookshelf
QuietMisdreavus Jan 17, 2018
839ff6f
Updated tests with fixed span location.
davidtwco Jan 13, 2018
13f8c82
Fixed off-by-one spans in MIR borrowck errors.
davidtwco Jan 13, 2018
b7228c8
Moved overflow check into end_point function.
davidtwco Jan 14, 2018
ee606c0
end_point handling multibyte characters correctly.
davidtwco Jan 14, 2018
e1c927b
Replaced multi-byte character handling in end_point with potentially …
davidtwco Jan 16, 2018
9d4ca01
next_point now handles creating spans over multibyte characters.
davidtwco Jan 17, 2018
2161c3f
Fix new test from rebase.
davidtwco Jan 17, 2018
a1b72f7
Now handling case where span has same lo and hi.
davidtwco Jan 17, 2018
908aa38
Deprecate std::net::lookup_host
sfackler Jan 17, 2018
0c946c0
converted space to tab in css files
hellow554 Jan 18, 2018
f66e711
Add E0659 for ambiguous names
GuillaumeGomez Jan 16, 2018
005791b
add target/ to ignored tidy dirs
Manishearth Jan 18, 2018
9a4287d
Update CONTRIBUTING.md
walinga Jan 18, 2018
6e9cbac
Rollup merge of #46938 - hellow554:rustdoc-kbd-style, r=GuillaumeGomez
GuillaumeGomez Jan 19, 2018
df40c4a
Rollup merge of #47334 - etaoins:only-call-res-init-on-gnu-unix, r=al…
GuillaumeGomez Jan 19, 2018
ac75587
Rollup merge of #47420 - davidtwco:issue-46885, r=estebank
GuillaumeGomez Jan 19, 2018
c71ea45
Rollup merge of #47508 - QuietMisdreavus:rbe-bookshelf, r=steveklabnik
GuillaumeGomez Jan 19, 2018
c71bc78
Rollup merge of #47510 - sfackler:deprecate-dns, r=alexcrichton
GuillaumeGomez Jan 19, 2018
223b474
Rollup merge of #47512 - GuillaumeGomez:e0659, r=petrochenkov
GuillaumeGomez Jan 19, 2018
3171cdf
Rollup merge of #47535 - Manishearth:ignore-target, r=kennytm
GuillaumeGomez Jan 19, 2018
ce797d5
Rollup merge of #47559 - walinga:pr-link-fix, r=kennytm
GuillaumeGomez Jan 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ It's absolutely fine to have multiple build directories with different
[pull-requests]: #pull-requests

Pull requests are the primary mechanism we use to change Rust. GitHub itself
has some [great documentation][pull-requests] on using the Pull Request feature.
has some [great documentation][about-pull-requests] on using the Pull Request feature.
We use the "fork and pull" model [described here][development-models], where
contributors push changes to their personal fork and create pull requests to
bring those changes into the source repository.

[pull-requests]: https://help.github.com/articles/about-pull-requests/
[about-pull-requests]: https://help.github.com/articles/about-pull-requests/
[development-models]: https://help.github.com/articles/about-collaborative-development-models/

Please make pull requests against the `master` branch.
Expand Down
2 changes: 2 additions & 0 deletions src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Rust provides a number of book-length sets of documentation, collectively
nicknamed 'The Rust Bookshelf.'

* [The Rust Programming Language][book] teaches you how to program in Rust.
* [Rust By Example][rbe] teaches you how to program in Rust using editable examples.
* [The Cargo Book][cargo-book] is a guide to Cargo, Rust's build tool and dependency manager.
* [The Unstable Book][unstable-book] has documentation for unstable features.
* [The Rustonomicon][nomicon] is your guidebook to the dark arts of unsafe Rust.
Expand All @@ -51,6 +52,7 @@ before this policy was put into place. That work is being tracked
[refchecklist]: https://github.com/rust-lang-nursery/reference/issues/9
[err]: error-index.html
[book]: book/index.html
[rbe]: rust-by-example/index.html
[nomicon]: nomicon/index.html
[unstable-book]: unstable-book/index.html
[rustdoc-book]: rustdoc/index.html
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// `sp` only covers `T`, change it so that it covers
// `T:` when appropriate
let sp = if has_lifetimes {
sp.to(sp.next_point().next_point())
sp.to(self.tcx.sess.codemap().next_point(
self.tcx.sess.codemap().next_point(sp)))
} else {
sp
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_borrowck/borrowck/check_loans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
// 3. Where does old loan expire.

let previous_end_span =
Some(old_loan.kill_scope.span(self.tcx(), &self.bccx.region_scope_tree)
.end_point());
Some(self.tcx().sess.codemap().end_point(
old_loan.kill_scope.span(self.tcx(), &self.bccx.region_scope_tree)));

let mut err = match (new_loan.kind, old_loan.kind) {
(ty::MutBorrow, ty::MutBorrow) =>
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
fn region_end_span(&self, region: ty::Region<'tcx>) -> Option<Span> {
match *region {
ty::ReScope(scope) => {
Some(scope.span(self.tcx, &self.region_scope_tree).end_point())
Some(self.tcx.sess.codemap().end_point(
scope.span(self.tcx, &self.region_scope_tree)))
}
_ => None
}
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/borrow_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,10 +1090,11 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
debug!("check_for_invalidation_at_exit({:?}): INVALID", place);
// FIXME: should be talking about the region lifetime instead
// of just a span here.
let span = self.tcx.sess.codemap().end_point(span);
self.report_borrowed_value_does_not_live_long_enough(
context,
borrow,
span.end_point(),
span,
flow_state.borrows.operator(),
)
}
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_mir/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
if let DropKind::Value { .. } = drop_kind {
scope.needs_cleanup = true;
}

let region_scope_span = region_scope.span(self.hir.tcx(),
&self.hir.region_scope_tree);
// Attribute scope exit drops to scope's closing brace
let scope_end = region_scope_span.with_lo(region_scope_span.hi());
// Attribute scope exit drops to scope's closing brace.
let scope_end = self.hir.tcx().sess.codemap().end_point(region_scope_span);

scope.drops.push(DropData {
span: scope_end,
location: place.clone(),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/dataflow/impls/borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ impl<'a, 'gcx, 'tcx> ActiveBorrows<'a, 'gcx, 'tcx> {
Some(_) => None,
None => {
match self.0.region_span_map.get(region) {
Some(span) => Some(span.end_point()),
None => Some(self.0.mir.span.end_point())
Some(span) => Some(self.0.tcx.sess.codemap().end_point(*span)),
None => Some(self.0.tcx.sess.codemap().end_point(self.0.mir.span))
}
}
}
Expand Down
53 changes: 53 additions & 0 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,59 @@ println!("const value: {}", SomeModule::PRIVATE); // ok!
```
"##,

E0659: r##"
An item usage is ambiguous.

Erroneous code example:

```compile_fail,E0659
pub mod moon {
pub fn foo() {}
}

pub mod earth {
pub fn foo() {}
}

mod collider {
pub use moon::*;
pub use earth::*;
}

fn main() {
collider::foo(); // ERROR: `foo` is ambiguous
}
```

This error generally appears when two items with the same name are imported into
a module. Here, the `foo` functions are imported and reexported from the
`collider` module and therefore, when we're using `collider::foo()`, both
functions collide.

To solve this error, the best solution is generally to keep the path before the
item when using it. Example:

```
pub mod moon {
pub fn foo() {}
}

pub mod earth {
pub fn foo() {}
}

mod collider {
pub use moon;
pub use earth;
}

fn main() {
collider::moon::foo(); // ok!
collider::earth::foo(); // ok!
}
```
"##,

}

register_diagnostics! {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2791,8 +2791,8 @@ impl<'a> Resolver<'a> {
if let Some(sp) = self.current_type_ascription.last() {
let mut sp = *sp;
loop { // try to find the `:`, bail on first non-':'/non-whitespace
sp = sp.next_point();
if let Ok(snippet) = cm.span_to_snippet(sp.to(sp.next_point())) {
sp = cm.next_point(sp);
if let Ok(snippet) = cm.span_to_snippet(sp.to(cm.next_point(sp))) {
debug!("snippet {:?}", snippet);
let line_sp = cm.lookup_char_pos(sp.hi()).line;
let line_base_sp = cm.lookup_char_pos(base_span.lo()).line;
Expand Down Expand Up @@ -3783,7 +3783,7 @@ impl<'a> Resolver<'a> {
self.session.buffer_lint(lint::builtin::LEGACY_IMPORTS, id, span, &msg);
} else {
let mut err =
self.session.struct_span_err(span, &format!("`{}` is ambiguous", name));
struct_span_err!(self.session, span, E0659, "`{}` is ambiguous", name);
err.span_note(b1.span, &msg1);
match b2.def() {
Def::Macro(..) if b2.span == DUMMY_SP =>
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
err.span_label(def_s, "defined here");
}
if sugg_unit {
let sugg_span = expr_sp.end_point();
let sugg_span = sess.codemap().end_point(expr_sp);
// remove closing `)` from the span
let sugg_span = sugg_span.with_hi(sugg_span.lo());
err.span_suggestion(
Expand Down Expand Up @@ -4400,10 +4400,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
/// statement and the return type has been left as default or has been specified as `()`. If so,
/// it suggests adding a semicolon.
fn suggest_missing_semicolon(&self,
err: &mut DiagnosticBuilder<'tcx>,
expression: &'gcx hir::Expr,
expected: Ty<'tcx>,
cause_span: Span) {
err: &mut DiagnosticBuilder<'tcx>,
expression: &'gcx hir::Expr,
expected: Ty<'tcx>,
cause_span: Span) {
if expected.is_nil() {
// `BlockTailExpression` only relevant if the tail expr would be
// useful on its own.
Expand All @@ -4415,7 +4415,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
hir::ExprLoop(..) |
hir::ExprMatch(..) |
hir::ExprBlock(..) => {
let sp = cause_span.next_point();
let sp = self.tcx.sess.codemap().next_point(cause_span);
err.span_suggestion(sp,
"try adding a semicolon",
";".to_string());
Expand Down
18 changes: 10 additions & 8 deletions src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,22 @@ r##"<!DOCTYPE html>
<h2>Keyboard Shortcuts</h2>

<dl>
<dt>?</dt>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt></dt>
<dt><kbd>↑</kbd></dt>
<dd>Move up in search results</dd>
<dt></dt>
<dt><kbd>↓</kbd></dt>
<dd>Move down in search results</dd>
<dt></dt>
<dt><kbd>↹</kbd></dt>
<dd>Switch tab</dd>
<dt>&#9166;</dt>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt style="width:31px;">+ / -</dt>
<dd>Collapse/expand all sections</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>

Expand Down
18 changes: 12 additions & 6 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -585,18 +585,13 @@ body.blur > :not(#help) {
flex: 0 0 auto;
box-shadow: 0 0 6px rgba(0,0,0,.2);
width: 550px;
height: 354px;
height: auto;
border: 1px solid;
}
#help dt {
float: left;
border-radius: 4px;
border: 1px solid;
width: 23px;
text-align: center;
clear: left;
display: block;
margin-top: -1px;
}
#help dd { margin: 5px 35px; }
#help .infos { padding-left: 0; }
Expand Down Expand Up @@ -1134,3 +1129,14 @@ h3.important {
left: -42px;
margin-top: 2px;
}

kbd {
display: inline-block;
padding: 3px 5px;
font: 15px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
vertical-align: middle;
border: solid 1px;
border-radius: 3px;
box-shadow: inset 0 -1px 0;
}
13 changes: 8 additions & 5 deletions src/librustdoc/html/static/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@ a.test-arrow {
border-color: #bfbfbf;
}

#help dt {
border-color: #bfbfbf;
background: #fff;
}

.since {
color: grey;
}
Expand Down Expand Up @@ -348,3 +343,11 @@ pre.ignore:hover, .information:hover + pre.ignore {
border-bottom-color: #e0e0e0;
}
}

kbd {
color: #444d56;
background-color: #fafbfc;
border-color: #d1d5da;
border-bottom-color: #c6cbd1;
box-shadow-color: #c6cbd1;
}
5 changes: 4 additions & 1 deletion src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ use fmt;
use hash;
use io;
use mem;
use net::{lookup_host, ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr};
use net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr};
#[allow(deprecated)]
use net::lookup_host;
use option;
use sys::net::netc as c;
use sys_common::{FromInner, AsInner, IntoInner};
Expand Down Expand Up @@ -845,6 +847,7 @@ impl ToSocketAddrs for (Ipv6Addr, u16) {
}
}

#[allow(deprecated)]
fn resolve_socket_addr(s: &str, p: u16) -> io::Result<vec::IntoIter<SocketAddr>> {
let ips = lookup_host(s)?;
let v: Vec<_> = ips.map(|mut a| { a.set_port(p); a }).collect();
Expand Down
7 changes: 7 additions & 0 deletions src/libstd/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,15 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
iterator and returning socket \
addresses",
issue = "27705")]
#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")]
pub struct LookupHost(net_imp::LookupHost);

#[unstable(feature = "lookup_host", reason = "unsure about the returned \
iterator and returning socket \
addresses",
issue = "27705")]
#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")]
#[allow(deprecated)]
impl Iterator for LookupHost {
type Item = SocketAddr;
fn next(&mut self) -> Option<SocketAddr> { self.0.next() }
Expand All @@ -149,6 +152,8 @@ impl Iterator for LookupHost {
iterator and returning socket \
addresses",
issue = "27705")]
#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")]
#[allow(deprecated)]
impl fmt::Debug for LookupHost {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("LookupHost { .. }")
Expand Down Expand Up @@ -181,6 +186,8 @@ impl fmt::Debug for LookupHost {
iterator and returning socket \
addresses",
issue = "27705")]
#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")]
#[allow(deprecated)]
pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
net_imp::lookup_host(host).map(LookupHost)
}
4 changes: 0 additions & 4 deletions src/libstd/sys/unix/l4re.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,5 @@ pub mod net {
pub fn lookup_host(_: &str) -> io::Result<LookupHost> {
unimpl!();
}

pub fn res_init_if_glibc_before_2_26() -> io::Result<()> {
unimpl!();
}
}

Loading