Rollup merge of #67460 - estebank:named-lts, r=nikomatsakis
Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes Fix #66406, fix #72106. ``` error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-param-without-lifetime-constraint.rs:14:5 | LL | fn get_relation(&self) -> To; | ----------------------------- expected `fn(&Article) -> &ProofReader` ... LL | fn get_relation(&self) -> &ProofReader { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&Article) -> &ProofReader` | = note: expected `fn(&Article) -> &ProofReader` found `fn(&Article) -> &ProofReader` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/trait-param-without-lifetime-constraint.rs:10:31 | LL | fn get_relation(&self) -> To; | ^^ consider borrowing this type parameter in the trait ``` r? @nikomatsakis
This commit is contained in:
commit
81207802a0
|
@ -193,9 +193,18 @@ impl Diagnostic {
|
||||||
expected_extra: &dyn fmt::Display,
|
expected_extra: &dyn fmt::Display,
|
||||||
found_extra: &dyn fmt::Display,
|
found_extra: &dyn fmt::Display,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
let expected_label = format!("expected {}", expected_label);
|
let expected_label = expected_label.to_string();
|
||||||
|
let expected_label = if expected_label.is_empty() {
|
||||||
let found_label = format!("found {}", found_label);
|
"expected".to_string()
|
||||||
|
} else {
|
||||||
|
format!("expected {}", expected_label)
|
||||||
|
};
|
||||||
|
let found_label = found_label.to_string();
|
||||||
|
let found_label = if found_label.is_empty() {
|
||||||
|
"found".to_string()
|
||||||
|
} else {
|
||||||
|
format!("found {}", found_label)
|
||||||
|
};
|
||||||
let (found_padding, expected_padding) = if expected_label.len() > found_label.len() {
|
let (found_padding, expected_padding) = if expected_label.len() > found_label.len() {
|
||||||
(expected_label.len() - found_label.len(), 0)
|
(expected_label.len() - found_label.len(), 0)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -987,12 +987,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push_ty_ref<'tcx>(
|
fn push_ty_ref<'tcx>(
|
||||||
r: &ty::Region<'tcx>,
|
region: &ty::Region<'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
mutbl: hir::Mutability,
|
mutbl: hir::Mutability,
|
||||||
s: &mut DiagnosticStyledString,
|
s: &mut DiagnosticStyledString,
|
||||||
) {
|
) {
|
||||||
let mut r = r.to_string();
|
let mut r = region.to_string();
|
||||||
if r == "'_" {
|
if r == "'_" {
|
||||||
r.clear();
|
r.clear();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,11 +2,16 @@
|
||||||
|
|
||||||
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
|
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
|
||||||
use crate::infer::lexical_region_resolve::RegionResolutionError;
|
use crate::infer::lexical_region_resolve::RegionResolutionError;
|
||||||
use crate::infer::{Subtype, ValuePairs};
|
use crate::infer::{Subtype, TyCtxtInferExt, ValuePairs};
|
||||||
use crate::traits::ObligationCauseCode::CompareImplMethodObligation;
|
use crate::traits::ObligationCauseCode::CompareImplMethodObligation;
|
||||||
use rustc_errors::ErrorReported;
|
use rustc_errors::ErrorReported;
|
||||||
use rustc_middle::ty::Ty;
|
use rustc_hir as hir;
|
||||||
use rustc_span::Span;
|
use rustc_hir::def::Res;
|
||||||
|
use rustc_hir::def_id::DefId;
|
||||||
|
use rustc_hir::intravisit::Visitor;
|
||||||
|
use rustc_middle::ty::error::ExpectedFound;
|
||||||
|
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||||
|
use rustc_span::{MultiSpan, Span};
|
||||||
|
|
||||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||||
/// Print the error message for lifetime errors when the `impl` doesn't conform to the `trait`.
|
/// Print the error message for lifetime errors when the `impl` doesn't conform to the `trait`.
|
||||||
|
@ -36,7 +41,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||||
var_origin.span(),
|
var_origin.span(),
|
||||||
sub_expected_found.expected,
|
sub_expected_found.expected,
|
||||||
sub_expected_found.found,
|
sub_expected_found.found,
|
||||||
self.tcx().def_span(*trait_item_def_id),
|
*trait_item_def_id,
|
||||||
);
|
);
|
||||||
return Some(ErrorReported);
|
return Some(ErrorReported);
|
||||||
}
|
}
|
||||||
|
@ -47,14 +52,100 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_err(&self, sp: Span, expected: Ty<'tcx>, found: Ty<'tcx>, impl_sp: Span) {
|
fn emit_err(&self, sp: Span, expected: Ty<'tcx>, found: Ty<'tcx>, trait_def_id: DefId) {
|
||||||
|
let tcx = self.tcx();
|
||||||
|
let trait_sp = self.tcx().def_span(trait_def_id);
|
||||||
let mut err = self
|
let mut err = self
|
||||||
.tcx()
|
.tcx()
|
||||||
.sess
|
.sess
|
||||||
.struct_span_err(sp, "`impl` item signature doesn't match `trait` item signature");
|
.struct_span_err(sp, "`impl` item signature doesn't match `trait` item signature");
|
||||||
err.note(&format!("expected `{:?}`\n found `{:?}`", expected, found));
|
err.span_label(sp, &format!("found `{:?}`", found));
|
||||||
err.span_label(sp, &format!("found {:?}", found));
|
err.span_label(trait_sp, &format!("expected `{:?}`", expected));
|
||||||
err.span_label(impl_sp, &format!("expected {:?}", expected));
|
|
||||||
|
// Get the span of all the used type parameters in the method.
|
||||||
|
let assoc_item = self.tcx().associated_item(trait_def_id);
|
||||||
|
let mut visitor = TypeParamSpanVisitor { tcx: self.tcx(), types: vec![] };
|
||||||
|
match assoc_item.kind {
|
||||||
|
ty::AssocKind::Fn => {
|
||||||
|
let hir = self.tcx().hir();
|
||||||
|
if let Some(hir_id) = assoc_item.def_id.as_local().map(|id| hir.as_local_hir_id(id))
|
||||||
|
{
|
||||||
|
if let Some(decl) = hir.fn_decl_by_hir_id(hir_id) {
|
||||||
|
visitor.visit_fn_decl(decl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
let mut type_param_span: MultiSpan =
|
||||||
|
visitor.types.iter().cloned().collect::<Vec<_>>().into();
|
||||||
|
for &span in &visitor.types {
|
||||||
|
type_param_span.push_span_label(
|
||||||
|
span,
|
||||||
|
"consider borrowing this type parameter in the trait".to_string(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some((expected, found)) = tcx
|
||||||
|
.infer_ctxt()
|
||||||
|
.enter(|infcx| infcx.expected_found_str_ty(&ExpectedFound { expected, found }))
|
||||||
|
{
|
||||||
|
// Highlighted the differences when showing the "expected/found" note.
|
||||||
|
err.note_expected_found(&"", expected, &"", found);
|
||||||
|
} else {
|
||||||
|
// This fallback shouldn't be necessary, but let's keep it in just in case.
|
||||||
|
err.note(&format!("expected `{:?}`\n found `{:?}`", expected, found));
|
||||||
|
}
|
||||||
|
err.span_help(
|
||||||
|
type_param_span,
|
||||||
|
"the lifetime requirements from the `impl` do not correspond to the requirements in \
|
||||||
|
the `trait`",
|
||||||
|
);
|
||||||
|
if visitor.types.is_empty() {
|
||||||
|
err.help(
|
||||||
|
"verify the lifetime relationships in the `trait` and `impl` between the `self` \
|
||||||
|
argument, the other inputs and its output",
|
||||||
|
);
|
||||||
|
}
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct TypeParamSpanVisitor<'tcx> {
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
types: Vec<Span>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
|
||||||
|
type Map = rustc_middle::hir::map::Map<'tcx>;
|
||||||
|
|
||||||
|
fn nested_visit_map(&mut self) -> hir::intravisit::NestedVisitorMap<Self::Map> {
|
||||||
|
hir::intravisit::NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx>) {
|
||||||
|
match arg.kind {
|
||||||
|
hir::TyKind::Rptr(_, ref mut_ty) => {
|
||||||
|
// We don't want to suggest looking into borrowing `&T` or `&Self`.
|
||||||
|
hir::intravisit::walk_ty(self, mut_ty.ty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hir::TyKind::Path(hir::QPath::Resolved(None, path)) => match &path.segments {
|
||||||
|
[segment]
|
||||||
|
if segment
|
||||||
|
.res
|
||||||
|
.map(|res| match res {
|
||||||
|
Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _) => true,
|
||||||
|
_ => false,
|
||||||
|
})
|
||||||
|
.unwrap_or(false) =>
|
||||||
|
{
|
||||||
|
self.types.push(path.span);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
hir::intravisit::walk_ty(self, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -14,16 +14,16 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | bar(foo, x)
|
LL | bar(foo, x)
|
||||||
| ^
|
| ^
|
||||||
= note: expected `Type<'_>`
|
= note: expected `Type<'_>`
|
||||||
found `Type<'a>`
|
found `Type<'a>`
|
||||||
= note: but, the lifetime must be valid for the static lifetime...
|
= note: but, the lifetime must be valid for the static lifetime...
|
||||||
note: ...so that the expression is assignable
|
note: ...so that the expression is assignable
|
||||||
--> $DIR/project-fn-ret-invariant.rs:48:4
|
--> $DIR/project-fn-ret-invariant.rs:48:4
|
||||||
|
|
|
|
||||||
LL | bar(foo, x)
|
LL | bar(foo, x)
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
= note: expected `Type<'static>`
|
= note: expected `Type<'static>`
|
||||||
found `Type<'_>`
|
found `Type<'_>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | let x: &'a _ = &y;
|
LL | let x: &'a _ = &y;
|
||||||
| ^^
|
| ^^
|
||||||
= note: expected `&'a &()`
|
= note: expected `&'a &()`
|
||||||
found `&'a &'b ()`
|
found `&'a &'b ()`
|
||||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 1:6...
|
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 1:6...
|
||||||
--> $DIR/E0490.rs:1:6
|
--> $DIR/E0490.rs:1:6
|
||||||
|
|
|
|
||||||
|
|
|
@ -14,16 +14,16 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | static_val(x);
|
LL | static_val(x);
|
||||||
| ^
|
| ^
|
||||||
= note: expected `std::boxed::Box<dyn std::fmt::Debug>`
|
= note: expected `std::boxed::Box<dyn std::fmt::Debug>`
|
||||||
found `std::boxed::Box<(dyn std::fmt::Debug + 'a)>`
|
found `std::boxed::Box<(dyn std::fmt::Debug + 'a)>`
|
||||||
= note: but, the lifetime must be valid for the static lifetime...
|
= note: but, the lifetime must be valid for the static lifetime...
|
||||||
note: ...so that the types are compatible
|
note: ...so that the types are compatible
|
||||||
--> $DIR/dyn-trait.rs:20:5
|
--> $DIR/dyn-trait.rs:20:5
|
||||||
|
|
|
|
||||||
LL | static_val(x);
|
LL | static_val(x);
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
= note: expected `StaticTrait`
|
= note: expected `StaticTrait`
|
||||||
found `StaticTrait`
|
found `StaticTrait`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,17 @@ error: `impl` item signature doesn't match `trait` item signature
|
||||||
--> $DIR/mismatched_trait_impl-2.rs:8:5
|
--> $DIR/mismatched_trait_impl-2.rs:8:5
|
||||||
|
|
|
|
||||||
LL | fn deref(&self) -> &dyn Trait {
|
LL | fn deref(&self) -> &dyn Trait {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&Struct) -> &dyn Trait
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&Struct) -> &dyn Trait`
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/libcore/ops/deref.rs:LL:COL
|
::: $SRC_DIR/libcore/ops/deref.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | fn deref(&self) -> &Self::Target;
|
LL | fn deref(&self) -> &Self::Target;
|
||||||
| --------------------------------- expected fn(&Struct) -> &(dyn Trait + 'static)
|
| --------------------------------- expected `fn(&Struct) -> &(dyn Trait + 'static)`
|
||||||
|
|
|
|
||||||
= note: expected `fn(&Struct) -> &(dyn Trait + 'static)`
|
= note: expected `fn(&Struct) -> &(dyn Trait + 'static)`
|
||||||
found `fn(&Struct) -> &dyn Trait`
|
found `fn(&Struct) -> &dyn Trait`
|
||||||
|
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
|
||||||
|
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,15 @@ error: `impl` item signature doesn't match `trait` item signature
|
||||||
--> $DIR/mismatched_trait_impl.rs:9:5
|
--> $DIR/mismatched_trait_impl.rs:9:5
|
||||||
|
|
|
|
||||||
LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32;
|
LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32;
|
||||||
| ---------------------------------------------- expected fn(&i32, &'a u32, &u32) -> &'a u32
|
| ---------------------------------------------- expected `fn(&i32, &'a u32, &u32) -> &'a u32`
|
||||||
...
|
...
|
||||||
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
|
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &u32, &u32) -> &u32
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&i32, &u32, &u32) -> &u32`
|
||||||
|
|
|
|
||||||
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
|
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
|
||||||
found `fn(&i32, &u32, &u32) -> &u32`
|
found `fn(&i32, &u32, &u32) -> &u32`
|
||||||
|
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
|
||||||
|
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,15 @@ error: `impl` item signature doesn't match `trait` item signature
|
||||||
--> $DIR/mismatched_trait_impl.rs:9:5
|
--> $DIR/mismatched_trait_impl.rs:9:5
|
||||||
|
|
|
|
||||||
LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32;
|
LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32;
|
||||||
| ---------------------------------------------- expected fn(&i32, &'a u32, &u32) -> &'a u32
|
| ---------------------------------------------- expected `fn(&i32, &'a u32, &u32) -> &'a u32`
|
||||||
...
|
...
|
||||||
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
|
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &u32, &u32) -> &u32
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&i32, &u32, &u32) -> &u32`
|
||||||
|
|
|
|
||||||
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
|
= note: expected `fn(&i32, &'a u32, &u32) -> &'a u32`
|
||||||
found `fn(&i32, &u32, &u32) -> &u32`
|
found `fn(&i32, &u32, &u32) -> &u32`
|
||||||
|
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
|
||||||
|
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
|
||||||
|
|
||||||
error[E0623]: lifetime mismatch
|
error[E0623]: lifetime mismatch
|
||||||
--> $DIR/mismatched_trait_impl.rs:10:9
|
--> $DIR/mismatched_trait_impl.rs:10:9
|
||||||
|
|
|
@ -26,8 +26,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | self.a();
|
LL | self.a();
|
||||||
| ^
|
| ^
|
||||||
= note: expected `&'a Self`
|
= note: expected `&'a Self`
|
||||||
found `&Self`
|
found `&Self`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | self.foo();
|
LL | self.foo();
|
||||||
| ^^^
|
| ^^^
|
||||||
= note: expected `&'a Self`
|
= note: expected `&'a Self`
|
||||||
found `&Self`
|
found `&Self`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
|
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `Publisher<'_>`
|
= note: expected `Publisher<'_>`
|
||||||
found `Publisher<'_>`
|
found `Publisher<'_>`
|
||||||
|
|
||||||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
|
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
|
||||||
--> $DIR/issue-20831-debruijn.rs:28:33
|
--> $DIR/issue-20831-debruijn.rs:28:33
|
||||||
|
@ -117,8 +117,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
|
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `Publisher<'_>`
|
= note: expected `Publisher<'_>`
|
||||||
found `Publisher<'_>`
|
found `Publisher<'_>`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | match (&t,) {
|
LL | match (&t,) {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
= note: expected `(&&(T,),)`
|
= note: expected `(&&(T,),)`
|
||||||
found `(&&'a (T,),)`
|
found `(&&'a (T,),)`
|
||||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 1:27...
|
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 1:27...
|
||||||
--> $DIR/issue-52213.rs:1:27
|
--> $DIR/issue-52213.rs:1:27
|
||||||
|
|
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Box::new(self.out_edges(u).map(|e| e.target()))
|
LL | Box::new(self.out_edges(u).map(|e| e.target()))
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
||||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
||||||
|
|
||||||
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
||||||
--> $DIR/issue-55796.rs:21:9
|
--> $DIR/issue-55796.rs:21:9
|
||||||
|
@ -45,8 +45,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Box::new(self.in_edges(u).map(|e| e.target()))
|
LL | Box::new(self.in_edges(u).map(|e| e.target()))
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
|
||||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,15 @@ error: `impl` item signature doesn't match `trait` item signature
|
||||||
--> $DIR/lifetime-mismatch-between-trait-and-impl.rs:6:5
|
--> $DIR/lifetime-mismatch-between-trait-and-impl.rs:6:5
|
||||||
|
|
|
|
||||||
LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32;
|
LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32;
|
||||||
| ------------------------------------------- expected fn(&i32, &'a i32) -> &'a i32
|
| ------------------------------------------- expected `fn(&i32, &'a i32) -> &'a i32`
|
||||||
...
|
...
|
||||||
LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
|
LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &i32) -> &i32
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&i32, &i32) -> &i32`
|
||||||
|
|
|
|
||||||
= note: expected `fn(&i32, &'a i32) -> &'a i32`
|
= note: expected `fn(&i32, &'a i32) -> &'a i32`
|
||||||
found `fn(&i32, &i32) -> &i32`
|
found `fn(&i32, &i32) -> &i32`
|
||||||
|
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
|
||||||
|
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Foo { bar }
|
LL | Foo { bar }
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
= note: expected `Foo<'_>`
|
= note: expected `Foo<'_>`
|
||||||
found `Foo<'_>`
|
found `Foo<'_>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
|
LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `Visitor<'d>`
|
= note: expected `Visitor<'d>`
|
||||||
found `Visitor<'_>`
|
found `Visitor<'_>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | C { f: b }
|
LL | C { f: b }
|
||||||
| ^
|
| ^
|
||||||
= note: expected `std::boxed::Box<std::boxed::Box<&isize>>`
|
= note: expected `std::boxed::Box<std::boxed::Box<&isize>>`
|
||||||
found `std::boxed::Box<std::boxed::Box<&isize>>`
|
found `std::boxed::Box<std::boxed::Box<&isize>>`
|
||||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6...
|
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6...
|
||||||
--> $DIR/type-alias-free-regions.rs:15:6
|
--> $DIR/type-alias-free-regions.rs:15:6
|
||||||
|
|
|
|
||||||
|
@ -28,8 +28,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | C { f: b }
|
LL | C { f: b }
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
= note: expected `C<'a>`
|
= note: expected `C<'a>`
|
||||||
found `C<'_>`
|
found `C<'_>`
|
||||||
|
|
||||||
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
||||||
--> $DIR/type-alias-free-regions.rs:27:16
|
--> $DIR/type-alias-free-regions.rs:27:16
|
||||||
|
@ -49,8 +49,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | C { f: Box::new(b.0) }
|
LL | C { f: Box::new(b.0) }
|
||||||
| ^^^
|
| ^^^
|
||||||
= note: expected `std::boxed::Box<&isize>`
|
= note: expected `std::boxed::Box<&isize>`
|
||||||
found `std::boxed::Box<&isize>`
|
found `std::boxed::Box<&isize>`
|
||||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6...
|
note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6...
|
||||||
--> $DIR/type-alias-free-regions.rs:25:6
|
--> $DIR/type-alias-free-regions.rs:25:6
|
||||||
|
|
|
|
||||||
|
@ -61,8 +61,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | C { f: Box::new(b.0) }
|
LL | C { f: Box::new(b.0) }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `C<'a>`
|
= note: expected `C<'a>`
|
||||||
found `C<'_>`
|
found `C<'_>`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | <Foo<'a>>::C
|
LL | <Foo<'a>>::C
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
= note: expected `Foo<'_>`
|
= note: expected `Foo<'_>`
|
||||||
found `Foo<'a>`
|
found `Foo<'a>`
|
||||||
= note: but, the lifetime must be valid for the static lifetime...
|
= note: but, the lifetime must be valid for the static lifetime...
|
||||||
note: ...so that reference does not outlive borrowed content
|
note: ...so that reference does not outlive borrowed content
|
||||||
--> $DIR/constant-in-expr-inherent-1.rs:8:5
|
--> $DIR/constant-in-expr-inherent-1.rs:8:5
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | T::C
|
LL | T::C
|
||||||
| ^^^^
|
| ^^^^
|
||||||
= note: expected `Foo<'_>`
|
= note: expected `Foo<'_>`
|
||||||
found `Foo<'a>`
|
found `Foo<'a>`
|
||||||
= note: but, the lifetime must be valid for the static lifetime...
|
= note: but, the lifetime must be valid for the static lifetime...
|
||||||
note: ...so that reference does not outlive borrowed content
|
note: ...so that reference does not outlive borrowed content
|
||||||
--> $DIR/constant-in-expr-trait-item-3.rs:10:5
|
--> $DIR/constant-in-expr-trait-item-3.rs:10:5
|
||||||
|
|
|
@ -24,8 +24,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | ss
|
LL | ss
|
||||||
| ^^
|
| ^^
|
||||||
= note: expected `&'b (dyn SomeTrait + 'b)`
|
= note: expected `&'b (dyn SomeTrait + 'b)`
|
||||||
found `&dyn SomeTrait`
|
found `&dyn SomeTrait`
|
||||||
|
|
||||||
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
|
||||||
--> $DIR/object-lifetime-default-elision.rs:71:5
|
--> $DIR/object-lifetime-default-elision.rs:71:5
|
||||||
|
@ -53,8 +53,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | ss
|
LL | ss
|
||||||
| ^^
|
| ^^
|
||||||
= note: expected `&'b (dyn SomeTrait + 'b)`
|
= note: expected `&'b (dyn SomeTrait + 'b)`
|
||||||
found `&dyn SomeTrait`
|
found `&dyn SomeTrait`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Box::new(v)
|
LL | Box::new(v)
|
||||||
| ^
|
| ^
|
||||||
= note: expected `&[u8]`
|
= note: expected `&[u8]`
|
||||||
found `&'a [u8]`
|
found `&'a [u8]`
|
||||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9...
|
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9...
|
||||||
--> $DIR/region-object-lifetime-in-coercion.rs:25:9
|
--> $DIR/region-object-lifetime-in-coercion.rs:25:9
|
||||||
|
|
|
|
||||||
|
@ -51,8 +51,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Box::new(v)
|
LL | Box::new(v)
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
= note: expected `std::boxed::Box<(dyn Foo + 'b)>`
|
= note: expected `std::boxed::Box<(dyn Foo + 'b)>`
|
||||||
found `std::boxed::Box<dyn Foo>`
|
found `std::boxed::Box<dyn Foo>`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | impl<'a> Foo<'static> for &'a i32 {
|
LL | impl<'a> Foo<'static> for &'a i32 {
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
= note: expected `Foo<'static>`
|
= note: expected `Foo<'static>`
|
||||||
found `Foo<'static>`
|
found `Foo<'static>`
|
||||||
= note: but, the lifetime must be valid for the static lifetime...
|
= note: but, the lifetime must be valid for the static lifetime...
|
||||||
note: ...so that the type `&i32` will meet its required lifetime bounds
|
note: ...so that the type `&i32` will meet its required lifetime bounds
|
||||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10
|
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10
|
||||||
|
@ -39,8 +39,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | impl<'a,'b> Foo<'b> for &'a i64 {
|
LL | impl<'a,'b> Foo<'b> for &'a i64 {
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: expected `Foo<'b>`
|
= note: expected `Foo<'b>`
|
||||||
found `Foo<'_>`
|
found `Foo<'_>`
|
||||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the impl at 19:9...
|
note: but, the lifetime must be valid for the lifetime `'b` as defined on the impl at 19:9...
|
||||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9
|
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9
|
||||||
|
|
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | impl<'a> Foo for &'a i32 {
|
LL | impl<'a> Foo for &'a i32 {
|
||||||
| ^^^
|
| ^^^
|
||||||
= note: expected `Foo`
|
= note: expected `Foo`
|
||||||
found `Foo`
|
found `Foo`
|
||||||
= note: but, the lifetime must be valid for the static lifetime...
|
= note: but, the lifetime must be valid for the static lifetime...
|
||||||
note: ...so that the type `&i32` will meet its required lifetime bounds
|
note: ...so that the type `&i32` will meet its required lifetime bounds
|
||||||
--> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10
|
--> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10
|
||||||
|
|
|
@ -20,8 +20,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | box B(&*v) as Box<dyn X>
|
LL | box B(&*v) as Box<dyn X>
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
||||||
found `std::boxed::Box<dyn X>`
|
found `std::boxed::Box<dyn X>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | box B(&*v) as Box<dyn X>
|
LL | box B(&*v) as Box<dyn X>
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
= note: expected `std::boxed::Box<(dyn X + 'static)>`
|
||||||
found `std::boxed::Box<dyn X>`
|
found `std::boxed::Box<dyn X>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | box v as Box<dyn SomeTrait + 'a>
|
LL | box v as Box<dyn SomeTrait + 'a>
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `std::boxed::Box<(dyn SomeTrait + 'c)>`
|
= note: expected `std::boxed::Box<(dyn SomeTrait + 'c)>`
|
||||||
found `std::boxed::Box<dyn SomeTrait>`
|
found `std::boxed::Box<dyn SomeTrait>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Ast::Add(x, y)
|
LL | Ast::Add(x, y)
|
||||||
| ^
|
| ^
|
||||||
= note: expected `&Ast<'_>`
|
= note: expected `&Ast<'_>`
|
||||||
found `&Ast<'a>`
|
found `&Ast<'a>`
|
||||||
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19...
|
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19...
|
||||||
--> $DIR/regions-creating-enums4.rs:6:19
|
--> $DIR/regions-creating-enums4.rs:6:19
|
||||||
|
|
|
|
||||||
|
@ -26,8 +26,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Ast::Add(x, y)
|
LL | Ast::Add(x, y)
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
= note: expected `Ast<'b>`
|
= note: expected `Ast<'b>`
|
||||||
found `Ast<'_>`
|
found `Ast<'_>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ LL | | if false { return ay; }
|
||||||
LL | | return z;
|
LL | | return z;
|
||||||
LL | | }));
|
LL | | }));
|
||||||
| |_____^
|
| |_____^
|
||||||
= note: expected `&isize`
|
= note: expected `&isize`
|
||||||
found `&isize`
|
found `&isize`
|
||||||
|
|
||||||
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
||||||
--> $DIR/regions-nested-fns.rs:14:27
|
--> $DIR/regions-nested-fns.rs:14:27
|
||||||
|
|
|
@ -29,8 +29,8 @@ LL | | where <() as Project<'a, 'b>>::Item : Eq
|
||||||
LL | | {
|
LL | | {
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_^
|
| |_^
|
||||||
= note: expected `Project<'a, 'b>`
|
= note: expected `Project<'a, 'b>`
|
||||||
found `Project<'_, '_>`
|
found `Project<'_, '_>`
|
||||||
|
|
||||||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
|
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
|
||||||
--> $DIR/regions-normalize-in-where-clause-list.rs:22:1
|
--> $DIR/regions-normalize-in-where-clause-list.rs:22:1
|
||||||
|
@ -63,8 +63,8 @@ LL | | where <() as Project<'a, 'b>>::Item : Eq
|
||||||
LL | | {
|
LL | | {
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_^
|
| |_^
|
||||||
= note: expected `Project<'a, 'b>`
|
= note: expected `Project<'a, 'b>`
|
||||||
found `Project<'_, '_>`
|
found `Project<'_, '_>`
|
||||||
|
|
||||||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
|
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
|
||||||
--> $DIR/regions-normalize-in-where-clause-list.rs:22:4
|
--> $DIR/regions-normalize-in-where-clause-list.rs:22:4
|
||||||
|
@ -87,8 +87,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | fn bar<'a, 'b>()
|
LL | fn bar<'a, 'b>()
|
||||||
| ^^^
|
| ^^^
|
||||||
= note: expected `Project<'a, 'b>`
|
= note: expected `Project<'a, 'b>`
|
||||||
found `Project<'_, '_>`
|
found `Project<'_, '_>`
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | with(|o| o)
|
LL | with(|o| o)
|
||||||
| ^
|
| ^
|
||||||
= note: expected `&isize`
|
= note: expected `&isize`
|
||||||
found `&isize`
|
found `&isize`
|
||||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14...
|
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14...
|
||||||
--> $DIR/regions-ret-borrowed-1.rs:9:14
|
--> $DIR/regions-ret-borrowed-1.rs:9:14
|
||||||
|
|
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | with(|o| o)
|
LL | with(|o| o)
|
||||||
| ^
|
| ^
|
||||||
= note: expected `&isize`
|
= note: expected `&isize`
|
||||||
found `&isize`
|
found `&isize`
|
||||||
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14...
|
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14...
|
||||||
--> $DIR/regions-ret-borrowed.rs:12:14
|
--> $DIR/regions-ret-borrowed.rs:12:14
|
||||||
|
|
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | x
|
LL | x
|
||||||
| ^
|
| ^
|
||||||
= note: expected `&'b mut (dyn Dummy + 'b)`
|
= note: expected `&'b mut (dyn Dummy + 'b)`
|
||||||
found `&mut (dyn Dummy + 'b)`
|
found `&mut (dyn Dummy + 'b)`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/regions-trait-object-subtyping.rs:22:5
|
--> $DIR/regions-trait-object-subtyping.rs:22:5
|
||||||
|
|
|
@ -118,8 +118,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
|
LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `W<'l1, 'l2>`
|
= note: expected `W<'l1, 'l2>`
|
||||||
found `W<'_, '_>`
|
found `W<'_, '_>`
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the enum it is implemented for does not
|
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the enum it is implemented for does not
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:61:14
|
--> $DIR/reject-specialized-drops-8142.rs:61:14
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
use std::error::Error;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
|
pub enum ValueRef<'a> {
|
||||||
|
Null,
|
||||||
|
Integer(i64),
|
||||||
|
Real(f64),
|
||||||
|
Text(&'a [u8]),
|
||||||
|
Blob(&'a [u8]),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ValueRef<'a> {
|
||||||
|
pub fn as_str(&self) -> FromSqlResult<&'a str, &'a &'a str> {
|
||||||
|
match *self {
|
||||||
|
ValueRef::Text(t) => {
|
||||||
|
std::str::from_utf8(t).map_err(|_| FromSqlError::InvalidType).map(|x| (x, &x))
|
||||||
|
}
|
||||||
|
_ => Err(FromSqlError::InvalidType),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub enum FromSqlError {
|
||||||
|
InvalidType
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for FromSqlError {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "InvalidType")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Error for FromSqlError {}
|
||||||
|
|
||||||
|
pub type FromSqlResult<T, K> = Result<(T, K), FromSqlError>;
|
||||||
|
|
||||||
|
pub trait FromSql: Sized {
|
||||||
|
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromSql for &str {
|
||||||
|
fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> {
|
||||||
|
//~^ ERROR `impl` item signature doesn't match `trait` item signature
|
||||||
|
value.as_str()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
println!("{}", "Hello World");
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
error: `impl` item signature doesn't match `trait` item signature
|
||||||
|
--> $DIR/self-without-lifetime-constraint.rs:45:5
|
||||||
|
|
|
||||||
|
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>;
|
||||||
|
| -------------------------------------------------------------------- expected `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), FromSqlError>`
|
||||||
|
...
|
||||||
|
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), FromSqlError>`
|
||||||
|
|
|
||||||
|
= note: expected `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), _>`
|
||||||
|
found `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), _>`
|
||||||
|
help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
|
||||||
|
--> $DIR/self-without-lifetime-constraint.rs:41:60
|
||||||
|
|
|
||||||
|
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>;
|
||||||
|
| ^^^^ consider borrowing this type parameter in the trait
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
|
@ -19,8 +19,8 @@ note: ...so that the types are compatible
|
||||||
|
|
|
|
||||||
LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
|
LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
= note: expected `T1<'a>`
|
= note: expected `T1<'a>`
|
||||||
found `T1<'_>`
|
found `T1<'_>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
struct Article {
|
||||||
|
proof_reader: ProofReader,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProofReader {
|
||||||
|
name: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait HaveRelationship<To> {
|
||||||
|
fn get_relation(&self) -> To;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HaveRelationship<&ProofReader> for Article {
|
||||||
|
fn get_relation(&self) -> &ProofReader {
|
||||||
|
//~^ ERROR `impl` item signature doesn't match `trait` item signature
|
||||||
|
&self.proof_reader
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,19 @@
|
||||||
|
error: `impl` item signature doesn't match `trait` item signature
|
||||||
|
--> $DIR/trait-param-without-lifetime-constraint.rs:14:5
|
||||||
|
|
|
||||||
|
LL | fn get_relation(&self) -> To;
|
||||||
|
| ----------------------------- expected `fn(&Article) -> &ProofReader`
|
||||||
|
...
|
||||||
|
LL | fn get_relation(&self) -> &ProofReader {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&Article) -> &ProofReader`
|
||||||
|
|
|
||||||
|
= note: expected `fn(&Article) -> &ProofReader`
|
||||||
|
found `fn(&Article) -> &ProofReader`
|
||||||
|
help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
|
||||||
|
--> $DIR/trait-param-without-lifetime-constraint.rs:10:31
|
||||||
|
|
|
||||||
|
LL | fn get_relation(&self) -> To;
|
||||||
|
| ^^ consider borrowing this type parameter in the trait
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
|
@ -23,8 +23,8 @@ note: ...so that the expression is assignable
|
||||||
|
|
|
|
||||||
LL | Box::new(items.iter())
|
LL | Box::new(items.iter())
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)>`
|
= note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)>`
|
||||||
found `std::boxed::Box<dyn std::iter::Iterator<Item = &T>>`
|
found `std::boxed::Box<dyn std::iter::Iterator<Item = &T>>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue