mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Reorder check_item_type
diagnostics so they occur next to the corresponding check_well_formed
diagnostics
This commit is contained in:
parent
dd2dee1c70
commit
cd4c352fb4
@ -8,7 +8,7 @@ use rustc_attr as attr;
|
||||
use rustc_errors::{ErrorGuaranteed, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind};
|
||||
use rustc_hir::def_id::LocalModDefId;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::Node;
|
||||
use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
|
||||
use rustc_infer::traits::{Obligation, TraitEngineExt as _};
|
||||
@ -440,7 +440,7 @@ fn check_static_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
let _indenter = indenter();
|
||||
match tcx.def_kind(def_id) {
|
||||
DefKind::Static(..) => {
|
||||
@ -458,11 +458,7 @@ fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
DefKind::Fn => {} // entirely within check_item_body
|
||||
DefKind::Impl { of_trait } => {
|
||||
if of_trait && let Some(impl_trait_ref) = tcx.impl_trait_ref(def_id) {
|
||||
check_impl_items_against_trait(
|
||||
tcx,
|
||||
def_id,
|
||||
impl_trait_ref.instantiate_identity(),
|
||||
);
|
||||
check_impl_items_against_trait(tcx, def_id, impl_trait_ref.instantiate_identity());
|
||||
check_on_unimplemented(tcx, def_id);
|
||||
}
|
||||
}
|
||||
@ -1304,16 +1300,6 @@ pub(super) fn check_type_params_are_used<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn check_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
|
||||
let module = tcx.hir_module_items(module_def_id);
|
||||
for id in module.items() {
|
||||
check_item_type(tcx, id.owner_id.def_id);
|
||||
}
|
||||
if module_def_id == LocalModDefId::CRATE_DEF_ID {
|
||||
super::entry::check_for_entry_fn(tcx);
|
||||
}
|
||||
}
|
||||
|
||||
fn async_opaque_type_cycle_error(tcx: TyCtxt<'_>, span: Span) -> ErrorGuaranteed {
|
||||
struct_span_err!(tcx.dcx(), span, E0733, "recursion in an `async fn` requires boxing")
|
||||
.span_label(span, "recursive `async fn`")
|
||||
|
@ -14,7 +14,7 @@ use std::ops::Not;
|
||||
use super::check_function_signature;
|
||||
use crate::errors;
|
||||
|
||||
pub(crate) fn check_for_entry_fn(tcx: TyCtxt<'_>) {
|
||||
pub(crate) fn check_for_entry_fn(tcx: TyCtxt<'_>, (): ()) {
|
||||
match tcx.entry_fn(()) {
|
||||
Some((def_id, EntryFnType::Main { .. })) => check_main_fn_ty(tcx, def_id),
|
||||
Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id),
|
||||
|
@ -75,7 +75,7 @@ pub use check::check_abi;
|
||||
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
use check::check_mod_item_types;
|
||||
use entry::check_for_entry_fn;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_errors::{pluralize, struct_span_err, Diagnostic, DiagnosticBuilder};
|
||||
@ -110,7 +110,7 @@ pub fn provide(providers: &mut Providers) {
|
||||
wfcheck::provide(providers);
|
||||
*providers = Providers {
|
||||
adt_destructor,
|
||||
check_mod_item_types,
|
||||
check_for_entry_fn,
|
||||
region_scope_tree,
|
||||
collect_return_position_impl_trait_in_trait_tys,
|
||||
compare_impl_const: compare_impl_item::compare_impl_const_raw,
|
||||
|
@ -172,7 +172,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
|
||||
item.name = ? tcx.def_path_str(def_id)
|
||||
);
|
||||
|
||||
match item.kind {
|
||||
let res = match item.kind {
|
||||
// Right now we check that every default trait implementation
|
||||
// has an implementation of itself. Basically, a case like:
|
||||
//
|
||||
@ -271,7 +271,11 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
|
||||
}
|
||||
}
|
||||
_ => Ok(()),
|
||||
}
|
||||
};
|
||||
|
||||
crate::check::check::check_item_type(tcx, def_id);
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
fn check_foreign_item(tcx: TyCtxt<'_>, item: &hir::ForeignItem<'_>) -> Result<(), ErrorGuaranteed> {
|
||||
|
@ -204,13 +204,9 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
|
||||
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
|
||||
});
|
||||
|
||||
// NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
|
||||
tcx.sess.time("item_types_checking", || {
|
||||
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
|
||||
});
|
||||
tcx.sess.time("entry_fn_checks", || tcx.ensure().check_for_entry_fn(()));
|
||||
|
||||
// HACK: `check_mod_type_wf` may spuriously emit errors due to `span_delayed_bug`, even if
|
||||
// those errors only actually get emitted in `check_mod_item_types`.
|
||||
// HACK: `check_for_entry_fn` wants to report its errors even if `check_mod_type_wf` has errored.
|
||||
errs?;
|
||||
|
||||
if tcx.features().rustc_attrs {
|
||||
|
@ -938,8 +938,8 @@ rustc_queries! {
|
||||
desc { |tcx| "checking naked functions in {}", describe_as_module(key, tcx) }
|
||||
}
|
||||
|
||||
query check_mod_item_types(key: LocalModDefId) -> () {
|
||||
desc { |tcx| "checking item types in {}", describe_as_module(key, tcx) }
|
||||
query check_for_entry_fn(key: ()) -> () {
|
||||
desc { |_tcx| "checking entry functions" }
|
||||
}
|
||||
|
||||
query check_mod_privacy(key: LocalModDefId) -> () {
|
||||
|
@ -323,7 +323,9 @@ pub(crate) fn run_global_ctxt(
|
||||
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
|
||||
});
|
||||
tcx.sess.time("item_types_checking", || {
|
||||
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
|
||||
tcx.hir().for_each_module(|module| {
|
||||
let _ = tcx.ensure().check_mod_type_wf(module);
|
||||
});
|
||||
});
|
||||
|
||||
tcx.dcx().abort_if_errors();
|
||||
|
@ -1,3 +1,15 @@
|
||||
error[E0277]: the trait bound `(T, U): Get` is not satisfied
|
||||
--> $DIR/associated-types-no-suitable-supertrait.rs:22:5
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)`
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/associated-types-no-suitable-supertrait.rs:12:1
|
||||
|
|
||||
LL | trait Get {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `(T, U): Get` is not satisfied
|
||||
--> $DIR/associated-types-no-suitable-supertrait.rs:22:40
|
||||
|
|
||||
@ -21,18 +33,6 @@ help: consider further restricting `Self`
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
|
||||
| +++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `(T, U): Get` is not satisfied
|
||||
--> $DIR/associated-types-no-suitable-supertrait.rs:22:5
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)`
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/associated-types-no-suitable-supertrait.rs:12:1
|
||||
|
|
||||
LL | trait Get {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -24,13 +24,13 @@ impl Tr for u32 {
|
||||
// ...but not in an impl that redefines one of the types.
|
||||
impl Tr for bool {
|
||||
type A = Box<Self::B>;
|
||||
//~^ ERROR overflow evaluating the requirement `<bool as Tr>::B == _`
|
||||
//~^ ERROR overflow evaluating the requirement `<bool as Tr>::A == _`
|
||||
}
|
||||
// (the error is shown twice for some reason)
|
||||
|
||||
impl Tr for usize {
|
||||
type B = &'static Self::A;
|
||||
//~^ ERROR overflow evaluating the requirement `<usize as Tr>::A == _`
|
||||
//~^ ERROR overflow evaluating the requirement `<usize as Tr>::B == _`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,10 +1,10 @@
|
||||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _`
|
||||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::A == _`
|
||||
--> $DIR/defaults-cyclic-fail-1.rs:26:14
|
||||
|
|
||||
LL | type A = Box<Self::B>;
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _`
|
||||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::B == _`
|
||||
--> $DIR/defaults-cyclic-fail-1.rs:32:14
|
||||
|
|
||||
LL | type B = &'static Self::A;
|
||||
|
@ -25,13 +25,13 @@ impl Tr for u32 {
|
||||
|
||||
impl Tr for bool {
|
||||
type A = Box<Self::B>;
|
||||
//~^ ERROR overflow evaluating the requirement `<bool as Tr>::B == _`
|
||||
//~^ ERROR overflow evaluating the requirement `<bool as Tr>::A == _`
|
||||
}
|
||||
// (the error is shown twice for some reason)
|
||||
|
||||
impl Tr for usize {
|
||||
type B = &'static Self::A;
|
||||
//~^ ERROR overflow evaluating the requirement `<usize as Tr>::A == _`
|
||||
//~^ ERROR overflow evaluating the requirement `<usize as Tr>::B == _`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,10 +1,10 @@
|
||||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _`
|
||||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::A == _`
|
||||
--> $DIR/defaults-cyclic-fail-2.rs:27:14
|
||||
|
|
||||
LL | type A = Box<Self::B>;
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _`
|
||||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::B == _`
|
||||
--> $DIR/defaults-cyclic-fail-2.rs:33:14
|
||||
|
|
||||
LL | type B = &'static Self::A;
|
||||
|
@ -1,3 +1,9 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-66312.rs:9:8
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| ^^^^^^^^^^^ expected `bool`, found `()`
|
||||
|
||||
error[E0307]: invalid `self` parameter type: T
|
||||
--> $DIR/issue-66312.rs:4:22
|
||||
|
|
||||
@ -7,12 +13,6 @@ LL | fn is_some(self: T);
|
||||
= note: type of `self` must be `Self` or a type that dereferences to it
|
||||
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-66312.rs:9:8
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| ^^^^^^^^^^^ expected `bool`, found `()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0307, E0308.
|
||||
|
@ -4,6 +4,7 @@
|
||||
trait TensorDimension {
|
||||
const DIM: usize;
|
||||
//~^ ERROR cycle detected when resolving instance
|
||||
//~| ERROR cycle detected when resolving instance
|
||||
// FIXME Given the current state of the compiler its expected that we cycle here,
|
||||
// but the cycle is still wrong.
|
||||
const ISSCALAR: bool = Self::DIM == 0;
|
||||
@ -79,6 +80,7 @@ impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorSi
|
||||
for BMap<'a, R, T, F, DIM>
|
||||
{
|
||||
fn size(&self) -> [usize; DIM] {
|
||||
//~^ ERROR: method not compatible with trait
|
||||
self.reference.size()
|
||||
}
|
||||
}
|
||||
@ -88,6 +90,7 @@ impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> Broadcas
|
||||
{
|
||||
type Element = R;
|
||||
fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> {
|
||||
//~^ ERROR: method not compatible with trait
|
||||
self.reference.bget(index).map(&self.closure)
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,44 @@ LL | trait TensorDimension {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0391]: cycle detected when resolving instance `<LazyUpdim<'_, T, <T as TensorDimension>::DIM, DIM> as TensorDimension>::DIM`
|
||||
--> $DIR/issue-83765.rs:5:5
|
||||
|
|
||||
LL | const DIM: usize;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires computing candidate for `<LazyUpdim<'_, T, <T as TensorDimension>::DIM, DIM> as TensorDimension>`...
|
||||
--> $DIR/issue-83765.rs:4:1
|
||||
|
|
||||
LL | trait TensorDimension {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires resolving instance `<LazyUpdim<'_, T, <T as TensorDimension>::DIM, DIM> as TensorDimension>::DIM`, completing the cycle
|
||||
note: cycle used when checking that `<impl at $DIR/issue-83765.rs:56:1: 56:97>` is well-formed
|
||||
--> $DIR/issue-83765.rs:56:1
|
||||
|
|
||||
LL | impl<'a, T: Broadcastable, const DIM: usize> Broadcastable for LazyUpdim<'a, T, { T::DIM }, DIM> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
error[E0308]: method not compatible with trait
|
||||
--> $DIR/issue-83765.rs:82:5
|
||||
|
|
||||
LL | fn size(&self) -> [usize; DIM] {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM`
|
||||
|
|
||||
= note: expected constant `Self::DIM`
|
||||
found constant `DIM`
|
||||
|
||||
error[E0308]: method not compatible with trait
|
||||
--> $DIR/issue-83765.rs:92:5
|
||||
|
|
||||
LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM`
|
||||
|
|
||||
= note: expected constant `Self::DIM`
|
||||
found constant `DIM`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0391.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
@ -6,30 +6,6 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:7:18
|
||||
|
|
||||
LL | const CONST_FOO: str = *"foo";
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
|
||||
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:11:18
|
||||
|
|
||||
LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
|
||||
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:15:20
|
||||
|
|
||||
LL | static STATIC_BAR: str = *"bar";
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
|
||||
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:3:35
|
||||
|
|
||||
@ -39,6 +15,14 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
|
||||
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:7:18
|
||||
|
|
||||
LL | const CONST_FOO: str = *"foo";
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:7:24
|
||||
|
|
||||
@ -48,6 +32,14 @@ LL | const CONST_FOO: str = *"foo";
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:11:18
|
||||
|
|
||||
LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
|
||||
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
|
||||
|
||||
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:11:37
|
||||
|
|
||||
@ -57,6 +49,14 @@ LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
|
||||
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:15:20
|
||||
|
|
||||
LL | static STATIC_BAR: str = *"bar";
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/const-unsized.rs:15:26
|
||||
|
|
||||
|
@ -1,9 +1,3 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-39974.rs:5:19
|
||||
|
|
||||
LL | f: [[f64; 2]; LENGTH],
|
||||
| ^^^^^^ expected `usize`, found `f64`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-39974.rs:1:21
|
||||
|
|
||||
@ -13,6 +7,12 @@ LL | const LENGTH: f64 = 2;
|
||||
| expected `f64`, found integer
|
||||
| help: use a float literal: `2.0`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-39974.rs:5:19
|
||||
|
|
||||
LL | f: [[f64; 2]; LENGTH],
|
||||
| ^^^^^^ expected `usize`, found `f64`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -1,16 +1,3 @@
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/issue-84931.rs:14:21
|
||||
|
|
||||
LL | type Item<'a> = &'a mut T;
|
||||
| -- ^^^^^^^^^ ...so that the reference type `&'a mut T` does not outlive the data it points at
|
||||
| |
|
||||
| the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
||||
|
|
||||
help: consider adding an explicit lifetime bound
|
||||
|
|
||||
LL | type Item<'a> = &'a mut T where T: 'a;
|
||||
| +++++++++++
|
||||
|
||||
error[E0477]: the type `StreamingSliceIter<'b, T>` does not fulfill the required lifetime
|
||||
--> $DIR/issue-84931.rs:14:21
|
||||
|
|
||||
@ -30,6 +17,19 @@ help: copy the `where` clause predicates from the trait
|
||||
LL | type Item<'a> = &'a mut T where Self: 'a;
|
||||
| ++++++++++++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/issue-84931.rs:14:21
|
||||
|
|
||||
LL | type Item<'a> = &'a mut T;
|
||||
| -- ^^^^^^^^^ ...so that the reference type `&'a mut T` does not outlive the data it points at
|
||||
| |
|
||||
| the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
||||
|
|
||||
help: consider adding an explicit lifetime bound
|
||||
|
|
||||
LL | type Item<'a> = &'a mut T where T: 'a;
|
||||
| +++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0309, E0477.
|
||||
|
@ -11,6 +11,26 @@ note: the lint level is defined here
|
||||
LL | #![warn(unused_lifetimes)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0478]: lifetime bound not satisfied
|
||||
--> $DIR/unsatisfied-item-lifetime-bound.rs:9:18
|
||||
|
|
||||
LL | type Y<'a: 'static>;
|
||||
| ------------------- definition of `Y` from trait
|
||||
...
|
||||
LL | type Y<'a> = &'a ();
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lifetime parameter instantiated with the lifetime `'a` as defined here
|
||||
--> $DIR/unsatisfied-item-lifetime-bound.rs:9:12
|
||||
|
|
||||
LL | type Y<'a> = &'a ();
|
||||
| ^^
|
||||
= note: but lifetime parameter must outlive the static lifetime
|
||||
help: copy the `where` clause predicates from the trait
|
||||
|
|
||||
LL | type Y<'a> = &'a () where 'a: 'static;
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0478]: lifetime bound not satisfied
|
||||
--> $DIR/unsatisfied-item-lifetime-bound.rs:14:8
|
||||
|
|
||||
@ -50,26 +70,6 @@ LL | struct D<'a> {
|
||||
| ^^
|
||||
= note: but lifetime parameter must outlive the static lifetime
|
||||
|
||||
error[E0478]: lifetime bound not satisfied
|
||||
--> $DIR/unsatisfied-item-lifetime-bound.rs:9:18
|
||||
|
|
||||
LL | type Y<'a: 'static>;
|
||||
| ------------------- definition of `Y` from trait
|
||||
...
|
||||
LL | type Y<'a> = &'a ();
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lifetime parameter instantiated with the lifetime `'a` as defined here
|
||||
--> $DIR/unsatisfied-item-lifetime-bound.rs:9:12
|
||||
|
|
||||
LL | type Y<'a> = &'a ();
|
||||
| ^^
|
||||
= note: but lifetime parameter must outlive the static lifetime
|
||||
help: copy the `where` clause predicates from the trait
|
||||
|
|
||||
LL | type Y<'a> = &'a () where 'a: 'static;
|
||||
| +++++++++++++++++
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0478`.
|
||||
|
@ -1,12 +1,3 @@
|
||||
error[E0658]: `async` blocks are not allowed in constants
|
||||
--> $DIR/issue-78722-2.rs:15:20
|
||||
|
|
||||
LL | let f: F = async { 1 };
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
|
||||
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
|
||||
|
||||
error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:13:13: 13:21}` to be a future that resolves to `u8`, but it resolves to `()`
|
||||
--> $DIR/issue-78722-2.rs:11:30
|
||||
|
|
||||
@ -26,6 +17,15 @@ note: this item must mention the opaque type in its signature in order to be abl
|
||||
LL | let f: F = async { 1 };
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error[E0658]: `async` blocks are not allowed in constants
|
||||
--> $DIR/issue-78722-2.rs:15:20
|
||||
|
|
||||
LL | let f: F = async { 1 };
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
|
||||
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0271, E0658.
|
||||
|
@ -1,8 +1,8 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
// edition:2021
|
||||
// compile-flags:-Z treat-err-as-bug=1
|
||||
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
|
||||
// compile-flags:-Z treat-err-as-bug=2
|
||||
// error-pattern: due to `-Z treat-err-as-bug=2
|
||||
// failure-status:101
|
||||
// normalize-stderr-test ".*note: .*\n\n" -> ""
|
||||
// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
|
||||
|
@ -4,9 +4,18 @@ error: unconstrained opaque type
|
||||
LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
error[E0792]: expected generic lifetime parameter, found `'_`
|
||||
--> $DIR/issue-86800.rs:39:5
|
||||
|
|
||||
LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
|
||||
| --- this generic parameter must be used with a generic lifetime parameter
|
||||
...
|
||||
LL | f
|
||||
| ^
|
||||
|
||||
error: the compiler unexpectedly panicked. this is a bug.
|
||||
|
||||
query stack during panic:
|
||||
#0 [type_of_opaque] computing type of opaque `TransactionFuture::{opaque#0}`
|
||||
#1 [type_of] computing type of `TransactionFuture::{opaque#0}`
|
||||
#0 [mir_borrowck] borrow-checking `execute_transaction_fut`
|
||||
#1 [type_of_opaque] computing type of opaque `execute_transaction_fut::{opaque#0}`
|
||||
end of query stack
|
||||
|
@ -5,7 +5,7 @@ LL | type Next = <GetNext<T::Next> as Next>::Next;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`)
|
||||
note: required for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next`
|
||||
note: required for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next`
|
||||
--> $DIR/issue-23122-2.rs:10:15
|
||||
|
|
||||
LL | impl<T: Next> Next for GetNext<T> {
|
||||
|
@ -29,15 +29,6 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: only the last element of a tuple may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/issue-84108.rs:14:13
|
||||
|
|
||||
LL | static BAZ: ([u8], usize) = ([], 0);
|
||||
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: only the last element of a tuple may have a dynamically sized type
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-84108.rs:9:45
|
||||
|
|
||||
@ -47,6 +38,15 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
|
||||
= note: expected slice `[u8]`
|
||||
found array `[_; 0]`
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/issue-84108.rs:14:13
|
||||
|
|
||||
LL | static BAZ: ([u8], usize) = ([], 0);
|
||||
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: only the last element of a tuple may have a dynamically sized type
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-84108.rs:14:30
|
||||
|
|
||||
|
@ -10,18 +10,6 @@ help: consider further restricting this bound
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `B: Clone` is not satisfied
|
||||
--> $DIR/issue-79224.rs:20:13
|
||||
|
|
||||
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
| ^^^^ the trait `Clone` is not implemented for `B`
|
||||
|
|
||||
= note: required for `B` to implement `ToOwned`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `B: Clone` is not satisfied
|
||||
--> $DIR/issue-79224.rs:20:5
|
||||
|
|
||||
@ -34,6 +22,18 @@ help: consider further restricting this bound
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `B: Clone` is not satisfied
|
||||
--> $DIR/issue-79224.rs:20:13
|
||||
|
|
||||
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
| ^^^^ the trait `Clone` is not implemented for `B`
|
||||
|
|
||||
= note: required for `B` to implement `ToOwned`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -29,9 +29,8 @@ struct SalsaStorage {
|
||||
}
|
||||
|
||||
impl Database for RootDatabase {
|
||||
// This would also be an error if we didn't abort compilation on the error
|
||||
// above.
|
||||
type Storage = SalsaStorage;
|
||||
//~^ ERROR overflow
|
||||
}
|
||||
impl HasQueryGroup for RootDatabase {}
|
||||
impl<DB> Query<DB> for ParseQuery
|
||||
|
@ -21,7 +21,7 @@ note: required because it appears within the type `RootDatabase`
|
||||
LL | struct RootDatabase {
|
||||
| ^^^^^^^^^^^^
|
||||
note: required for `RootDatabase` to implement `SourceDatabase`
|
||||
--> $DIR/cycle-cache-err-60010.rs:44:9
|
||||
--> $DIR/cycle-cache-err-60010.rs:43:9
|
||||
|
|
||||
LL | impl<T> SourceDatabase for T
|
||||
| ^^^^^^^^^^^^^^ ^
|
||||
@ -29,7 +29,7 @@ LL | where
|
||||
LL | T: RefUnwindSafe,
|
||||
| ------------- unsatisfied trait bound introduced here
|
||||
note: required for `ParseQuery` to implement `Query<RootDatabase>`
|
||||
--> $DIR/cycle-cache-err-60010.rs:37:10
|
||||
--> $DIR/cycle-cache-err-60010.rs:36:10
|
||||
|
|
||||
LL | impl<DB> Query<DB> for ParseQuery
|
||||
| ^^^^^^^^^ ^^^^^^^^^^
|
||||
@ -37,6 +37,59 @@ LL | where
|
||||
LL | DB: SourceDatabase,
|
||||
| -------------- unsatisfied trait bound introduced here
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe`
|
||||
--> $DIR/cycle-cache-err-60010.rs:32:20
|
||||
|
|
||||
LL | type Storage = SalsaStorage;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
note: required because it appears within the type `PhantomData<SalsaStorage>`
|
||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||
note: required because it appears within the type `Unique<SalsaStorage>`
|
||||
--> $SRC_DIR/core/src/ptr/unique.rs:LL:COL
|
||||
note: required because it appears within the type `Box<SalsaStorage>`
|
||||
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
note: required because it appears within the type `Runtime<RootDatabase>`
|
||||
--> $DIR/cycle-cache-err-60010.rs:23:8
|
||||
|
|
||||
LL | struct Runtime<DB: Database> {
|
||||
| ^^^^^^^
|
||||
note: required because it appears within the type `RootDatabase`
|
||||
--> $DIR/cycle-cache-err-60010.rs:20:8
|
||||
|
|
||||
LL | struct RootDatabase {
|
||||
| ^^^^^^^^^^^^
|
||||
note: required for `RootDatabase` to implement `SourceDatabase`
|
||||
--> $DIR/cycle-cache-err-60010.rs:43:9
|
||||
|
|
||||
LL | impl<T> SourceDatabase for T
|
||||
| ^^^^^^^^^^^^^^ ^
|
||||
LL | where
|
||||
LL | T: RefUnwindSafe,
|
||||
| ------------- unsatisfied trait bound introduced here
|
||||
note: required for `ParseQuery` to implement `Query<RootDatabase>`
|
||||
--> $DIR/cycle-cache-err-60010.rs:36:10
|
||||
|
|
||||
LL | impl<DB> Query<DB> for ParseQuery
|
||||
| ^^^^^^^^^ ^^^^^^^^^^
|
||||
LL | where
|
||||
LL | DB: SourceDatabase,
|
||||
| -------------- unsatisfied trait bound introduced here
|
||||
note: required because it appears within the type `SalsaStorage`
|
||||
--> $DIR/cycle-cache-err-60010.rs:26:8
|
||||
|
|
||||
LL | struct SalsaStorage {
|
||||
| ^^^^^^^^^^^^
|
||||
note: required by a bound in `Database::Storage`
|
||||
--> $DIR/cycle-cache-err-60010.rs:7:5
|
||||
|
|
||||
LL | type Storage;
|
||||
| ^^^^^^^^^^^^^ required by this bound in `Database::Storage`
|
||||
help: consider relaxing the implicit `Sized` restriction
|
||||
|
|
||||
LL | type Storage: ?Sized;
|
||||
| ++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
||||
|
@ -4,15 +4,15 @@
|
||||
//~^ WARN the feature `specialization` is incomplete
|
||||
|
||||
trait Default {
|
||||
type Id;
|
||||
type Id;
|
||||
|
||||
fn intu(&self) -> &Self::Id;
|
||||
fn intu(&self) -> &Self::Id;
|
||||
}
|
||||
|
||||
impl<T> Default for T {
|
||||
default type Id = T; //~ ERROR type annotations needed
|
||||
// This will be fixed by #111994
|
||||
fn intu(&self) -> &Self::Id { //~ ERROR type annotations needed
|
||||
fn intu(&self) -> &Self::Id {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
@ -8,19 +8,12 @@ LL | #![feature(specialization)]
|
||||
= help: consider using `min_specialization` instead, which is more stable and complete
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0284]: type annotations needed: cannot satisfy `<T as Default>::Id normalizes-to _`
|
||||
--> $DIR/specialization-transmute.rs:15:23
|
||||
|
|
||||
LL | fn intu(&self) -> &Self::Id {
|
||||
| ^^^^^^^^^ cannot satisfy `<T as Default>::Id normalizes-to _`
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/specialization-transmute.rs:13:23
|
||||
|
|
||||
LL | default type Id = T;
|
||||
| ^ cannot infer type for associated type `<T as Default>::Id`
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
||||
Some errors have detailed explanations: E0282, E0284.
|
||||
For more information about an error, try `rustc --explain E0282`.
|
||||
For more information about this error, try `rustc --explain E0282`.
|
||||
|
@ -1,19 +1,3 @@
|
||||
error[E0277]: the trait bound `T: Trait` is not satisfied
|
||||
--> $DIR/generic_underconstrained.rs:9:31
|
||||
|
|
||||
LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained`
|
||||
--> $DIR/generic_underconstrained.rs:6:26
|
||||
|
|
||||
LL | type Underconstrained<T: Trait> = impl Send;
|
||||
| ^^^^^ required by this bound
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
|
||||
| +++++++
|
||||
|
||||
error[E0277]: the trait bound `T: Trait` is not satisfied
|
||||
--> $DIR/generic_underconstrained.rs:9:51
|
||||
|
|
||||
@ -35,6 +19,22 @@ help: consider restricting type parameter `T`
|
||||
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
|
||||
| +++++++
|
||||
|
||||
error[E0277]: the trait bound `T: Trait` is not satisfied
|
||||
--> $DIR/generic_underconstrained.rs:9:31
|
||||
|
|
||||
LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained`
|
||||
--> $DIR/generic_underconstrained.rs:6:26
|
||||
|
|
||||
LL | type Underconstrained<T: Trait> = impl Send;
|
||||
| ^^^^^ required by this bound
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
|
||||
| +++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -1,35 +1,3 @@
|
||||
error[E0277]: `U` doesn't implement `Debug`
|
||||
--> $DIR/generic_underconstrained2.rs:8:33
|
||||
|
|
||||
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained`
|
||||
--> $DIR/generic_underconstrained2.rs:5:26
|
||||
|
|
||||
LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
|
||||
| ^^^^^^^^^^^^^^^ required by this bound
|
||||
help: consider restricting type parameter `U`
|
||||
|
|
||||
LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0277]: `V` doesn't implement `Debug`
|
||||
--> $DIR/generic_underconstrained2.rs:17:43
|
||||
|
|
||||
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained2`
|
||||
--> $DIR/generic_underconstrained2.rs:14:27
|
||||
|
|
||||
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
|
||||
| ^^^^^^^^^^^^^^^ required by this bound
|
||||
help: consider restricting type parameter `V`
|
||||
|
|
||||
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0277]: `U` doesn't implement `Debug`
|
||||
--> $DIR/generic_underconstrained2.rs:8:53
|
||||
|
|
||||
@ -72,6 +40,38 @@ help: consider restricting type parameter `V`
|
||||
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0277]: `U` doesn't implement `Debug`
|
||||
--> $DIR/generic_underconstrained2.rs:8:33
|
||||
|
|
||||
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained`
|
||||
--> $DIR/generic_underconstrained2.rs:5:26
|
||||
|
|
||||
LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
|
||||
| ^^^^^^^^^^^^^^^ required by this bound
|
||||
help: consider restricting type parameter `U`
|
||||
|
|
||||
LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0277]: `V` doesn't implement `Debug`
|
||||
--> $DIR/generic_underconstrained2.rs:17:43
|
||||
|
|
||||
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained2`
|
||||
--> $DIR/generic_underconstrained2.rs:14:27
|
||||
|
|
||||
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
|
||||
| ^^^^^^^^^^^^^^^ required by this bound
|
||||
help: consider restricting type parameter `V`
|
||||
|
|
||||
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
|
||||
| +++++++++++++++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -17,17 +17,11 @@ LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
|
||||
= note: ...which requires computing layout of `Bug<u8, ()>`...
|
||||
= note: ...which requires normalizing `Bug<u8, ()>`...
|
||||
= note: ...which again requires computing type of `Bug::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in top-level module
|
||||
--> $DIR/issue-53092-2.rs:1:1
|
||||
note: cycle used when checking that `Bug::{opaque#0}` is well-formed
|
||||
--> $DIR/issue-53092-2.rs:4:18
|
||||
|
|
||||
LL | / #![feature(type_alias_impl_trait)]
|
||||
LL | | #![allow(dead_code)]
|
||||
LL | |
|
||||
LL | | type Bug<T, U> = impl Fn(T) -> U + Copy;
|
||||
... |
|
||||
LL | | CONST_BUG(0);
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error[E0277]: the trait bound `U: From<T>` is not satisfied
|
||||
|
@ -1,3 +1,20 @@
|
||||
error[E0053]: method `dummy2` has an incompatible type for trait
|
||||
--> $DIR/ufcs-explicit-self-bad.rs:37:21
|
||||
|
|
||||
LL | fn dummy2(self: &Bar<T>) {}
|
||||
| ------^^^^^^^
|
||||
| | |
|
||||
| | expected `&'a Bar<T>`, found `Bar<T>`
|
||||
| help: change the self-receiver type to match the trait: `&self`
|
||||
|
|
||||
note: type in trait
|
||||
--> $DIR/ufcs-explicit-self-bad.rs:31:15
|
||||
|
|
||||
LL | fn dummy2(&self);
|
||||
| ^^^^^
|
||||
= note: expected signature `fn(&&'a Bar<_>)`
|
||||
found signature `fn(&Bar<_>)`
|
||||
|
||||
error[E0307]: invalid `self` parameter type: isize
|
||||
--> $DIR/ufcs-explicit-self-bad.rs:8:18
|
||||
|
|
||||
@ -101,23 +118,6 @@ note: ...does not necessarily outlive the anonymous lifetime defined here
|
||||
LL | fn dummy3(self: &&Bar<T>) {}
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0053]: method `dummy2` has an incompatible type for trait
|
||||
--> $DIR/ufcs-explicit-self-bad.rs:37:21
|
||||
|
|
||||
LL | fn dummy2(self: &Bar<T>) {}
|
||||
| ------^^^^^^^
|
||||
| | |
|
||||
| | expected `&'a Bar<T>`, found `Bar<T>`
|
||||
| help: change the self-receiver type to match the trait: `&self`
|
||||
|
|
||||
note: type in trait
|
||||
--> $DIR/ufcs-explicit-self-bad.rs:31:15
|
||||
|
|
||||
LL | fn dummy2(&self);
|
||||
| ^^^^^
|
||||
= note: expected signature `fn(&&'a Bar<_>)`
|
||||
found signature `fn(&Bar<_>)`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0053, E0307, E0308.
|
||||
|
@ -16,6 +16,18 @@ help: the `Box` type always has a statically known size and allocates its conten
|
||||
LL | a: Box<str>,
|
||||
| ++++ +
|
||||
|
||||
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
||||
--> $DIR/union-unsized.rs:5:5
|
||||
|
|
||||
LL | a: str,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
|
||||
help: wrap the field type in `ManuallyDrop<...>`
|
||||
|
|
||||
LL | a: std::mem::ManuallyDrop<str>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/union-unsized.rs:14:8
|
||||
|
|
||||
@ -34,18 +46,6 @@ help: the `Box` type always has a statically known size and allocates its conten
|
||||
LL | b: Box<str>,
|
||||
| ++++ +
|
||||
|
||||
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
||||
--> $DIR/union-unsized.rs:5:5
|
||||
|
|
||||
LL | a: str,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
|
||||
help: wrap the field type in `ManuallyDrop<...>`
|
||||
|
|
||||
LL | a: std::mem::ManuallyDrop<str>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
||||
--> $DIR/union-unsized.rs:14:5
|
||||
|
|
||||
|
@ -16,6 +16,18 @@ help: the `Box` type always has a statically known size and allocates its conten
|
||||
LL | a: Box<str>,
|
||||
| ++++ +
|
||||
|
||||
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
||||
--> $DIR/union-unsized.rs:5:5
|
||||
|
|
||||
LL | a: str,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
|
||||
help: wrap the field type in `ManuallyDrop<...>`
|
||||
|
|
||||
LL | a: std::mem::ManuallyDrop<str>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/union-unsized.rs:14:8
|
||||
|
|
||||
@ -34,18 +46,6 @@ help: the `Box` type always has a statically known size and allocates its conten
|
||||
LL | b: Box<str>,
|
||||
| ++++ +
|
||||
|
||||
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
||||
--> $DIR/union-unsized.rs:5:5
|
||||
|
|
||||
LL | a: str,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
|
||||
help: wrap the field type in `ManuallyDrop<...>`
|
||||
|
|
||||
LL | a: std::mem::ManuallyDrop<str>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
||||
--> $DIR/union-unsized.rs:14:5
|
||||
|
|
||||
|
@ -1,3 +1,15 @@
|
||||
error[E0277]: `&'a T` is not an iterator
|
||||
--> $DIR/hir-wf-check-erase-regions.rs:7:21
|
||||
|
|
||||
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `&'a T`
|
||||
= help: the trait `Iterator` is implemented for `&mut I`
|
||||
= note: required for `Flatten<std::slice::Iter<'a, T>>` to implement `Iterator`
|
||||
note: required by a bound in `std::iter::IntoIterator::IntoIter`
|
||||
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
|
||||
|
||||
error[E0277]: `&'a T` is not an iterator
|
||||
--> $DIR/hir-wf-check-erase-regions.rs:7:21
|
||||
|
|
||||
@ -22,18 +34,6 @@ LL | fn into_iter(self) -> Self::IntoIter {
|
||||
note: required by a bound in `Flatten`
|
||||
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
|
||||
|
||||
error[E0277]: `&'a T` is not an iterator
|
||||
--> $DIR/hir-wf-check-erase-regions.rs:7:21
|
||||
|
|
||||
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `&'a T`
|
||||
= help: the trait `Iterator` is implemented for `&mut I`
|
||||
= note: required for `Flatten<std::slice::Iter<'a, T>>` to implement `Iterator`
|
||||
note: required by a bound in `std::iter::IntoIterator::IntoIter`
|
||||
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
Loading…
Reference in New Issue
Block a user