Rollup merge of #74228 - estebank:unsized-param, r=davidtwco

Provide structured suggestion on unsized fields and fn params

* Suggest borrowing or boxing unsized fields
* Suggest borrowing fn parameters
* Remove some verbosity of unsized errors
* Remove `on_unimplemented` note from `trait Sized`

Fix #23286, fix #28653.

r? @davidtwco
This commit is contained in:
Manish Goregaokar 2020-07-14 13:19:24 -07:00 committed by GitHub
commit a364c0a782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
131 changed files with 554 additions and 437 deletions

View file

@ -84,11 +84,8 @@ impl<T: ?Sized> !Send for *mut T {}
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "sized"]
#[rustc_on_unimplemented(
on(parent_trait = "std::path::Path", label = "borrow the `Path` instead"),
message = "the size for values of type `{Self}` cannot be known at compilation time",
label = "doesn't have a size known at compile-time",
note = "to learn more, visit <https://doc.rust-lang.org/book/\
ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>"
label = "doesn't have a size known at compile-time"
)]
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
#[rustc_specialization_trait]

View file

@ -526,7 +526,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
Ident::with_dummy_span(sym::_task_context),
hir::BindingAnnotation::Mutable,
);
let param = hir::Param { attrs: &[], hir_id: self.next_id(), pat, span };
let param = hir::Param { attrs: &[], hir_id: self.next_id(), pat, ty_span: span, span };
let params = arena_vec![self; param];
let body_id = self.lower_body(move |this| {

View file

@ -972,6 +972,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
attrs: self.lower_attrs(&param.attrs),
hir_id: self.lower_node_id(param.id),
pat: self.lower_pat(&param.pat),
ty_span: param.ty.span,
span: param.span,
}
}
@ -1098,6 +1099,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
attrs: parameter.attrs,
hir_id: parameter.hir_id,
pat: new_parameter_pat,
ty_span: parameter.ty_span,
span: parameter.span,
};

View file

@ -2148,6 +2148,7 @@ pub struct Param<'hir> {
pub attrs: &'hir [Attribute],
pub hir_id: HirId,
pub pat: &'hir Pat<'hir>,
pub ty_span: Span,
pub span: Span,
}

View file

@ -215,7 +215,7 @@ pub enum ObligationCauseCode<'tcx> {
/// Type of each variable must be `Sized`.
VariableType(hir::HirId),
/// Argument type must be `Sized`.
SizedArgumentType,
SizedArgumentType(Option<Span>),
/// Return type must be `Sized`.
SizedReturnType,
/// Yield type must be `Sized`.
@ -229,6 +229,7 @@ pub enum ObligationCauseCode<'tcx> {
/// Types of fields (other than the last, except for packed structs) in a struct must be sized.
FieldSized {
adt_kind: AdtKind,
span: Span,
last: bool,
},

View file

@ -151,12 +151,14 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
super::VariableType(id) => Some(super::VariableType(id)),
super::ReturnValue(id) => Some(super::ReturnValue(id)),
super::ReturnType => Some(super::ReturnType),
super::SizedArgumentType => Some(super::SizedArgumentType),
super::SizedArgumentType(sp) => Some(super::SizedArgumentType(sp)),
super::SizedReturnType => Some(super::SizedReturnType),
super::SizedYieldType => Some(super::SizedYieldType),
super::InlineAsmSized => Some(super::InlineAsmSized),
super::RepeatVec(suggest_flag) => Some(super::RepeatVec(suggest_flag)),
super::FieldSized { adt_kind, last } => Some(super::FieldSized { adt_kind, last }),
super::FieldSized { adt_kind, span, last } => {
Some(super::FieldSized { adt_kind, span, last })
}
super::ConstSized => Some(super::ConstSized),
super::ConstPatternStructural => Some(super::ConstPatternStructural),
super::SharedStatic => Some(super::SharedStatic),

View file

@ -376,7 +376,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
// If it has a custom `#[rustc_on_unimplemented]`
// error message, let's display it as the label!
err.span_label(span, s.as_str());
err.help(&explanation);
if !matches!(trait_ref.skip_binder().self_ty().kind, ty::Param(_)) {
// When the self type is a type param We don't need to "the trait
// `std::marker::Sized` is not implemented for `T`" as we will point
// at the type param with a label to suggest constraining it.
err.help(&explanation);
}
} else {
err.span_label(span, explanation);
}
@ -403,7 +408,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
self.suggest_dereferences(&obligation, &mut err, &trait_ref, points_at_arg);
self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err);
self.suggest_fn_call(&obligation, &mut err, &trait_ref, points_at_arg);
self.suggest_remove_reference(&obligation, &mut err, &trait_ref);
self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref);

View file

@ -43,12 +43,6 @@ pub trait InferCtxtExt<'tcx> {
body_id: hir::HirId,
);
fn suggest_borrow_on_unsized_slice(
&self,
code: &ObligationCauseCode<'tcx>,
err: &mut DiagnosticBuilder<'_>,
);
fn suggest_dereferences(
&self,
obligation: &PredicateObligation<'tcx>,
@ -515,32 +509,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
}
/// When encountering an assignment of an unsized trait, like `let x = ""[..];`, provide a
/// suggestion to borrow the initializer in order to use have a slice instead.
fn suggest_borrow_on_unsized_slice(
&self,
code: &ObligationCauseCode<'tcx>,
err: &mut DiagnosticBuilder<'_>,
) {
if let &ObligationCauseCode::VariableType(hir_id) = code {
let parent_node = self.tcx.hir().get_parent_node(hir_id);
if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) {
if let Some(ref expr) = local.init {
if let hir::ExprKind::Index(_, _) = expr.kind {
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
err.span_suggestion(
expr.span,
"consider borrowing here",
format!("&{}", snippet),
Applicability::MachineApplicable,
);
}
}
}
}
}
}
/// Given a closure's `DefId`, return the given name of the closure.
///
/// This doesn't account for reassignments, but it's only used for suggestions.
@ -1817,15 +1785,56 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
}
}
ObligationCauseCode::VariableType(_) => {
err.note("all local variables must have a statically known size");
ObligationCauseCode::VariableType(hir_id) => {
let parent_node = self.tcx.hir().get_parent_node(hir_id);
match self.tcx.hir().find(parent_node) {
Some(Node::Local(hir::Local {
init: Some(hir::Expr { kind: hir::ExprKind::Index(_, _), span, .. }),
..
})) => {
// When encountering an assignment of an unsized trait, like
// `let x = ""[..];`, provide a suggestion to borrow the initializer in
// order to use have a slice instead.
err.span_suggestion_verbose(
span.shrink_to_lo(),
"consider borrowing here",
"&".to_owned(),
Applicability::MachineApplicable,
);
err.note("all local variables must have a statically known size");
}
Some(Node::Param(param)) => {
err.span_suggestion_verbose(
param.ty_span.shrink_to_lo(),
"function arguments must have a statically known size, borrowed types \
always have a known size",
"&".to_owned(),
Applicability::MachineApplicable,
);
}
_ => {
err.note("all local variables must have a statically known size");
}
}
if !self.tcx.features().unsized_locals {
err.help("unsized locals are gated as an unstable feature");
}
}
ObligationCauseCode::SizedArgumentType => {
err.note("all function arguments must have a statically known size");
if !self.tcx.features().unsized_locals {
ObligationCauseCode::SizedArgumentType(sp) => {
if let Some(span) = sp {
err.span_suggestion_verbose(
span.shrink_to_lo(),
"function arguments must have a statically known size, borrowed types \
always have a known size",
"&".to_string(),
Applicability::MachineApplicable,
);
} else {
err.note("all function arguments must have a statically known size");
}
if tcx.sess.opts.unstable_features.is_nightly_build()
&& !self.tcx.features().unsized_locals
{
err.help("unsized locals are gated as an unstable feature");
}
}
@ -1844,26 +1853,44 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
ObligationCauseCode::StructInitializerSized => {
err.note("structs must have a statically known size to be initialized");
}
ObligationCauseCode::FieldSized { adt_kind: ref item, last } => match *item {
AdtKind::Struct => {
if last {
err.note(
"the last field of a packed struct may only have a \
dynamically sized type if it does not need drop to be run",
);
} else {
err.note(
"only the last field of a struct may have a dynamically sized type",
);
ObligationCauseCode::FieldSized { adt_kind: ref item, last, span } => {
match *item {
AdtKind::Struct => {
if last {
err.note(
"the last field of a packed struct may only have a \
dynamically sized type if it does not need drop to be run",
);
} else {
err.note(
"only the last field of a struct may have a dynamically sized type",
);
}
}
AdtKind::Union => {
err.note("no field of a union may have a dynamically sized type");
}
AdtKind::Enum => {
err.note("no field of an enum variant may have a dynamically sized type");
}
}
AdtKind::Union => {
err.note("no field of a union may have a dynamically sized type");
}
AdtKind::Enum => {
err.note("no field of an enum variant may have a dynamically sized type");
}
},
err.help("change the field's type to have a statically known size");
err.span_suggestion(
span.shrink_to_lo(),
"borrowed types always have a statically known size",
"&".to_string(),
Applicability::MachineApplicable,
);
err.multipart_suggestion(
"the `Box` type always has a statically known size and allocates its contents \
in the heap",
vec![
(span.shrink_to_lo(), "Box<".to_string()),
(span.shrink_to_hi(), ">".to_string()),
],
Applicability::MachineApplicable,
);
}
ObligationCauseCode::ConstSized => {
err.note("constant expressions must have a statically known size");
}

View file

@ -487,7 +487,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.require_type_is_sized_deferred(
input,
expr.span,
traits::SizedArgumentType,
traits::SizedArgumentType(None),
);
}
}

View file

@ -1342,14 +1342,15 @@ fn check_fn<'a, 'tcx>(
let inputs_fn = fn_sig.inputs().iter().copied();
for (idx, (param_ty, param)) in inputs_fn.chain(maybe_va_list).zip(body.params).enumerate() {
// Check the pattern.
fcx.check_pat_top(&param.pat, param_ty, try { inputs_hir?.get(idx)?.span }, false);
let ty_span = try { inputs_hir?.get(idx)?.span };
fcx.check_pat_top(&param.pat, param_ty, ty_span, false);
// Check that argument is Sized.
// The check for a non-trivial pattern is a hack to avoid duplicate warnings
// for simple cases like `fn foo(x: Trait)`,
// where we would error once on the parameter as a whole, and once on the binding `x`.
if param.pat.simple_ident().is_none() && !tcx.features().unsized_locals {
fcx.require_type_is_sized(param_ty, param.pat.span, traits::SizedArgumentType);
fcx.require_type_is_sized(param_ty, param.pat.span, traits::SizedArgumentType(ty_span));
}
fcx.write_ty(param.hir_id, param_ty);

View file

@ -394,6 +394,7 @@ fn check_type_defn<'tcx, F>(
Some(i) => i,
None => bug!(),
},
span: field.span,
last,
},
),
@ -1326,10 +1327,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.iter()
.map(|field| {
let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id(field.hir_id));
let field_ty = self.normalize_associated_types_in(field.span, &field_ty);
let field_ty = self.normalize_associated_types_in(field.ty.span, &field_ty);
let field_ty = self.resolve_vars_if_possible(&field_ty);
debug!("non_enum_variant: type of field {:?} is {:?}", field, field_ty);
AdtField { ty: field_ty, span: field.span }
AdtField { ty: field_ty, span: field.ty.span }
})
.collect();
AdtVariant { fields, explicit_discr: None }

View file

@ -17,7 +17,6 @@ LL | asm!("{}", in(reg) v[..]);
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u64]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all inline asm arguments must have a statically known size
error[E0277]: the size for values of type `[u64]` cannot be known at compilation time
@ -27,7 +26,6 @@ LL | asm!("{}", out(reg) v[..]);
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u64]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all inline asm arguments must have a statically known size
error[E0277]: the size for values of type `[u64]` cannot be known at compilation time
@ -37,7 +35,6 @@ LL | asm!("{}", inout(reg) v[..]);
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u64]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all inline asm arguments must have a statically known size
error: aborting due to 5 previous errors

View file

@ -5,7 +5,6 @@ LL | let x = t.get();
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `<T as Get>::Value`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: consider further restricting the associated type

View file

@ -139,7 +139,6 @@ LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to 11 previous errors

View file

@ -21,7 +21,6 @@ LL | trait UncheckedCopy: Sized {
LL | + AddAssign<&'static str>
| ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self`
help: consider further restricting `Self`
|
LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> {
@ -50,7 +49,6 @@ LL | trait UncheckedCopy: Sized {
LL | + Display = Self;
| ^^^^^^^ `Self` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `Self`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: consider further restricting `Self`
|
@ -69,7 +67,6 @@ LL | + Display = Self;
LL | impl<T> UncheckedCopy for T {}
| ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `T`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: consider restricting type parameter `T`
|
@ -105,7 +102,6 @@ LL | + AddAssign<&'static str>
LL | impl<T> UncheckedCopy for T {}
| ^^^^^^^^^^^^^ no implementation for `T += &'static str`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T`
help: consider restricting type parameter `T`
|
LL | impl<T: std::ops::AddAssign<&'static str>> UncheckedCopy for T {}

View file

@ -21,7 +21,6 @@ LL | trait UncheckedCopy: Sized {
LL | + AddAssign<&'static str>
| ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self`
help: consider further restricting `Self`
|
LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> {
@ -50,7 +49,6 @@ LL | trait UncheckedCopy: Sized {
LL | + Display = Self;
| ^^^^^^^ `Self` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `Self`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: consider further restricting `Self`
|
@ -69,7 +67,6 @@ LL | + Display = Self;
LL | impl<T> UncheckedCopy for T {}
| ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `T`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: consider restricting type parameter `T`
|
@ -105,7 +102,6 @@ LL | + AddAssign<&'static str>
LL | impl<T> UncheckedCopy for T {}
| ^^^^^^^^^^^^^ no implementation for `T += &'static str`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T`
help: consider restricting type parameter `T`
|
LL | impl<T: std::ops::AddAssign<&'static str>> UncheckedCopy for T {}

View file

@ -6,8 +6,6 @@ LL | trait MyTrait {
LL | type This = Self;
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider further restricting `Self`
|
LL | trait MyTrait: std::marker::Sized {

View file

@ -9,8 +9,6 @@ LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self>
LL | pub trait Add<Rhs = Self> {
| --- required by this bound in `std::ops::Add`
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider further restricting `Self`
|
LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> + std::marker::Sized {}

View file

@ -7,7 +7,6 @@ LL |
LL | async { (ty, ty1) }
| ------------------- this returned value is of type `impl std::future::Future`
|
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `U`
note: captured value is not `Send`
--> $DIR/issue-70818.rs:6:18
|

View file

@ -17,10 +17,12 @@ LL | async fn frob(self) {}
| ^^^^ doesn't have a size known at compile-time
|
= help: within `Foo`, the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Foo`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | async fn frob(&self) {}
| ^
error: aborting due to 3 previous errors

View file

@ -4,7 +4,6 @@ error[E0277]: `T` cannot be sent between threads safely
LL | 1.bar::<T>();
| ^^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
help: consider further restricting this bound
|
LL | fn foo<T:'static + std::marker::Send>() {

View file

@ -21,7 +21,6 @@ LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
--> $DIR/bad-sized.rs:4:37
@ -30,7 +29,6 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new();
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::vec::Vec::<T>::new`
error: aborting due to 3 previous errors

View file

@ -4,7 +4,6 @@ error[E0277]: `impl Sized` doesn't implement `std::fmt::Debug`
LL | println!("{:?}", t);
| ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `impl Sized`
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
@ -18,7 +17,6 @@ error[E0277]: `T` doesn't implement `std::fmt::Debug`
LL | println!("{:?}", t);
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `T`
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
@ -32,7 +30,6 @@ error[E0277]: `T` doesn't implement `std::fmt::Debug`
LL | println!("{:?}", t);
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `T`
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
@ -46,7 +43,6 @@ error[E0277]: `Y` doesn't implement `std::fmt::Debug`
LL | println!("{:?} {:?}", x, y);
| ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `Y`
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `Y`
@ -60,7 +56,6 @@ error[E0277]: `X` doesn't implement `std::fmt::Debug`
LL | println!("{:?}", x);
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `X`
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
@ -74,7 +69,6 @@ error[E0277]: `X` doesn't implement `std::fmt::Debug`
LL | println!("{:?}", x);
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `X`
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `X`

View file

@ -5,7 +5,6 @@ LL | let _ = Box::into_boxed_slice(boxed_slice);
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::boxed::Box::<T>::into_boxed_slice`
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
@ -15,7 +14,6 @@ LL | let _ = Box::into_boxed_slice(boxed_slice);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: slice and array elements must have `Sized` type
error[E0277]: the size for values of type `dyn std::fmt::Debug` cannot be known at compilation time
@ -25,7 +23,6 @@ LL | let _ = Box::into_boxed_slice(boxed_trait);
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn std::fmt::Debug`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::boxed::Box::<T>::into_boxed_slice`
error[E0277]: the size for values of type `dyn std::fmt::Debug` cannot be known at compilation time
@ -35,7 +32,6 @@ LL | let _ = Box::into_boxed_slice(boxed_trait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn std::fmt::Debug`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: slice and array elements must have `Sized` type
error: aborting due to 4 previous errors

View file

@ -7,7 +7,6 @@ LL |
LL | impl <T: Sync+'static> Foo for (T,) { }
| ^^^ `T` cannot be sent between threads safely
|
= help: within `(T,)`, the trait `std::marker::Send` is not implemented for `T`
= note: required because it appears within the type `(T,)`
help: consider further restricting this bound
|
@ -23,7 +22,6 @@ LL | trait Foo : Send+Sync { }
LL | impl <T: Send> Foo for (T,T) { }
| ^^^ `T` cannot be shared between threads safely
|
= help: within `(T, T)`, the trait `std::marker::Sync` is not implemented for `T`
= note: required because it appears within the type `(T, T)`
help: consider further restricting this bound
|

View file

@ -9,7 +9,6 @@ LL | impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
| ---- required by this bound in `trait_superkinds_in_metadata::RequiresRequiresShareAndSend`
|
= help: within `X<T>`, the trait `std::marker::Send` is not implemented for `T`
= note: required because it appears within the type `X<T>`
help: consider further restricting this bound
|

View file

@ -7,7 +7,6 @@ LL |
LL | impl <T: Sync+'static> Foo for T { }
| ^^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
help: consider further restricting this bound
|
LL | impl <T: Sync+'static + std::marker::Send> Foo for T { }

View file

@ -8,7 +8,6 @@ LL | impl Foo for str { }
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the trait bound `f32: Foo` is not satisfied
--> $DIR/impl_wf.rs:27:17

View file

@ -7,7 +7,6 @@ LL | struct X<F> where F: FnOnce() + 'static + Send {
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
| ^^^^ `F` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `F`
help: consider further restricting this bound
|
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send {

View file

@ -7,7 +7,6 @@ LL | fn take_const_owned<F>(_: F) where F: FnOnce() + Sync + Send {
LL | take_const_owned(f);
| ^ `F` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `F`
help: consider further restricting this bound
|
LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync {

View file

@ -16,10 +16,10 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:14:5
--> $DIR/array-size-in-generic-struct-param.rs:14:10
|
LL | arr: [u8; CFG.arr_size],
| ^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes

View file

@ -5,7 +5,6 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/const-unsized.rs:6:18
@ -14,7 +13,6 @@ LL | const CONST_FOO: str = *"foo";
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
--> $DIR/const-unsized.rs:9:18
@ -23,7 +21,6 @@ LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/const-unsized.rs:12:20
@ -32,7 +29,6 @@ LL | static STATIC_BAR: str = *"bar";
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to 4 previous errors

View file

@ -5,7 +5,6 @@ LL | f5.ptr = *z;
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn ToBar`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the left-hand-side of an assignment must have a statically known size
error: aborting due to previous error

View file

@ -14,7 +14,6 @@ LL | f5.2 = Bar1 {f: 36};
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn ToBar`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the left-hand-side of an assignment must have a statically known size
error: aborting due to 2 previous errors

View file

@ -14,7 +14,6 @@ LL | f5.ptr = Bar1 {f: 36};
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn ToBar`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the left-hand-side of an assignment must have a statically known size
error: aborting due to 2 previous errors

View file

@ -5,7 +5,6 @@ LL | let h: &(([isize],),) = &(*g,);
| ^^^^^ doesn't have a size known at compile-time
|
= help: within `(([isize],),)`, the trait `std::marker::Sized` is not implemented for `[isize]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `([isize],)`
= note: required because it appears within the type `(([isize],),)`
= note: tuples must have a statically known size to be initialized

View file

@ -5,7 +5,6 @@ LL | let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `Fat<Fat<[isize]>>`, the trait `std::marker::Sized` is not implemented for `[isize]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Fat<[isize]>`
= note: required because it appears within the type `Fat<Fat<[isize]>>`
= note: structs must have a statically known size to be initialized

View file

@ -6,8 +6,6 @@ LL | fn test1<T: ?Sized + Foo>(t: &T) {
LL | let u: &dyn Foo = t;
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error[E0277]: the size for values of type `T` cannot be known at compilation time
@ -18,8 +16,6 @@ LL | fn test2<T: ?Sized + Foo>(t: &T) {
LL | let v: &dyn Foo = t as &dyn Foo;
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error[E0277]: the size for values of type `str` cannot be known at compilation time
@ -29,7 +25,6 @@ LL | let _: &[&dyn Foo] = &["hi"];
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
@ -39,7 +34,6 @@ LL | let _: &dyn Foo = x as &dyn Foo;
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error: aborting due to 4 previous errors

View file

@ -8,7 +8,6 @@ LL | impl Foo<[isize]> for usize { }
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[isize]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | trait Foo<T: ?Sized> : Sized { fn take(self, x: &T) { } } // Note: T is sized
@ -24,7 +23,6 @@ LL | impl Foo<isize> for [usize] { }
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[usize]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to 2 previous errors

View file

@ -2,13 +2,15 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
--> $DIR/E0277.rs:13:6
|
LL | fn f(p: Path) { }
| ^ borrow the `Path` instead
| ^ doesn't have a size known at compile-time
|
= help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `std::path::Path`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn f(p: &Path) { }
| ^
error[E0277]: the trait bound `i32: Foo` is not satisfied
--> $DIR/E0277.rs:17:15

View file

@ -1,8 +1,8 @@
error[E0478]: lifetime bound not satisfied
--> $DIR/E0478.rs:4:5
--> $DIR/E0478.rs:4:12
|
LL | child: Box<dyn Wedding<'kiss> + 'SnowWhite>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'SnowWhite` as defined on the struct at 3:22
--> $DIR/E0478.rs:3:22

View file

@ -8,7 +8,6 @@ LL | assert_sized::<A>();
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `A`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | fn assert_sized<T: ?Sized>() { }
@ -24,7 +23,6 @@ LL | assert_sized::<Foo>();
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `Foo`, the trait `std::marker::Sized` is not implemented for `A`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Foo`
help: consider relaxing the implicit `Sized` restriction
|
@ -41,7 +39,6 @@ LL | assert_sized::<Bar<A>>();
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `Bar<A>`, the trait `std::marker::Sized` is not implemented for `A`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Bar<A>`
help: consider relaxing the implicit `Sized` restriction
|
@ -58,7 +55,6 @@ LL | assert_sized::<Bar<Bar<A>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `Bar<Bar<A>>`, the trait `std::marker::Sized` is not implemented for `A`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Bar<A>`
= note: required because it appears within the type `Bar<Bar<A>>`
help: consider relaxing the implicit `Sized` restriction

View file

@ -5,7 +5,6 @@ LL | static symbol: [usize];
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[usize]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to previous error

View file

@ -1,10 +1,10 @@
error[E0310]: the parameter type `U` may not live long enough
--> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:5
--> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:10
|
LL | struct Foo<U> {
| - help: consider adding an explicit lifetime bound...: `U: 'static`
LL | bar: Bar<U>
| ^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
| ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
error: aborting due to previous error

View file

@ -95,7 +95,6 @@ LL | struct TwoStrs(str, str) where str: Sized;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -108,7 +107,6 @@ LL | | }
| |_^ doesn't have a size known at compile-time
|
= help: within `Dst<(dyn A + 'static)>`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Dst<(dyn A + 'static)>`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -122,7 +120,6 @@ LL | | }
| |_^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable

View file

@ -5,9 +5,11 @@ LL | fn f(f: dyn FnOnce()) {}
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn f(f: &dyn FnOnce()) {}
| ^
error: aborting due to previous error

View file

@ -9,7 +9,6 @@ LL | | };
| |____^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the yield type of a generator must have a statically known size
error[E0277]: the size for values of type `str` cannot be known at compilation time
@ -19,7 +18,6 @@ LL | Pin::new(&mut gen).resume(());
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to 2 previous errors

View file

@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32;
LL | type F<'a> = Self;
| ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T`
|
= help: the trait `std::ops::Fn<()>` is not implemented for `T`
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }
help: consider restricting type parameter `T`
|

View file

@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32;
LL | type F<'a> = Self;
| ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T`
|
= help: the trait `std::ops::Fn<()>` is not implemented for `T`
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }
help: consider restricting type parameter `T`
|

View file

@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32;
LL | type F<'a> = Self;
| ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T`
|
= help: the trait `std::ops::Fn<()>` is not implemented for `T`
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }
help: consider restricting type parameter `T`
|

View file

@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32;
LL | type F<'a> = Self;
| ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T`
|
= help: the trait `std::ops::Fn<()>` is not implemented for `T`
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }
help: consider restricting type parameter `T`
|

View file

@ -8,7 +8,6 @@ LL | impl Tsized for () {}
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[()]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to previous error

View file

@ -16,7 +16,6 @@ LL | fn fuz() -> (usize, Trait) { (42, Struct) }
| doesn't have a size known at compile-time
|
= help: within `(usize, (dyn Trait + 'static))`, the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
= note: the return type of a function must have a statically known size
@ -38,7 +37,6 @@ LL | fn bar() -> (usize, dyn Trait) { (42, Struct) }
| doesn't have a size known at compile-time
|
= help: within `(usize, (dyn Trait + 'static))`, the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
= note: the return type of a function must have a statically known size

View file

@ -56,7 +56,6 @@ LL | impl<'self> Serializable<str> for &'self str {
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | trait Serializable<'self, T: ?Sized> {

View file

@ -5,7 +5,6 @@ LL | let _x = "test" as &dyn (::std::any::Any);
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn std::any::Any`
error: aborting due to previous error

View file

@ -5,7 +5,6 @@ LL | &mut something
| ^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[T]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature

View file

@ -5,7 +5,6 @@ LL | (|| Box::new(*(&[0][..])))();
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::boxed::Box::<T>::new`
error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
@ -15,7 +14,6 @@ LL | (|| Box::new(*(&[0][..])))();
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature

View file

@ -8,7 +8,6 @@ LL | enum Option<T> {
| - required by this bound in `Option`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
--> $DIR/issue-18919.rs:7:13
|

View file

@ -1,5 +1,5 @@
error[E0038]: the trait `Qiz` cannot be made into an object
--> $DIR/issue-19380.rs:11:3
--> $DIR/issue-19380.rs:11:9
|
LL | trait Qiz {
| --- this trait cannot be made into an object...
@ -7,7 +7,7 @@ LL | fn qiz();
| --- ...because associated function `qiz` has no `self` parameter
...
LL | foos: &'static [&'static (dyn Qiz + 'static)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object
|
help: consider turning `qiz` into a method by giving it a `&self` argument or constraining it so it does not apply to trait objects
|

View file

@ -7,8 +7,6 @@ LL | trait From<Src> {
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider further restricting `Self`
|
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self>, Self: std::marker::Sized {

View file

@ -10,7 +10,6 @@ LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `[i32]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to previous error

View file

@ -5,7 +5,6 @@ LL | for item in *things { *item = 0 }
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item = &'a mut u8>`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::iter::IntoIterator::into_iter`
error: aborting due to previous error

View file

@ -1,11 +1,10 @@
error[E0277]: the size for values of type `[std::string::String]` cannot be known at compilation time
--> $DIR/issue-22874.rs:2:5
--> $DIR/issue-22874.rs:2:11
|
LL | rows: [[String]],
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[std::string::String]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: slice and array elements must have `Sized` type
error: aborting due to previous error

View file

@ -8,7 +8,6 @@ LL | struct Vec<T> {
| - required by this bound in `Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
--> $DIR/issue-23281.rs:8:12
|

View file

@ -5,7 +5,6 @@ LL | static foo: dyn Fn() -> u32 = || -> u32 {
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to previous error

View file

@ -1,14 +1,21 @@
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/issue-27060-2.rs:3:5
--> $DIR/issue-27060-2.rs:3:11
|
LL | pub struct Bad<T: ?Sized> {
| - this type parameter needs to be `std::marker::Sized`
LL | data: T,
| ^^^^^^^ doesn't have a size known at compile-time
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the last field of a packed struct may only have a dynamically sized type if it does not need drop to be run
= help: change the field's type to have a statically known size
help: borrowed types always have a statically known size
|
LL | data: &T,
| ^
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
LL | data: Box<T>,
| ^^^^ ^
error: aborting due to previous error

View file

@ -4,14 +4,15 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
LL | fn foo(self) -> &'static i32 {
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: consider further restricting `Self`
|
LL | fn foo(self) -> &'static i32 where Self: std::marker::Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn foo(&self) -> &'static i32 {
| ^
error: aborting due to previous error

View file

@ -5,7 +5,6 @@ LL | &X(*Y)
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature

View file

@ -5,8 +5,16 @@ LL | V([Box<E>]),
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box<E>]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: no field of an enum variant may have a dynamically sized type
= help: change the field's type to have a statically known size
help: borrowed types always have a statically known size
|
LL | V(&[Box<E>]),
| ^
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
LL | V(Box<[Box<E>]>),
| ^^^^ ^
error: aborting due to previous error

View file

@ -5,9 +5,11 @@ LL | fn _test(ref _p: str) {}
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn _test(ref _p: &str) {}
| ^
error: aborting due to previous error

View file

@ -5,9 +5,11 @@ LL | pub fn example(ref s: str) {}
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | pub fn example(ref s: &str) {}
| ^
error: aborting due to previous error

View file

@ -5,13 +5,15 @@ LL | fn baz(_: Self::Target) where Self: Deref {}
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `<Self as std::ops::Deref>::Target`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature
help: consider further restricting the associated type
|
LL | fn baz(_: Self::Target) where Self: Deref, <Self as std::ops::Deref>::Target: std::marker::Sized {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn baz(_: &Self::Target) where Self: Deref {}
| ^
error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time
--> $DIR/issue-42312.rs:8:10
@ -20,9 +22,11 @@ LL | pub fn f(_: dyn ToString) {}
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | pub fn f(_: &dyn ToString) {}
| ^
error: aborting due to 2 previous errors

View file

@ -5,7 +5,6 @@ LL | pub static mut symbol: [i8];
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[i8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to previous error

View file

@ -5,9 +5,11 @@ LL | fn new_struct(r: dyn A + 'static)
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn new_struct(r: &dyn A + 'static)
| ^
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
--> $DIR/issue-5883.rs:8:8
@ -19,7 +21,6 @@ LL | Struct { r: r }
| --------------- this returned value is of type `Struct`
|
= help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Struct`
= note: the return type of a function must have a statically known size

View file

@ -10,7 +10,6 @@ LL | type Ctx = dyn Alias<T>;
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to previous error

View file

@ -4,7 +4,6 @@ error[E0277]: `T` cannot be sent between threads safely
LL | let a = &t as &dyn Gettable<T>;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`
@ -31,7 +30,6 @@ error[E0277]: `T` cannot be sent between threads safely
LL | let a: &dyn Gettable<T> = &t;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`

View file

@ -4,7 +4,6 @@ error[E0277]: `T` cannot be sent between threads safely
LL | let a = &t as &dyn Gettable<T>;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`
@ -31,7 +30,6 @@ error[E0277]: `T` cannot be sent between threads safely
LL | let a: &dyn Gettable<T> = &t;
| ^^ `T` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `T`
= note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
= note: required for the cast to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`

View file

@ -9,8 +9,6 @@ LL | fn test<T>() {
LL | let _: [u8; sof::<T>()];
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | pub const fn sof<T: ?Sized>() -> usize {

View file

@ -8,10 +8,10 @@ LL | #![feature(lazy_normalization_consts)]
= note: see issue #72219 <https://github.com/rust-lang/rust/issues/72219> for more information
error: constant expression depends on a generic parameter
--> $DIR/issue-57739.rs:12:5
--> $DIR/issue-57739.rs:12:12
|
LL | array: [u8; T::SIZE],
| ^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes

View file

@ -1,10 +1,10 @@
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:19:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:19:10
|
LL | struct Foo<T> {
| - help: consider adding an explicit lifetime bound...: `T: 'static`
LL | foo: &'static T
| ^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
| ^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:19

View file

@ -209,7 +209,6 @@ LL | let _ = fat_v as *const dyn Foo;
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error[E0277]: the size for values of type `str` cannot be known at compilation time
@ -219,7 +218,6 @@ LL | let _ = a as *const dyn Foo;
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error[E0606]: casting `&{float}` as `f32` is invalid

View file

@ -7,7 +7,6 @@ LL | fn is_zen<T: Zen>(_: T) {}
LL | is_zen(x)
| ^ `T` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `T`
= note: required because of the requirements on the impl of `Zen` for `&T`
= note: required because it appears within the type `std::marker::PhantomData<&T>`
= note: required because it appears within the type `Guard<'_, T>`
@ -25,7 +24,6 @@ LL | fn is_zen<T: Zen>(_: T) {}
LL | is_zen(x)
| ^ `T` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `T`
= note: required because of the requirements on the impl of `Zen` for `&T`
= note: required because it appears within the type `std::marker::PhantomData<&T>`
= note: required because it appears within the type `Guard<'_, T>`

View file

@ -19,7 +19,6 @@ LL | let range = *arr..;
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::ops::RangeFrom`
error: aborting due to 3 previous errors

View file

@ -5,10 +5,10 @@ LL | z: Box<dyn Is<'a>+'b+'c>,
| ^^
error[E0478]: lifetime bound not satisfied
--> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:5
--> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:8
|
LL | z: Box<dyn Is<'a>+'b+'c>,
| ^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'b` as defined on the struct at 11:15
--> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15

View file

@ -1,8 +1,8 @@
error[E0478]: lifetime bound not satisfied
--> $DIR/regions-wf-trait-object.rs:7:5
--> $DIR/regions-wf-trait-object.rs:7:8
|
LL | x: Box<dyn TheTrait<'a>+'b>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'b` as defined on the struct at 6:15
--> $DIR/regions-wf-trait-object.rs:6:15

View file

@ -5,9 +5,11 @@ LL | fn foo(_x: K) {}
| ^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn foo(_x: &K) {}
| ^
error: aborting due to previous error

View file

@ -1,10 +1,10 @@
error[E0310]: the parameter type `U` may not live long enough
--> $DIR/dont-infer-static.rs:8:5
--> $DIR/dont-infer-static.rs:8:10
|
LL | struct Foo<U> {
| - help: consider adding an explicit lifetime bound...: `U: 'static`
LL | bar: Bar<U>
| ^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
| ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
error: aborting due to previous error

View file

@ -24,7 +24,6 @@ LL | type U<'a>: PartialEq<&'a Self>;
LL | default type U<'a> = &'a T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T == T`
|
= help: the trait `std::cmp::PartialEq` is not implemented for `T`
= note: required because of the requirements on the impl of `std::cmp::PartialEq` for `&'a T`
help: consider further restricting this bound
|

View file

@ -19,14 +19,15 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
--> $DIR/str-array-assignment.rs:7:7
|
LL | let v = s[..2];
| ^ ------ help: consider borrowing here: `&s[..2]`
| |
| doesn't have a size known at compile-time
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: consider borrowing here
|
LL | let v = &s[..2];
| ^
error[E0308]: mismatched types
--> $DIR/str-array-assignment.rs:9:17

View file

@ -8,7 +8,6 @@ LL | s[1..2] = bot();
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider relaxing the implicit `Sized` restriction
|
LL | fn bot<T: ?Sized>() -> T { loop {} }
@ -21,7 +20,6 @@ LL | s[1..2] = bot();
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the left-hand-side of an assignment must have a statically known size
error[E0277]: the type `str` cannot be indexed by `usize`

View file

@ -80,7 +80,6 @@ LL | <str as Foo<u8>>::bar;
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str`
error: aborting due to 5 previous errors

View file

@ -80,7 +80,6 @@ LL | <str as Foo<u8>>::bar;
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str`
error: aborting due to 5 previous errors

View file

@ -1,5 +1,5 @@
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/adt-param-with-implicit-sized-bound.rs:25:5
--> $DIR/adt-param-with-implicit-sized-bound.rs:25:9
|
LL | struct X<T>(T);
| - required by this bound in `X`
@ -7,10 +7,8 @@ LL | struct X<T>(T);
LL | struct Struct5<T: ?Sized>{
| - this type parameter needs to be `std::marker::Sized`
LL | _t: X<T>,
| ^^^^^^^^ doesn't have a size known at compile-time
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
--> $DIR/adt-param-with-implicit-sized-bound.rs:18:10
|
@ -28,8 +26,6 @@ LL | fn func1() -> Struct1<Self>;
LL | struct Struct1<T>{
| - required by this bound in `Struct1`
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider further restricting `Self`
|
LL | fn func1() -> Struct1<Self> where Self: std::marker::Sized;
@ -48,8 +44,6 @@ LL | fn func2<'a>() -> Struct2<'a, Self>;
LL | struct Struct2<'a, T>{
| - required by this bound in `Struct2`
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider further restricting `Self`
|
LL | fn func2<'a>() -> Struct2<'a, Self> where Self: std::marker::Sized;
@ -68,8 +62,6 @@ LL | fn func3() -> Struct3<Self>;
LL | struct Struct3<T>{
| - required by this bound in `Struct3`
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
--> $DIR/adt-param-with-implicit-sized-bound.rs:14:16
|
@ -91,8 +83,6 @@ LL | fn func4() -> Struct4<Self>;
LL | struct Struct4<T>{
| - required by this bound in `Struct4`
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
help: consider further restricting `Self`
|
LL | fn func4() -> Struct4<Self> where Self: std::marker::Sized;

View file

@ -2,13 +2,15 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
--> $DIR/path-by-value.rs:3:6
|
LL | fn f(p: Path) { }
| ^ borrow the `Path` instead
| ^ doesn't have a size known at compile-time
|
= help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `std::path::Path`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn f(p: &Path) { }
| ^
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | fn is_send<T: Send>(val: T) {}
LL | is_send(val);
| ^^^ `impl Sync` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `impl Sync`
help: consider further restricting this bound
|
LL | fn use_impl_sync(val: impl Sync + std::marker::Send) {
@ -22,7 +21,6 @@ LL | fn is_send<T: Send>(val: T) {}
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `S`
help: consider further restricting this bound
|
LL | fn use_where<S>(val: S) where S: Sync + std::marker::Send {
@ -37,7 +35,6 @@ LL | fn is_send<T: Send>(val: T) {}
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `S`
help: consider further restricting this bound
|
LL | fn use_bound<S: Sync + std::marker::Send>(val: S) {
@ -52,7 +49,6 @@ LL | fn is_send<T: Send>(val: T) {}
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `S`
help: consider further restricting this bound
|
LL | Sync + std::marker::Send
@ -67,7 +63,6 @@ LL | fn is_send<T: Send>(val: T) {}
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `S`
help: consider further restricting this bound
|
LL | fn use_bound_and_where<S: Sync>(val: S) where S: std::fmt::Debug + std::marker::Send {
@ -82,7 +77,6 @@ LL | fn is_send<T: Send>(val: T) {}
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `S`
help: consider restricting type parameter `S`
|
LL | fn use_unbound<S: std::marker::Send>(val: S) {

View file

@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `RootDatabase: SourceDatabase`
--> $DIR/cycle-cache-err-60010.rs:27:5
--> $DIR/cycle-cache-err-60010.rs:27:13
|
LL | _parse: <ParseQuery as Query<RootDatabase>>::Data,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery`

View file

@ -13,9 +13,11 @@ LL | fn foo(_x: Foo + Send) {
| ^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + std::marker::Send + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn foo(_x: &Foo + Send) {
| ^
error: aborting due to previous error; 1 warning emitted

View file

@ -13,13 +13,13 @@ LL | impl<T: Trait> Foo<T> {
| ^^^^^^^
error[E0277]: the trait bound `isize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:19:5
--> $DIR/trait-bounds-on-structs-and-enums.rs:19:8
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
...
LL | a: Foo<isize>,
| ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
| ^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:23:10
@ -31,13 +31,13 @@ LL | Quux(Bar<usize>),
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
error[E0277]: the trait bound `U: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:27:5
--> $DIR/trait-bounds-on-structs-and-enums.rs:27:8
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
...
LL | b: Foo<U>,
| ^^^^^^^^^ the trait `Trait` is not implemented for `U`
| ^^^^^^ the trait `Trait` is not implemented for `U`
|
help: consider restricting type parameter `U`
|
@ -68,13 +68,13 @@ LL | Foo<i32>,
| ^^^^^^^^ the trait `Trait` is not implemented for `i32`
error[E0277]: the trait bound `u8: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:39:22
--> $DIR/trait-bounds-on-structs-and-enums.rs:39:29
|
LL | enum Bar<T:Trait> {
| ----- required by this bound in `Bar`
...
LL | DictionaryLike { field: Bar<u8> },
| ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8`
| ^^^^^^^ the trait `Trait` is not implemented for `u8`
error: aborting due to 7 previous errors

View file

@ -11,9 +11,6 @@ LL | mem::size_of::<U>();
|
LL | pub const fn size_of<T>() -> usize {
| - required by this bound in `std::mem::size_of`
|
= help: the trait `std::marker::Sized` is not implemented for `U`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `U` cannot be known at compilation time
--> $DIR/trait-suggest-where-clause.rs:10:5
@ -29,8 +26,6 @@ LL | mem::size_of::<Misc<U>>();
LL | pub const fn size_of<T>() -> usize {
| - required by this bound in `std::mem::size_of`
|
= help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Misc<U>`
error[E0277]: the trait bound `u64: std::convert::From<T>` is not satisfied
@ -69,7 +64,6 @@ LL | pub const fn size_of<T>() -> usize {
| - required by this bound in `std::mem::size_of`
|
= help: the trait `std::marker::Sized` is not implemented for `[T]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `[&U]` cannot be known at compilation time
--> $DIR/trait-suggest-where-clause.rs:31:5
@ -83,7 +77,6 @@ LL | pub const fn size_of<T>() -> usize {
| - required by this bound in `std::mem::size_of`
|
= help: the trait `std::marker::Sized` is not implemented for `[&U]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to 7 previous errors

View file

@ -5,7 +5,6 @@ LL | fn cant_return_str() -> str {
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the return type of a function must have a statically known size
error[E0599]: no method named `test` found for type `i32` in the current scope

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