Skip to content

Commit ec8b300

Browse files
committed
Auto merge of rust-lang#138841 - matthiaskrgr:rollup-bfkls57, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#138018 (rustdoc: Use own logic to print `#[repr(..)]` attributes in JSON output.) - rust-lang#138294 (Mark some std tests as requiring `panic = "unwind"`) - rust-lang#138468 (rustdoc js: add nonnull helper and typecheck src-script.js) - rust-lang#138675 (Add release notes for 1.85.1) - rust-lang#138765 (Fix Thread::set_name on cygwin) - rust-lang#138786 (Move some driver code around) - rust-lang#138793 (target spec check: better error when llvm-floatabi is missing) - rust-lang#138822 (De-Stabilize `file_lock`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7555d0c + e9af841 commit ec8b300

File tree

7 files changed

+52
-9
lines changed

7 files changed

+52
-9
lines changed

Diff for: std/src/fs.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ impl File {
665665
/// # Examples
666666
///
667667
/// ```no_run
668+
/// #![feature(file_lock)]
668669
/// use std::fs::File;
669670
///
670671
/// fn main() -> std::io::Result<()> {
@@ -673,7 +674,7 @@ impl File {
673674
/// Ok(())
674675
/// }
675676
/// ```
676-
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
677+
#[unstable(feature = "file_lock", issue = "130994")]
677678
pub fn lock(&self) -> io::Result<()> {
678679
self.inner.lock()
679680
}
@@ -717,6 +718,7 @@ impl File {
717718
/// # Examples
718719
///
719720
/// ```no_run
721+
/// #![feature(file_lock)]
720722
/// use std::fs::File;
721723
///
722724
/// fn main() -> std::io::Result<()> {
@@ -725,7 +727,7 @@ impl File {
725727
/// Ok(())
726728
/// }
727729
/// ```
728-
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
730+
#[unstable(feature = "file_lock", issue = "130994")]
729731
pub fn lock_shared(&self) -> io::Result<()> {
730732
self.inner.lock_shared()
731733
}
@@ -774,6 +776,7 @@ impl File {
774776
/// # Examples
775777
///
776778
/// ```no_run
779+
/// #![feature(file_lock)]
777780
/// use std::fs::File;
778781
///
779782
/// fn main() -> std::io::Result<()> {
@@ -782,7 +785,7 @@ impl File {
782785
/// Ok(())
783786
/// }
784787
/// ```
785-
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
788+
#[unstable(feature = "file_lock", issue = "130994")]
786789
pub fn try_lock(&self) -> io::Result<bool> {
787790
self.inner.try_lock()
788791
}
@@ -830,6 +833,7 @@ impl File {
830833
/// # Examples
831834
///
832835
/// ```no_run
836+
/// #![feature(file_lock)]
833837
/// use std::fs::File;
834838
///
835839
/// fn main() -> std::io::Result<()> {
@@ -838,7 +842,7 @@ impl File {
838842
/// Ok(())
839843
/// }
840844
/// ```
841-
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
845+
#[unstable(feature = "file_lock", issue = "130994")]
842846
pub fn try_lock_shared(&self) -> io::Result<bool> {
843847
self.inner.try_lock_shared()
844848
}
@@ -866,6 +870,7 @@ impl File {
866870
/// # Examples
867871
///
868872
/// ```no_run
873+
/// #![feature(file_lock)]
869874
/// use std::fs::File;
870875
///
871876
/// fn main() -> std::io::Result<()> {
@@ -875,7 +880,7 @@ impl File {
875880
/// Ok(())
876881
/// }
877882
/// ```
878-
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
883+
#[unstable(feature = "file_lock", issue = "130994")]
879884
pub fn unlock(&self) -> io::Result<()> {
880885
self.inner.unlock()
881886
}

Diff for: std/src/sys/pal/unix/thread.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ impl Thread {
143143
pub fn set_name(name: &CStr) {
144144
unsafe {
145145
cfg_if::cfg_if! {
146-
if #[cfg(target_os = "linux")] {
147-
// Linux limits the allowed length of the name.
146+
if #[cfg(any(target_os = "linux", target_os = "cygwin"))] {
147+
// Linux and Cygwin limits the allowed length of the name.
148148
const TASK_COMM_LEN: usize = 16;
149149
let name = truncate_cstr::<{ TASK_COMM_LEN }>(name);
150150
} else {
@@ -346,6 +346,7 @@ impl Drop for Thread {
346346
target_os = "solaris",
347347
target_os = "illumos",
348348
target_os = "vxworks",
349+
target_os = "cygwin",
349350
target_vendor = "apple",
350351
))]
351352
fn truncate_cstr<const MAX_WITH_NUL: usize>(cstr: &CStr) -> [libc::c_char; MAX_WITH_NUL] {

Diff for: std/src/thread/tests.rs

+5
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ fn test_is_finished() {
108108
}
109109

110110
#[test]
111+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
111112
fn test_join_panic() {
112113
match thread::spawn(move || panic!()).join() {
113114
result::Result::Err(_) => (),
@@ -210,6 +211,7 @@ fn test_simple_newsched_spawn() {
210211
}
211212

212213
#[test]
214+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
213215
fn test_try_panic_message_string_literal() {
214216
match thread::spawn(move || {
215217
panic!("static string");
@@ -226,6 +228,7 @@ fn test_try_panic_message_string_literal() {
226228
}
227229

228230
#[test]
231+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
229232
fn test_try_panic_any_message_owned_str() {
230233
match thread::spawn(move || {
231234
panic_any("owned string".to_string());
@@ -242,6 +245,7 @@ fn test_try_panic_any_message_owned_str() {
242245
}
243246

244247
#[test]
248+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
245249
fn test_try_panic_any_message_any() {
246250
match thread::spawn(move || {
247251
panic_any(Box::new(413u16) as Box<dyn Any + Send>);
@@ -260,6 +264,7 @@ fn test_try_panic_any_message_any() {
260264
}
261265

262266
#[test]
267+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
263268
fn test_try_panic_any_message_unit_struct() {
264269
struct Juju;
265270

Diff for: std/tests/sync/mutex.rs

+10
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ fn test_into_inner_drop() {
118118
}
119119

120120
#[test]
121+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
121122
fn test_into_inner_poison() {
122123
let m = new_poisoned_mutex(NonCopy(10));
123124

@@ -135,6 +136,7 @@ fn test_get_cloned() {
135136
}
136137

137138
#[test]
139+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
138140
fn test_get_cloned_poison() {
139141
let m = new_poisoned_mutex(Cloneable(10));
140142

@@ -152,6 +154,7 @@ fn test_get_mut() {
152154
}
153155

154156
#[test]
157+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
155158
fn test_get_mut_poison() {
156159
let mut m = new_poisoned_mutex(NonCopy(10));
157160

@@ -179,6 +182,7 @@ fn test_set() {
179182
}
180183

181184
#[test]
185+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
182186
fn test_set_poison() {
183187
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
184188
where
@@ -217,6 +221,7 @@ fn test_replace() {
217221
}
218222

219223
#[test]
224+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
220225
fn test_replace_poison() {
221226
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
222227
where
@@ -261,6 +266,7 @@ fn test_mutex_arc_condvar() {
261266
}
262267

263268
#[test]
269+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
264270
fn test_arc_condvar_poison() {
265271
let packet = Packet(Arc::new((Mutex::new(1), Condvar::new())));
266272
let packet2 = Packet(packet.0.clone());
@@ -290,6 +296,7 @@ fn test_arc_condvar_poison() {
290296
}
291297

292298
#[test]
299+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
293300
fn test_mutex_arc_poison() {
294301
let arc = Arc::new(Mutex::new(1));
295302
assert!(!arc.is_poisoned());
@@ -304,6 +311,7 @@ fn test_mutex_arc_poison() {
304311
}
305312

306313
#[test]
314+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
307315
fn test_mutex_arc_poison_mapped() {
308316
let arc = Arc::new(Mutex::new(1));
309317
assert!(!arc.is_poisoned());
@@ -335,6 +343,7 @@ fn test_mutex_arc_nested() {
335343
}
336344

337345
#[test]
346+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
338347
fn test_mutex_arc_access_in_unwind() {
339348
let arc = Arc::new(Mutex::new(1));
340349
let arc2 = arc.clone();
@@ -381,6 +390,7 @@ fn test_mapping_mapped_guard() {
381390
}
382391

383392
#[test]
393+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
384394
fn panic_while_mapping_unlocked_poison() {
385395
let lock = Mutex::new(());
386396

Diff for: std/tests/sync/once.rs

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ fn stampede_once() {
5252
}
5353

5454
#[test]
55+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
5556
fn poison_bad() {
5657
static O: Once = Once::new();
5758

@@ -80,6 +81,7 @@ fn poison_bad() {
8081
}
8182

8283
#[test]
84+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
8385
fn wait_for_force_to_finish() {
8486
static O: Once = Once::new();
8587

@@ -137,6 +139,7 @@ fn wait() {
137139
}
138140

139141
#[test]
142+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
140143
fn wait_on_poisoned() {
141144
let once = Once::new();
142145

@@ -145,6 +148,7 @@ fn wait_on_poisoned() {
145148
}
146149

147150
#[test]
151+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
148152
fn wait_force_on_poisoned() {
149153
let once = Once::new();
150154

Diff for: std/tests/sync/once_lock.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ fn get_or_try_init() {
7777
let cell: OnceLock<String> = OnceLock::new();
7878
assert!(cell.get().is_none());
7979

80-
let res = panic::catch_unwind(|| cell.get_or_try_init(|| -> Result<_, ()> { panic!() }));
81-
assert!(res.is_err());
80+
if cfg!(panic = "unwind") {
81+
let res = panic::catch_unwind(|| cell.get_or_try_init(|| -> Result<_, ()> { panic!() }));
82+
assert!(res.is_err());
83+
}
8284
assert!(cell.get().is_none());
8385

8486
assert_eq!(cell.get_or_try_init(|| Err(())), Err(()));

Diff for: std/tests/sync/rwlock.rs

+16
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ fn frob() {
7373
}
7474

7575
#[test]
76+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
7677
fn test_rw_arc_poison_wr() {
7778
let arc = Arc::new(RwLock::new(1));
7879
let arc2 = arc.clone();
@@ -85,6 +86,7 @@ fn test_rw_arc_poison_wr() {
8586
}
8687

8788
#[test]
89+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
8890
fn test_rw_arc_poison_mapped_w_r() {
8991
let arc = Arc::new(RwLock::new(1));
9092
let arc2 = arc.clone();
@@ -98,6 +100,7 @@ fn test_rw_arc_poison_mapped_w_r() {
98100
}
99101

100102
#[test]
103+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
101104
fn test_rw_arc_poison_ww() {
102105
let arc = Arc::new(RwLock::new(1));
103106
assert!(!arc.is_poisoned());
@@ -112,6 +115,7 @@ fn test_rw_arc_poison_ww() {
112115
}
113116

114117
#[test]
118+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
115119
fn test_rw_arc_poison_mapped_w_w() {
116120
let arc = Arc::new(RwLock::new(1));
117121
let arc2 = arc.clone();
@@ -126,6 +130,7 @@ fn test_rw_arc_poison_mapped_w_w() {
126130
}
127131

128132
#[test]
133+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
129134
fn test_rw_arc_no_poison_rr() {
130135
let arc = Arc::new(RwLock::new(1));
131136
let arc2 = arc.clone();
@@ -139,6 +144,7 @@ fn test_rw_arc_no_poison_rr() {
139144
}
140145

141146
#[test]
147+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
142148
fn test_rw_arc_no_poison_mapped_r_r() {
143149
let arc = Arc::new(RwLock::new(1));
144150
let arc2 = arc.clone();
@@ -153,6 +159,7 @@ fn test_rw_arc_no_poison_mapped_r_r() {
153159
}
154160

155161
#[test]
162+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
156163
fn test_rw_arc_no_poison_rw() {
157164
let arc = Arc::new(RwLock::new(1));
158165
let arc2 = arc.clone();
@@ -166,6 +173,7 @@ fn test_rw_arc_no_poison_rw() {
166173
}
167174

168175
#[test]
176+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
169177
fn test_rw_arc_no_poison_mapped_r_w() {
170178
let arc = Arc::new(RwLock::new(1));
171179
let arc2 = arc.clone();
@@ -218,6 +226,7 @@ fn test_rw_arc() {
218226
}
219227

220228
#[test]
229+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
221230
fn test_rw_arc_access_in_unwind() {
222231
let arc = Arc::new(RwLock::new(1));
223232
let arc2 = arc.clone();
@@ -316,6 +325,7 @@ fn test_into_inner_drop() {
316325
}
317326

318327
#[test]
328+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
319329
fn test_into_inner_poison() {
320330
let m = new_poisoned_rwlock(NonCopy(10));
321331

@@ -333,6 +343,7 @@ fn test_get_cloned() {
333343
}
334344

335345
#[test]
346+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
336347
fn test_get_cloned_poison() {
337348
let m = new_poisoned_rwlock(Cloneable(10));
338349

@@ -350,6 +361,7 @@ fn test_get_mut() {
350361
}
351362

352363
#[test]
364+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
353365
fn test_get_mut_poison() {
354366
let mut m = new_poisoned_rwlock(NonCopy(10));
355367

@@ -377,6 +389,7 @@ fn test_set() {
377389
}
378390

379391
#[test]
392+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
380393
fn test_set_poison() {
381394
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
382395
where
@@ -415,6 +428,7 @@ fn test_replace() {
415428
}
416429

417430
#[test]
431+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
418432
fn test_replace_poison() {
419433
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
420434
where
@@ -482,6 +496,7 @@ fn test_mapping_mapped_guard() {
482496
}
483497

484498
#[test]
499+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
485500
fn panic_while_mapping_read_unlocked_no_poison() {
486501
let lock = RwLock::new(());
487502

@@ -551,6 +566,7 @@ fn panic_while_mapping_read_unlocked_no_poison() {
551566
}
552567

553568
#[test]
569+
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
554570
fn panic_while_mapping_write_unlocked_poison() {
555571
let lock = RwLock::new(());
556572

0 commit comments

Comments
 (0)