mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Auto merge of #132722 - joboet:rollup-0q67jyo, r=joboet
Rollup of 6 pull requests
Successful merges:
- #132057 (miri: update ABI compat checks to accept Option-like types)
- #132665 (Implement `div_ceil` for `NonZero<unsigned>`)
- #132694 (fix(x): fix a regex used to find python executable)
- #132707 (Add --diagnostic-width to some tests failing after 1a0c502183
)
- #132715 (fix `LazyLock::get` and `LazyLock::get_mut` document)
- #132716 (chore(issue-template): fix branch name)
r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
commit
3d1dba830a
2
.github/ISSUE_TEMPLATE/tracking_issue.md
vendored
2
.github/ISSUE_TEMPLATE/tracking_issue.md
vendored
@ -46,7 +46,7 @@ for larger features an implementation could be broken up into multiple PRs.
|
|||||||
|
|
||||||
[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
|
[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
|
||||||
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
|
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
|
||||||
[nightly-style-procedure]: https://github.com/rust-lang/style-team/blob/master/nightly-style-procedure.md
|
[nightly-style-procedure]: https://github.com/rust-lang/style-team/blob/main/nightly-style-procedure.md
|
||||||
[Style Guide]: https://github.com/rust-lang/rust/tree/master/src/doc/style-guide
|
[Style Guide]: https://github.com/rust-lang/rust/tree/master/src/doc/style-guide
|
||||||
|
|
||||||
### Unresolved Questions
|
### Unresolved Questions
|
||||||
|
@ -4,9 +4,9 @@ use std::assert_matches::assert_matches;
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use either::{Left, Right};
|
use either::{Left, Right};
|
||||||
use rustc_abi::{self as abi, ExternAbi, FieldIdx, Integer};
|
use rustc_abi::{self as abi, ExternAbi, FieldIdx, Integer, VariantIdx};
|
||||||
use rustc_middle::ty::layout::{FnAbiOf, IntegerExt, LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{FnAbiOf, IntegerExt, LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::{self, AdtDef, Instance, Ty};
|
use rustc_middle::ty::{self, AdtDef, Instance, Ty, VariantDef};
|
||||||
use rustc_middle::{bug, mir, span_bug};
|
use rustc_middle::{bug, mir, span_bug};
|
||||||
use rustc_span::sym;
|
use rustc_span::sym;
|
||||||
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode};
|
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode};
|
||||||
@ -92,30 +92,47 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||||||
|
|
||||||
/// Unwrap types that are guaranteed a null-pointer-optimization
|
/// Unwrap types that are guaranteed a null-pointer-optimization
|
||||||
fn unfold_npo(&self, layout: TyAndLayout<'tcx>) -> InterpResult<'tcx, TyAndLayout<'tcx>> {
|
fn unfold_npo(&self, layout: TyAndLayout<'tcx>) -> InterpResult<'tcx, TyAndLayout<'tcx>> {
|
||||||
// Check if this is `Option` wrapping some type or if this is `Result` wrapping a 1-ZST and
|
// Check if this is an option-like type wrapping some type.
|
||||||
// another type.
|
|
||||||
let ty::Adt(def, args) = layout.ty.kind() else {
|
let ty::Adt(def, args) = layout.ty.kind() else {
|
||||||
// Not an ADT, so definitely no NPO.
|
// Not an ADT, so definitely no NPO.
|
||||||
return interp_ok(layout);
|
return interp_ok(layout);
|
||||||
};
|
};
|
||||||
let inner = if self.tcx.is_diagnostic_item(sym::Option, def.did()) {
|
if def.variants().len() != 2 {
|
||||||
// The wrapped type is the only arg.
|
// Not a 2-variant enum, so no NPO.
|
||||||
self.layout_of(args[0].as_type().unwrap())?
|
return interp_ok(layout);
|
||||||
} else if self.tcx.is_diagnostic_item(sym::Result, def.did()) {
|
}
|
||||||
// We want to extract which (if any) of the args is not a 1-ZST.
|
assert!(def.is_enum());
|
||||||
let lhs = self.layout_of(args[0].as_type().unwrap())?;
|
|
||||||
let rhs = self.layout_of(args[1].as_type().unwrap())?;
|
let all_fields_1zst = |variant: &VariantDef| -> InterpResult<'tcx, _> {
|
||||||
if lhs.is_1zst() {
|
for field in &variant.fields {
|
||||||
rhs
|
let ty = field.ty(*self.tcx, args);
|
||||||
} else if rhs.is_1zst() {
|
let layout = self.layout_of(ty)?;
|
||||||
lhs
|
if !layout.is_1zst() {
|
||||||
} else {
|
return interp_ok(false);
|
||||||
return interp_ok(layout); // no NPO
|
}
|
||||||
}
|
}
|
||||||
} else {
|
interp_ok(true)
|
||||||
return interp_ok(layout); // no NPO
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If one variant consists entirely of 1-ZST, then the other variant
|
||||||
|
// is the only "relevant" one for this check.
|
||||||
|
let var0 = VariantIdx::from_u32(0);
|
||||||
|
let var1 = VariantIdx::from_u32(1);
|
||||||
|
let relevant_variant = if all_fields_1zst(def.variant(var0))? {
|
||||||
|
def.variant(var1)
|
||||||
|
} else if all_fields_1zst(def.variant(var1))? {
|
||||||
|
def.variant(var0)
|
||||||
|
} else {
|
||||||
|
// No varant is all-1-ZST, so no NPO.
|
||||||
|
return interp_ok(layout);
|
||||||
|
};
|
||||||
|
// The "relevant" variant must have exactly one field, and its type is the "inner" type.
|
||||||
|
if relevant_variant.fields.len() != 1 {
|
||||||
|
return interp_ok(layout);
|
||||||
|
}
|
||||||
|
let inner = relevant_variant.fields[FieldIdx::from_u32(0)].ty(*self.tcx, args);
|
||||||
|
let inner = self.layout_of(inner)?;
|
||||||
|
|
||||||
// Check if the inner type is one of the NPO-guaranteed ones.
|
// Check if the inner type is one of the NPO-guaranteed ones.
|
||||||
// For that we first unpeel transparent *structs* (but not unions).
|
// For that we first unpeel transparent *structs* (but not unions).
|
||||||
let is_npo = |def: AdtDef<'tcx>| {
|
let is_npo = |def: AdtDef<'tcx>| {
|
||||||
|
@ -1214,6 +1214,35 @@ macro_rules! nonzero_integer_signedness_dependent_impls {
|
|||||||
*self = *self % other;
|
*self = *self % other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl NonZero<$Int> {
|
||||||
|
/// Calculates the quotient of `self` and `rhs`, rounding the result towards positive infinity.
|
||||||
|
///
|
||||||
|
/// The result is guaranteed to be non-zero.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// # #![feature(unsigned_nonzero_div_ceil)]
|
||||||
|
/// # use std::num::NonZero;
|
||||||
|
#[doc = concat!("let one = NonZero::new(1", stringify!($Int), ").unwrap();")]
|
||||||
|
#[doc = concat!("let max = NonZero::new(", stringify!($Int), "::MAX).unwrap();")]
|
||||||
|
/// assert_eq!(one.div_ceil(max), one);
|
||||||
|
///
|
||||||
|
#[doc = concat!("let two = NonZero::new(2", stringify!($Int), ").unwrap();")]
|
||||||
|
#[doc = concat!("let three = NonZero::new(3", stringify!($Int), ").unwrap();")]
|
||||||
|
/// assert_eq!(three.div_ceil(two), two);
|
||||||
|
/// ```
|
||||||
|
#[unstable(feature = "unsigned_nonzero_div_ceil", issue = "none")]
|
||||||
|
#[must_use = "this returns the result of the operation, \
|
||||||
|
without modifying the original"]
|
||||||
|
#[inline]
|
||||||
|
pub const fn div_ceil(self, rhs: Self) -> Self {
|
||||||
|
let v = self.get().div_ceil(rhs.get());
|
||||||
|
// SAFETY: ceiled division of two positive integers can never be zero.
|
||||||
|
unsafe { Self::new_unchecked(v) }
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// Impls for signed nonzero types only.
|
// Impls for signed nonzero types only.
|
||||||
(signed $Int:ty) => {
|
(signed $Int:ty) => {
|
||||||
|
@ -226,7 +226,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, F> LazyLock<T, F> {
|
impl<T, F> LazyLock<T, F> {
|
||||||
/// Returns a reference to the value if initialized, or `None` if not.
|
/// Returns a mutable reference to the value if initialized, or `None` if not.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -255,7 +255,7 @@ impl<T, F> LazyLock<T, F> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a mutable reference to the value if initialized, or `None` if not.
|
/// Returns a reference to the value if initialized, or `None` if not.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![feature(never_type)]
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::{mem, num, ptr};
|
use std::{mem, num, ptr};
|
||||||
|
|
||||||
@ -12,6 +14,18 @@ fn id<T>(x: T) -> T {
|
|||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
enum Either<T, U> {
|
||||||
|
Left(T),
|
||||||
|
Right(U),
|
||||||
|
}
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
enum Either2<T, U> {
|
||||||
|
Left(T),
|
||||||
|
#[allow(unused)]
|
||||||
|
Right(U, ()),
|
||||||
|
}
|
||||||
|
|
||||||
fn test_abi_compat<T: Clone, U: Clone>(t: T, u: U) {
|
fn test_abi_compat<T: Clone, U: Clone>(t: T, u: U) {
|
||||||
fn id<T>(x: T) -> T {
|
fn id<T>(x: T) -> T {
|
||||||
x
|
x
|
||||||
@ -81,6 +95,8 @@ fn main() {
|
|||||||
test_abi_compat(main as fn(), id::<i32> as fn(i32) -> i32);
|
test_abi_compat(main as fn(), id::<i32> as fn(i32) -> i32);
|
||||||
// - 1-ZST
|
// - 1-ZST
|
||||||
test_abi_compat((), [0u8; 0]);
|
test_abi_compat((), [0u8; 0]);
|
||||||
|
|
||||||
|
// Guaranteed null-pointer-layout optimizations:
|
||||||
// - Guaranteed Option<X> null-pointer-optimizations (RFC 3391).
|
// - Guaranteed Option<X> null-pointer-optimizations (RFC 3391).
|
||||||
test_abi_compat(&0u32 as *const u32, Some(&0u32));
|
test_abi_compat(&0u32 as *const u32, Some(&0u32));
|
||||||
test_abi_compat(main as fn(), Some(main as fn()));
|
test_abi_compat(main as fn(), Some(main as fn()));
|
||||||
@ -89,6 +105,7 @@ fn main() {
|
|||||||
test_abi_compat(0u32, Some(Wrapper(num::NonZeroU32::new(1u32).unwrap())));
|
test_abi_compat(0u32, Some(Wrapper(num::NonZeroU32::new(1u32).unwrap())));
|
||||||
// - Guaranteed Result<X, ZST1> does the same as Option<X> (RFC 3391)
|
// - Guaranteed Result<X, ZST1> does the same as Option<X> (RFC 3391)
|
||||||
test_abi_compat(&0u32 as *const u32, Result::<_, ()>::Ok(&0u32));
|
test_abi_compat(&0u32 as *const u32, Result::<_, ()>::Ok(&0u32));
|
||||||
|
test_abi_compat(&0u32 as *const u32, Result::<_, !>::Ok(&0u32));
|
||||||
test_abi_compat(main as fn(), Result::<_, ()>::Ok(main as fn()));
|
test_abi_compat(main as fn(), Result::<_, ()>::Ok(main as fn()));
|
||||||
test_abi_compat(0u32, Result::<_, ()>::Ok(num::NonZeroU32::new(1).unwrap()));
|
test_abi_compat(0u32, Result::<_, ()>::Ok(num::NonZeroU32::new(1).unwrap()));
|
||||||
test_abi_compat(&0u32 as *const u32, Result::<_, ()>::Ok(Wrapper(&0u32)));
|
test_abi_compat(&0u32 as *const u32, Result::<_, ()>::Ok(Wrapper(&0u32)));
|
||||||
@ -99,6 +116,13 @@ fn main() {
|
|||||||
test_abi_compat(0u32, Result::<(), _>::Err(num::NonZeroU32::new(1).unwrap()));
|
test_abi_compat(0u32, Result::<(), _>::Err(num::NonZeroU32::new(1).unwrap()));
|
||||||
test_abi_compat(&0u32 as *const u32, Result::<(), _>::Err(Wrapper(&0u32)));
|
test_abi_compat(&0u32 as *const u32, Result::<(), _>::Err(Wrapper(&0u32)));
|
||||||
test_abi_compat(0u32, Result::<(), _>::Err(Wrapper(num::NonZeroU32::new(1).unwrap())));
|
test_abi_compat(0u32, Result::<(), _>::Err(Wrapper(num::NonZeroU32::new(1).unwrap())));
|
||||||
|
// - Guaranteed null-pointer-optimizations for custom option-like types
|
||||||
|
test_abi_compat(&0u32 as *const u32, Either::<_, ()>::Left(&0u32));
|
||||||
|
test_abi_compat(&0u32 as *const u32, Either::<_, !>::Left(&0u32));
|
||||||
|
test_abi_compat(&0u32 as *const u32, Either::<(), _>::Right(&0u32));
|
||||||
|
test_abi_compat(&0u32 as *const u32, Either::<!, _>::Right(&0u32));
|
||||||
|
test_abi_compat(&0u32 as *const u32, Either2::<_, ()>::Left(&0u32));
|
||||||
|
test_abi_compat(&0u32 as *const u32, Either2::<_, [u8; 0]>::Left(&0u32));
|
||||||
|
|
||||||
// These must work for *any* type, since we guarantee that `repr(transparent)` is ABI-compatible
|
// These must work for *any* type, since we guarantee that `repr(transparent)` is ABI-compatible
|
||||||
// with the wrapped field.
|
// with the wrapped field.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
//@ edition:2021
|
//@ edition:2021
|
||||||
|
//@compile-flags: --diagnostic-width=300
|
||||||
// gate-test-coroutine_clone
|
// gate-test-coroutine_clone
|
||||||
// Verifies that feature(coroutine_clone) doesn't allow async blocks to be cloned/copied.
|
// Verifies that feature(coroutine_clone) doesn't allow async blocks to be cloned/copied.
|
||||||
|
|
||||||
|
@ -1,89 +1,89 @@
|
|||||||
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}: Copy` is not satisfied
|
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Copy` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:17:16
|
--> $DIR/clone-impl-async.rs:18:16
|
||||||
|
|
|
|
||||||
LL | check_copy(&inner_non_clone);
|
LL | check_copy(&inner_non_clone);
|
||||||
| ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}`
|
| ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_copy`
|
note: required by a bound in `check_copy`
|
||||||
--> $DIR/clone-impl-async.rs:69:18
|
--> $DIR/clone-impl-async.rs:70:18
|
||||||
|
|
|
|
||||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||||
| ^^^^ required by this bound in `check_copy`
|
| ^^^^ required by this bound in `check_copy`
|
||||||
|
|
||||||
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}: Clone` is not satisfied
|
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Clone` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:19:17
|
--> $DIR/clone-impl-async.rs:20:17
|
||||||
|
|
|
|
||||||
LL | check_clone(&inner_non_clone);
|
LL | check_clone(&inner_non_clone);
|
||||||
| ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}`
|
| ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_clone`
|
note: required by a bound in `check_clone`
|
||||||
--> $DIR/clone-impl-async.rs:70:19
|
--> $DIR/clone-impl-async.rs:71:19
|
||||||
|
|
|
|
||||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||||
| ^^^^^ required by this bound in `check_clone`
|
| ^^^^^ required by this bound in `check_clone`
|
||||||
|
|
||||||
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}: Copy` is not satisfied
|
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Copy` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:26:16
|
--> $DIR/clone-impl-async.rs:27:16
|
||||||
|
|
|
|
||||||
LL | check_copy(&outer_non_clone);
|
LL | check_copy(&outer_non_clone);
|
||||||
| ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}`
|
| ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_copy`
|
note: required by a bound in `check_copy`
|
||||||
--> $DIR/clone-impl-async.rs:69:18
|
--> $DIR/clone-impl-async.rs:70:18
|
||||||
|
|
|
|
||||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||||
| ^^^^ required by this bound in `check_copy`
|
| ^^^^ required by this bound in `check_copy`
|
||||||
|
|
||||||
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}: Clone` is not satisfied
|
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Clone` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:28:17
|
--> $DIR/clone-impl-async.rs:29:17
|
||||||
|
|
|
|
||||||
LL | check_clone(&outer_non_clone);
|
LL | check_clone(&outer_non_clone);
|
||||||
| ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}`
|
| ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_clone`
|
note: required by a bound in `check_clone`
|
||||||
--> $DIR/clone-impl-async.rs:70:19
|
--> $DIR/clone-impl-async.rs:71:19
|
||||||
|
|
|
|
||||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||||
| ^^^^^ required by this bound in `check_clone`
|
| ^^^^^ required by this bound in `check_clone`
|
||||||
|
|
||||||
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}: Copy` is not satisfied
|
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Copy` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:32:16
|
--> $DIR/clone-impl-async.rs:33:16
|
||||||
|
|
|
|
||||||
LL | check_copy(&maybe_copy_clone);
|
LL | check_copy(&maybe_copy_clone);
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}`
|
| ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_copy`
|
note: required by a bound in `check_copy`
|
||||||
--> $DIR/clone-impl-async.rs:69:18
|
--> $DIR/clone-impl-async.rs:70:18
|
||||||
|
|
|
|
||||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||||
| ^^^^ required by this bound in `check_copy`
|
| ^^^^ required by this bound in `check_copy`
|
||||||
|
|
||||||
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}: Clone` is not satisfied
|
error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Clone` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:34:17
|
--> $DIR/clone-impl-async.rs:35:17
|
||||||
|
|
|
|
||||||
LL | check_clone(&maybe_copy_clone);
|
LL | check_clone(&maybe_copy_clone);
|
||||||
| ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}`
|
| ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_clone`
|
note: required by a bound in `check_clone`
|
||||||
--> $DIR/clone-impl-async.rs:70:19
|
--> $DIR/clone-impl-async.rs:71:19
|
||||||
|
|
|
|
||||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||||
| ^^^^^ required by this bound in `check_clone`
|
| ^^^^^ required by this bound in `check_clone`
|
||||||
|
|
||||||
error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
|
error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:38:16
|
--> $DIR/clone-impl-async.rs:39:16
|
||||||
|
|
|
|
||||||
LL | check_copy(&inner_non_clone_fn);
|
LL | check_copy(&inner_non_clone_fn);
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
|
| ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
|
||||||
@ -91,13 +91,13 @@ LL | check_copy(&inner_non_clone_fn);
|
|||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_copy`
|
note: required by a bound in `check_copy`
|
||||||
--> $DIR/clone-impl-async.rs:69:18
|
--> $DIR/clone-impl-async.rs:70:18
|
||||||
|
|
|
|
||||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||||
| ^^^^ required by this bound in `check_copy`
|
| ^^^^ required by this bound in `check_copy`
|
||||||
|
|
||||||
error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
|
error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:40:17
|
--> $DIR/clone-impl-async.rs:41:17
|
||||||
|
|
|
|
||||||
LL | check_clone(&inner_non_clone_fn);
|
LL | check_clone(&inner_non_clone_fn);
|
||||||
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
|
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
|
||||||
@ -105,13 +105,13 @@ LL | check_clone(&inner_non_clone_fn);
|
|||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_clone`
|
note: required by a bound in `check_clone`
|
||||||
--> $DIR/clone-impl-async.rs:70:19
|
--> $DIR/clone-impl-async.rs:71:19
|
||||||
|
|
|
|
||||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||||
| ^^^^^ required by this bound in `check_clone`
|
| ^^^^^ required by this bound in `check_clone`
|
||||||
|
|
||||||
error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
|
error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:44:16
|
--> $DIR/clone-impl-async.rs:45:16
|
||||||
|
|
|
|
||||||
LL | check_copy(&outer_non_clone_fn);
|
LL | check_copy(&outer_non_clone_fn);
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
|
| ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
|
||||||
@ -119,13 +119,13 @@ LL | check_copy(&outer_non_clone_fn);
|
|||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_copy`
|
note: required by a bound in `check_copy`
|
||||||
--> $DIR/clone-impl-async.rs:69:18
|
--> $DIR/clone-impl-async.rs:70:18
|
||||||
|
|
|
|
||||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||||
| ^^^^ required by this bound in `check_copy`
|
| ^^^^ required by this bound in `check_copy`
|
||||||
|
|
||||||
error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
|
error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:46:17
|
--> $DIR/clone-impl-async.rs:47:17
|
||||||
|
|
|
|
||||||
LL | check_clone(&outer_non_clone_fn);
|
LL | check_clone(&outer_non_clone_fn);
|
||||||
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
|
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
|
||||||
@ -133,13 +133,13 @@ LL | check_clone(&outer_non_clone_fn);
|
|||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_clone`
|
note: required by a bound in `check_clone`
|
||||||
--> $DIR/clone-impl-async.rs:70:19
|
--> $DIR/clone-impl-async.rs:71:19
|
||||||
|
|
|
|
||||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||||
| ^^^^^ required by this bound in `check_clone`
|
| ^^^^^ required by this bound in `check_clone`
|
||||||
|
|
||||||
error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
|
error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:50:16
|
--> $DIR/clone-impl-async.rs:51:16
|
||||||
|
|
|
|
||||||
LL | check_copy(&maybe_copy_clone_fn);
|
LL | check_copy(&maybe_copy_clone_fn);
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
|
| ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
|
||||||
@ -147,13 +147,13 @@ LL | check_copy(&maybe_copy_clone_fn);
|
|||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_copy`
|
note: required by a bound in `check_copy`
|
||||||
--> $DIR/clone-impl-async.rs:69:18
|
--> $DIR/clone-impl-async.rs:70:18
|
||||||
|
|
|
|
||||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||||
| ^^^^ required by this bound in `check_copy`
|
| ^^^^ required by this bound in `check_copy`
|
||||||
|
|
||||||
error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
|
error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
|
||||||
--> $DIR/clone-impl-async.rs:52:17
|
--> $DIR/clone-impl-async.rs:53:17
|
||||||
|
|
|
|
||||||
LL | check_clone(&maybe_copy_clone_fn);
|
LL | check_clone(&maybe_copy_clone_fn);
|
||||||
| ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
|
| ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
|
||||||
@ -161,7 +161,7 @@ LL | check_clone(&maybe_copy_clone_fn);
|
|||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_clone`
|
note: required by a bound in `check_clone`
|
||||||
--> $DIR/clone-impl-async.rs:70:19
|
--> $DIR/clone-impl-async.rs:71:19
|
||||||
|
|
|
|
||||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||||
| ^^^^^ required by this bound in `check_clone`
|
| ^^^^^ required by this bound in `check_clone`
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//@compile-flags: --diagnostic-width=300
|
||||||
// gate-test-coroutine_clone
|
// gate-test-coroutine_clone
|
||||||
// Verifies that static coroutines cannot be cloned/copied.
|
// Verifies that static coroutines cannot be cloned/copied.
|
||||||
|
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}: Copy` is not satisfied
|
error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}: Copy` is not satisfied
|
||||||
--> $DIR/clone-impl-static.rs:11:16
|
--> $DIR/clone-impl-static.rs:12:16
|
||||||
|
|
|
|
||||||
LL | check_copy(&gen);
|
LL | check_copy(&gen);
|
||||||
| ---------- ^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}`
|
| ---------- ^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_copy`
|
note: required by a bound in `check_copy`
|
||||||
--> $DIR/clone-impl-static.rs:17:18
|
--> $DIR/clone-impl-static.rs:18:18
|
||||||
|
|
|
|
||||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||||
| ^^^^ required by this bound in `check_copy`
|
| ^^^^ required by this bound in `check_copy`
|
||||||
|
|
||||||
error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}: Clone` is not satisfied
|
error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}: Clone` is not satisfied
|
||||||
--> $DIR/clone-impl-static.rs:13:17
|
--> $DIR/clone-impl-static.rs:14:17
|
||||||
|
|
|
|
||||||
LL | check_clone(&gen);
|
LL | check_clone(&gen);
|
||||||
| ----------- ^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}`
|
| ----------- ^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `check_clone`
|
note: required by a bound in `check_clone`
|
||||||
--> $DIR/clone-impl-static.rs:18:19
|
--> $DIR/clone-impl-static.rs:19:19
|
||||||
|
|
|
|
||||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||||
| ^^^^^ required by this bound in `check_clone`
|
| ^^^^^ required by this bound in `check_clone`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//@compile-flags: --edition 2024 -Zunstable-options
|
//@compile-flags: --edition 2024 -Zunstable-options --diagnostic-width=300
|
||||||
#![feature(coroutines, coroutine_trait, gen_blocks)]
|
#![feature(coroutines, coroutine_trait, gen_blocks)]
|
||||||
|
|
||||||
use std::ops::Coroutine;
|
use std::ops::Coroutine;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
//@ edition:2018
|
//@ edition:2018
|
||||||
|
//@compile-flags: --diagnostic-width=300
|
||||||
|
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}: Copy` is not satisfied
|
error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}: Copy` is not satisfied
|
||||||
--> $DIR/issue-55872-3.rs:13:20
|
--> $DIR/issue-55872-3.rs:14:20
|
||||||
|
|
|
|
||||||
LL | fn foo<T>() -> Self::E {
|
LL | fn foo<T>() -> Self::E {
|
||||||
| ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}`
|
| ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}`
|
||||||
LL |
|
LL |
|
||||||
LL | async {}
|
LL | async {}
|
||||||
| -------- return type was inferred to be `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}` here
|
| -------- return type was inferred to be `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}` here
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//@compile-flags: --diagnostic-width=300
|
||||||
// Check that closures do not implement `Clone` if their environment is not `Clone`.
|
// Check that closures do not implement `Clone` if their environment is not `Clone`.
|
||||||
|
|
||||||
struct S(i32);
|
struct S(i32);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
error[E0277]: the trait bound `S: Clone` is not satisfied in `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`
|
error[E0277]: the trait bound `S: Clone` is not satisfied in `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}`
|
||||||
--> $DIR/not-clone-closure.rs:11:23
|
--> $DIR/not-clone-closure.rs:12:23
|
||||||
|
|
|
|
||||||
LL | let hello = move || {
|
LL | let hello = move || {
|
||||||
| ------- within this `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`
|
| ------- within this `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}`
|
||||||
...
|
...
|
||||||
LL | let hello = hello.clone();
|
LL | let hello = hello.clone();
|
||||||
| ^^^^^ within `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`, the trait `Clone` is not implemented for `S`
|
| ^^^^^ within `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}`, the trait `Clone` is not implemented for `S`
|
||||||
|
|
|
|
||||||
note: required because it's used within this closure
|
note: required because it's used within this closure
|
||||||
--> $DIR/not-clone-closure.rs:7:17
|
--> $DIR/not-clone-closure.rs:8:17
|
||||||
|
|
|
|
||||||
LL | let hello = move || {
|
LL | let hello = move || {
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
2
x
2
x
@ -36,7 +36,7 @@ for SEARCH_PYTHON in py python3 python python2; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
python=$(bash -c "compgen -c python" | grep '^python[2-3]\.[0-9]\+$' | head -n1)
|
python=$(bash -c "compgen -c python" | grep '^python[2-3]\.[0-9]+$' | head -n1)
|
||||||
if ! [ "$python" = "" ]; then
|
if ! [ "$python" = "" ]; then
|
||||||
exec "$python" "$xpy" "$@"
|
exec "$python" "$xpy" "$@"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user