Rollup merge of #128228 - slanterns:const_waker, r=dtolnay,oli-obk · model-checking/verify-rust-std@604d618 (original) (raw)

`@@ -251,7 +251,7 @@ pub struct Context<'a> {

`

251

251

`impl<'a> Context<'a> {

`

252

252

`` /// Creates a new Context from a &Waker.

``

253

253

`#[stable(feature = "futures_api", since = "1.36.0")]

`

254

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

254

`+

#[rustc_const_stable(feature = "const_waker", since = "CURRENT_RUSTC_VERSION")]

`

255

255

`#[must_use]

`

256

256

`#[inline]

`

257

257

`pub const fn from_waker(waker: &'a Waker) -> Self {

`

`@@ -262,23 +262,23 @@ impl<'a> Context<'a> {

`

262

262

`#[inline]

`

263

263

`#[must_use]

`

264

264

`#[stable(feature = "futures_api", since = "1.36.0")]

`

265

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

265

`+

#[rustc_const_stable(feature = "const_waker", since = "CURRENT_RUSTC_VERSION")]

`

266

266

`pub const fn waker(&self) -> &'a Waker {

`

267

267

`&self.waker

`

268

268

`}

`

269

269

``

270

270

`` /// Returns a reference to the [LocalWaker] for the current task.

``

271

271

`#[inline]

`

272

272

`#[unstable(feature = "local_waker", issue = "118959")]

`

273

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

273

`+

#[rustc_const_unstable(feature = "local_waker", issue = "118959")]

`

274

274

`pub const fn local_waker(&self) -> &'a LocalWaker {

`

275

275

`&self.local_waker

`

276

276

`}

`

277

277

``

278

278

`/// Returns a reference to the extension data for the current task.

`

279

279

`#[inline]

`

280

280

`#[unstable(feature = "context_ext", issue = "123392")]

`

281

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

281

`+

#[rustc_const_unstable(feature = "context_ext", issue = "123392")]

`

282

282

`pub const fn ext(&mut self) -> &mut dyn Any {

`

283

283

`// FIXME: this field makes Context extra-weird about unwind safety

`

284

284

`// can we justify AssertUnwindSafe if we stabilize this? do we care?

`

`@@ -337,8 +337,8 @@ pub struct ContextBuilder<'a> {

`

337

337

`impl<'a> ContextBuilder<'a> {

`

338

338

`/// Creates a ContextBuilder from a Waker.

`

339

339

`#[inline]

`

340

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

341

340

`#[unstable(feature = "local_waker", issue = "118959")]

`

``

341

`+

#[rustc_const_stable(feature = "const_waker", since = "CURRENT_RUSTC_VERSION")]

`

342

342

`pub const fn from_waker(waker: &'a Waker) -> Self {

`

343

343

`// SAFETY: LocalWaker is just Waker without thread safety

`

344

344

`let local_waker = unsafe { transmute(waker) };

`

`@@ -353,8 +353,8 @@ impl<'a> ContextBuilder<'a> {

`

353

353

``

354

354

`/// Creates a ContextBuilder from an existing Context.

`

355

355

`#[inline]

`

356

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

357

356

`#[unstable(feature = "context_ext", issue = "123392")]

`

``

357

`+

#[rustc_const_unstable(feature = "context_ext", issue = "123392")]

`

358

358

`pub const fn from(cx: &'a mut Context<'_>) -> Self {

`

359

359

`let ext = match &mut cx.ext.0 {

`

360

360

`ExtData::Some(ext) => ExtData::Some(*ext),

`

`@@ -372,31 +372,31 @@ impl<'a> ContextBuilder<'a> {

`

372

372

`` /// Sets the value for the waker on Context.

``

373

373

`#[inline]

`

374

374

`#[unstable(feature = "context_ext", issue = "123392")]

`

375

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

375

`+

#[rustc_const_unstable(feature = "context_ext", issue = "123392")]

`

376

376

`pub const fn waker(self, waker: &'a Waker) -> Self {

`

377

377

`Self { waker, ..self }

`

378

378

`}

`

379

379

``

380

380

`` /// Sets the value for the local waker on Context.

``

381

381

`#[inline]

`

382

382

`#[unstable(feature = "local_waker", issue = "118959")]

`

383

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

383

`+

#[rustc_const_unstable(feature = "local_waker", issue = "118959")]

`

384

384

`pub const fn local_waker(self, local_waker: &'a LocalWaker) -> Self {

`

385

385

`Self { local_waker, ..self }

`

386

386

`}

`

387

387

``

388

388

`` /// Sets the value for the extension data on Context.

``

389

389

`#[inline]

`

390

390

`#[unstable(feature = "context_ext", issue = "123392")]

`

391

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

391

`+

#[rustc_const_unstable(feature = "context_ext", issue = "123392")]

`

392

392

`pub const fn ext(self, data: &'a mut dyn Any) -> Self {

`

393

393

`Self { ext: ExtData::Some(data), ..self }

`

394

394

`}

`

395

395

``

396

396

`` /// Builds the Context.

``

397

397

`#[inline]

`

398

398

`#[unstable(feature = "local_waker", issue = "118959")]

`

399

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

399

`+

#[rustc_const_stable(feature = "const_waker", since = "CURRENT_RUSTC_VERSION")]

`

400

400

`pub const fn build(self) -> Context<'a> {

`

401

401

`let ContextBuilder { waker, local_waker, ext, _marker, _marker2 } = self;

`

402

402

`Context { waker, local_waker, ext: AssertUnwindSafe(ext), _marker, _marker2 }

`

`@@ -522,7 +522,7 @@ impl Waker {

`

522

522

`#[inline]

`

523

523

`#[must_use]

`

524

524

`#[stable(feature = "futures_api", since = "1.36.0")]

`

525

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

525

`+

#[rustc_const_stable(feature = "const_waker", since = "CURRENT_RUSTC_VERSION")]

`

526

526

`pub const unsafe fn from_raw(waker: RawWaker) -> Waker {

`

527

527

`Waker { waker }

`

528

528

`}

`

`@@ -773,7 +773,7 @@ impl LocalWaker {

`

773

773

`#[inline]

`

774

774

`#[must_use]

`

775

775

`#[unstable(feature = "local_waker", issue = "118959")]

`

776

``

`-

#[rustc_const_unstable(feature = "const_waker", issue = "102012")]

`

``

776

`+

#[rustc_const_unstable(feature = "local_waker", issue = "118959")]

`

777

777

`pub const unsafe fn from_raw(waker: RawWaker) -> LocalWaker {

`

778

778

`Self { waker }

`

779

779

`}

`