Auto merge of #130732 - matthiaskrgr:rollup-ke1j314, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #129550 (Add str.as_str() for easy Deref to string slices)
 - #130344 (Handle unsized consts with type `str`  in v0 symbol mangling)
 - #130659 (Support `char::encode_utf16` in const scenarios.)
 - #130705 (No longer mark RTN as incomplete)
 - #130712 (Don't call `ty::Const::normalize` in error reporting)
 - #130713 (Mark `u8::make_ascii_uppercase` and `u8::make_ascii_lowercase` as const.)
 - #130714 (Introduce `structurally_normalize_const`, use it in `rustc_hir_typeck`)
 - #130715 (Replace calls to `ty::Const::{try_}eval` in mir build/pattern analysis)
 - #130723 (Add test for `available_parallelism()`)
 - #130726 (tests: Remove spuriously failing vec-tryinto-array codegen test)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-09-23 04:56:10 +00:00
commit 702987f75b
120 changed files with 523 additions and 801 deletions

View File

@ -578,7 +578,7 @@ declare_features! (
/// be used to describe E or vise-versa.
(unstable, result_ffi_guarantees, "1.80.0", Some(110503)),
/// Allows bounding the return type of AFIT/RPITIT.
(incomplete, return_type_notation, "1.70.0", Some(109417)),
(unstable, return_type_notation, "1.70.0", Some(109417)),
/// Allows `extern "rust-cold"`.
(unstable, rust_cold_cc, "1.63.0", Some(97544)),
/// Allows use of x86 SHA512, SM3 and SM4 target-features and intrinsics

View File

@ -1668,10 +1668,17 @@ pub enum ArrayLen<'hir> {
}
impl ArrayLen<'_> {
pub fn hir_id(&self) -> HirId {
pub fn span(self) -> Span {
match self {
ArrayLen::Infer(InferArg { hir_id, .. }) | ArrayLen::Body(ConstArg { hir_id, .. }) => {
*hir_id
ArrayLen::Infer(arg) => arg.span,
ArrayLen::Body(body) => body.span(),
}
}
pub fn hir_id(self) -> HirId {
match self {
ArrayLen::Infer(InferArg { hir_id, .. }) | ArrayLen::Body(&ConstArg { hir_id, .. }) => {
hir_id
}
}
}

View File

@ -1491,8 +1491,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expr: &'tcx hir::Expr<'tcx>,
) -> Ty<'tcx> {
let tcx = self.tcx;
let count = self.lower_array_length(count);
if let Some(count) = count.try_eval_target_usize(tcx, self.param_env) {
let count_span = count.span();
let count = self.try_structurally_resolve_const(count_span, self.lower_array_length(count));
if let Some(count) = count.try_to_target_usize(tcx) {
self.suggest_array_len(expr, count);
}
@ -1520,19 +1522,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
return Ty::new_error(tcx, guar);
}
self.check_repeat_element_needs_copy_bound(element, count, element_ty);
// If the length is 0, we don't create any elements, so we don't copy any.
// If the length is 1, we don't copy that one element, we move it. Only check
// for `Copy` if the length is larger, or unevaluated.
// FIXME(min_const_generic_exprs): We could perhaps defer this check so that
// we don't require `<?0t as Tr>::CONST` doesn't unnecessarily require `Copy`.
if count.try_to_target_usize(tcx).is_none_or(|x| x > 1) {
self.enforce_repeat_element_needs_copy_bound(element, element_ty);
}
let ty = Ty::new_array_with_const_len(tcx, t, count);
self.register_wf_obligation(ty.into(), expr.span, ObligationCauseCode::WellFormed(None));
ty
}
fn check_repeat_element_needs_copy_bound(
/// Requires that `element_ty` is `Copy` (unless it's a const expression itself).
fn enforce_repeat_element_needs_copy_bound(
&self,
element: &hir::Expr<'_>,
count: ty::Const<'tcx>,
element_ty: Ty<'tcx>,
) {
let tcx = self.tcx;
@ -1565,9 +1572,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => traits::IsConstable::No,
};
// If the length is 0, we don't create any elements, so we don't copy any. If the length is 1, we
// don't copy that one element, we move it. Only check for Copy if the length is larger.
if count.try_eval_target_usize(tcx, self.param_env).is_none_or(|len| len > 1) {
let lang_item = self.tcx.require_lang_item(LangItem::Copy, None);
let code = traits::ObligationCauseCode::RepeatElementCopy {
is_constable,
@ -1586,7 +1590,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
self.require_type_meets(element_ty, element.span, code, lang_item);
}
}
fn check_expr_tuple(
&self,
@ -2800,9 +2803,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
len: ty::Const<'tcx>,
) {
err.span_label(field.span, "unknown field");
if let (Some(len), Ok(user_index)) =
(len.try_eval_target_usize(self.tcx, self.param_env), field.as_str().parse::<u64>())
{
if let (Some(len), Ok(user_index)) = (
self.try_structurally_resolve_const(base.span, len).try_to_target_usize(self.tcx),
field.as_str().parse::<u64>(),
) {
let help = "instead of using tuple indexing, use array indexing";
let applicability = if len < user_index {
Applicability::MachineApplicable

View File

@ -1470,6 +1470,33 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
#[instrument(level = "debug", skip(self, sp), ret)]
pub fn try_structurally_resolve_const(&self, sp: Span, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
// FIXME(min_const_generic_exprs): We could process obligations here if `ct` is a var.
if self.next_trait_solver()
&& let ty::ConstKind::Unevaluated(..) = ct.kind()
{
// We need to use a separate variable here as otherwise the temporary for
// `self.fulfillment_cx.borrow_mut()` is alive in the `Err` branch, resulting
// in a reentrant borrow, causing an ICE.
let result = self
.at(&self.misc(sp), self.param_env)
.structurally_normalize_const(ct, &mut **self.fulfillment_cx.borrow_mut());
match result {
Ok(normalized_ct) => normalized_ct,
Err(errors) => {
let guar = self.err_ctxt().report_fulfillment_errors(errors);
return ty::Const::new_error(self.tcx, guar);
}
}
} else if self.tcx.features().generic_const_exprs {
ct.normalize(self.tcx, self.param_env)
} else {
ct
}
}
/// Resolves `ty` by a single level if `ty` is a type variable.
///
/// When the new solver is enabled, this will also attempt to normalize

View File

@ -1502,7 +1502,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Create an dummy type `&[_]` so that both &[] and `&Vec<T>` can coerce to it.
let dummy_ty = if let ty::Array(elem_ty, size) = peeled.kind()
&& let ty::Infer(_) = elem_ty.kind()
&& size.try_eval_target_usize(self.tcx, self.param_env) == Some(0)
&& self
.try_structurally_resolve_const(provided_expr.span, *size)
.try_to_target_usize(self.tcx)
== Some(0)
{
let slice = Ty::new_slice(self.tcx, *elem_ty);
Ty::new_imm_ref(self.tcx, self.tcx.lifetimes.re_static, slice)

View File

@ -101,7 +101,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
Ok(SizeSkeleton::Generic(size)) => {
if let Some(size) = size.try_eval_target_usize(tcx, self.param_env) {
if let Some(size) =
self.try_structurally_resolve_const(span, size).try_to_target_usize(tcx)
{
format!("{size} bytes")
} else {
format!("generic size {size}")

View File

@ -1721,20 +1721,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
if item_name.name == sym::as_str && rcvr_ty.peel_refs().is_str() {
let msg = "remove this method call";
let mut fallback_span = true;
if let SelfSource::MethodCall(expr) = source {
let call_expr = self.tcx.hir().expect_expr(self.tcx.parent_hir_id(expr.hir_id));
if let Some(span) = call_expr.span.trim_start(expr.span) {
err.span_suggestion(span, msg, "", Applicability::MachineApplicable);
fallback_span = false;
}
}
if fallback_span {
err.span_label(span, msg);
}
} else if let Some(similar_candidate) = similar_candidate {
if let Some(similar_candidate) = similar_candidate {
// Don't emit a suggestion if we found an actual method
// that had unsatisfied trait bounds
if unsatisfied_predicates.is_empty()

View File

@ -2412,7 +2412,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
len: ty::Const<'tcx>,
min_len: u64,
) -> (Option<Ty<'tcx>>, Ty<'tcx>) {
let len = len.try_eval_target_usize(self.tcx, self.param_env);
let len = self.try_structurally_resolve_const(span, len).try_to_target_usize(self.tcx);
let guar = if let Some(len) = len {
// Now we know the length...

View File

@ -57,7 +57,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
this.in_scope(region_scope, lint_level, |this| this.as_rvalue(block, scope, value))
}
ExprKind::Repeat { value, count } => {
if Some(0) == count.try_eval_target_usize(this.tcx, this.param_env) {
if Some(0) == count.try_to_target_usize(this.tcx) {
this.build_zero_repeat(block, value, scope, source_info)
} else {
let value_operand = unpack!(

View File

@ -42,7 +42,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let tcx = self.tcx;
let (min_length, exact_size) = if let Some(place_resolved) = place.try_to_place(self) {
match place_resolved.ty(&self.local_decls, tcx).ty.kind() {
ty::Array(_, length) => (length.eval_target_usize(tcx, self.param_env), true),
ty::Array(_, length) => (
length
.try_to_target_usize(tcx)
.expect("expected len of array pat to be definite"),
true,
),
_ => ((prefix.len() + suffix.len()).try_into().unwrap(), false),
}
} else {

View File

@ -441,7 +441,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
ty::Slice(..) => PatKind::Slice { prefix, slice, suffix },
// Fixed-length array, `[T; len]`.
ty::Array(_, len) => {
let len = len.eval_target_usize(self.tcx, self.param_env);
let len = len
.try_to_target_usize(self.tcx)
.expect("expected len of array pat to be definite");
assert!(len >= prefix.len() as u64 + suffix.len() as u64);
PatKind::Array { prefix, slice, suffix }
}

View File

@ -352,7 +352,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
ty::Array(sub_ty, len) => {
// We treat arrays of a constant but unknown length like slices.
ConstructorSet::Slice {
array_len: len.try_eval_target_usize(cx.tcx, cx.param_env).map(|l| l as usize),
array_len: len.try_to_target_usize(cx.tcx).map(|l| l as usize),
subtype_is_empty: cx.is_uninhabited(*sub_ty),
}
}
@ -685,9 +685,12 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
}
PatKind::Array { prefix, slice, suffix } | PatKind::Slice { prefix, slice, suffix } => {
let array_len = match ty.kind() {
ty::Array(_, length) => {
Some(length.eval_target_usize(cx.tcx, cx.param_env) as usize)
}
ty::Array(_, length) => Some(
length
.try_to_target_usize(cx.tcx)
.expect("expected len of array pat to be definite")
as usize,
),
ty::Slice(_) => None,
_ => span_bug!(pat.span, "bad ty {} for slice pattern", ty.inner()),
};

View File

@ -607,27 +607,18 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
let _ = write!(self.out, "{bits:x}_");
}
// FIXME(valtrees): Remove the special case for `str`
// here and fully support unsized constants.
ty::Ref(_, inner_ty, mutbl) => {
self.push(match mutbl {
hir::Mutability::Not => "R",
hir::Mutability::Mut => "Q",
// Handle `str` as partial support for unsized constants
ty::Str => {
let tcx = self.tcx();
// HACK(jaic1): hide the `str` type behind a reference
// for the following transformation from valtree to raw bytes
let ref_ty = Ty::new_imm_ref(tcx, tcx.lifetimes.re_static, ct_ty);
let slice = valtree.try_to_raw_bytes(tcx, ref_ty).unwrap_or_else(|| {
bug!("expected to get raw bytes from valtree {:?} for type {:}", valtree, ct_ty)
});
let s = std::str::from_utf8(slice).expect("non utf8 str from MIR interpreter");
match inner_ty.kind() {
ty::Str if mutbl.is_not() => {
let slice =
valtree.try_to_raw_bytes(self.tcx(), ct_ty).unwrap_or_else(|| {
bug!(
"expected to get raw bytes from valtree {:?} for type {:}",
valtree,
ct_ty
)
});
let s =
std::str::from_utf8(slice).expect("non utf8 str from MIR interpreter");
// "e" for str as a basic type
self.push("e");
// FIXME(eddyb) use a specialized hex-encoding loop.
@ -637,16 +628,20 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
self.push("_");
}
_ => {
let pointee_ty = ct_ty
.builtin_deref(true)
.expect("tried to dereference on non-ptr type");
let dereferenced_const =
ty::Const::new_value(self.tcx, valtree, pointee_ty);
// FIXME(valtrees): Remove the special case for `str`
// here and fully support unsized constants.
ty::Ref(_, _, mutbl) => {
self.push(match mutbl {
hir::Mutability::Not => "R",
hir::Mutability::Mut => "Q",
});
let pointee_ty =
ct_ty.builtin_deref(true).expect("tried to dereference on non-ptr type");
let dereferenced_const = ty::Const::new_value(self.tcx, valtree, pointee_ty);
dereferenced_const.print(self)?;
}
}
}
ty::Array(..) | ty::Tuple(..) | ty::Adt(..) | ty::Slice(_) => {
let contents = self.tcx.destructure_const(ct);

View File

@ -17,7 +17,7 @@ use rustc_middle::traits::SignatureMismatchData;
use rustc_middle::traits::select::OverflowError;
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
use rustc_middle::ty::error::{ExpectedFound, TypeError};
use rustc_middle::ty::fold::{BottomUpFolder, TypeFolder, TypeSuperFoldable};
use rustc_middle::ty::fold::{TypeFolder, TypeSuperFoldable};
use rustc_middle::ty::print::{
FmtPrinter, Print, PrintTraitPredicateExt as _, PrintTraitRefExt as _,
with_forced_trimmed_paths,
@ -1788,22 +1788,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
return false;
}
let cand = self.resolve_vars_if_possible(impl_trait_ref).fold_with(
&mut BottomUpFolder {
tcx: self.tcx,
ty_op: |ty| ty,
lt_op: |lt| lt,
ct_op: |ct| ct.normalize(self.tcx, ty::ParamEnv::empty()),
},
);
if cand.references_error() {
let impl_trait_ref = self.resolve_vars_if_possible(impl_trait_ref);
if impl_trait_ref.references_error() {
return false;
}
err.highlighted_help(vec![
StringPart::normal(format!("the trait `{}` ", cand.print_trait_sugared())),
StringPart::normal(format!(
"the trait `{}` ",
impl_trait_ref.print_trait_sugared()
)),
StringPart::highlighted("is"),
StringPart::normal(" implemented for `"),
StringPart::highlighted(cand.self_ty().to_string()),
StringPart::highlighted(impl_trait_ref.self_ty().to_string()),
StringPart::normal("`"),
]);
@ -1915,15 +1911,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let mut impl_candidates: Vec<_> = impl_candidates
.iter()
.cloned()
.filter(|cand| !cand.trait_ref.references_error())
.map(|mut cand| {
// Fold the consts so that they shows up as, e.g., `10`
// instead of `core::::array::{impl#30}::{constant#0}`.
cand.trait_ref = cand.trait_ref.fold_with(&mut BottomUpFolder {
tcx: self.tcx,
ty_op: |ty| ty,
lt_op: |lt| lt,
ct_op: |ct| ct.normalize(self.tcx, ty::ParamEnv::empty()),
});
// Normalize the trait ref in its *own* param-env so
// that consts are folded and any trivial projections
// are normalized.
cand.trait_ref = self
.tcx
.try_normalize_erasing_regions(
self.tcx.param_env(cand.impl_def_id),
cand.trait_ref,
)
.unwrap_or(cand.trait_ref);
cand
})
.collect();

View File

@ -4620,7 +4620,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
format!("&{}{ty}", mutability.prefix_str())
}
}
ty::Array(ty, len) if let Some(len) = len.try_eval_target_usize(tcx, param_env) => {
ty::Array(ty, len) if let Some(len) = len.try_to_target_usize(tcx) => {
if len == 0 {
"[]".to_string()
} else if self.type_is_copy_modulo_regions(param_env, ty) || len == 1 {

View File

@ -46,4 +46,44 @@ impl<'tcx> At<'_, 'tcx> {
Ok(self.normalize(ty).into_value_registering_obligations(self.infcx, fulfill_cx))
}
}
fn structurally_normalize_const<E: 'tcx>(
&self,
ct: ty::Const<'tcx>,
fulfill_cx: &mut dyn TraitEngine<'tcx, E>,
) -> Result<ty::Const<'tcx>, Vec<E>> {
assert!(!ct.is_ct_infer(), "should have resolved vars before calling");
if self.infcx.next_trait_solver() {
let ty::ConstKind::Unevaluated(..) = ct.kind() else {
return Ok(ct);
};
let new_infer_ct = self.infcx.next_const_var(self.cause.span);
// We simply emit an `alias-eq` goal here, since that will take care of
// normalizing the LHS of the projection until it is a rigid projection
// (or a not-yet-defined opaque in scope).
let obligation = Obligation::new(
self.infcx.tcx,
self.cause.clone(),
self.param_env,
ty::PredicateKind::AliasRelate(
ct.into(),
new_infer_ct.into(),
ty::AliasRelationDirection::Equate,
),
);
fulfill_cx.register_predicate_obligation(self.infcx, obligation);
let errors = fulfill_cx.select_where_possible(self.infcx);
if !errors.is_empty() {
return Err(errors);
}
Ok(self.infcx.resolve_vars_if_possible(new_infer_ct))
} else {
Ok(self.normalize(ct).into_value_registering_obligations(self.infcx, fulfill_cx))
}
}
}

View File

@ -93,6 +93,7 @@
// tidy-alphabetical-start
#![cfg_attr(not(no_global_oom_handling), feature(const_alloc_error))]
#![cfg_attr(not(no_global_oom_handling), feature(const_btree_len))]
#![cfg_attr(test, feature(str_as_str))]
#![feature(alloc_layout_extra)]
#![feature(allocator_api)]
#![feature(array_chunks)]

View File

@ -448,7 +448,11 @@ fn test_from_box_str() {
use std::string::String;
let s = String::from("foo").into_boxed_str();
assert_eq!((&&&s).as_str(), "foo");
let r: Rc<str> = Rc::from(s);
assert_eq!((&r).as_str(), "foo");
assert_eq!(r.as_str(), "foo");
assert_eq!(&r[..], "foo");
}

View File

@ -638,8 +638,7 @@ impl char {
#[rustc_const_stable(feature = "const_char_len_utf", since = "1.52.0")]
#[inline]
pub const fn len_utf16(self) -> usize {
let ch = self as u32;
if (ch & 0xFFFF) == ch { 1 } else { 2 }
len_utf16(self as u32)
}
/// Encodes this character as UTF-8 into the provided byte buffer,
@ -709,8 +708,9 @@ impl char {
/// '𝕊'.encode_utf16(&mut b);
/// ```
#[stable(feature = "unicode_encode_char", since = "1.15.0")]
#[rustc_const_unstable(feature = "const_char_encode_utf16", issue = "130660")]
#[inline]
pub fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] {
pub const fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] {
encode_utf16_raw(self as u32, dst)
}
@ -1279,7 +1279,7 @@ impl char {
///
/// [`to_ascii_uppercase()`]: #method.to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_char_make_ascii", issue = "130698")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[inline]
pub const fn make_ascii_uppercase(&mut self) {
*self = self.to_ascii_uppercase();
@ -1305,7 +1305,7 @@ impl char {
///
/// [`to_ascii_lowercase()`]: #method.to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_char_make_ascii", issue = "130698")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[inline]
pub const fn make_ascii_lowercase(&mut self) {
*self = self.to_ascii_lowercase();
@ -1747,7 +1747,12 @@ const fn len_utf8(code: u32) -> usize {
}
}
/// Encodes a raw u32 value as UTF-8 into the provided byte buffer,
#[inline]
const fn len_utf16(code: u32) -> usize {
if (code & 0xFFFF) == code { 1 } else { 2 }
}
/// Encodes a raw `u32` value as UTF-8 into the provided byte buffer,
/// and then returns the subslice of the buffer that contains the encoded character.
///
/// Unlike `char::encode_utf8`, this method also handles codepoints in the surrogate range.
@ -1801,7 +1806,7 @@ pub const fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> &mut [u8] {
unsafe { slice::from_raw_parts_mut(dst.as_mut_ptr(), len) }
}
/// Encodes a raw u32 value as UTF-16 into the provided `u16` buffer,
/// Encodes a raw `u32` value as UTF-16 into the provided `u16` buffer,
/// and then returns the subslice of the buffer that contains the encoded character.
///
/// Unlike `char::encode_utf16`, this method also handles codepoints in the surrogate range.
@ -1812,28 +1817,33 @@ pub const fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> &mut [u8] {
/// Panics if the buffer is not large enough.
/// A buffer of length 2 is large enough to encode any `char`.
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
#[rustc_const_unstable(feature = "const_char_encode_utf16", issue = "130660")]
#[doc(hidden)]
#[inline]
pub fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] {
// SAFETY: each arm checks whether there are enough bits to write into
unsafe {
if (code & 0xFFFF) == code && !dst.is_empty() {
// The BMP falls through
*dst.get_unchecked_mut(0) = code as u16;
slice::from_raw_parts_mut(dst.as_mut_ptr(), 1)
} else if dst.len() >= 2 {
// Supplementary planes break into surrogates.
code -= 0x1_0000;
*dst.get_unchecked_mut(0) = 0xD800 | ((code >> 10) as u16);
*dst.get_unchecked_mut(1) = 0xDC00 | ((code as u16) & 0x3FF);
slice::from_raw_parts_mut(dst.as_mut_ptr(), 2)
} else {
pub const fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] {
const fn panic_at_const(_code: u32, _len: usize, _dst_len: usize) {
// Note that we cannot format in constant expressions.
panic!("encode_utf16: buffer does not have enough bytes to encode code point");
}
fn panic_at_rt(code: u32, len: usize, dst_len: usize) {
panic!(
"encode_utf16: need {} units to encode U+{:X}, but the buffer has {}",
char::from_u32_unchecked(code).len_utf16(),
code,
dst.len(),
)
"encode_utf16: need {len} bytes to encode U+{code:04X} but buffer has just {dst_len}",
);
}
let len = len_utf16(code);
match (len, &mut *dst) {
(1, [a, ..]) => {
*a = code as u16;
}
(2, [a, b, ..]) => {
code -= 0x1_0000;
*a = (code >> 10) as u16 | 0xD800;
*b = (code & 0x3FF) as u16 | 0xDC00;
}
// FIXME(const-hack): We would prefer to have streamlined panics when formatters become const-friendly.
_ => const_eval_select((code, len, dst.len()), panic_at_const, panic_at_rt),
};
// SAFETY: `<&mut [u16]>::as_mut_ptr` is guaranteed to return a valid pointer and `len` has been tested to be within bounds.
unsafe { slice::from_raw_parts_mut(dst.as_mut_ptr(), len) }
}

View File

@ -119,6 +119,7 @@
#![feature(const_bigint_helper_methods)]
#![feature(const_black_box)]
#![feature(const_cell_into_inner)]
#![feature(const_char_encode_utf16)]
#![feature(const_char_encode_utf8)]
#![feature(const_eval_select)]
#![feature(const_exact_div)]

View File

@ -624,8 +624,9 @@ impl u8 {
///
/// [`to_ascii_uppercase`]: Self::to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[inline]
pub fn make_ascii_uppercase(&mut self) {
pub const fn make_ascii_uppercase(&mut self) {
*self = self.to_ascii_uppercase();
}
@ -649,8 +650,9 @@ impl u8 {
///
/// [`to_ascii_lowercase`]: Self::to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[inline]
pub fn make_ascii_lowercase(&mut self) {
pub const fn make_ascii_lowercase(&mut self) {
*self = self.to_ascii_lowercase();
}

View File

@ -2740,6 +2740,17 @@ impl str {
pub fn substr_range(&self, substr: &str) -> Option<Range<usize>> {
self.as_bytes().subslice_range(substr.as_bytes())
}
/// Returns the same string as a string slice `&str`.
///
/// This method is redundant when used directly on `&str`, but
/// it helps dereferencing other string-like types to string slices,
/// for example references to `Box<str>` or `Arc<str>`.
#[inline]
#[unstable(feature = "str_as_str", issue = "130366")]
pub fn as_str(&self) -> &str {
self
}
}
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -37,3 +37,21 @@ fn thread_local_containing_const_statements() {
assert_eq!(CELL.get(), 1);
assert_eq!(REFCELL.take(), 1);
}
#[test]
// Include an ignore list on purpose, so that new platforms don't miss it
#[cfg_attr(
any(
target_os = "redox",
target_os = "l4re",
target_env = "sgx",
target_os = "solid_asp3",
target_os = "teeos",
target_os = "wasi"
),
should_panic
)]
fn available_parallelism() {
// check that std::thread::available_parallelism() returns a valid value
assert!(thread::available_parallelism().is_ok());
}

View File

@ -1,22 +0,0 @@
//@ compile-flags: -O
// This regress since Rust version 1.72.
//@ min-llvm-version: 18.1.4
#![crate_type = "lib"]
use std::convert::TryInto;
const N: usize = 24;
// CHECK-LABEL: @example
// CHECK-NOT: unwrap_failed
#[no_mangle]
pub fn example(a: Vec<u8>) -> u8 {
if a.len() != 32 {
return 0;
}
let a: [u8; 32] = a.try_into().unwrap();
a[15] + a[N]
}

View File

@ -1,7 +1,6 @@
//@ edition: 2021
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
async fn method() {}

View File

@ -1,66 +1,57 @@
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:28:36
--> $DIR/bad-inputs-and-output.rs:27:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
--> $DIR/bad-inputs-and-output.rs:30:36
|
LL | fn bar_qualified<T: Trait>() where <T as Trait>::method() -> (): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:34:36
--> $DIR/bad-inputs-and-output.rs:33:36
|
LL | fn baz_qualified<T: Trait>() where <T as Trait>::method(): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^ not a associated type
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: argument types not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:10:23
--> $DIR/bad-inputs-and-output.rs:9:23
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^ help: remove the input types: `()`
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:13:25
--> $DIR/bad-inputs-and-output.rs:12:25
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^ help: remove the return type
error: return type notation arguments must be elided with `..`
--> $DIR/bad-inputs-and-output.rs:16:23
--> $DIR/bad-inputs-and-output.rs:15:23
|
LL | fn baz<T: Trait<method(): Send>>() {}
| ^^ help: add `..`: `(..)`
error: argument types not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:19:40
--> $DIR/bad-inputs-and-output.rs:18:40
|
LL | fn foo_path<T: Trait>() where T::method(i32): Send {}
| ^^^^^ help: remove the input types: `()`
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:22:42
--> $DIR/bad-inputs-and-output.rs:21:42
|
LL | fn bar_path<T: Trait>() where T::method() -> (): Send {}
| ^^^^^^ help: remove the return type
error: return type notation arguments must be elided with `..`
--> $DIR/bad-inputs-and-output.rs:25:40
--> $DIR/bad-inputs-and-output.rs:24:40
|
LL | fn baz_path<T: Trait>() where T::method(): Send {}
| ^^ help: add `..`: `(..)`
error: aborting due to 9 previous errors; 1 warning emitted
error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0575`.

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Tr {
const CONST: usize;

View File

@ -1,23 +1,14 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bare-path.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation not allowed in this position yet
--> $DIR/bare-path.rs:15:23
--> $DIR/bare-path.rs:14:23
|
LL | let _ = T::CONST::(..);
| ^^^^
error: return type notation not allowed in this position yet
--> $DIR/bare-path.rs:17:12
--> $DIR/bare-path.rs:16:12
|
LL | let _: T::method(..);
| ^^^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors

View File

@ -3,7 +3,6 @@
//@ [with] check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
async fn method() -> Result<(), ()>;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:5:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,29 +1,20 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:5:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: future cannot be sent between threads safely
--> $DIR/basic.rs:23:13
--> $DIR/basic.rs:22:13
|
LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }`, which is required by `impl Future<Output = Result<(), ()>>: Send`
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:13:5
--> $DIR/basic.rs:12:5
|
LL | T::method().await?;
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }`, which is not `Send`
note: required by a bound in `is_send`
--> $DIR/basic.rs:17:20
--> $DIR/basic.rs:16:20
|
LL | fn is_send(_: impl Send) {}
| ^^^^ required by this bound in `is_send`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {}
fn needs_trait(_: impl Trait) {}

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/display.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `impl Sized { <T as Assoc>::method(..) }: Trait` is not satisfied
--> $DIR/display.rs:15:17
--> $DIR/display.rs:14:17
|
LL | needs_trait(T::method());
| ----------- ^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method(..) }`
@ -16,13 +7,13 @@ LL | needs_trait(T::method());
| required by a bound introduced by this call
|
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
--> $DIR/display.rs:4:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error[E0277]: the trait bound `impl Sized { <T as Assoc>::method_with_lt(..) }: Trait` is not satisfied
--> $DIR/display.rs:17:17
--> $DIR/display.rs:16:17
|
LL | needs_trait(T::method_with_lt());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method_with_lt(..) }`
@ -30,13 +21,13 @@ LL | needs_trait(T::method_with_lt());
| required by a bound introduced by this call
|
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
--> $DIR/display.rs:4:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error[E0277]: the trait bound `impl Sized: Trait` is not satisfied
--> $DIR/display.rs:19:17
--> $DIR/display.rs:18:17
|
LL | needs_trait(T::method_with_ty());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized`
@ -44,18 +35,18 @@ LL | needs_trait(T::method_with_ty());
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/display.rs:4:1
--> $DIR/display.rs:3:1
|
LL | trait Trait {}
| ^^^^^^^^^^^
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
--> $DIR/display.rs:4:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error[E0277]: the trait bound `impl Sized: Trait` is not satisfied
--> $DIR/display.rs:21:17
--> $DIR/display.rs:20:17
|
LL | needs_trait(T::method_with_ct());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized`
@ -63,16 +54,16 @@ LL | needs_trait(T::method_with_ct());
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/display.rs:4:1
--> $DIR/display.rs:3:1
|
LL | trait Trait {}
| ^^^^^^^^^^^
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
--> $DIR/display.rs:4:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`
error: aborting due to 4 previous errors; 1 warning emitted
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,7 +1,6 @@
//@ edition: 2021
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;

View File

@ -1,17 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed to use type equality
--> $DIR/equality.rs:12:18
--> $DIR/equality.rs:11:18
|
LL | fn test<T: Trait<method(..) = Box<dyn Future<Output = ()>>>>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error

View File

@ -1,7 +1,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait<'a> {
fn late<'b>(&'b self, _: &'a ()) -> impl Sized;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/higher-ranked-bound-works.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,7 +1,6 @@
//@ edition: 2021
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait HealthCheck {
async fn check<const N: usize>() -> bool;

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-120208-higher-ranked-const.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed for functions that have const parameters
--> $DIR/issue-120208-higher-ranked-const.rs:12:21
--> $DIR/issue-120208-higher-ranked-const.rs:11:21
|
LL | async fn check<const N: usize>() -> bool;
| -------------- const parameter declared here
@ -16,5 +7,5 @@ LL | async fn check<const N: usize>() -> bool;
LL | HC: HealthCheck<check(..): Send> + Send + 'static,
| ^^^^^^^^^^^^^^^
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error

View File

@ -1,7 +1,6 @@
//@ edition: 2021
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
async fn method() {}

View File

@ -1,18 +1,9 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/missing.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0220]: associated function `methid` not found for `Trait`
--> $DIR/missing.rs:10:17
--> $DIR/missing.rs:9:17
|
LL | fn bar<T: Trait<methid(..): Send>>() {}
| ^^^^^^ help: there is an associated function with a similar name: `method`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0220`.

View File

@ -2,7 +2,6 @@
#![allow(non_camel_case_types)]
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
type test;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/namespace-conflict.rs:4:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
fn method() {}

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/non-rpitit.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation used on function that is not `async` and does not return `impl Trait`
--> $DIR/non-rpitit.rs:8:19
--> $DIR/non-rpitit.rs:7:19
|
LL | fn method() {}
| ----------- this function must be `async` or return `impl Trait`
@ -19,7 +10,7 @@ LL | fn bound<T: Trait<method(..): Send>>() {}
= note: function returns `()`, which is not compatible with associated type return bounds
error: return type notation used on function that is not `async` and does not return `impl Trait`
--> $DIR/non-rpitit.rs:11:30
--> $DIR/non-rpitit.rs:10:30
|
LL | fn method() {}
| ----------- this function must be `async` or return `impl Trait`
@ -29,5 +20,5 @@ LL | fn path<T>() where T: Trait, T::method(..): Send {}
|
= note: function returns `()`, which is not compatible with associated type return bounds
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
fn function() {}

View File

@ -1,49 +1,40 @@
error[E0575]: expected function, found function `function`
--> $DIR/not-a-method.rs:8:5
--> $DIR/not-a-method.rs:7:5
|
LL | function(..): Send,
| ^^^^^^^^^^^^ not a function
error[E0573]: expected type, found function `function`
--> $DIR/not-a-method.rs:16:5
--> $DIR/not-a-method.rs:15:5
|
LL | function(): Send,
| ^^^^^^^^^^ not a type
error[E0576]: cannot find function `method` in this scope
--> $DIR/not-a-method.rs:28:5
--> $DIR/not-a-method.rs:27:5
|
LL | method(..): Send,
| ^^^^^^ not found in this scope
error[E0412]: cannot find type `method` in this scope
--> $DIR/not-a-method.rs:37:5
--> $DIR/not-a-method.rs:36:5
|
LL | method(): Send,
| ^^^^^^ not found in this scope
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/not-a-method.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation not allowed in this position yet
--> $DIR/not-a-method.rs:8:5
--> $DIR/not-a-method.rs:7:5
|
LL | function(..): Send,
| ^^^^^^^^^^^^
error: return type notation not allowed in this position yet
--> $DIR/not-a-method.rs:28:5
--> $DIR/not-a-method.rs:27:5
|
LL | method(..): Send,
| ^^^^^^^^^^
error: aborting due to 6 previous errors; 1 warning emitted
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0412, E0573, E0575, E0576.
For more information about an error, try `rustc --explain E0412`.

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait A {
fn method() -> impl Sized;

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-ambiguous.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0221]: ambiguous associated function `method` in bounds of `T`
--> $DIR/path-ambiguous.rs:13:5
--> $DIR/path-ambiguous.rs:12:5
|
LL | fn method() -> impl Sized;
| -------------------------- ambiguous `method` from `A`
@ -29,7 +20,7 @@ LL | <T as A>::method(..): Send,
| ~~~~~~~~~~
error[E0221]: ambiguous associated function `method` in bounds of `T`
--> $DIR/path-ambiguous.rs:22:5
--> $DIR/path-ambiguous.rs:21:5
|
LL | fn method() -> impl Sized;
| -------------------------- ambiguous `method` from `A`
@ -49,6 +40,6 @@ help: use fully-qualified syntax to disambiguate
LL | <T as A>::method(..): Send,
| ~~~~~~~~~~
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0221`.

View File

@ -1,7 +1,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
fn method() -> impl Sized;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-constrained-in-method.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait A<'a> {
fn method() -> impl Sized;

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-higher-ranked.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0212]: cannot use the associated function of a trait with uninferred generic parameters
--> $DIR/path-higher-ranked.rs:12:5
--> $DIR/path-higher-ranked.rs:11:5
|
LL | T::method(..): Send,
| ^^^^^^^^^^^^^
@ -19,7 +10,7 @@ LL | <T as A<'_>>::method(..): Send,
| ~~~~~~~~~~~~~~
error[E0212]: cannot use the associated function of a trait with uninferred generic parameters
--> $DIR/path-higher-ranked.rs:20:5
--> $DIR/path-higher-ranked.rs:19:5
|
LL | T::method(..): Send,
| ^^^^^^^^^^^^^
@ -29,6 +20,6 @@ help: use a fully qualified path with inferred lifetimes
LL | <T as A<'_>>::method(..): Send,
| ~~~~~~~~~~~~~~
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0212`.

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait A {
#[allow(non_camel_case_types)]

View File

@ -1,33 +1,24 @@
error[E0576]: cannot find method or associated constant `method` in trait `A`
--> $DIR/path-missing.rs:11:15
--> $DIR/path-missing.rs:10:15
|
LL | <T as A>::method(..): Send,
| ^^^^^^ not found in `A`
error[E0575]: expected method or associated constant, found associated type `A::bad`
--> $DIR/path-missing.rs:13:5
--> $DIR/path-missing.rs:12:5
|
LL | <T as A>::bad(..): Send,
| ^^^^^^^^^^^^^^^^^
|
= note: can't use a type alias as a constructor
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-missing.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0220]: associated function `method` not found for `T`
--> $DIR/path-missing.rs:20:8
--> $DIR/path-missing.rs:19:8
|
LL | T::method(..): Send,
| ^^^^^^ associated function `method` not found
error: aborting due to 3 previous errors; 1 warning emitted
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0220, E0575, E0576.
For more information about an error, try `rustc --explain E0220`.

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
fn method() -> impl Sized;

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-no-qself.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0223]: ambiguous associated type
--> $DIR/path-no-qself.rs:10:5
--> $DIR/path-no-qself.rs:9:5
|
LL | Trait::method(..): Send,
| ^^^^^^^^^^^^^^^^^
@ -18,6 +9,6 @@ help: if there were a type named `Example` that implemented `Trait`, you could u
LL | <Example as Trait>::method: Send,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0223`.

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
fn method() -> impl Sized;

View File

@ -1,30 +1,21 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-non-param-qself.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0223]: ambiguous associated function
--> $DIR/path-non-param-qself.rs:12:5
--> $DIR/path-non-param-qself.rs:11:5
|
LL | <()>::method(..): Send,
| ^^^^^^^^^^^^^^^^
error[E0223]: ambiguous associated function
--> $DIR/path-non-param-qself.rs:14:5
--> $DIR/path-non-param-qself.rs:13:5
|
LL | i32::method(..): Send,
| ^^^^^^^^^^^^^^^
error[E0223]: ambiguous associated function
--> $DIR/path-non-param-qself.rs:16:5
--> $DIR/path-non-param-qself.rs:15:5
|
LL | Adt::method(..): Send,
| ^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors; 1 warning emitted
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0223`.

View File

@ -1,7 +1,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
fn method() -> impl Sized;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-self-qself.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
fn method<T>() -> impl Sized;

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-type-param.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed for functions that have type parameters
--> $DIR/path-type-param.rs:10:5
--> $DIR/path-type-param.rs:9:5
|
LL | fn method<T>() -> impl Sized;
| - type parameter declared here
@ -17,7 +8,7 @@ LL | <T as Foo>::method(..): Send,
| ^^^^^^^^^^^^^^^^^^^^^^
error: return type notation is not allowed for functions that have type parameters
--> $DIR/path-type-param.rs:17:5
--> $DIR/path-type-param.rs:16:5
|
LL | fn method<T>() -> impl Sized;
| - type parameter declared here
@ -25,5 +16,5 @@ LL | fn method<T>() -> impl Sized;
LL | <T as Foo>::method(..): Send,
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
fn method() -> impl Sized;

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-unsatisfied.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: `*mut ()` cannot be sent between threads safely
--> $DIR/path-unsatisfied.rs:23:12
--> $DIR/path-unsatisfied.rs:22:12
|
LL | fn method() -> impl Sized {
| ---------- within this `impl Sized`
@ -18,12 +9,12 @@ LL | test::<DoesntWork>();
|
= help: within `impl Sized`, the trait `Send` is not implemented for `*mut ()`, which is required by `impl Sized: Send`
note: required because it appears within the type `impl Sized`
--> $DIR/path-unsatisfied.rs:10:20
--> $DIR/path-unsatisfied.rs:9:20
|
LL | fn method() -> impl Sized {
| ^^^^^^^^^^
note: required by a bound in `test`
--> $DIR/path-unsatisfied.rs:18:20
--> $DIR/path-unsatisfied.rs:17:20
|
LL | fn test<T: Trait>()
| ---- required by a bound in this function
@ -31,6 +22,6 @@ LL | where
LL | T::method(..): Send,
| ^^^^ required by this bound in `test`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,7 +1,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
fn method() -> impl Sized;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/path-works.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,12 +1,3 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-110963-early.rs:4:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: implementation of `Send` is not general enough
--> $DIR/issue-110963-early.rs:14:5
|
@ -36,5 +27,5 @@ LL | | });
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>(..) }`, for some specific lifetime `'2`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors

View File

@ -2,7 +2,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait HealthCheck {
async fn check(&mut self) -> bool;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-110963-late.rs:4:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -5,7 +5,6 @@
//@ edition:2021
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
async fn bar(&self);

View File

@ -2,7 +2,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/rtn-implied-in-supertrait.rs:4:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,5 +1,4 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
// Shouldn't ICE when we have a (bad) RTN in an impl header

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/rtn-in-impl-signature.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0229]: associated item constraints are not allowed here
--> $DIR/rtn-in-impl-signature.rs:10:17
--> $DIR/rtn-in-impl-signature.rs:9:17
|
LL | impl Super1<'_, bar(..): Send> for () {}
| ^^^^^^^^^^^^^ associated item constraint not allowed here
@ -20,7 +11,7 @@ LL + impl Super1<'_> for () {}
|
error[E0046]: not all trait items implemented, missing: `bar`
--> $DIR/rtn-in-impl-signature.rs:10:1
--> $DIR/rtn-in-impl-signature.rs:9:1
|
LL | fn bar<'b>() -> bool;
| --------------------- `bar` from trait
@ -28,7 +19,7 @@ LL | fn bar<'b>() -> bool;
LL | impl Super1<'_, bar(..): Send> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0046, E0229.
For more information about an error, try `rustc --explain E0046`.

View File

@ -1,7 +1,6 @@
//@ edition:2021
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super1<'a> {
async fn test();

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound-ambig.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0221]: ambiguous associated function `test` in bounds of `Foo`
--> $DIR/super-method-bound-ambig.rs:25:12
--> $DIR/super-method-bound-ambig.rs:24:12
|
LL | async fn test();
| ---------------- ambiguous `test` from `for<'a> Super1<'a>`
@ -19,6 +10,6 @@ LL | async fn test();
LL | T: Foo<test(..): Send>,
| ^^^^^^^^^^^^^^ ambiguous associated function `test`
error: aborting due to 1 previous error; 1 warning emitted
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0221`.

View File

@ -2,7 +2,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super<'a> {
async fn test();

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:4:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,7 +1,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use
trait IntFactory {
fn stream(&self) -> impl Iterator<Item = i32>;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,7 +1,6 @@
//@ edition: 2021
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
async fn bar<T>() {}

View File

@ -1,14 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed for functions that have type parameters
--> $DIR/ty-or-ct-params.rs:14:12
--> $DIR/ty-or-ct-params.rs:13:12
|
LL | async fn bar<T>() {}
| - type parameter declared here
@ -17,7 +8,7 @@ LL | T: Foo<bar(..): Send, baz(..): Send>,
| ^^^^^^^^^^^^^
error: return type notation is not allowed for functions that have const parameters
--> $DIR/ty-or-ct-params.rs:14:27
--> $DIR/ty-or-ct-params.rs:13:27
|
LL | async fn baz<const N: usize>() {}
| -------------- const parameter declared here
@ -25,5 +16,5 @@ LL | async fn baz<const N: usize>() {}
LL | T: Foo<bar(..): Send, baz(..): Send>,
| ^^^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors

View File

@ -303,8 +303,8 @@ LL | let _ = FOO & (*"Sized".to_string().into_boxed_str());
|
= help: the trait `BitAnd<str>` is not implemented for `i32`
= help: the following other types implement trait `BitAnd<Rhs>`:
`&'a i32` implements `BitAnd<i32>`
`&i32` implements `BitAnd<&i32>`
`&i32` implements `BitAnd<i32>`
`&i32` implements `BitAnd`
`i32` implements `BitAnd<&i32>`
`i32` implements `BitAnd`

View File

@ -6,8 +6,8 @@ LL | x * y
|
= help: the trait `Mul<f32>` is not implemented for `i32`
= help: the following other types implement trait `Mul<Rhs>`:
`&'a i32` implements `Mul<i32>`
`&i32` implements `Mul<&i32>`
`&i32` implements `Mul<i32>`
`&i32` implements `Mul`
`i32` implements `Mul<&i32>`
`i32` implements `Mul`

View File

@ -6,14 +6,14 @@ LL | 22 >> p.char;
|
= help: the trait `Shr<char>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
`&'a i128` implements `Shr<i128>`
`&'a i128` implements `Shr<i16>`
`&'a i128` implements `Shr<i32>`
`&'a i128` implements `Shr<i64>`
`&'a i128` implements `Shr<i8>`
`&'a i128` implements `Shr<isize>`
`&'a i128` implements `Shr<u128>`
`&'a i128` implements `Shr<u16>`
`&i128` implements `Shr<&i16>`
`&i128` implements `Shr<&i32>`
`&i128` implements `Shr<&i64>`
`&i128` implements `Shr<&i8>`
`&i128` implements `Shr<&isize>`
`&i128` implements `Shr<&u128>`
`&i128` implements `Shr<&u16>`
`&i128` implements `Shr<&u32>`
and 568 others
error[E0277]: no implementation for `{integer} >> &str`
@ -24,14 +24,14 @@ LL | 22 >> p.str;
|
= help: the trait `Shr<&str>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
`&'a i128` implements `Shr<i128>`
`&'a i128` implements `Shr<i16>`
`&'a i128` implements `Shr<i32>`
`&'a i128` implements `Shr<i64>`
`&'a i128` implements `Shr<i8>`
`&'a i128` implements `Shr<isize>`
`&'a i128` implements `Shr<u128>`
`&'a i128` implements `Shr<u16>`
`&i128` implements `Shr<&i16>`
`&i128` implements `Shr<&i32>`
`&i128` implements `Shr<&i64>`
`&i128` implements `Shr<&i8>`
`&i128` implements `Shr<&isize>`
`&i128` implements `Shr<&u128>`
`&i128` implements `Shr<&u16>`
`&i128` implements `Shr<&u32>`
and 568 others
error[E0277]: no implementation for `{integer} >> &Panolpy`
@ -42,14 +42,14 @@ LL | 22 >> p;
|
= help: the trait `Shr<&Panolpy>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
`&'a i128` implements `Shr<i128>`
`&'a i128` implements `Shr<i16>`
`&'a i128` implements `Shr<i32>`
`&'a i128` implements `Shr<i64>`
`&'a i128` implements `Shr<i8>`
`&'a i128` implements `Shr<isize>`
`&'a i128` implements `Shr<u128>`
`&'a i128` implements `Shr<u16>`
`&i128` implements `Shr<&i16>`
`&i128` implements `Shr<&i32>`
`&i128` implements `Shr<&i64>`
`&i128` implements `Shr<&i8>`
`&i128` implements `Shr<&isize>`
`&i128` implements `Shr<&u128>`
`&i128` implements `Shr<&u16>`
`&i128` implements `Shr<&u32>`
and 568 others
error[E0308]: mismatched types

View File

@ -1,7 +1,6 @@
//@ check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
fn borrow(&mut self) -> impl Sized + '_;

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/rtn-static.rs:3:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -2,10 +2,10 @@ error[E0308]: mismatched types
--> $DIR/different-fn.rs:10:5
|
LL | [0; size_of::<Foo<T>>()]
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `size_of::<T>()`, found `size_of::<Foo<T>>()`
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `size_of::<T>()`, found `0`
|
= note: expected constant `size_of::<T>()`
found constant `size_of::<Foo<T>>()`
found constant `0`
error: unconstrained generic constant
--> $DIR/different-fn.rs:10:9

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied
LL | let _ = A;
| ^ the trait `Bar<_>` is not implemented for `A<_>`
|
= help: the trait `Bar<_>` is implemented for `A<7>`
= help: the trait `Bar<_>` is implemented for `A<{ 6 + 1 }>`
note: required by a bound in `A`
--> $DIR/unused-substs-1.rs:9:11
|

View File

@ -0,0 +1,24 @@
//@ check-pass
//@ compile-flags: -Csymbol-mangling-version=v0
#![allow(incomplete_features)]
#![feature(unsized_const_params)]
// Regression test for #116303
#[derive(PartialEq, Eq)]
struct MyStr(str);
impl std::marker::UnsizedConstParamTy for MyStr {}
fn function_with_my_str<const S: &'static MyStr>() -> &'static MyStr {
S
}
impl MyStr {
const fn new(s: &'static str) -> &'static MyStr {
unsafe { std::mem::transmute(s) }
}
}
pub fn main() {
let f = function_with_my_str::<{ MyStr::new("hello") }>();
}

View File

@ -12,8 +12,8 @@ LL | = [0; (i8::MAX + 1u8) as usize];
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
`&'a i8` implements `Add<i8>`
`&i8` implements `Add<&i8>`
`&i8` implements `Add<i8>`
`&i8` implements `Add`
`i8` implements `Add<&i8>`
`i8` implements `Add`

View File

@ -12,8 +12,8 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
`&'a i8` implements `Add<i8>`
`&i8` implements `Add<&i8>`
`&i8` implements `Add<i8>`
`&i8` implements `Add`
`i8` implements `Add<&i8>`
`i8` implements `Add`

View File

@ -30,8 +30,8 @@ LL | n + sum_to(n - 1)
|
= help: the trait `Add<impl Foo>` is not implemented for `u32`
= help: the following other types implement trait `Add<Rhs>`:
`&'a u32` implements `Add<u32>`
`&u32` implements `Add<&u32>`
`&u32` implements `Add<u32>`
`&u32` implements `Add`
`u32` implements `Add<&u32>`
`u32` implements `Add`

View File

@ -6,14 +6,14 @@ LL | 1 +
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
`&'a f128` implements `Add<f128>`
`&'a f16` implements `Add<f16>`
`&'a f32` implements `Add<f32>`
`&'a f64` implements `Add<f64>`
`&'a i128` implements `Add<i128>`
`&'a i16` implements `Add<i16>`
`&'a i32` implements `Add<i32>`
`&'a i64` implements `Add<i64>`
`&f128` implements `Add<f128>`
`&f128` implements `Add`
`&f16` implements `Add<f16>`
`&f16` implements `Add`
`&f32` implements `Add<f32>`
`&f32` implements `Add`
`&f64` implements `Add<f64>`
`&f64` implements `Add`
and 56 others
error[E0277]: cannot add `()` to `{integer}`
@ -24,14 +24,14 @@ LL | 1 +
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
`&'a f128` implements `Add<f128>`
`&'a f16` implements `Add<f16>`
`&'a f32` implements `Add<f32>`
`&'a f64` implements `Add<f64>`
`&'a i128` implements `Add<i128>`
`&'a i16` implements `Add<i16>`
`&'a i32` implements `Add<i32>`
`&'a i64` implements `Add<i64>`
`&f128` implements `Add<f128>`
`&f128` implements `Add`
`&f16` implements `Add<f16>`
`&f16` implements `Add`
`&f32` implements `Add<f32>`
`&f32` implements `Add`
`&f64` implements `Add<f64>`
`&f64` implements `Add`
and 56 others
error: aborting due to 2 previous errors

View File

@ -6,8 +6,8 @@ LL | 1.0f64 - 1
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
`&'a f64` implements `Sub<f64>`
`&f64` implements `Sub<&f64>`
`&f64` implements `Sub<f64>`
`&f64` implements `Sub`
`f64` implements `Sub<&f64>`
`f64` implements `Sub`
help: consider using a floating-point literal by writing it with `.0`

View File

@ -16,14 +16,14 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
`&'a f128` implements `Add<f128>`
`&'a f16` implements `Add<f16>`
`&'a f32` implements `Add<f32>`
`&'a f64` implements `Add<f64>`
`&'a i128` implements `Add<i128>`
`&'a i16` implements `Add<i16>`
`&'a i32` implements `Add<i32>`
`&'a i64` implements `Add<i64>`
`&f128` implements `Add<f128>`
`&f128` implements `Add`
`&f16` implements `Add<f16>`
`&f16` implements `Add`
`&f32` implements `Add<f32>`
`&f32` implements `Add`
`&f64` implements `Add<f64>`
`&f64` implements `Add`
and 56 others
error: aborting due to 2 previous errors

View File

@ -33,7 +33,7 @@ LL | println!("{}", scores.sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
`i32` implements `Sum<&'a i32>`
`i32` implements `Sum<&i32>`
`i32` implements `Sum`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:14:10
@ -66,7 +66,7 @@ LL | .sum::<i32>(),
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
`i32` implements `Sum<&'a i32>`
`i32` implements `Sum<&i32>`
`i32` implements `Sum`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:23:14
@ -99,7 +99,7 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
`i32` implements `Sum<&'a i32>`
`i32` implements `Sum<&i32>`
`i32` implements `Sum`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:27:38

Some files were not shown because too many files have changed in this diff Show More