Skip to content

Rollup of 12 pull requests #82600

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

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
222fb63
Lint for unused borrows as part of `unused_must_use`
ecstatic-morse Sep 21, 2020
4f8b259
Add test for `unused_borrows` lint
ecstatic-morse Sep 18, 2020
2468c61
Silence unused borrows warning in unit tests
ecstatic-morse Sep 18, 2020
0fdde0c
Silence unused borrows warning in UI tests
ecstatic-morse Sep 21, 2020
3b5105c
Fix derived `HashStable` impls
ecstatic-morse Sep 21, 2020
651d289
Add note about encoding when null bytes found
syvb Feb 7, 2021
a9bb3fb
Add tests for new UTF-16 behavior
syvb Feb 7, 2021
c6cb014
Clarify error message wording
syvb Feb 7, 2021
ed8c686
Bless tests with new error wording
syvb Feb 7, 2021
bff4e93
Add missing "see its documentation for more" stdio
pickfire Feb 22, 2021
c0c4436
Remove a redundant macro
osa1 Feb 22, 2021
55626ed
Use log level to control partitioning debug output
tmiasko Feb 24, 2021
e130e9c
Update measureme dependency to the latest version
wesleywiser Feb 25, 2021
c7091f5
Link crtbegin/crtend on musl to terminate .eh_frame
nikic Feb 26, 2021
4dcbc00
fix typo in RELEASES.md
tspiteri Feb 26, 2021
dd502cb
doc: cube root, not cubic root
tspiteri Feb 26, 2021
5661fe3
Fix intra-doc handling of `Self` in enum
lucas-deangelis Feb 26, 2021
d95b7b3
Fix formatting
lucas-deangelis Feb 26, 2021
02cc850
Update src/librustdoc/passes/collect_intra_doc_links.rs
lucas-deangelis Feb 26, 2021
5835f6d
Move test file, add test of generated link
lucas-deangelis Feb 27, 2021
e026e18
Add ARIA role to sidebar toggle in Rustdoc
tazjin Feb 27, 2021
d94b4e8
clarify RW lock's priority gotcha
matklad Feb 27, 2021
261c952
Update library/std/src/sync/rwlock.rs
matklad Feb 27, 2021
a0d6213
Rollup merge of #76894 - ecstatic-morse:lint-unused-borrows, r=lcnr
Dylan-DPC Feb 27, 2021
8248067
Rollup merge of #81856 - Smittyvb:utf16-warn, r=matthewjasper
Dylan-DPC Feb 27, 2021
f732804
Rollup merge of #82395 - pickfire:see-more, r=GuillaumeGomez
Dylan-DPC Feb 27, 2021
b85fca3
Rollup merge of #82401 - osa1:remove_redundant_macro, r=matthewjasper
Dylan-DPC Feb 27, 2021
00c2181
Rollup merge of #82498 - tmiasko:partitioning-debug, r=matthewjasper
Dylan-DPC Feb 27, 2021
c0ab70b
Rollup merge of #82534 - nikic:musl-crtend, r=nagisa
Dylan-DPC Feb 27, 2021
756f8a0
Rollup merge of #82537 - wesleywiser:update_measureme, r=oli-obk
Dylan-DPC Feb 27, 2021
2f305fd
Rollup merge of #82560 - tspiteri:releases-typo, r=ehuss
Dylan-DPC Feb 27, 2021
71c381e
Rollup merge of #82561 - tspiteri:cube-root, r=Dylan-DPC
Dylan-DPC Feb 27, 2021
d14b18e
Rollup merge of #82563 - lucas-deangelis:issue-82209-fix, r=jyn514
Dylan-DPC Feb 27, 2021
97fd561
Rollup merge of #82584 - tazjin:rustdoc-aria, r=GuillaumeGomez
Dylan-DPC Feb 27, 2021
985669a
Rollup merge of #82596 - matklad:rwlock, r=sfackler
Dylan-DPC Feb 27, 2021
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
16 changes: 14 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2149,11 +2149,14 @@ dependencies = [

[[package]]
name = "measureme"
version = "9.0.0"
version = "9.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22bf8d885d073610aee20e7fa205c4341ed32a761dbde96da5fd96301a8d3e82"
checksum = "4a98e07fe802486895addb2b5467f33f205e82c426bfaf350f5d8109b137767c"
dependencies = [
"log",
"memmap",
"parking_lot",
"perf-event-open-sys",
"rustc-hash",
"smallvec 1.6.1",
]
Expand Down Expand Up @@ -2550,6 +2553,15 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"

[[package]]
name = "perf-event-open-sys"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce9bedf5da2c234fdf2391ede2b90fabf585355f33100689bc364a3ea558561a"
dependencies = [
"libc",
]

[[package]]
name = "pest"
version = "2.1.3"
Expand Down
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The following previously stable methods are now `const`.
- `saturating_pow` for all integer types.
- `wrapping_pow` for all integer types.
- `next_power_of_two` for all unsigned integer types.
- `checked_power_of_two` for all unsigned integer types.
- `checked_next_power_of_two` for all unsigned integer types.

Cargo
-----------------------
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ doctest = false
bitflags = "1.0"
cstr = "0.2"
libc = "0.2"
measureme = "9.0.0"
measureme = "9.1.0"
snap = "1"
tracing = "0.1"
rustc_middle = { path = "../rustc_middle" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rustc-hash = "1.1.0"
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
rustc_index = { path = "../rustc_index", package = "rustc_index" }
bitflags = "1.2.1"
measureme = "9.0.0"
measureme = "9.1.0"
libc = "0.2"
stacker = "0.1.12"
tempfile = "3.0.5"
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
| hir::BinOpKind::Shl
| hir::BinOpKind::Shr => Some("bitwise operation"),
},

hir::ExprKind::AddrOf(..) => Some("borrow"),

hir::ExprKind::Unary(..) => Some("unary operation"),
_ => None,
};
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_macros/src/hash_stable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn hash_stable_generic_derive(mut s: synstructure::Structure<'_>) -> proc_ma
quote! {}
} else if let Some(project) = attrs.project {
quote! {
&#bi.#project.hash_stable(__hcx, __hasher);
(&#bi.#project).hash_stable(__hcx, __hasher);
}
} else {
quote! {
Expand Down Expand Up @@ -95,7 +95,7 @@ pub fn hash_stable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::To
quote! {}
} else if let Some(project) = attrs.project {
quote! {
&#bi.#project.hash_stable(__hcx, __hasher);
(&#bi.#project).hash_stable(__hcx, __hasher);
}
} else {
quote! {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
chalk-ir = "0.55.0"
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
measureme = "9.0.0"
measureme = "9.1.0"
rustc_session = { path = "../rustc_session" }
rustc_type_ir = { path = "../rustc_type_ir" }
21 changes: 15 additions & 6 deletions compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,22 @@ where
I: Iterator<Item = &'a CodegenUnit<'tcx>>,
'tcx: 'a,
{
if cfg!(debug_assertions) {
debug!("{}", label);
let dump = move || {
use std::fmt::Write;

let s = &mut String::new();
let _ = writeln!(s, "{}", label);
for cgu in cgus {
debug!("CodegenUnit {} estimated size {} :", cgu.name(), cgu.size_estimate());
let _ =
writeln!(s, "CodegenUnit {} estimated size {} :", cgu.name(), cgu.size_estimate());

for (mono_item, linkage) in cgu.items() {
let symbol_name = mono_item.symbol_name(tcx).name;
let symbol_hash_start = symbol_name.rfind('h');
let symbol_hash = symbol_hash_start.map_or("<no hash>", |i| &symbol_name[i..]);

debug!(
let _ = writeln!(
s,
" - {} [{:?}] [{}] estimated size {}",
mono_item,
linkage,
Expand All @@ -258,9 +263,13 @@ where
);
}

debug!("");
let _ = writeln!(s, "");
}
}

std::mem::take(s)
};

debug!("{}", dump());
}

#[inline(never)] // give this a place in the profiler
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ impl<'a> StringReader<'a> {
// tokens like `<<` from `rustc_lexer`, and then add fancier error recovery to it,
// as there will be less overall work to do this way.
let token = unicode_chars::check_for_substitution(self, start, c, &mut err);
if c == '\x00' {
err.help("source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used");
}
err.emit();
token?
}
Expand Down
21 changes: 14 additions & 7 deletions compiler/rustc_target/src/spec/crt_objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,24 @@ pub(super) fn all(obj: &str) -> CrtObjects {

pub(super) fn pre_musl_fallback() -> CrtObjects {
new(&[
(LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o"]),
(LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o"]),
(LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o"]),
(LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o"]),
(LinkOutputKind::DynamicDylib, &["crti.o"]),
(LinkOutputKind::StaticDylib, &["crti.o"]),
(LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
(LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o", "crtbeginS.o"]),
(LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
(LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o", "crtbeginS.o"]),
(LinkOutputKind::DynamicDylib, &["crti.o", "crtbeginS.o"]),
(LinkOutputKind::StaticDylib, &["crti.o", "crtbeginS.o"]),
])
}

pub(super) fn post_musl_fallback() -> CrtObjects {
all("crtn.o")
new(&[
(LinkOutputKind::DynamicNoPicExe, &["crtend.o", "crtn.o"]),
(LinkOutputKind::DynamicPicExe, &["crtendS.o", "crtn.o"]),
(LinkOutputKind::StaticNoPicExe, &["crtend.o", "crtn.o"]),
(LinkOutputKind::StaticPicExe, &["crtendS.o", "crtn.o"]),
(LinkOutputKind::DynamicDylib, &["crtendS.o", "crtn.o"]),
(LinkOutputKind::StaticDylib, &["crtendS.o", "crtn.o"]),
])
}

pub(super) fn pre_mingw_fallback() -> CrtObjects {
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_typeck/src/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,21 +517,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}

if self.is_fn_ty(&rcvr_ty, span) {
macro_rules! report_function {
($span:expr, $name:expr) => {
err.note(&format!(
"`{}` is a function, perhaps you wish to call it",
$name
));
};
fn report_function<T: std::fmt::Display>(
err: &mut DiagnosticBuilder<'_>,
name: T,
) {
err.note(
&format!("`{}` is a function, perhaps you wish to call it", name,),
);
}

if let SelfSource::MethodCall(expr) = source {
if let Ok(expr_string) = tcx.sess.source_map().span_to_snippet(expr.span) {
report_function!(expr.span, expr_string);
report_function(&mut err, expr_string);
} else if let ExprKind::Path(QPath::Resolved(_, ref path)) = expr.kind {
if let Some(segment) = path.segments.last() {
report_function!(expr.span, segment.ident);
report_function(&mut err, segment.ident);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions library/alloc/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ mod slice_index {
#[test]
#[should_panic]
fn test_slice_fail() {
&"中华Việt Nam"[0..2];
let _ = &"中华Việt Nam"[0..2];
}

panic_cases! {
Expand Down Expand Up @@ -684,13 +684,13 @@ mod slice_index {
#[test]
#[should_panic(expected = "byte index 1024 is out of bounds of `Lorem ipsum dolor sit amet")]
fn test_slice_fail_truncated_1() {
&LOREM_PARAGRAPH[..1024];
let _ = &LOREM_PARAGRAPH[..1024];
}
// check the truncation in the panic message
#[test]
#[should_panic(expected = "luctus, im`[...]")]
fn test_slice_fail_truncated_2() {
&LOREM_PARAGRAPH[..1024];
let _ = &LOREM_PARAGRAPH[..1024];
}
}

Expand All @@ -705,7 +705,7 @@ fn test_str_slice_rangetoinclusive_ok() {
#[should_panic]
fn test_str_slice_rangetoinclusive_notok() {
let s = "abcαβγ";
&s[..=3];
let _ = &s[..=3];
}

#[test]
Expand All @@ -721,7 +721,7 @@ fn test_str_slicemut_rangetoinclusive_ok() {
fn test_str_slicemut_rangetoinclusive_notok() {
let mut s = "abcαβγ".to_owned();
let s: &mut str = &mut s;
&mut s[..=3];
let _ = &mut s[..=3];
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions library/alloc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,35 +541,35 @@ fn test_index_out_of_bounds() {
#[should_panic]
fn test_slice_out_of_bounds_1() {
let x = vec![1, 2, 3, 4, 5];
&x[!0..];
let _ = &x[!0..];
}

#[test]
#[should_panic]
fn test_slice_out_of_bounds_2() {
let x = vec![1, 2, 3, 4, 5];
&x[..6];
let _ = &x[..6];
}

#[test]
#[should_panic]
fn test_slice_out_of_bounds_3() {
let x = vec![1, 2, 3, 4, 5];
&x[!0..4];
let _ = &x[!0..4];
}

#[test]
#[should_panic]
fn test_slice_out_of_bounds_4() {
let x = vec![1, 2, 3, 4, 5];
&x[1..6];
let _ = &x[1..6];
}

#[test]
#[should_panic]
fn test_slice_out_of_bounds_5() {
let x = vec![1, 2, 3, 4, 5];
&x[3..2];
let _ = &x[3..2];
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ impl f32 {
unsafe { cmath::fdimf(self, other) }
}

/// Returns the cubic root of a number.
/// Returns the cube root of a number.
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl f64 {
unsafe { cmath::fdim(self, other) }
}

/// Returns the cubic root of a number.
/// Returns the cube root of a number.
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/io/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ pub struct Stdout {
/// A locked reference to the [`Stdout`] handle.
///
/// This handle implements the [`Write`] trait, and is constructed via
/// the [`Stdout::lock`] method.
/// the [`Stdout::lock`] method. See its documentation for more.
///
/// ### Note: Windows Portability Consideration
/// When operating in a console, the Windows implementation of this stream does not support
Expand Down Expand Up @@ -711,7 +711,7 @@ pub struct Stderr {
/// A locked reference to the [`Stderr`] handle.
///
/// This handle implements the [`Write`] trait and is constructed via
/// the [`Stderr::lock`] method.
/// the [`Stderr::lock`] method. See its documentation for more.
///
/// ### Note: Windows Portability Consideration
/// When operating in a console, the Windows implementation of this stream does not support
Expand Down
4 changes: 3 additions & 1 deletion library/std/src/sync/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use crate::sys_common::rwlock as sys;
///
/// The priority policy of the lock is dependent on the underlying operating
/// system's implementation, and this type does not guarantee that any
/// particular policy will be used.
/// particular policy will be used. In particular, a writer which is waiting to
/// acquire the lock in `write` might or might not block concurrent calls to
/// `read`.
///
/// The type parameter `T` represents the data that this lock protects. It is
/// required that `T` satisfies [`Send`] to be shared across threads and
Expand Down
8 changes: 4 additions & 4 deletions library/std/src/sys_common/wtf8/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ fn wtf8_slice() {
#[test]
#[should_panic]
fn wtf8_slice_not_code_point_boundary() {
&Wtf8::from_str("aé 💩")[2..4];
let _ = &Wtf8::from_str("aé 💩")[2..4];
}

#[test]
Expand All @@ -312,18 +312,18 @@ fn wtf8_slice_from() {
#[test]
#[should_panic]
fn wtf8_slice_from_not_code_point_boundary() {
&Wtf8::from_str("aé 💩")[2..];
let _ = &Wtf8::from_str("aé 💩")[2..];
}

#[test]
fn wtf8_slice_to() {
assert_eq!(&Wtf8::from_str("aé 💩")[..4].bytes, b"a\xC3\xA9 ");
let _ = assert_eq!(&Wtf8::from_str("aé 💩")[..4].bytes, b"a\xC3\xA9 ");
}

#[test]
#[should_panic]
fn wtf8_slice_to_not_code_point_boundary() {
&Wtf8::from_str("aé 💩")[5..];
let _ = &Wtf8::from_str("aé 💩")[5..];
}

#[test]
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ fn copy_self_contained_objects(
DependencyType::TargetSelfContained,
);
}
for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] {
let src = compiler_file(builder, builder.cc(target), target, obj);
let target = libdir_self_contained.join(obj);
builder.copy(&src, &target);
target_deps.push((target, DependencyType::TargetSelfContained));
}
} else if target.ends_with("-wasi") {
let srcdir = builder.wasi_root(target).unwrap().join("lib/wasm32-wasi");
for &obj in &["crt1.o", "crt1-reactor.o"] {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ crate fn render<T: Print, S: Print>(
<![endif]-->\
{before_content}\
<nav class=\"sidebar\">\
<div class=\"sidebar-menu\">&#9776;</div>\
<div class=\"sidebar-menu\" role=\"button\">&#9776;</div>\
{logo}\
{sidebar}\
</nav>\
Expand Down
Loading