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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 6 additions & 5 deletions
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 23 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 11 additions & 1 deletion
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

Lines changed: 9 additions & 4 deletions
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

0 commit comments

Comments
 (0)