Skip to content

Commit 7402866

Browse files
committed
Auto merge of #45674 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests - Successful merges: #45450, #45579, #45602, #45619, #45624, #45644, #45646, #45648, #45649, #45650, #45652, #45660, #45664, #45671 - Failed merges:
2 parents 31bbe57 + 0284550 commit 7402866

File tree

21 files changed

+221
-61
lines changed

21 files changed

+221
-61
lines changed

src/bootstrap/bootstrap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def default_build_triple():
294294
raise ValueError('unknown byteorder: {}'.format(sys.byteorder))
295295
# only the n64 ABI is supported, indicate it
296296
ostype += 'abi64'
297-
elif cputype == 'sparcv9':
297+
elif cputype == 'sparcv9' or cputype == 'sparc64':
298298
pass
299299
else:
300300
err = "unknown cpu type: {}".format(cputype)

src/bootstrap/native.rs

+1
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ impl Step for Openssl {
451451
"x86_64-apple-darwin" => "darwin64-x86_64-cc",
452452
"x86_64-linux-android" => "linux-x86_64",
453453
"x86_64-unknown-freebsd" => "BSD-x86_64",
454+
"x86_64-unknown-dragonfly" => "BSD-x86_64",
454455
"x86_64-unknown-linux-gnu" => "linux-x86_64",
455456
"x86_64-unknown-linux-musl" => "linux-x86_64",
456457
"x86_64-unknown-netbsd" => "BSD-x86_64",

src/librustc/hir/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,9 @@ pub enum Expr_ {
10541054
/// A function call
10551055
///
10561056
/// The first field resolves to the function itself (usually an `ExprPath`),
1057-
/// and the second field is the list of arguments
1057+
/// and the second field is the list of arguments.
1058+
/// This also represents calling the constructor of
1059+
/// tuple-like ADTs such as tuple structs and enum variants.
10581060
ExprCall(P<Expr>, HirVec<Expr>),
10591061
/// A method call (`x.foo::<'static, Bar, Baz>(a, b, c, d)`)
10601062
///

src/librustc/ich/hcx.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -371,17 +371,18 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for Span {
371371
// If this is not an empty or invalid span, we want to hash the last
372372
// position that belongs to it, as opposed to hashing the first
373373
// position past it.
374-
let span_hi = if self.hi() > self.lo() {
374+
let span = self.data();
375+
let span_hi = if span.hi > span.lo {
375376
// We might end up in the middle of a multibyte character here,
376377
// but that's OK, since we are not trying to decode anything at
377378
// this position.
378-
self.hi() - ::syntax_pos::BytePos(1)
379+
span.hi - ::syntax_pos::BytePos(1)
379380
} else {
380-
self.hi()
381+
span.hi
381382
};
382383

383384
{
384-
let loc1 = hcx.codemap().byte_pos_to_line_and_col(self.lo());
385+
let loc1 = hcx.codemap().byte_pos_to_line_and_col(span.lo);
385386
let loc1 = loc1.as_ref()
386387
.map(|&(ref fm, line, col)| (&fm.name[..], line, col.to_usize()))
387388
.unwrap_or(("???", 0, 0));
@@ -414,7 +415,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for Span {
414415
}
415416
}
416417

417-
if self.ctxt() == SyntaxContext::empty() {
418+
if span.ctxt == SyntaxContext::empty() {
418419
0u8.hash_stable(hcx, hasher);
419420
} else {
420421
1u8.hash_stable(hcx, hasher);

src/librustc/middle/dead.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> {
5151
tables: &'a ty::TypeckTables<'tcx>,
5252
live_symbols: Box<FxHashSet<ast::NodeId>>,
5353
struct_has_extern_repr: bool,
54-
ignore_non_const_paths: bool,
54+
in_pat: bool,
5555
inherited_pub_visibility: bool,
5656
ignore_variant_stack: Vec<DefId>,
5757
}
@@ -75,10 +75,10 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
7575

7676
fn handle_definition(&mut self, def: Def) {
7777
match def {
78-
Def::Const(_) | Def::AssociatedConst(..) => {
78+
Def::Const(_) | Def::AssociatedConst(..) | Def::TyAlias(_) => {
7979
self.check_def_id(def.def_id());
8080
}
81-
_ if self.ignore_non_const_paths => (),
81+
_ if self.in_pat => (),
8282
Def::PrimTy(..) | Def::SelfTy(..) |
8383
Def::Local(..) | Def::Upvar(..) => {}
8484
Def::Variant(variant_id) | Def::VariantCtor(variant_id, ..) => {
@@ -289,9 +289,9 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
289289
_ => ()
290290
}
291291

292-
self.ignore_non_const_paths = true;
292+
self.in_pat = true;
293293
intravisit::walk_pat(self, pat);
294-
self.ignore_non_const_paths = false;
294+
self.in_pat = false;
295295
}
296296

297297
fn visit_path(&mut self, path: &'tcx hir::Path, _: ast::NodeId) {
@@ -429,7 +429,7 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
429429
tables: &ty::TypeckTables::empty(None),
430430
live_symbols: box FxHashSet(),
431431
struct_has_extern_repr: false,
432-
ignore_non_const_paths: false,
432+
in_pat: false,
433433
inherited_pub_visibility: false,
434434
ignore_variant_stack: vec![],
435435
};

src/librustc_resolve/lib.rs

+23-3
Original file line numberDiff line numberDiff line change
@@ -3606,12 +3606,12 @@ impl<'a> Resolver<'a> {
36063606
}
36073607
}
36083608

3609-
fn report_conflict(&mut self,
3609+
fn report_conflict<'b>(&mut self,
36103610
parent: Module,
36113611
ident: Ident,
36123612
ns: Namespace,
3613-
new_binding: &NameBinding,
3614-
old_binding: &NameBinding) {
3613+
new_binding: &NameBinding<'b>,
3614+
old_binding: &NameBinding<'b>) {
36153615
// Error on the second of two conflicting names
36163616
if old_binding.span.lo() > new_binding.span.lo() {
36173617
return self.report_conflict(parent, ident, ns, old_binding, new_binding);
@@ -3683,6 +3683,26 @@ impl<'a> Resolver<'a> {
36833683
old_noun, old_kind, name));
36843684
}
36853685

3686+
// See https://github.com/rust-lang/rust/issues/32354
3687+
if old_binding.is_import() || new_binding.is_import() {
3688+
let binding = if new_binding.is_import() {
3689+
new_binding
3690+
} else {
3691+
old_binding
3692+
};
3693+
3694+
let cm = self.session.codemap();
3695+
let rename_msg = "You can use `as` to change the binding name of the import";
3696+
3697+
if let Ok(snippet) = cm.span_to_snippet(binding.span) {
3698+
err.span_suggestion(binding.span,
3699+
rename_msg,
3700+
format!("{} as Other{}", snippet, name));
3701+
} else {
3702+
err.span_label(binding.span, rename_msg);
3703+
}
3704+
}
3705+
36863706
err.emit();
36873707
self.name_already_seen.insert(name, span);
36883708
}

src/librustc_trans/back/linker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ impl<'a> Linker for EmLinker<'a> {
747747
fn exported_symbols(tcx: TyCtxt, crate_type: CrateType) -> Vec<String> {
748748
let mut symbols = Vec::new();
749749

750-
let export_threshold = symbol_export::threshold(tcx);
750+
let export_threshold = symbol_export::crates_export_threshold(&[crate_type]);
751751
for &(ref name, _, level) in tcx.exported_symbols(LOCAL_CRATE).iter() {
752752
if level.is_below_threshold(export_threshold) {
753753
symbols.push(name.clone());

src/librustdoc/html/static/rustdoc.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,8 @@ a {
545545
.content .search-results td:first-child { padding-right: 0; }
546546
.content .search-results td:first-child a { padding-right: 10px; }
547547

548-
tr.result span.primitive::after { content: ' (primitive type)'; font-style: italic; color: black;
548+
tr.result span.primitive::after {
549+
content: ' (primitive type)'; font-style: italic; color: black;
549550
}
550551

551552
body.blur > :not(#help) {
@@ -761,6 +762,15 @@ span.since {
761762
margin-top: 5px;
762763
}
763764

765+
.docblock > .section-header:first-child {
766+
margin-left: 15px;
767+
margin-top: 0;
768+
}
769+
770+
.docblock > .section-header:first-child:hover > a:before {
771+
left: -10px;
772+
}
773+
764774
.enum > .collapsed, .struct > .collapsed {
765775
margin-bottom: 25px;
766776
}

src/libstd/io/mod.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,10 @@ pub trait Read {
736736

737737
/// Transforms this `Read` instance to an [`Iterator`] over its bytes.
738738
///
739-
/// The returned type implements [`Iterator`] where the `Item` is [`Result`]`<`[`u8`]`,
740-
/// R::Err>`. The yielded item is [`Ok`] if a byte was successfully read and
741-
/// [`Err`] otherwise for I/O errors. EOF is mapped to returning [`None`] from
742-
/// this iterator.
739+
/// The returned type implements [`Iterator`] where the `Item` is
740+
/// [`Result`]`<`[`u8`]`, `[`io::Error`]>`.
741+
/// The yielded item is [`Ok`] if a byte was successfully read and [`Err`]
742+
/// otherwise. EOF is mapped to returning [`None`] from this iterator.
743743
///
744744
/// # Examples
745745
///
@@ -748,6 +748,7 @@ pub trait Read {
748748
/// [file]: ../fs/struct.File.html
749749
/// [`Iterator`]: ../../std/iter/trait.Iterator.html
750750
/// [`Result`]: ../../std/result/enum.Result.html
751+
/// [`io::Error``]: ../../std/io/struct.Error.html
751752
/// [`u8`]: ../../std/primitive.u8.html
752753
/// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
753754
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
@@ -1410,6 +1411,8 @@ pub trait BufRead: Read {
14101411
///
14111412
/// If successful, this function will return the total number of bytes read.
14121413
///
1414+
/// An empty buffer returned indicates that the stream has reached EOF.
1415+
///
14131416
/// # Errors
14141417
///
14151418
/// This function will ignore all instances of [`ErrorKind::Interrupted`] and
@@ -1470,6 +1473,8 @@ pub trait BufRead: Read {
14701473
///
14711474
/// If successful, this function will return the total number of bytes read.
14721475
///
1476+
/// An empty buffer returned indicates that the stream has reached EOF.
1477+
///
14731478
/// # Errors
14741479
///
14751480
/// This function has the same error semantics as [`read_until`] and will

src/libstd/sys/unix/ext/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@
1010

1111
//! Experimental extensions to `std` for Unix platforms.
1212
//!
13-
//! For now, this module is limited to extracting file descriptors,
14-
//! but its functionality will grow over time.
13+
//! Provides access to platform-level information on Unix platforms, and
14+
//! exposes Unix-specific functions that would otherwise be inappropriate as
15+
//! part of the core `std` library.
16+
//!
17+
//! It exposes more ways to deal with platform-specific strings (`OsStr`,
18+
//! `OsString`), allows to set permissions more granularly, extract low-level
19+
//! file descriptors from files and sockets, and has platform-specific helpers
20+
//! for spawning processes.
1521
//!
1622
//! # Examples
1723
//!

src/libstd/sys/unix/rand.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ mod imp {
4949
target_arch = "powerpc64",
5050
target_arch = "s390x")))]
5151
fn getrandom(buf: &mut [u8]) -> libc::c_long {
52-
#[cfg(target_arch = "x86_64")]
52+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
53+
const NR_GETRANDOM: libc::c_long = 0x40000000 + 318;
54+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
5355
const NR_GETRANDOM: libc::c_long = 318;
5456
#[cfg(target_arch = "x86")]
5557
const NR_GETRANDOM: libc::c_long = 355;

src/libsyntax/ast.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,9 @@ pub enum ExprKind {
901901
/// A function call
902902
///
903903
/// The first field resolves to the function itself,
904-
/// and the second field is the list of arguments
904+
/// and the second field is the list of arguments.
905+
/// This also represents calling the constructor of
906+
/// tuple-like ADTs such as tuple structs and enum variants.
905907
Call(P<Expr>, Vec<P<Expr>>),
906908
/// A method call (`x.foo::<'static, Bar, Baz>(a, b, c, d)`)
907909
///

src/libsyntax/parse/attr.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ impl<'a> Parser<'a> {
105105
let span = self.span;
106106
self.diagnostic()
107107
.struct_span_err(span, reason)
108-
.note("inner attributes and doc comments, like `#![no_std]` or \
109-
`//! My crate`, annotate the item enclosing them, and are \
110-
usually found at the beginning of source files. Outer \
111-
attributes and doc comments, like `#[test]` and
112-
`/// My function`, annotate the item following them.")
108+
.note("inner attributes, like `#![no_std]`, annotate the item \
109+
enclosing them, and are usually found at the beginning of \
110+
source files. Outer attributes, like `#[test]`, annotate the \
111+
item following them.")
113112
.emit()
114113
}
115114
ast::AttrStyle::Inner

0 commit comments

Comments
 (0)