Auto merge of #94802 - matthiaskrgr:rollup-4plu0fi, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #92150 (Improve suggestion when casting usize to (possibly) wide pointer)
 - #94635 (Merge `#[deprecated]` and `#[rustc_deprecated]`)
 - #94657 (Constify `Index{,Mut}` for `[T]`, `str`, and `[T; N]`)
 - #94746 (diagnostics: use rustc_on_unimplemented to recommend `[].iter()`)
 - #94788 (Account for suggestions for complete removal of lines)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-03-10 12:32:01 +00:00
commit ba14a836c7
73 changed files with 861 additions and 624 deletions

View File

@ -437,13 +437,6 @@ macro_rules! gate_modifier { ($($name:literal => $feature:ident)*) => {
)
.emit();
}
} else {
if attr.has_name(sym::deprecated) {
self.sess
.struct_span_err(attr.span, "`#[deprecated]` cannot be used in staged API")
.span_label(attr.span, "use `#[rustc_deprecated]` instead")
.emit();
}
}
}

View File

@ -664,6 +664,7 @@ fn find_deprecation_generic<'a, I>(sess: &Session, attrs_iter: I) -> Option<(Dep
{
let mut depr: Option<(Deprecation, Span)> = None;
let diagnostic = &sess.parse_sess.span_diagnostic;
let is_rustc = sess.features_untracked().staged_api;
'outer: for attr in attrs_iter {
if !(attr.has_name(sym::deprecated) || attr.has_name(sym::rustc_deprecated)) {
@ -728,17 +729,31 @@ fn find_deprecation_generic<'a, I>(sess: &Session, attrs_iter: I) -> Option<(Dep
continue 'outer;
}
}
sym::note if attr.has_name(sym::deprecated) => {
sym::note => {
if !get(mi, &mut note) {
continue 'outer;
}
}
// FIXME(jhpratt) remove this after a bootstrap occurs. Emitting an
// error specific to the renaming would be a good idea as well.
sym::reason if attr.has_name(sym::rustc_deprecated) => {
if !get(mi, &mut note) {
continue 'outer;
}
}
sym::suggestion if attr.has_name(sym::rustc_deprecated) => {
sym::suggestion => {
if !sess.features_untracked().deprecated_suggestion {
let mut diag = sess.struct_span_err(
mi.span,
"suggestions on deprecated items are unstable",
);
if sess.is_nightly_build() {
diag.help("add `#![feature(deprecated_suggestion)]` to the crate root");
}
// FIXME(jhpratt) change this to an actual tracking issue
diag.note("see #XXX for more details").emit();
}
if !get(mi, &mut suggestion) {
continue 'outer;
}
@ -752,7 +767,7 @@ fn find_deprecation_generic<'a, I>(sess: &Session, attrs_iter: I) -> Option<(Dep
if attr.has_name(sym::deprecated) {
&["since", "note"]
} else {
&["since", "reason", "suggestion"]
&["since", "note", "suggestion"]
},
),
);
@ -775,24 +790,22 @@ fn find_deprecation_generic<'a, I>(sess: &Session, attrs_iter: I) -> Option<(Dep
}
}
if suggestion.is_some() && attr.has_name(sym::deprecated) {
unreachable!("only allowed on rustc_deprecated")
}
if attr.has_name(sym::rustc_deprecated) {
if is_rustc {
if since.is_none() {
handle_errors(&sess.parse_sess, attr.span, AttrError::MissingSince);
continue;
}
if note.is_none() {
struct_span_err!(diagnostic, attr.span, E0543, "missing 'reason'").emit();
struct_span_err!(diagnostic, attr.span, E0543, "missing 'note'").emit();
continue;
}
}
let is_since_rustc_version = attr.has_name(sym::rustc_deprecated);
depr = Some((Deprecation { since, note, suggestion, is_since_rustc_version }, attr.span));
depr = Some((
Deprecation { since, note, suggestion, is_since_rustc_version: is_rustc },
attr.span,
));
}
depr

View File

@ -1657,6 +1657,31 @@ enum DisplaySuggestion {
let line_start = sm.lookup_char_pos(parts[0].span.lo()).line;
draw_col_separator_no_space(&mut buffer, 1, max_line_num_len + 1);
let mut lines = complete.lines();
if lines.clone().next().is_none() {
// Account for a suggestion to completely remove a line(s) with whitespace (#94192).
let line_end = sm.lookup_char_pos(parts[0].span.hi()).line;
for line in line_start..=line_end {
buffer.puts(
row_num - 1 + line - line_start,
0,
&self.maybe_anonymized(line),
Style::LineNumber,
);
buffer.puts(
row_num - 1 + line - line_start,
max_line_num_len + 1,
"- ",
Style::Removal,
);
buffer.puts(
row_num - 1 + line - line_start,
max_line_num_len + 3,
&normalize_whitespace(&*file_lines.file.get_line(line - 1).unwrap()),
Style::Removal,
);
}
row_num += line_end - line_start;
}
for (line_pos, (line, highlight_parts)) in
lines.by_ref().zip(highlights).take(MAX_SUGGESTION_HIGHLIGHT_LINES).enumerate()
{

View File

@ -362,6 +362,8 @@ pub fn set(&self, features: &mut Features, span: Span) {
(active, default_alloc_error_handler, "1.48.0", Some(66741), None),
/// Allows default type parameters to influence type inference.
(active, default_type_parameter_fallback, "1.3.0", Some(27336), None),
/// Allows having using `suggestion` in the `#[deprecated]` attribute.
(active, deprecated_suggestion, "1.61.0", Some(94785), None),
/// Allows `#[derive(Default)]` and `#[default]` on enums.
(active, derive_default_enum, "1.56.0", Some(86985), None),
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.

View File

@ -461,7 +461,7 @@ pub struct BuiltinAttribute {
// DuplicatesOk since it has its own validation
ungated!(
rustc_deprecated, Normal,
template!(List: r#"since = "version", reason = "...""#), DuplicatesOk // See E0550
template!(List: r#"since = "version", note = "...""#), DuplicatesOk // See E0550
),
// DuplicatesOk since it has its own validation
ungated!(

View File

@ -1886,6 +1886,15 @@ pub fn is_slice(self) -> bool {
}
}
#[inline]
pub fn is_array_slice(self) -> bool {
match self.kind() {
Slice(_) => true,
RawPtr(TypeAndMut { ty, .. }) | Ref(_, ty, _) => matches!(ty.kind(), Slice(_)),
_ => false,
}
}
#[inline]
pub fn is_array(self) -> bool {
matches!(self.kind(), Array(..))

View File

@ -202,7 +202,7 @@ fn annotate<F>(
self.tcx.sess,
*span,
E0549,
"rustc_deprecated attribute must be paired with \
"deprecated attribute must be paired with \
either stable or unstable attribute"
)
.emit();

View File

@ -562,6 +562,7 @@
delay_span_bug_from_inside_query,
deny,
deprecated,
deprecated_suggestion,
deref,
deref_method,
deref_mut,

View File

@ -11,7 +11,7 @@
use super::InferCtxtPrivExt;
crate trait InferCtxtExt<'tcx> {
pub trait InferCtxtExt<'tcx> {
/*private*/
fn impl_similar_to(
&self,
@ -204,6 +204,10 @@ fn on_unimplemented_note(
flags.push((sym::_Self, Some("{integral}".to_owned())));
}
if self_ty.is_array_slice() {
flags.push((sym::_Self, Some("&[]".to_owned())));
}
if let ty::Array(aty, len) = self_ty.kind() {
flags.push((sym::_Self, Some("[]".to_owned())));
flags.push((sym::_Self, Some(format!("[{}]", aty))));

View File

@ -165,6 +165,12 @@ pub enum CastError {
NonScalar,
UnknownExprPtrKind,
UnknownCastPtrKind,
/// Cast of int to (possibly) fat raw pointer.
///
/// Argument is the specific name of the metadata in plain words, such as "a vtable"
/// or "a length". If this argument is None, then the metadata is unknown, for example,
/// when we're typechecking a type parameter with a ?Sized bound.
IntToFatCast(Option<&'static str>),
}
impl From<ErrorGuaranteed> for CastError {
@ -522,6 +528,35 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'tcx>, e: CastError) {
.diagnostic()
.emit();
}
CastError::IntToFatCast(known_metadata) => {
let mut err = struct_span_err!(
fcx.tcx.sess,
self.cast_span,
E0606,
"cannot cast `{}` to a pointer that {} wide",
fcx.ty_to_string(self.expr_ty),
if known_metadata.is_some() { "is" } else { "may be" }
);
err.span_label(
self.cast_span,
format!(
"creating a `{}` requires both an address and {}",
self.cast_ty,
known_metadata.unwrap_or("type-specific metadata"),
),
);
if fcx.tcx.sess.is_nightly_build() {
err.span_label(
self.expr.span,
"consider casting this expression to `*const ()`, \
then using `core::ptr::from_raw_parts`",
);
}
err.emit();
}
CastError::UnknownCastPtrKind | CastError::UnknownExprPtrKind => {
let unknown_cast_to = match e {
CastError::UnknownCastPtrKind => true,
@ -900,7 +935,13 @@ fn check_addr_ptr_cast(
match fcx.pointer_kind(m_cast.ty, self.span)? {
None => Err(CastError::UnknownCastPtrKind),
Some(PointerKind::Thin) => Ok(CastKind::AddrPtrCast),
_ => Err(CastError::IllegalCast),
Some(PointerKind::Vtable(_)) => Err(CastError::IntToFatCast(Some("a vtable"))),
Some(PointerKind::Length) => Err(CastError::IntToFatCast(Some("a length"))),
Some(
PointerKind::OfProjection(_)
| PointerKind::OfOpaque(_, _)
| PointerKind::OfParam(_),
) => Err(CastError::IntToFatCast(None)),
}
}

View File

@ -19,9 +19,10 @@
use rustc_span::lev_distance;
use rustc_span::symbol::{kw, sym, Ident};
use rustc_span::{source_map, FileName, MultiSpan, Span};
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
use rustc_trait_selection::traits::error_reporting::on_unimplemented::InferCtxtExt as _;
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
use rustc_trait_selection::traits::{
FulfillmentError, Obligation, ObligationCause, ObligationCauseCode,
FulfillmentError, Obligation, ObligationCause, ObligationCauseCode, OnUnimplementedNote,
};
use std::cmp::Ordering;
@ -483,150 +484,6 @@ pub fn report_method_error(
}
}
let mut label_span_not_found = || {
if unsatisfied_predicates.is_empty() {
err.span_label(span, format!("{item_kind} not found in `{ty_str}`"));
let is_string_or_ref_str = match actual.kind() {
ty::Ref(_, ty, _) => {
ty.is_str()
|| matches!(
ty.kind(),
ty::Adt(adt, _) if self.tcx.is_diagnostic_item(sym::String, adt.did)
)
}
ty::Adt(adt, _) => self.tcx.is_diagnostic_item(sym::String, adt.did),
_ => false,
};
if is_string_or_ref_str && item_name.name == sym::iter {
err.span_suggestion_verbose(
item_name.span,
"because of the in-memory representation of `&str`, to obtain \
an `Iterator` over each of its codepoint use method `chars`",
String::from("chars"),
Applicability::MachineApplicable,
);
}
if let ty::Adt(adt, _) = rcvr_ty.kind() {
let mut inherent_impls_candidate = self
.tcx
.inherent_impls(adt.did)
.iter()
.copied()
.filter(|def_id| {
if let Some(assoc) = self.associated_value(*def_id, item_name) {
// Check for both mode is the same so we avoid suggesting
// incorrect associated item.
match (mode, assoc.fn_has_self_parameter, source) {
(Mode::MethodCall, true, SelfSource::MethodCall(_)) => {
// We check that the suggest type is actually
// different from the received one
// So we avoid suggestion method with Box<Self>
// for instance
self.tcx.at(span).type_of(*def_id) != actual
&& self.tcx.at(span).type_of(*def_id) != rcvr_ty
}
(Mode::Path, false, _) => true,
_ => false,
}
} else {
false
}
})
.collect::<Vec<_>>();
if !inherent_impls_candidate.is_empty() {
inherent_impls_candidate.sort();
inherent_impls_candidate.dedup();
// number of type to shows at most.
let limit = if inherent_impls_candidate.len() == 5 { 5 } else { 4 };
let type_candidates = inherent_impls_candidate
.iter()
.take(limit)
.map(|impl_item| {
format!("- `{}`", self.tcx.at(span).type_of(*impl_item))
})
.collect::<Vec<_>>()
.join("\n");
let additional_types = if inherent_impls_candidate.len() > limit {
format!(
"\nand {} more types",
inherent_impls_candidate.len() - limit
)
} else {
"".to_string()
};
err.note(&format!(
"the {item_kind} was found for\n{}{}",
type_candidates, additional_types
));
}
}
} else {
err.span_label(span, format!("{item_kind} cannot be called on `{ty_str}` due to unsatisfied trait bounds"));
}
};
// If the method name is the name of a field with a function or closure type,
// give a helping note that it has to be called as `(x.f)(...)`.
if let SelfSource::MethodCall(expr) = source {
let field_receiver =
self.autoderef(span, rcvr_ty).find_map(|(ty, _)| match ty.kind() {
ty::Adt(def, substs) if !def.is_enum() => {
let variant = &def.non_enum_variant();
self.tcx.find_field_index(item_name, variant).map(|index| {
let field = &variant.fields[index];
let field_ty = field.ty(tcx, substs);
(field, field_ty)
})
}
_ => None,
});
if let Some((field, field_ty)) = field_receiver {
let scope = self.tcx.parent_module(self.body_id).to_def_id();
let is_accessible = field.vis.is_accessible_from(scope, self.tcx);
if is_accessible {
if self.is_fn_ty(field_ty, span) {
let expr_span = expr.span.to(item_name.span);
err.multipart_suggestion(
&format!(
"to call the function stored in `{}`, \
surround the field access with parentheses",
item_name,
),
vec![
(expr_span.shrink_to_lo(), '('.to_string()),
(expr_span.shrink_to_hi(), ')'.to_string()),
],
Applicability::MachineApplicable,
);
} else {
let call_expr = self
.tcx
.hir()
.expect_expr(self.tcx.hir().get_parent_node(expr.hir_id));
if let Some(span) = call_expr.span.trim_start(item_name.span) {
err.span_suggestion(
span,
"remove the arguments",
String::new(),
Applicability::MaybeIncorrect,
);
}
}
}
let field_kind = if is_accessible { "field" } else { "private field" };
err.span_label(item_name.span, format!("{}, not a method", field_kind));
} else if lev_candidate.is_none() && static_sources.is_empty() {
label_span_not_found();
}
} else {
label_span_not_found();
}
if self.is_fn_ty(rcvr_ty, span) {
fn report_function<T: std::fmt::Display>(err: &mut Diagnostic, name: T) {
err.note(
@ -645,12 +502,15 @@ fn report_function<T: std::fmt::Display>(err: &mut Diagnostic, name: T) {
}
}
let mut custom_span_label = false;
if !static_sources.is_empty() {
err.note(
"found the following associated functions; to be used as methods, \
functions must have a `self` parameter",
);
err.span_label(span, "this is an associated function, not a method");
custom_span_label = true;
}
if static_sources.len() == 1 {
let ty_str = if let Some(CandidateSource::ImplSource(impl_did)) =
@ -686,6 +546,7 @@ fn report_function<T: std::fmt::Display>(err: &mut Diagnostic, name: T) {
report_candidates(span, &mut err, static_sources, sugg_span);
}
let mut bound_spans = vec![];
let mut restrict_type_params = false;
let mut unsatisfied_bounds = false;
if item_name.name == sym::count && self.is_slice_ty(actual, span) {
@ -709,7 +570,31 @@ fn report_function<T: std::fmt::Display>(err: &mut Diagnostic, name: T) {
self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id))
};
let mut type_params = FxHashMap::default();
let mut bound_spans = vec![];
// Pick out the list of unimplemented traits on the receiver.
// This is used for custom error messages with the `#[rustc_on_unimplemented]` attribute.
let mut unimplemented_traits = FxHashMap::default();
for (predicate, _parent_pred, cause) in &unsatisfied_predicates {
if let (ty::PredicateKind::Trait(p), Some(cause)) =
(predicate.kind().skip_binder(), cause.as_ref())
{
if p.trait_ref.self_ty() != rcvr_ty {
// This is necessary, not just to keep the errors clean, but also
// because our derived obligations can wind up with a trait ref that
// requires a different param_env to be correctly compared.
continue;
}
unimplemented_traits.entry(p.trait_ref.def_id).or_insert((
predicate.kind().rebind(p.trait_ref),
Obligation {
cause: cause.clone(),
param_env: self.param_env,
predicate: predicate.clone(),
recursion_depth: 0,
},
));
}
}
let mut collect_type_param_suggestions =
|self_ty: Ty<'tcx>, parent_pred: ty::Predicate<'tcx>, obligation: &str| {
@ -945,11 +830,7 @@ trait bound{s}",
bound_list.sort_by(|(_, a), (_, b)| a.cmp(b)); // Sort alphabetically.
bound_list.dedup_by(|(_, a), (_, b)| a == b); // #35677
bound_list.sort_by_key(|(pos, _)| *pos); // Keep the original predicate order.
bound_spans.sort();
bound_spans.dedup();
for (span, msg) in bound_spans.into_iter() {
err.span_label(span, &msg);
}
if !bound_list.is_empty() || !skip_list.is_empty() {
let bound_list = bound_list
.into_iter()
@ -957,9 +838,34 @@ trait bound{s}",
.collect::<Vec<_>>()
.join("\n");
let actual_prefix = actual.prefix_string(self.tcx);
err.set_primary_message(&format!(
info!("unimplemented_traits.len() == {}", unimplemented_traits.len());
let (primary_message, label) = if unimplemented_traits.len() == 1 {
unimplemented_traits
.into_iter()
.next()
.map(|(_, (trait_ref, obligation))| {
if trait_ref.self_ty().references_error()
|| actual.references_error()
{
// Avoid crashing.
return (None, None);
}
let OnUnimplementedNote { message, label, .. } =
self.infcx.on_unimplemented_note(trait_ref, &obligation);
(message, label)
})
.unwrap_or((None, None))
} else {
(None, None)
};
let primary_message = primary_message.unwrap_or_else(|| format!(
"the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, but its trait bounds were not satisfied"
));
err.set_primary_message(&primary_message);
if let Some(label) = label {
custom_span_label = true;
err.span_label(span, label);
}
if !bound_list.is_empty() {
err.note(&format!(
"the following trait bounds were not satisfied:\n{bound_list}"
@ -971,6 +877,156 @@ trait bound{s}",
}
}
let mut label_span_not_found = || {
if unsatisfied_predicates.is_empty() {
err.span_label(span, format!("{item_kind} not found in `{ty_str}`"));
let is_string_or_ref_str = match actual.kind() {
ty::Ref(_, ty, _) => {
ty.is_str()
|| matches!(
ty.kind(),
ty::Adt(adt, _) if self.tcx.is_diagnostic_item(sym::String, adt.did)
)
}
ty::Adt(adt, _) => self.tcx.is_diagnostic_item(sym::String, adt.did),
_ => false,
};
if is_string_or_ref_str && item_name.name == sym::iter {
err.span_suggestion_verbose(
item_name.span,
"because of the in-memory representation of `&str`, to obtain \
an `Iterator` over each of its codepoint use method `chars`",
String::from("chars"),
Applicability::MachineApplicable,
);
}
if let ty::Adt(adt, _) = rcvr_ty.kind() {
let mut inherent_impls_candidate = self
.tcx
.inherent_impls(adt.did)
.iter()
.copied()
.filter(|def_id| {
if let Some(assoc) = self.associated_value(*def_id, item_name) {
// Check for both mode is the same so we avoid suggesting
// incorrect associated item.
match (mode, assoc.fn_has_self_parameter, source) {
(Mode::MethodCall, true, SelfSource::MethodCall(_)) => {
// We check that the suggest type is actually
// different from the received one
// So we avoid suggestion method with Box<Self>
// for instance
self.tcx.at(span).type_of(*def_id) != actual
&& self.tcx.at(span).type_of(*def_id) != rcvr_ty
}
(Mode::Path, false, _) => true,
_ => false,
}
} else {
false
}
})
.collect::<Vec<_>>();
if !inherent_impls_candidate.is_empty() {
inherent_impls_candidate.sort();
inherent_impls_candidate.dedup();
// number of type to shows at most.
let limit = if inherent_impls_candidate.len() == 5 { 5 } else { 4 };
let type_candidates = inherent_impls_candidate
.iter()
.take(limit)
.map(|impl_item| {
format!("- `{}`", self.tcx.at(span).type_of(*impl_item))
})
.collect::<Vec<_>>()
.join("\n");
let additional_types = if inherent_impls_candidate.len() > limit {
format!(
"\nand {} more types",
inherent_impls_candidate.len() - limit
)
} else {
"".to_string()
};
err.note(&format!(
"the {item_kind} was found for\n{}{}",
type_candidates, additional_types
));
}
}
} else {
err.span_label(span, format!("{item_kind} cannot be called on `{ty_str}` due to unsatisfied trait bounds"));
}
};
// If the method name is the name of a field with a function or closure type,
// give a helping note that it has to be called as `(x.f)(...)`.
if let SelfSource::MethodCall(expr) = source {
let field_receiver =
self.autoderef(span, rcvr_ty).find_map(|(ty, _)| match ty.kind() {
ty::Adt(def, substs) if !def.is_enum() => {
let variant = &def.non_enum_variant();
self.tcx.find_field_index(item_name, variant).map(|index| {
let field = &variant.fields[index];
let field_ty = field.ty(tcx, substs);
(field, field_ty)
})
}
_ => None,
});
if let Some((field, field_ty)) = field_receiver {
let scope = self.tcx.parent_module(self.body_id).to_def_id();
let is_accessible = field.vis.is_accessible_from(scope, self.tcx);
if is_accessible {
if self.is_fn_ty(field_ty, span) {
let expr_span = expr.span.to(item_name.span);
err.multipart_suggestion(
&format!(
"to call the function stored in `{}`, \
surround the field access with parentheses",
item_name,
),
vec![
(expr_span.shrink_to_lo(), '('.to_string()),
(expr_span.shrink_to_hi(), ')'.to_string()),
],
Applicability::MachineApplicable,
);
} else {
let call_expr = self
.tcx
.hir()
.expect_expr(self.tcx.hir().get_parent_node(expr.hir_id));
if let Some(span) = call_expr.span.trim_start(item_name.span) {
err.span_suggestion(
span,
"remove the arguments",
String::new(),
Applicability::MaybeIncorrect,
);
}
}
}
let field_kind = if is_accessible { "field" } else { "private field" };
err.span_label(item_name.span, format!("{}, not a method", field_kind));
} else if lev_candidate.is_none() && !custom_span_label {
label_span_not_found();
}
} else if !custom_span_label {
label_span_not_found();
}
bound_spans.sort();
bound_spans.dedup();
for (span, msg) in bound_spans.into_iter() {
err.span_label(span, &msg);
}
if actual.is_numeric() && actual.is_fresh() || restrict_type_params {
} else {
self.suggest_traits_to_import(

View File

@ -276,9 +276,10 @@ fn into_iter(self) -> IterMut<'a, T> {
}
#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
impl<T, I, const N: usize> Index<I> for [T; N]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
impl<T, I, const N: usize> const Index<I> for [T; N]
where
[T]: Index<I>,
[T]: ~const Index<I>,
{
type Output = <[T] as Index<I>>::Output;
@ -289,9 +290,10 @@ fn index(&self, index: I) -> &Self::Output {
}
#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
impl<T, I, const N: usize> IndexMut<I> for [T; N]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
impl<T, I, const N: usize> const IndexMut<I> for [T; N]
where
[T]: IndexMut<I>,
[T]: ~const IndexMut<I>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut Self::Output {

View File

@ -34,6 +34,11 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \
to have a bounded `RangeInclusive`: `0..=end`"
),
on(
_Self = "[]",
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
),
on(_Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
on(
_Self = "&str",
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"

View File

@ -149,6 +149,8 @@
#![feature(variant_count)]
#![feature(const_array_from_ref)]
#![feature(const_slice_from_ref)]
#![feature(const_slice_index)]
#![feature(const_is_char_boundary)]
//
// Language features:
#![feature(abi_unadjusted)]
@ -167,6 +169,7 @@
#![feature(const_refs_to_cell)]
#![feature(decl_macro)]
#![feature(derive_default_enum)]
#![cfg_attr(not(bootstrap), feature(deprecated_suggestion))]
#![feature(doc_cfg)]
#![feature(doc_notable_trait)]
#![feature(rustdoc_internals)]

View File

@ -809,7 +809,7 @@ pub fn escape_ascii(self) -> ascii::EscapeDefault {
ascii::escape_default(self)
}
pub(crate) fn is_utf8_char_boundary(self) -> bool {
pub(crate) const fn is_utf8_char_boundary(self) -> bool {
// This is bit magic equivalent to: b < 128 || b >= 192
(self as i8) >= -0x40
}

View File

@ -446,7 +446,7 @@ impl RangeInclusive<usize> {
/// Converts to an exclusive `Range` for `SliceIndex` implementations.
/// The caller is responsible for dealing with `end == usize::MAX`.
#[inline]
pub(crate) fn into_slice_range(self) -> Range<usize> {
pub(crate) const fn into_slice_range(self) -> Range<usize> {
// If we're not exhausted, we want to simply slice `start..end + 1`.
// If we are exhausted, then slicing with `end + 1..end + 1` gives us an
// empty range that is still subject to bounds-checks for that endpoint.

View File

@ -1032,10 +1032,11 @@ pub const fn as_ptr(self) -> *const T {
/// }
/// ```
#[unstable(feature = "slice_ptr_get", issue = "74265")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output
pub const unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output
where
I: SliceIndex<[T]>,
I: ~const SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
unsafe { index.get_unchecked(self) }

View File

@ -1302,10 +1302,11 @@ pub const fn as_mut_ptr(self) -> *mut T {
/// }
/// ```
#[unstable(feature = "slice_ptr_get", issue = "74265")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline(always)]
pub unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
where
I: SliceIndex<[T]>,
I: ~const SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
unsafe { index.get_unchecked_mut(self) }

View File

@ -630,10 +630,11 @@ pub const fn as_mut_ptr(self) -> *mut T {
/// }
/// ```
#[unstable(feature = "slice_ptr_get", issue = "74265")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output>
pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output>
where
I: SliceIndex<[T]>,
I: ~const SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
// As a consequence, the resulting pointer cannot be null.

View File

@ -1,12 +1,14 @@
//! Indexing implementations for `[T]`.
use crate::intrinsics::const_eval_select;
use crate::ops;
use crate::ptr;
#[stable(feature = "rust1", since = "1.0.0")]
impl<T, I> ops::Index<I> for [T]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
impl<T, I> const ops::Index<I> for [T]
where
I: SliceIndex<[T]>,
I: ~const SliceIndex<[T]>,
{
type Output = I::Output;
@ -17,9 +19,10 @@ fn index(&self, index: I) -> &I::Output {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T, I> ops::IndexMut<I> for [T]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
impl<T, I> const ops::IndexMut<I> for [T]
where
I: SliceIndex<[T]>,
I: ~const SliceIndex<[T]>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut I::Output {
@ -31,31 +34,72 @@ fn index_mut(&mut self, index: I) -> &mut I::Output {
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cold]
#[track_caller]
fn slice_start_index_len_fail(index: usize, len: usize) -> ! {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
const fn slice_start_index_len_fail(index: usize, len: usize) -> ! {
// SAFETY: we are just panicking here
unsafe {
const_eval_select(
(index, len),
slice_start_index_len_fail_ct,
slice_start_index_len_fail_rt,
)
}
}
// FIXME const-hack
fn slice_start_index_len_fail_rt(index: usize, len: usize) -> ! {
panic!("range start index {} out of range for slice of length {}", index, len);
}
const fn slice_start_index_len_fail_ct(_: usize, _: usize) -> ! {
panic!("slice start index is out of range for slice");
}
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cold]
#[track_caller]
fn slice_end_index_len_fail(index: usize, len: usize) -> ! {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
const fn slice_end_index_len_fail(index: usize, len: usize) -> ! {
// SAFETY: we are just panicking here
unsafe {
const_eval_select((index, len), slice_end_index_len_fail_ct, slice_end_index_len_fail_rt)
}
}
// FIXME const-hack
fn slice_end_index_len_fail_rt(index: usize, len: usize) -> ! {
panic!("range end index {} out of range for slice of length {}", index, len);
}
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cold]
#[track_caller]
fn slice_index_order_fail(index: usize, end: usize) -> ! {
panic!("slice index starts at {} but ends at {}", index, end);
const fn slice_end_index_len_fail_ct(_: usize, _: usize) -> ! {
panic!("slice end index is out of range for slice");
}
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cold]
#[track_caller]
fn slice_start_index_overflow_fail() -> ! {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
const fn slice_index_order_fail(index: usize, end: usize) -> ! {
// SAFETY: we are just panicking here
unsafe { const_eval_select((index, end), slice_index_order_fail_ct, slice_index_order_fail_rt) }
}
// FIXME const-hack
fn slice_index_order_fail_rt(index: usize, end: usize) -> ! {
panic!("slice index starts at {} but ends at {}", index, end);
}
const fn slice_index_order_fail_ct(_: usize, _: usize) -> ! {
panic!("slice index start is larger than end");
}
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cold]
#[track_caller]
const fn slice_start_index_overflow_fail() -> ! {
panic!("attempted to index slice from after maximum usize");
}
@ -63,7 +107,7 @@ fn slice_start_index_overflow_fail() -> ! {
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[cold]
#[track_caller]
fn slice_end_index_overflow_fail() -> ! {
const fn slice_end_index_overflow_fail() -> ! {
panic!("attempted to index slice up to maximum usize");
}
@ -153,7 +197,8 @@ pub unsafe trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
}
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
unsafe impl<T> SliceIndex<[T]> for usize {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl<T> const SliceIndex<[T]> for usize {
type Output = T;
#[inline]
@ -197,7 +242,8 @@ fn index_mut(self, slice: &mut [T]) -> &mut T {
}
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
unsafe impl<T> SliceIndex<[T]> for ops::Range<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl<T> const SliceIndex<[T]> for ops::Range<usize> {
type Output = [T];
#[inline]
@ -261,7 +307,8 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
}
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
unsafe impl<T> SliceIndex<[T]> for ops::RangeTo<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl<T> const SliceIndex<[T]> for ops::RangeTo<usize> {
type Output = [T];
#[inline]
@ -298,7 +345,8 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
}
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
unsafe impl<T> SliceIndex<[T]> for ops::RangeFrom<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl<T> const SliceIndex<[T]> for ops::RangeFrom<usize> {
type Output = [T];
#[inline]
@ -343,7 +391,8 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
}
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
unsafe impl<T> SliceIndex<[T]> for ops::RangeFull {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl<T> const SliceIndex<[T]> for ops::RangeFull {
type Output = [T];
#[inline]
@ -378,7 +427,8 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
}
#[stable(feature = "inclusive_range", since = "1.26.0")]
unsafe impl<T> SliceIndex<[T]> for ops::RangeInclusive<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl<T> const SliceIndex<[T]> for ops::RangeInclusive<usize> {
type Output = [T];
#[inline]
@ -421,7 +471,8 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] {
}
#[stable(feature = "inclusive_range", since = "1.26.0")]
unsafe impl<T> SliceIndex<[T]> for ops::RangeToInclusive<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl<T> const SliceIndex<[T]> for ops::RangeToInclusive<usize> {
type Output = [T];
#[inline]

View File

@ -324,10 +324,11 @@ pub const fn last_mut(&mut self) -> Option<&mut T> {
/// assert_eq!(None, v.get(0..4));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub fn get<I>(&self, index: I) -> Option<&I::Output>
pub const fn get<I>(&self, index: I) -> Option<&I::Output>
where
I: SliceIndex<Self>,
I: ~const SliceIndex<Self>,
{
index.get(self)
}
@ -348,10 +349,11 @@ pub fn get<I>(&self, index: I) -> Option<&I::Output>
/// assert_eq!(x, &[0, 42, 2]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output>
pub const fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output>
where
I: SliceIndex<Self>,
I: ~const SliceIndex<Self>,
{
index.get_mut(self)
}
@ -379,10 +381,11 @@ pub fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output>
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output
pub const unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output
where
I: SliceIndex<Self>,
I: ~const SliceIndex<Self>,
{
// SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`;
// the slice is dereferenceable because `self` is a safe reference.
@ -415,10 +418,11 @@ pub unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output
/// assert_eq!(x, &[1, 13, 4]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output
pub const unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output
where
I: SliceIndex<Self>,
I: ~const SliceIndex<Self>,
{
// SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`;
// the slice is dereferenceable because `self` is a safe reference.

View File

@ -79,7 +79,23 @@
#[inline(never)]
#[cold]
#[track_caller]
fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! {
#[rustc_allow_const_fn_unstable(const_eval_select)]
const fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! {
// SAFETY: panics for both branches
unsafe {
crate::intrinsics::const_eval_select(
(s, begin, end),
slice_error_fail_ct,
slice_error_fail_rt,
)
}
}
const fn slice_error_fail_ct(_: &str, _: usize, _: usize) -> ! {
panic!("failed to slice string");
}
fn slice_error_fail_rt(s: &str, begin: usize, end: usize) -> ! {
const MAX_DISPLAY_LENGTH: usize = 256;
let trunc_len = s.floor_char_boundary(MAX_DISPLAY_LENGTH);
let s_trunc = &s[..trunc_len];
@ -189,8 +205,9 @@ pub const fn is_empty(&self) -> bool {
/// ```
#[must_use]
#[stable(feature = "is_char_boundary", since = "1.9.0")]
#[rustc_const_unstable(feature = "const_is_char_boundary", issue = "none")]
#[inline]
pub fn is_char_boundary(&self, index: usize) -> bool {
pub const fn is_char_boundary(&self, index: usize) -> bool {
// 0 is always ok.
// Test for 0 explicitly so that it can optimize out the check
// easily and skip reading string data for that case.
@ -418,8 +435,9 @@ pub fn as_mut_ptr(&mut self) -> *mut u8 {
/// assert!(v.get(..42).is_none());
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
i.get(self)
}
@ -450,8 +468,9 @@ pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
/// assert_eq!("HEllo", v);
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
pub const fn get_mut<I: ~const SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
i.get_mut(self)
}
@ -482,8 +501,9 @@ pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
/// }
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: I) -> &I::Output {
// SAFETY: the caller must uphold the safety contract for `get_unchecked`;
// the slice is dereferenceable because `self` is a safe reference.
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
@ -517,8 +537,12 @@ pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
/// }
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
pub const unsafe fn get_unchecked_mut<I: ~const SliceIndex<str>>(
&mut self,
i: I,
) -> &mut I::Output {
// SAFETY: the caller must uphold the safety contract for `get_unchecked_mut`;
// the slice is dereferenceable because `self` is a safe reference.
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.

View File

@ -53,9 +53,10 @@ fn partial_cmp(&self, other: &str) -> Option<Ordering> {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<I> ops::Index<I> for str
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
impl<I> const ops::Index<I> for str
where
I: SliceIndex<str>,
I: ~const SliceIndex<str>,
{
type Output = I::Output;
@ -66,9 +67,10 @@ fn index(&self, index: I) -> &I::Output {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<I> ops::IndexMut<I> for str
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
impl<I> const ops::IndexMut<I> for str
where
I: SliceIndex<str>,
I: ~const SliceIndex<str>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut I::Output {
@ -79,7 +81,7 @@ fn index_mut(&mut self, index: I) -> &mut I::Output {
#[inline(never)]
#[cold]
#[track_caller]
fn str_index_overflow_fail() -> ! {
const fn str_index_overflow_fail() -> ! {
panic!("attempted to index str up to maximum usize");
}
@ -96,7 +98,8 @@ fn str_index_overflow_fail() -> ! {
///
/// Equivalent to `&self[0 .. len]` or `&mut self[0 .. len]`.
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe impl SliceIndex<str> for ops::RangeFull {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl const SliceIndex<str> for ops::RangeFull {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@ -160,7 +163,8 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
/// // &s[3 .. 100];
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe impl SliceIndex<str> for ops::Range<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl const SliceIndex<str> for ops::Range<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@ -247,7 +251,8 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
/// Panics if `end` does not point to the starting byte offset of a
/// character (as defined by `is_char_boundary`), or if `end > len`.
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe impl SliceIndex<str> for ops::RangeTo<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl const SliceIndex<str> for ops::RangeTo<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@ -317,7 +322,8 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
/// Panics if `begin` does not point to the starting byte offset of
/// a character (as defined by `is_char_boundary`), or if `begin > len`.
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe impl SliceIndex<str> for ops::RangeFrom<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl const SliceIndex<str> for ops::RangeFrom<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@ -393,7 +399,8 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
/// to the ending byte offset of a character (`end + 1` is either a starting
/// byte offset or equal to `len`), if `begin > end`, or if `end >= len`.
#[stable(feature = "inclusive_range", since = "1.26.0")]
unsafe impl SliceIndex<str> for ops::RangeInclusive<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl const SliceIndex<str> for ops::RangeInclusive<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@ -444,7 +451,8 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
/// (`end + 1` is either a starting byte offset as defined by
/// `is_char_boundary`, or equal to `len`), or if `end >= len`.
#[stable(feature = "inclusive_range", since = "1.26.0")]
unsafe impl SliceIndex<str> for ops::RangeToInclusive<usize> {
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
unsafe impl const SliceIndex<str> for ops::RangeToInclusive<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {

View File

@ -263,6 +263,7 @@
#![feature(doc_cfg)]
#![feature(doc_cfg_hide)]
#![feature(rustdoc_internals)]
#![cfg_attr(not(bootstrap), feature(deprecated_suggestion))]
#![feature(doc_masked)]
#![feature(doc_notable_trait)]
#![feature(dropck_eyepatch)]

View File

@ -19,6 +19,15 @@ fn main() {
q as *const [i32]; //~ ERROR cannot cast
// #21397
let t: *mut (dyn Trait + 'static) = 0 as *mut _; //~ ERROR casting
let mut fail: *const str = 0 as *const str; //~ ERROR casting
let t: *mut (dyn Trait + 'static) = 0 as *mut _;
//~^ ERROR cannot cast `usize` to a pointer that is wide
let mut fail: *const str = 0 as *const str;
//~^ ERROR cannot cast `usize` to a pointer that is wide
let mut fail2: *const str = 0isize as *const str;
//~^ ERROR cannot cast `isize` to a pointer that is wide
}
fn foo<T: ?Sized>() {
let s = 0 as *const T;
//~^ ERROR cannot cast `usize` to a pointer that may be wide
}

View File

@ -50,19 +50,39 @@ error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]
LL | q as *const [i32];
| ^^^^^^^^^^^^^^^^^
error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid
--> $DIR/fat-ptr-cast.rs:22:41
error[E0606]: cannot cast `usize` to a pointer that is wide
--> $DIR/fat-ptr-cast.rs:22:46
|
LL | let t: *mut (dyn Trait + 'static) = 0 as *mut _;
| ^^^^^^^^^^^
| - ^^^^^^ creating a `*mut (dyn Trait + 'static)` requires both an address and a vtable
| |
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
error[E0606]: casting `usize` as `*const str` is invalid
--> $DIR/fat-ptr-cast.rs:23:32
error[E0606]: cannot cast `usize` to a pointer that is wide
--> $DIR/fat-ptr-cast.rs:24:37
|
LL | let mut fail: *const str = 0 as *const str;
| ^^^^^^^^^^^^^^^
| - ^^^^^^^^^^ creating a `*const str` requires both an address and a length
| |
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
error: aborting due to 9 previous errors
error[E0606]: cannot cast `isize` to a pointer that is wide
--> $DIR/fat-ptr-cast.rs:26:43
|
LL | let mut fail2: *const str = 0isize as *const str;
| ------ ^^^^^^^^^^ creating a `*const str` requires both an address and a length
| |
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
error[E0606]: cannot cast `usize` to a pointer that may be wide
--> $DIR/fat-ptr-cast.rs:31:18
|
LL | let s = 0 as *const T;
| - ^^^^^^^^ creating a `*const T` requires both an address and type-specific metadata
| |
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
error: aborting due to 11 previous errors
Some errors have detailed explanations: E0605, E0606, E0607.
For more information about an error, try `rustc --explain E0605`.

View File

@ -1,4 +0,0 @@
#![feature(staged_api)]
#![stable(feature = "stable_test_feature", since = "1.0.0")]
#[deprecated] //~ ERROR `#[deprecated]` cannot be used in staged API
fn main() {}

View File

@ -1,8 +0,0 @@
error: `#[deprecated]` cannot be used in staged API
--> $DIR/deprecation-in-staged-api.rs:3:1
|
LL | #[deprecated]
| ^^^^^^^^^^^^^ use `#[rustc_deprecated]` instead
error: aborting due to previous error

View File

@ -0,0 +1,6 @@
// compile-flags: --crate-type=lib
#![no_implicit_prelude]
#[deprecated(suggestion = "foo")] //~ ERROR suggestions on deprecated items are unstable
struct Foo {}

View File

@ -0,0 +1,11 @@
error: suggestions on deprecated items are unstable
--> $DIR/feature-gate-deprecated_suggestion.rs:5:14
|
LL | #[deprecated(suggestion = "foo")]
| ^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(deprecated_suggestion)]` to the crate root
= note: see #XXX for more details
error: aborting due to previous error

View File

@ -4,11 +4,11 @@
#![stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
#[rustc_deprecated(since = "99.99.99", reason = "effectively never")]
#[deprecated(since = "99.99.99", note = "effectively never")]
#[stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
pub struct S1;
#[rustc_deprecated(since = "TBD", reason = "literally never")]
#[deprecated(since = "TBD", note = "literally never")]
#[stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
pub struct S2;

View File

@ -1,17 +1,17 @@
error: use of unit struct `S1` that will be deprecated in future version 99.99.99: effectively never
--> $DIR/rustc_deprecation-in-future.rs:16:13
--> $DIR/staged-deprecation-in-future.rs:16:13
|
LL | let _ = S1;
| ^^
|
note: the lint level is defined here
--> $DIR/rustc_deprecation-in-future.rs:1:9
--> $DIR/staged-deprecation-in-future.rs:1:9
|
LL | #![deny(deprecated_in_future)]
| ^^^^^^^^^^^^^^^^^^^^
error: use of unit struct `S2` that will be deprecated in a future Rust version: literally never
--> $DIR/rustc_deprecation-in-future.rs:17:13
--> $DIR/staged-deprecation-in-future.rs:17:13
|
LL | let _ = S2;
| ^^

View File

@ -1,6 +1,7 @@
// run-rustfix
#![feature(staged_api)]
#![feature(deprecated_suggestion)]
#![stable(since = "1.0.0", feature = "test")]
@ -10,9 +11,9 @@
struct Foo;
impl Foo {
#[rustc_deprecated(
#[deprecated(
since = "1.0.0",
reason = "replaced by `replacement`",
note = "replaced by `replacement`",
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]
@ -22,9 +23,9 @@ impl Foo {
}
mod bar {
#[rustc_deprecated(
#[deprecated(
since = "1.0.0",
reason = "replaced by `replacement`",
note = "replaced by `replacement`",
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]

View File

@ -1,6 +1,7 @@
// run-rustfix
#![feature(staged_api)]
#![feature(deprecated_suggestion)]
#![stable(since = "1.0.0", feature = "test")]
@ -10,9 +11,9 @@
struct Foo;
impl Foo {
#[rustc_deprecated(
#[deprecated(
since = "1.0.0",
reason = "replaced by `replacement`",
note = "replaced by `replacement`",
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]
@ -22,9 +23,9 @@ fn replacement(&self) {}
}
mod bar {
#[rustc_deprecated(
#[deprecated(
since = "1.0.0",
reason = "replaced by `replacement`",
note = "replaced by `replacement`",
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]

View File

@ -1,17 +1,17 @@
error: use of deprecated function `bar::deprecated`: replaced by `replacement`
--> $DIR/suggestion.rs:41:10
--> $DIR/suggestion.rs:42:10
|
LL | bar::deprecated();
| ^^^^^^^^^^ help: replace the use of the deprecated function: `replacement`
|
note: the lint level is defined here
--> $DIR/suggestion.rs:7:9
--> $DIR/suggestion.rs:8:9
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
error: use of deprecated associated function `Foo::deprecated`: replaced by `replacement`
--> $DIR/suggestion.rs:39:9
--> $DIR/suggestion.rs:40:9
|
LL | foo.deprecated();
| ^^^^^^^^^^ help: replace the use of the deprecated associated function: `replacement`

View File

@ -1,43 +0,0 @@
// Testing gating of `#[rustc_deprecated]` in "weird" places.
//
// This file sits on its own because these signal errors, making
// this test incompatible with the "warnings only" nature of
// issue-43106-gating-of-builtin-attrs.rs
#![rustc_deprecated()]
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR missing 'since' [E0542]
#[rustc_deprecated()]
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR missing 'since' [E0542]
mod rustc_deprecated {
mod inner {
#![rustc_deprecated()]
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR missing 'since' [E0542]
}
#[rustc_deprecated()]
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR missing 'since' [E0542]
fn f() {}
#[rustc_deprecated()]
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR missing 'since' [E0542]
//~| ERROR missing 'since' [E0542]
struct S;
#[rustc_deprecated()]
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR missing 'since' [E0542]
type T = S;
#[rustc_deprecated()]
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR missing 'since' [E0542]
impl S {}
}
fn main() {}

View File

@ -1,94 +0,0 @@
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:9
|
LL | #![rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:21:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:32:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:37:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:11:1
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:7:1
|
LL | #![rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:7:1
|
LL | #![rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:11:1
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:9
|
LL | #![rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:21:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:32:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/issue-43106-gating-of-rustc_deprecated.rs:37:5
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 15 previous errors
Some errors have detailed explanations: E0542, E0734.
For more information about an error, try `rustc --explain E0542`.

View File

@ -7,7 +7,7 @@
impl Foo {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn foo(self) {}
}

View File

@ -1,8 +1,8 @@
error[E0599]: the method `to_string` exists for raw pointer `*const u8`, but its trait bounds were not satisfied
error[E0599]: `*const u8` doesn't implement `std::fmt::Display`
--> $DIR/issue-21596.rs:4:22
|
LL | println!("{}", z.to_string());
| ^^^^^^^^^ method cannot be called on `*const u8` due to unsatisfied trait bounds
| ^^^^^^^^^ `*const u8` cannot be formatted with the default formatter
|
= note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref
= note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior

View File

@ -20,7 +20,7 @@ pub fn stable() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub mod unstable_mod {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated() {}
pub fn unstable() {}

View File

@ -4,7 +4,7 @@
#![unstable(feature = "unstable_test_feature", issue = "none")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn foo() -> usize {
20
}

View File

@ -5,21 +5,21 @@
#![stable(feature = "lint_stability", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated() {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_text() {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "99.99.99", reason = "text")]
#[deprecated(since = "99.99.99", note = "text")]
pub fn deprecated_future() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_unstable() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_unstable_text() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -37,17 +37,17 @@ pub fn stable_text() {}
impl MethodTester {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated(&self) {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_unstable(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_unstable_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -64,17 +64,17 @@ pub fn method_stable_text(&self) {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub trait Trait {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated(&self) {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_unstable(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_unstable_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -93,7 +93,7 @@ pub trait TraitWithAssociatedTypes {
#[unstable(feature = "unstable_test_feature", issue = "none")]
type TypeUnstable = u8;
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
type TypeDeprecated = u8;
}
@ -104,18 +104,18 @@ impl Trait for MethodTester {}
pub trait UnstableTrait { fn dummy(&self) { } }
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub trait DeprecatedTrait {
#[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { }
}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnstableStruct {
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
@ -133,10 +133,10 @@ pub enum UnstableEnum {}
pub enum StableEnum {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnstableUnitStruct;
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableUnitStruct;
@ -146,10 +146,10 @@ pub enum StableEnum {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub enum Enum {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
DeprecatedVariant,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
DeprecatedUnstableVariant,
#[unstable(feature = "unstable_test_feature", issue = "none")]
UnstableVariant,
@ -159,10 +159,10 @@ pub enum Enum {
}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);

View File

@ -6,7 +6,7 @@ pub struct Stable {
pub inherit: u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub override2: u8,
#[stable(feature = "rust2", since = "2.0.0")]
@ -17,7 +17,7 @@ pub struct Stable {
pub struct Stable2(#[stable(feature = "rust2", since = "2.0.0")] pub u8,
#[unstable(feature = "unstable_test_feature", issue = "none")] pub u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8,
#[deprecated(since = "1.0.0", note = "text")] pub u8,
pub u8);
#[stable(feature = "rust1", since = "1.0.0")]
@ -28,7 +28,7 @@ pub enum Stable3 {
Override1,
#[unstable(feature = "unstable_test_feature", issue = "none")]
Override2,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
#[unstable(feature = "unstable_test_feature", issue = "none")]
Override3,
}
@ -38,7 +38,7 @@ pub struct Unstable {
pub inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
pub override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub override2: u8,
}
@ -47,10 +47,10 @@ pub struct Unstable {
pub struct Unstable2(pub u8,
#[stable(feature = "rust1", since = "1.0.0")] pub u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8);
#[deprecated(since = "1.0.0", note = "text")] pub u8);
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct Deprecated {
pub inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
@ -60,7 +60,7 @@ pub struct Deprecated {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct Deprecated2(pub u8,
#[stable(feature = "rust1", since = "1.0.0")] pub u8,
#[unstable(feature = "unstable_test_feature", issue = "none")] pub u8);

View File

@ -169,10 +169,10 @@ trait LocalTrait2 : DeprecatedTrait { }
mod this_crate {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_text() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -190,10 +190,10 @@ pub fn stable_text() {}
impl MethodTester {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -209,10 +209,10 @@ pub fn method_stable_text(&self) {}
pub trait Trait {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -229,7 +229,7 @@ fn trait_stable_text(&self) {}
impl Trait for MethodTester {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
@ -243,7 +243,7 @@ pub struct StableStruct {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableUnitStruct;
@ -252,7 +252,7 @@ pub struct StableStruct {
pub enum Enum {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
DeprecatedVariant,
#[unstable(feature = "unstable_test_feature", issue = "none")]
UnstableVariant,
@ -262,7 +262,7 @@ pub enum Enum {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableTupleStruct(isize);
@ -382,7 +382,7 @@ fn test_method_object(foo: &dyn Trait) {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn test_fn_body() {
fn fn_in_body() {}
fn_in_body();
@ -390,7 +390,7 @@ fn fn_in_body() {}
impl MethodTester {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
fn_in_body();
@ -398,7 +398,7 @@ fn fn_in_body() {}
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }
}

View File

@ -219,10 +219,10 @@ fn test_inheritance() {
mod this_crate {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_text() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -240,10 +240,10 @@ pub fn stable_text() {}
impl MethodTester {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -259,10 +259,10 @@ pub fn method_stable_text(&self) {}
pub trait Trait {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -279,7 +279,7 @@ fn trait_stable_text(&self) {}
impl Trait for MethodTester {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
@ -293,7 +293,7 @@ pub struct StableStruct {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableUnitStruct;
@ -302,7 +302,7 @@ pub struct StableStruct {
pub enum Enum {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
DeprecatedVariant,
#[unstable(feature = "unstable_test_feature", issue = "none")]
UnstableVariant,
@ -312,7 +312,7 @@ pub enum Enum {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableTupleStruct(isize);
@ -433,7 +433,7 @@ fn test_method_object(foo: &dyn Trait) {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn test_fn_body() {
fn fn_in_body() {}
fn_in_body(); //~ WARN use of deprecated function `this_crate::test_fn_body::fn_in_body`: text
@ -441,7 +441,7 @@ fn fn_in_body() {}
impl MethodTester {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
fn_in_body(); //~ WARN use of deprecated function `this_crate::MethodTester::test_method_body::fn_in_body`: text
@ -449,7 +449,7 @@ fn fn_in_body() {}
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }
}

View File

@ -160,7 +160,7 @@ struct Stable {
inherit: u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
#[unstable(feature = "unstable_test_feature", issue = "none")]
override2: u8,
}
@ -169,14 +169,14 @@ struct Stable {
struct Stable2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[deprecated(since = "1.0.0", note = "text")] u8);
#[unstable(feature = "unstable_test_feature", issue = "none")]
struct Unstable {
inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
#[unstable(feature = "unstable_test_feature", issue = "none")]
override2: u8,
}
@ -185,10 +185,10 @@ struct Unstable {
struct Unstable2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[deprecated(since = "1.0.0", note = "text")] u8);
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
struct Deprecated {
inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
@ -198,7 +198,7 @@ struct Deprecated {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
struct Deprecated2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "unstable_test_feature", issue = "none")] u8);

View File

@ -135,7 +135,7 @@ struct Stable {
inherit: u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
#[unstable(feature = "unstable_test_feature", issue = "none")]
override2: u8,
#[stable(feature = "rust2", since = "2.0.0")]
@ -146,14 +146,14 @@ struct Stable {
struct Stable2(u8,
#[stable(feature = "rust2", since = "2.0.0")] u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[deprecated(since = "1.0.0", note = "text")] u8);
#[unstable(feature = "unstable_test_feature", issue = "none")]
struct Unstable {
inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
#[unstable(feature = "unstable_test_feature", issue = "none")]
override2: u8,
}
@ -162,10 +162,10 @@ struct Unstable {
struct Unstable2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[deprecated(since = "1.0.0", note = "text")] u8);
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
struct Deprecated {
inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
@ -175,7 +175,7 @@ struct Deprecated {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
struct Deprecated2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "unstable_test_feature", issue = "none")] u8);

View File

@ -204,14 +204,14 @@ fn test_inheritance() {
mod this_crate {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "99.99.99", reason = "text")]
#[deprecated(since = "99.99.99", note = "text")]
pub fn deprecated_future() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -229,10 +229,10 @@ pub fn stable_text() {}
impl MethodTester {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -248,10 +248,10 @@ pub fn method_stable_text(&self) {}
pub trait Trait {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -268,7 +268,7 @@ fn trait_stable_text(&self) {}
impl Trait for MethodTester {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
@ -282,7 +282,7 @@ pub struct StableStruct {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableUnitStruct;
@ -291,7 +291,7 @@ pub struct StableStruct {
pub enum Enum {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
DeprecatedVariant,
#[unstable(feature = "unstable_test_feature", issue = "none")]
UnstableVariant,
@ -301,7 +301,7 @@ pub enum Enum {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableTupleStruct(isize);
@ -423,7 +423,7 @@ fn test_method_object(foo: &dyn Trait) {
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn test_fn_body() {
fn fn_in_body() {}
fn_in_body();
@ -431,7 +431,7 @@ fn fn_in_body() {}
impl MethodTester {
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
fn_in_body();
@ -439,7 +439,7 @@ fn fn_in_body() {}
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }
}

View File

@ -7,7 +7,7 @@
macro_rules! unstable_macro{ () => () }
#[stable(feature = "deprecated_macros", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "deprecation reason")]
#[deprecated(since = "1.0.0", note = "deprecation note")]
#[macro_export]
macro_rules! deprecated_macro{ () => () }

View File

@ -14,7 +14,7 @@ macro_rules! local_unstable { () => () }
macro local_unstable_modern() {}
#[stable(feature = "deprecated_macros", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "local deprecation reason")]
#[deprecated(since = "1.0.0", note = "local deprecation note")]
#[macro_export]
macro_rules! local_deprecated{ () => () }
@ -25,7 +25,7 @@ fn main() {
// unstable_macro_modern!(); // ERROR use of unstable library feature 'unstable_macros'
deprecated_macro!();
//~^ WARN use of deprecated macro `deprecated_macro`: deprecation reason
//~^ WARN use of deprecated macro `deprecated_macro`: deprecation note
local_deprecated!();
//~^ WARN use of deprecated macro `local_deprecated`: local deprecation reason
//~^ WARN use of deprecated macro `local_deprecated`: local deprecation note
}

View File

@ -22,7 +22,7 @@ LL | unstable_macro!();
|
= help: add `#![feature(unstable_macros)]` to the crate attributes to enable
warning: use of deprecated macro `deprecated_macro`: deprecation reason
warning: use of deprecated macro `deprecated_macro`: deprecation note
--> $DIR/macro-stability.rs:27:5
|
LL | deprecated_macro!();
@ -30,7 +30,7 @@ LL | deprecated_macro!();
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated macro `local_deprecated`: local deprecation reason
warning: use of deprecated macro `local_deprecated`: local deprecation note
--> $DIR/macro-stability.rs:29:5
|
LL | local_deprecated!();

View File

@ -0,0 +1,7 @@
fn get_slice() -> &'static [i32] {
&[1, 2, 3, 4]
}
fn main() {
let sqsum = get_slice().map(|i| i * i).sum(); //~ ERROR [E0599]
}

View File

@ -0,0 +1,15 @@
error[E0599]: `&'static [i32]` is not an iterator
--> $DIR/issue-94581.rs:6:29
|
LL | let sqsum = get_slice().map(|i| i * i).sum();
| ^^^ `&'static [i32]` is not an iterator; try calling `.iter()`
|
= note: the following trait bounds were not satisfied:
`&'static [i32]: Iterator`
which is required by `&mut &'static [i32]: Iterator`
`[i32]: Iterator`
which is required by `&mut [i32]: Iterator`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.

View File

@ -16,7 +16,7 @@ fn main() {
let y = Foo;
y.zero()
.take() //~ ERROR the method
.take() //~ ERROR not an iterator
.one(0);
y.three::<usize>(); //~ ERROR this function takes 3 arguments but 0 arguments were supplied
}

View File

@ -40,7 +40,7 @@ note: associated function defined here
LL | fn two(self, _: isize, _: isize) -> Foo { self }
| ^^^ ---- -------- --------
error[E0599]: the method `take` exists for struct `Foo`, but its trait bounds were not satisfied
error[E0599]: `Foo` is not an iterator
--> $DIR/method-call-err-msg.rs:19:7
|
LL | pub struct Foo;
@ -50,7 +50,7 @@ LL | pub struct Foo;
| doesn't satisfy `Foo: Iterator`
...
LL | .take()
| ^^^^ method cannot be called on `Foo` due to unsatisfied trait bounds
| ^^^^ `Foo` is not an iterator
|
= note: the following trait bounds were not satisfied:
`Foo: Iterator`

View File

@ -48,7 +48,7 @@ fn main()
let _ = E::A as *const u8; //~ ERROR is invalid
let _ = 'a' as *const u8; //~ ERROR is invalid
let _ = 42usize as *const [u8]; //~ ERROR is invalid
let _ = 42usize as *const [u8]; //~ ERROR cannot cast `usize` to a pointer that is wide
let _ = v as *const [u8]; //~ ERROR cannot cast
let _ = fat_v as *const dyn Foo; //~ ERROR the size for values of type
let _ = foo as *const str; //~ ERROR is invalid

View File

@ -148,11 +148,13 @@ error[E0606]: casting `char` as `*const u8` is invalid
LL | let _ = 'a' as *const u8;
| ^^^^^^^^^^^^^^^^
error[E0606]: casting `usize` as `*const [u8]` is invalid
--> $DIR/cast-rfc0401.rs:51:13
error[E0606]: cannot cast `usize` to a pointer that is wide
--> $DIR/cast-rfc0401.rs:51:24
|
LL | let _ = 42usize as *const [u8];
| ^^^^^^^^^^^^^^^^^^^^^^
| ------- ^^^^^^^^^^^ creating a `*const [u8]` requires both an address and a length
| |
| consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]`
--> $DIR/cast-rfc0401.rs:52:13

View File

@ -5,6 +5,6 @@
use std::iter::once;
fn main() {
once::<&str>("str").fuse().filter(|a: &str| true).count();
//~^ ERROR the method
//~^ ERROR not an iterator
//~| ERROR type mismatch in closure arguments
}

View File

@ -12,11 +12,11 @@ note: required by a bound in `filter`
LL | P: FnMut(&Self::Item) -> bool,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `filter`
error[E0599]: the method `count` exists for struct `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>`, but its trait bounds were not satisfied
error[E0599]: `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>` is not an iterator
--> $DIR/issue-36053-2.rs:7:55
|
LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
| -------------- ^^^^^ method cannot be called on `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>` due to unsatisfied trait bounds
| -------------- ^^^^^ `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>` is not an iterator
| |
| doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool`
| doesn't satisfy `_: FnMut<(&&str,)>`

View File

@ -5,21 +5,21 @@
#![stable(feature = "lint_stability", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated() {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_text() {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "99.99.99", reason = "text")]
#[deprecated(since = "99.99.99", note = "text")]
pub fn deprecated_future() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_unstable() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn deprecated_unstable_text() {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -37,17 +37,17 @@ pub fn stable_text() {}
impl MethodTester {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated(&self) {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_unstable(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub fn method_deprecated_unstable_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -64,17 +64,17 @@ pub fn method_stable_text(&self) {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub trait Trait {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated(&self) {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_unstable(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
fn trait_deprecated_unstable_text(&self) {}
#[unstable(feature = "unstable_test_feature", issue = "none")]
@ -93,7 +93,7 @@ pub trait TraitWithAssociatedTypes {
#[unstable(feature = "unstable_test_feature", issue = "none")]
type TypeUnstable = u8;
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
type TypeDeprecated = u8;
}
@ -104,18 +104,18 @@ impl Trait for MethodTester {}
pub trait UnstableTrait { fn dummy(&self) { } }
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub trait DeprecatedTrait {
#[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { }
}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnstableStruct {
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
@ -133,10 +133,10 @@ pub enum UnstableEnum {}
pub enum StableEnum {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnstableUnitStruct;
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableUnitStruct;
@ -146,10 +146,10 @@ pub enum StableEnum {}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub enum Enum {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
DeprecatedVariant,
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
DeprecatedUnstableVariant,
#[unstable(feature = "unstable_test_feature", issue = "none")]
UnstableVariant,
@ -159,10 +159,10 @@ pub enum Enum {
}
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[unstable(feature = "unstable_test_feature", issue = "none")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[deprecated(since = "1.0.0", note = "text")]
pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[unstable(feature = "unstable_test_feature", issue = "none")]
pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);

View File

@ -40,14 +40,14 @@ pub struct Struct3<A = isize, #[unstable(feature = "unstable_default", issue = "
pub field2: B,
}
#[rustc_deprecated(since = "1.1.0", reason = "test")]
#[deprecated(since = "1.1.0", note = "test")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub struct Struct4<A = usize> {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub field: A,
}
#[rustc_deprecated(since = "1.1.0", reason = "test")]
#[deprecated(since = "1.1.0", note = "test")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub struct Struct5<#[unstable(feature = "unstable_default", issue = "none")] A = usize> {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
@ -99,7 +99,7 @@ pub enum Enum3<T = isize, #[unstable(feature = "unstable_default", issue = "none
Err(#[stable(feature = "stable_test_feature", since = "1.0.0")] E),
}
#[rustc_deprecated(since = "1.1.0", reason = "test")]
#[deprecated(since = "1.1.0", note = "test")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub enum Enum4<T = usize> {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
@ -108,7 +108,7 @@ pub enum Enum4<T = usize> {
None,
}
#[rustc_deprecated(since = "1.1.0", reason = "test")]
#[deprecated(since = "1.1.0", note = "test")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub enum Enum5<#[unstable(feature = "unstable_default", issue = "none")] T = usize> {
#[stable(feature = "stable_test_feature", since = "1.0.0")]
@ -152,11 +152,11 @@ pub enum Enum6<#[unstable(feature = "unstable_default6", issue = "none")] T = us
pub type Alias3<T = isize, #[unstable(feature = "unstable_default", issue = "none")] E = usize> =
Result<T, E>;
#[rustc_deprecated(since = "1.1.0", reason = "test")]
#[deprecated(since = "1.1.0", note = "test")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub type Alias4<T = usize> = Option<T>;
#[rustc_deprecated(since = "1.1.0", reason = "test")]
#[deprecated(since = "1.1.0", note = "test")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub type Alias5<#[unstable(feature = "unstable_default", issue = "none")] T = usize> = Option<T>;

View File

@ -2,6 +2,4 @@
#[unstable()] //~ ERROR: stability attributes may not be used
#[stable()] //~ ERROR: stability attributes may not be used
#[rustc_deprecated()] //~ ERROR: stability attributes may not be used
//~^ ERROR missing 'since'
fn main() {}

View File

@ -10,19 +10,6 @@ error[E0734]: stability attributes may not be used outside of the standard libra
LL | #[stable()]
| ^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
error[E0542]: missing 'since'
--> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0542, E0734.
For more information about an error, try `rustc --explain E0542`.
For more information about this error, try `rustc --explain E0734`.

View File

@ -1,5 +1,3 @@
#[unstable()] //~ ERROR: stability attributes may not be used
#[stable()] //~ ERROR: stability attributes may not be used
#[rustc_deprecated()] //~ ERROR: stability attributes may not be used
//~^ ERROR missing 'since'
fn main() {}

View File

@ -10,19 +10,6 @@ error[E0734]: stability attributes may not be used outside of the standard libra
LL | #[stable()]
| ^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/stability-attribute-non-staged.rs:3:1
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
error[E0542]: missing 'since'
--> $DIR/stability-attribute-non-staged.rs:3:1
|
LL | #[rustc_deprecated()]
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0542, E0734.
For more information about an error, try `rustc --explain E0542`.
For more information about this error, try `rustc --explain E0734`.

View File

@ -18,13 +18,11 @@ fn f3() { }
fn f4() { }
#[stable(feature = "a", since = "b")]
#[rustc_deprecated] //~ ERROR malformed `rustc_deprecated` attribute
//~^ ERROR missing 'since'
#[deprecated] //~ ERROR missing 'since'
fn f5() { }
#[stable(feature = "a", since = "b")]
#[rustc_deprecated = "a"] //~ ERROR malformed `rustc_deprecated` attribute
//~^ ERROR missing 'since'
#[deprecated = "a"] //~ ERROR missing 'since'
fn f6() { }
}

View File

@ -22,30 +22,18 @@ error: malformed `stable` attribute input
LL | #[stable = "a"]
| ^^^^^^^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]`
error: malformed `rustc_deprecated` attribute input
--> $DIR/stability-attribute-sanity-4.rs:21:5
|
LL | #[rustc_deprecated]
| ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_deprecated(since = "version", reason = "...")]`
error: malformed `rustc_deprecated` attribute input
--> $DIR/stability-attribute-sanity-4.rs:26:5
|
LL | #[rustc_deprecated = "a"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_deprecated(since = "version", reason = "...")]`
error[E0542]: missing 'since'
--> $DIR/stability-attribute-sanity-4.rs:21:5
|
LL | #[rustc_deprecated]
LL | #[deprecated]
| ^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/stability-attribute-sanity-4.rs:25:5
|
LL | #[deprecated = "a"]
| ^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/stability-attribute-sanity-4.rs:26:5
|
LL | #[rustc_deprecated = "a"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0542`.

View File

@ -37,11 +37,11 @@ mod missing_version {
fn f1() { }
#[stable(feature = "a", since = "b")]
#[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542]
#[deprecated(note = "a")] //~ ERROR missing 'since' [E0542]
fn f2() { }
#[stable(feature = "a", since = "b")]
#[rustc_deprecated(since = "a")] //~ ERROR missing 'reason' [E0543]
#[deprecated(since = "a")] //~ ERROR missing 'note' [E0543]
fn f3() { }
}
@ -58,19 +58,19 @@ fn multiple2() { }
fn multiple3() { }
#[stable(feature = "a", since = "b")] //~ ERROR invalid stability version found
#[rustc_deprecated(since = "b", reason = "text")]
#[rustc_deprecated(since = "b", reason = "text")] //~ ERROR multiple deprecated attributes
#[deprecated(since = "b", note = "text")]
#[deprecated(since = "b", note = "text")] //~ ERROR multiple deprecated attributes
#[rustc_const_unstable(feature = "c", issue = "none")]
#[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels
pub const fn multiple4() { }
#[stable(feature = "a", since = "1.0.0")] //~ ERROR invalid deprecation version found
//~^ ERROR feature `a` is declared stable since 1.0.0
#[rustc_deprecated(since = "invalid", reason = "text")]
#[deprecated(since = "invalid", note = "text")]
fn invalid_deprecation_version() {}
#[rustc_deprecated(since = "a", reason = "text")]
#[deprecated(since = "a", note = "text")]
fn deprecated_without_unstable_or_stable() { }
//~^^ ERROR rustc_deprecated attribute must be paired with either stable or unstable attribute
//~^^ ERROR deprecated attribute must be paired with either stable or unstable attribute
fn main() { }

View File

@ -55,14 +55,14 @@ LL | #[stable(feature = "a")]
error[E0542]: missing 'since'
--> $DIR/stability-attribute-sanity.rs:40:5
|
LL | #[rustc_deprecated(reason = "a")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[deprecated(note = "a")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0543]: missing 'reason'
error[E0543]: missing 'note'
--> $DIR/stability-attribute-sanity.rs:44:5
|
LL | #[rustc_deprecated(since = "a")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[deprecated(since = "a")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:49:1
@ -85,10 +85,10 @@ LL | #[stable(feature = "a", since = "b")]
error[E0550]: multiple deprecated attributes
--> $DIR/stability-attribute-sanity.rs:62:1
|
LL | #[rustc_deprecated(since = "b", reason = "text")]
| ------------------------------------------------- first deprecation attribute
LL | #[rustc_deprecated(since = "b", reason = "text")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute
LL | #[deprecated(since = "b", note = "text")]
| ----------------------------------------- first deprecation attribute
LL | #[deprecated(since = "b", note = "text")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:64:1
@ -114,11 +114,11 @@ LL | #[stable(feature = "a", since = "1.0.0")]
LL | fn invalid_deprecation_version() {}
| ----------------------------------- the stability attribute annotates this item
error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute
error[E0549]: deprecated attribute must be paired with either stable or unstable attribute
--> $DIR/stability-attribute-sanity.rs:72:1
|
LL | #[rustc_deprecated(since = "a", reason = "text")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[deprecated(since = "a", note = "text")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0711]: feature `a` is declared stable since 1.0.0, but was previously declared stable since b
--> $DIR/stability-attribute-sanity.rs:67:1

View File

@ -23,8 +23,8 @@ LL | let _ = s.get(4);
note: required by a bound in `core::str::<impl str>::get`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
LL | pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
| ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get`
LL | pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get`
error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-idx.rs:5:29
@ -40,8 +40,8 @@ LL | let _ = s.get_unchecked(4);
note: required by a bound in `core::str::<impl str>::get_unchecked`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
LL | pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
| ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked`
LL | pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: I) -> &I::Output {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked`
error[E0277]: the type `str` cannot be indexed by `char`
--> $DIR/str-idx.rs:6:17

View File

@ -47,8 +47,8 @@ LL | s.get_mut(1);
note: required by a bound in `core::str::<impl str>::get_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
LL | pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
| ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_mut`
LL | pub const fn get_mut<I: ~const SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_mut`
error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-mut-idx.rs:11:25
@ -64,8 +64,8 @@ LL | s.get_unchecked_mut(1);
note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
LL | pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
| ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked_mut`
LL | pub const unsafe fn get_unchecked_mut<I: ~const SliceIndex<str>>(
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked_mut`
error[E0277]: the type `str` cannot be indexed by `char`
--> $DIR/str-mut-idx.rs:13:5

View File

@ -0,0 +1,30 @@
struct Wrapper<T>(T);
fn foo<T>(foo: Wrapper<T>)
//~^ ERROR the size for values of type `T` cannot be known at compilation time
where
T
:
?
Sized
{
//
}
fn bar<T>(foo: Wrapper<T>)
//~^ ERROR the size for values of type `T` cannot be known at compilation time
where T: ?Sized
{
//
}
fn qux<T>(foo: Wrapper<T>)
//~^ ERROR the size for values of type `T` cannot be known at compilation time
where
T: ?Sized
{
//
}
fn main() {}

View File

@ -0,0 +1,83 @@
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:3:16
|
LL | fn foo<T>(foo: Wrapper<T>)
| - ^^^^^^^^^^ doesn't have a size known at compile-time
| |
| this type parameter needs to be `std::marker::Sized`
|
note: required by a bound in `Wrapper`
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
|
LL | struct Wrapper<T>(T);
| ^ required by this bound in `Wrapper`
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
|
LL | struct Wrapper<T>(T);
| ^ - ...if indirection were used here: `Box<T>`
| |
| this could be changed to `T: ?Sized`...
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - where
LL - T
LL - :
LL - ?
LL - Sized
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:14:16
|
LL | fn bar<T>(foo: Wrapper<T>)
| - ^^^^^^^^^^ doesn't have a size known at compile-time
| |
| this type parameter needs to be `std::marker::Sized`
|
note: required by a bound in `Wrapper`
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
|
LL | struct Wrapper<T>(T);
| ^ required by this bound in `Wrapper`
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
|
LL | struct Wrapper<T>(T);
| ^ - ...if indirection were used here: `Box<T>`
| |
| this could be changed to `T: ?Sized`...
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - where T: ?Sized
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:21:16
|
LL | fn qux<T>(foo: Wrapper<T>)
| - ^^^^^^^^^^ doesn't have a size known at compile-time
| |
| this type parameter needs to be `std::marker::Sized`
|
note: required by a bound in `Wrapper`
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
|
LL | struct Wrapper<T>(T);
| ^ required by this bound in `Wrapper`
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
|
LL | struct Wrapper<T>(T);
| ^ - ...if indirection were used here: `Box<T>`
| |
| this could be changed to `T: ?Sized`...
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - where
LL - T: ?Sized
|
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.