Skip to content

Commit 704934d

Browse files
committed
Auto merge of #86006 - JohnTitor:rollup-97iuoi3, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #83653 (Remove unused code from `rustc_data_structures::sync`) - #84466 (rustdoc: Remove `PrimitiveType::{to_url_str, as_str}`) - #84880 (Make match in `register_res` easier to read) - #84942 (rustdoc: link to stable/beta docs consistently in documentation) - #85853 (Warn against boxed DST in `improper_ctypes_definitions` lint) - #85939 (Fix suggestion for removing &mut from &mut macro!().) - #85966 (wasm: Make simd types passed via indirection again) - #85979 (don't suggest unsized indirection in where-clauses) - #85983 (Update to semver 1.0.3) - #85988 (Note that `ninja = false` goes under `[llvm]`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents c79419a + 062e789 commit 704934d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+360
-283
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ dependencies = [
294294
"rand 0.8.3",
295295
"rustc-workspace-hack",
296296
"rustfix",
297-
"semver 1.0.1",
297+
"semver 1.0.3",
298298
"serde",
299299
"serde_ignored",
300300
"serde_json",
@@ -4692,9 +4692,9 @@ dependencies = [
46924692

46934693
[[package]]
46944694
name = "semver"
4695-
version = "1.0.1"
4695+
version = "1.0.3"
46964696
source = "registry+https://github.com/rust-lang/crates.io-index"
4697-
checksum = "d023dabf011d5dcb5ac64e3685d97d3b0ef412911077a2851455c6098524a723"
4697+
checksum = "5f3aac57ee7f3272d8395c6e4f502f434f0e289fcd62876f70daa008c20dcabe"
46984698
dependencies = [
46994699
"serde",
47004700
]

compiler/rustc_data_structures/src/sync.rs

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -43,49 +43,9 @@ cfg_if! {
4343
use std::ops::Add;
4444
use std::panic::{resume_unwind, catch_unwind, AssertUnwindSafe};
4545

46-
/// This is a single threaded variant of AtomicCell provided by crossbeam.
47-
/// Unlike `Atomic` this is intended for all `Copy` types,
48-
/// but it lacks the explicit ordering arguments.
49-
#[derive(Debug)]
50-
pub struct AtomicCell<T: Copy>(Cell<T>);
51-
52-
impl<T: Copy> AtomicCell<T> {
53-
#[inline]
54-
pub fn new(v: T) -> Self {
55-
AtomicCell(Cell::new(v))
56-
}
57-
58-
#[inline]
59-
pub fn get_mut(&mut self) -> &mut T {
60-
self.0.get_mut()
61-
}
62-
}
63-
64-
impl<T: Copy> AtomicCell<T> {
65-
#[inline]
66-
pub fn into_inner(self) -> T {
67-
self.0.into_inner()
68-
}
69-
70-
#[inline]
71-
pub fn load(&self) -> T {
72-
self.0.get()
73-
}
74-
75-
#[inline]
76-
pub fn store(&self, val: T) {
77-
self.0.set(val)
78-
}
79-
80-
#[inline]
81-
pub fn swap(&self, val: T) -> T {
82-
self.0.replace(val)
83-
}
84-
}
85-
8646
/// This is a single threaded variant of `AtomicU64`, `AtomicUsize`, etc.
87-
/// It differs from `AtomicCell` in that it has explicit ordering arguments
88-
/// and is only intended for use with the native atomic types.
47+
/// It has explicit ordering arguments and is only intended for use with
48+
/// the native atomic types.
8949
/// You should use this type through the `AtomicU64`, `AtomicUsize`, etc, type aliases
9050
/// as it's not intended to be used separately.
9151
#[derive(Debug)]
@@ -159,22 +119,6 @@ cfg_if! {
159119
(oper_a(), oper_b())
160120
}
161121

162-
pub struct SerialScope;
163-
164-
impl SerialScope {
165-
pub fn spawn<F>(&self, f: F)
166-
where F: FnOnce(&SerialScope)
167-
{
168-
f(self)
169-
}
170-
}
171-
172-
pub fn scope<F, R>(f: F) -> R
173-
where F: FnOnce(&SerialScope) -> R
174-
{
175-
f(&SerialScope)
176-
}
177-
178122
#[macro_export]
179123
macro_rules! parallel {
180124
($($blocks:tt),*) => {
@@ -318,8 +262,6 @@ cfg_if! {
318262

319263
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
320264

321-
pub use crossbeam_utils::atomic::AtomicCell;
322-
323265
pub use std::sync::Arc as Lrc;
324266
pub use std::sync::Weak as Weak;
325267

compiler/rustc_lint/src/types.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -909,11 +909,18 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
909909
}
910910

911911
match *ty.kind() {
912-
ty::Adt(def, _) if def.is_box() && matches!(self.mode, CItemKind::Definition) => {
913-
FfiSafe
914-
}
915-
916912
ty::Adt(def, substs) => {
913+
if def.is_box() && matches!(self.mode, CItemKind::Definition) {
914+
if ty.boxed_ty().is_sized(tcx.at(DUMMY_SP), self.cx.param_env) {
915+
return FfiSafe;
916+
} else {
917+
return FfiUnsafe {
918+
ty,
919+
reason: format!("box cannot be represented as a single pointer"),
920+
help: None,
921+
};
922+
}
923+
}
917924
if def.is_phantom_data() {
918925
return FfiPhantom(ty);
919926
}

compiler/rustc_target/src/spec/wasm_base.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ pub fn options() -> TargetOptions {
103103
linker: Some("rust-lld".to_owned()),
104104
lld_flavor: LldFlavor::Wasm,
105105

106-
// No need for indirection here, simd types can always be passed by
107-
// value as the whole module either has simd or not, which is different
108-
// from x86 (for example) where programs can have functions that don't
109-
// enable simd features.
110-
simd_types_indirect: false,
111-
112106
pre_link_args,
113107

114108
crt_objects_fallback: Some(CrtObjectsFallback::Wasm),

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,10 @@ impl<'v> Visitor<'v> for FindTypeParam {
18781878
hir::intravisit::NestedVisitorMap::None
18791879
}
18801880

1881+
fn visit_where_predicate(&mut self, _: &'v hir::WherePredicate<'v>) {
1882+
// Skip where-clauses, to avoid suggesting indirection for type parameters found there.
1883+
}
1884+
18811885
fn visit_ty(&mut self, ty: &hir::Ty<'_>) {
18821886
// We collect the spans of all uses of the "bare" type param, like in `field: T` or
18831887
// `field: (T, T)` where we could make `T: ?Sized` while skipping cases that are known to be

compiler/rustc_typeck/src/check/demand.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use rustc_span::Span;
1717
use super::method::probe;
1818

1919
use std::fmt;
20+
use std::iter;
2021

2122
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2223
pub fn emit_coerce_suggestions(
@@ -573,12 +574,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
573574
// We have `&T`, check if what was expected was `T`. If so,
574575
// we may want to suggest removing a `&`.
575576
if sm.is_imported(expr.span) {
576-
if let Ok(src) = sm.span_to_snippet(sp) {
577-
if let Some(src) = src.strip_prefix('&') {
577+
// Go through the spans from which this span was expanded,
578+
// and find the one that's pointing inside `sp`.
579+
//
580+
// E.g. for `&format!("")`, where we want the span to the
581+
// `format!()` invocation instead of its expansion.
582+
if let Some(call_span) =
583+
iter::successors(Some(expr.span), |s| s.parent()).find(|&s| sp.contains(s))
584+
{
585+
if let Ok(code) = sm.span_to_snippet(call_span) {
578586
return Some((
579587
sp,
580588
"consider removing the borrow",
581-
src.to_string(),
589+
code,
582590
Applicability::MachineApplicable,
583591
));
584592
}

library/alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#![allow(unused_attributes)]
6060
#![stable(feature = "alloc", since = "1.36.0")]
6161
#![doc(
62-
html_root_url = "https://doc.rust-lang.org/nightly/",
6362
html_playground_url = "https://play.rust-lang.org/",
6463
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
6564
test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))

library/core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#![cfg(not(test))]
5252
#![stable(feature = "core", since = "1.6.0")]
5353
#![doc(
54-
html_root_url = "https://doc.rust-lang.org/nightly/",
5554
html_playground_url = "https://play.rust-lang.org/",
5655
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
5756
test(no_crate_inject, attr(deny(warnings))),

library/panic_abort/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
66
#![no_std]
77
#![unstable(feature = "panic_abort", issue = "32837")]
8-
#![doc(
9-
html_root_url = "https://doc.rust-lang.org/nightly/",
10-
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/"
11-
)]
8+
#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
129
#![panic_runtime]
1310
#![allow(unused_features)]
1411
#![feature(core_intrinsics)]

library/panic_unwind/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
1414
#![no_std]
1515
#![unstable(feature = "panic_unwind", issue = "32837")]
16-
#![doc(
17-
html_root_url = "https://doc.rust-lang.org/nightly/",
18-
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/"
19-
)]
16+
#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
2017
#![feature(core_intrinsics)]
2118
#![feature(lang_items)]
2219
#![feature(nll)]

0 commit comments

Comments
 (0)