mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
Auto merge of #132147 - estebank:long-types-2, r=davidtwco
Tweak E0277 output when a candidate is available *Follow up to #132086.* Go from ``` error[E0277]: the trait bound `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` is not satisfied --> src/main.rs:7:50 | 7 | fn leaf<'a, O>(parser: impl CSTParser<'a, O>) -> impl CSTParser<'a, ()> { | ^^^^^^^^^^^^^^^^^^^^^^ the trait `chumsky::private::ParserSealed<'_, &str, (), chumsky::extra::Full<EmptyErr, (), ()>>` is not implemented for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>`, which is required by `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` | = help: the trait `chumsky::private::ParserSealed<'_, &'a str, ((), ()), chumsky::extra::Full<EmptyErr, (), ()>>` is implemented for `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>` = help: for that trait implementation, expected `((), ())`, found `()` = note: required for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>` to implement `Parser<'_, &str, ()>` note: required for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>` to implement `CSTParser<'a>` --> src/main.rs:5:16 | 5 | impl<'a, O, T> CSTParser<'a, O> for T where T: Parser<'a, &'a str, O> {} | ^^^^^^^^^^^^^^^^ ^ ---------------------- unsatisfied trait bound introduced here = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-0008f9a4f2023b08.long-type-13239977239800463552.txt' = note: consider using `--verbose` to print the full type name to the console = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-0008f9a4f2023b08.long-type-13239977239800463552.txt' = note: consider using `--verbose` to print the full type name to the console ``` to ``` error[E0277]: the trait bound `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` is not satisfied --> src/main.rs:7:50 | 7 | fn leaf<'a, O>(parser: impl CSTParser<'a, O>) -> impl CSTParser<'a, ()> { | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound ... 11 | ws.then(parser.map(|_| ())) | --------------------------- return type was inferred to be `Then<Ignored<..., ...>, ..., ..., ..., ...>` here | = help: the trait `ParserSealed<'_, &_, (), Full<_, _, _>>` is not implemented for `Then<Ignored<..., ...>, ..., ..., ..., ...>` but trait `ParserSealed<'_, &'a _, ((), ()), Full<_, _, _>>` is implemented for it = help: for that trait implementation, expected `((), ())`, found `()` = note: required for `Then<Ignored<..., ...>, ..., ..., ..., ...>` to implement `Parser<'_, &str, ()>` note: required for `Then<Ignored<..., ...>, ..., ..., ..., ...>` to implement `CSTParser<'a>` --> src/main.rs:5:16 | 5 | impl<'a, O, T> CSTParser<'a, O> for T where T: Parser<'a, &'a str, O> {} | ^^^^^^^^^^^^^^^^ ^ ---------------------- unsatisfied trait bound introduced here = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-df9d52be87eada65.long-type-1337037744507305372.txt' = note: consider using `--verbose` to print the full type name to the console ``` * Remove redundant wording * Introduce trait diff highlighting logic and use it * Fix incorrect "long type written to path" logic (can be split off) * Point at tail expression in more cases in E0277 * Avoid long primary span labels in E0277 by moving them to a `help` Fix #132013. There are individual commits that can be their own PR. If the review load is too big, happy to split them off.
This commit is contained in:
commit
b3f75cc872
@ -1,5 +1,7 @@
|
||||
use std::borrow::Cow;
|
||||
use std::fs::File;
|
||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||
use std::io::{Read, Write};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use rustc_errors::pluralize;
|
||||
@ -250,8 +252,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
|
||||
let width = self.sess.diagnostic_width();
|
||||
let length_limit = width.saturating_sub(30);
|
||||
if regular.len() <= width {
|
||||
let length_limit = width / 2;
|
||||
if regular.len() <= width * 2 / 3 {
|
||||
return regular;
|
||||
}
|
||||
let short = self.ty_string_with_limit(ty, length_limit);
|
||||
@ -265,7 +267,20 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
*path = Some(path.take().unwrap_or_else(|| {
|
||||
self.output_filenames(()).temp_path_ext(&format!("long-type-{hash}.txt"), None)
|
||||
}));
|
||||
match std::fs::write(path.as_ref().unwrap(), &format!("{regular}\n")) {
|
||||
let Ok(mut file) =
|
||||
File::options().create(true).read(true).append(true).open(&path.as_ref().unwrap())
|
||||
else {
|
||||
return regular;
|
||||
};
|
||||
|
||||
// Do not write the same type to the file multiple times.
|
||||
let mut contents = String::new();
|
||||
let _ = file.read_to_string(&mut contents);
|
||||
if let Some(_) = contents.lines().find(|line| line == ®ular) {
|
||||
return short;
|
||||
}
|
||||
|
||||
match write!(file, "{regular}\n") {
|
||||
Ok(_) => short,
|
||||
Err(_) => regular,
|
||||
}
|
||||
|
@ -766,6 +766,67 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
values
|
||||
}
|
||||
|
||||
pub fn cmp_traits(
|
||||
&self,
|
||||
def_id1: DefId,
|
||||
args1: &[ty::GenericArg<'tcx>],
|
||||
def_id2: DefId,
|
||||
args2: &[ty::GenericArg<'tcx>],
|
||||
) -> (DiagStyledString, DiagStyledString) {
|
||||
let mut values = (DiagStyledString::new(), DiagStyledString::new());
|
||||
|
||||
if def_id1 != def_id2 {
|
||||
values.0.push_highlighted(self.tcx.def_path_str(def_id1).as_str());
|
||||
values.1.push_highlighted(self.tcx.def_path_str(def_id2).as_str());
|
||||
} else {
|
||||
values.0.push_normal(self.tcx.item_name(def_id1).as_str());
|
||||
values.1.push_normal(self.tcx.item_name(def_id2).as_str());
|
||||
}
|
||||
|
||||
if args1.len() != args2.len() {
|
||||
let (pre, post) = if args1.len() > 0 { ("<", ">") } else { ("", "") };
|
||||
values.0.push_normal(format!(
|
||||
"{pre}{}{post}",
|
||||
args1.iter().map(|a| a.to_string()).collect::<Vec<_>>().join(", ")
|
||||
));
|
||||
let (pre, post) = if args2.len() > 0 { ("<", ">") } else { ("", "") };
|
||||
values.1.push_normal(format!(
|
||||
"{pre}{}{post}",
|
||||
args2.iter().map(|a| a.to_string()).collect::<Vec<_>>().join(", ")
|
||||
));
|
||||
return values;
|
||||
}
|
||||
|
||||
if args1.len() > 0 {
|
||||
values.0.push_normal("<");
|
||||
values.1.push_normal("<");
|
||||
}
|
||||
for (i, (a, b)) in std::iter::zip(args1, args2).enumerate() {
|
||||
let a_str = a.to_string();
|
||||
let b_str = b.to_string();
|
||||
if let (Some(a), Some(b)) = (a.as_type(), b.as_type()) {
|
||||
let (a, b) = self.cmp(a, b);
|
||||
values.0.0.extend(a.0);
|
||||
values.1.0.extend(b.0);
|
||||
} else if a_str != b_str {
|
||||
values.0.push_highlighted(a_str);
|
||||
values.1.push_highlighted(b_str);
|
||||
} else {
|
||||
values.0.push_normal(a_str);
|
||||
values.1.push_normal(b_str);
|
||||
}
|
||||
if i + 1 < args1.len() {
|
||||
values.0.push_normal(", ");
|
||||
values.1.push_normal(", ");
|
||||
}
|
||||
}
|
||||
if args1.len() > 0 {
|
||||
values.0.push_normal(">");
|
||||
values.1.push_normal(">");
|
||||
}
|
||||
values
|
||||
}
|
||||
|
||||
/// Compares two given types, eliding parts that are the same between them and highlighting
|
||||
/// relevant differences, and return two representation of those types for highlighted printing.
|
||||
pub fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagStyledString, DiagStyledString) {
|
||||
|
@ -6,8 +6,8 @@ use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{
|
||||
Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey, StringPart, Suggestions, pluralize,
|
||||
struct_span_code_err,
|
||||
Applicability, Diag, ErrorGuaranteed, Level, MultiSpan, StashKey, StringPart, Suggestions,
|
||||
pluralize, struct_span_code_err,
|
||||
};
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
|
||||
@ -328,6 +328,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
}
|
||||
} else if let Some(custom_explanation) = safe_transmute_explanation {
|
||||
err.span_label(span, custom_explanation);
|
||||
} else if explanation.len() > self.tcx.sess.diagnostic_width() {
|
||||
// Really long types don't look good as span labels, instead move it
|
||||
// to a `help`.
|
||||
err.span_label(span, "unsatisfied trait bound");
|
||||
err.help(explanation);
|
||||
} else {
|
||||
err.span_label(span, explanation);
|
||||
}
|
||||
@ -1832,21 +1837,81 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
if impl_trait_ref.references_error() {
|
||||
return false;
|
||||
}
|
||||
let self_ty = impl_trait_ref.self_ty().to_string();
|
||||
err.highlighted_help(vec![
|
||||
StringPart::normal(format!(
|
||||
"the trait `{}` ",
|
||||
impl_trait_ref.print_trait_sugared()
|
||||
)),
|
||||
StringPart::highlighted("is"),
|
||||
|
||||
if let [child, ..] = &err.children[..]
|
||||
&& child.level == Level::Help
|
||||
&& let Some(line) = child.messages.get(0)
|
||||
&& let Some(line) = line.0.as_str()
|
||||
&& line.starts_with("the trait")
|
||||
&& line.contains("is not implemented for")
|
||||
{
|
||||
// HACK(estebank): we remove the pre-existing
|
||||
// "the trait `X` is not implemented for" note, which only happens if there
|
||||
// was a custom label. We do this because we want that note to always be the
|
||||
// first, and making this logic run earlier will get tricky. For now, we
|
||||
// instead keep the logic the same and modify the already constructed error
|
||||
// to avoid the wording duplication.
|
||||
err.children.remove(0);
|
||||
}
|
||||
|
||||
let traits = self.cmp_traits(
|
||||
obligation_trait_ref.def_id,
|
||||
&obligation_trait_ref.args[1..],
|
||||
impl_trait_ref.def_id,
|
||||
&impl_trait_ref.args[1..],
|
||||
);
|
||||
let traits_content = (traits.0.content(), traits.1.content());
|
||||
let types = self.cmp(obligation_trait_ref.self_ty(), impl_trait_ref.self_ty());
|
||||
let types_content = (types.0.content(), types.1.content());
|
||||
let mut msg = vec![StringPart::normal("the trait `")];
|
||||
if traits_content.0 == traits_content.1 {
|
||||
msg.push(StringPart::normal(
|
||||
impl_trait_ref.print_trait_sugared().to_string(),
|
||||
));
|
||||
} else {
|
||||
msg.extend(traits.0.0);
|
||||
}
|
||||
msg.extend([
|
||||
StringPart::normal("` "),
|
||||
StringPart::highlighted("is not"),
|
||||
StringPart::normal(" implemented for `"),
|
||||
if let [TypeError::Sorts(_)] = &terrs[..] {
|
||||
StringPart::normal(self_ty)
|
||||
} else {
|
||||
StringPart::highlighted(self_ty)
|
||||
},
|
||||
StringPart::normal("`"),
|
||||
]);
|
||||
if types_content.0 == types_content.1 {
|
||||
let ty =
|
||||
self.tcx.short_ty_string(obligation_trait_ref.self_ty(), &mut None);
|
||||
msg.push(StringPart::normal(ty));
|
||||
} else {
|
||||
msg.extend(types.0.0);
|
||||
}
|
||||
msg.push(StringPart::normal("`"));
|
||||
if types_content.0 == types_content.1 {
|
||||
msg.push(StringPart::normal("\nbut trait `"));
|
||||
msg.extend(traits.1.0);
|
||||
msg.extend([
|
||||
StringPart::normal("` "),
|
||||
StringPart::highlighted("is"),
|
||||
StringPart::normal(" implemented for it"),
|
||||
]);
|
||||
} else if traits_content.0 == traits_content.1 {
|
||||
msg.extend([
|
||||
StringPart::normal("\nbut it "),
|
||||
StringPart::highlighted("is"),
|
||||
StringPart::normal(" implemented for `"),
|
||||
]);
|
||||
msg.extend(types.1.0);
|
||||
msg.push(StringPart::normal("`"));
|
||||
} else {
|
||||
msg.push(StringPart::normal("\nbut trait `"));
|
||||
msg.extend(traits.1.0);
|
||||
msg.extend([
|
||||
StringPart::normal("` "),
|
||||
StringPart::highlighted("is"),
|
||||
StringPart::normal(" implemented for `"),
|
||||
]);
|
||||
msg.extend(types.1.0);
|
||||
msg.push(StringPart::normal("`"));
|
||||
}
|
||||
err.highlighted_help(msg);
|
||||
|
||||
if let [TypeError::Sorts(exp_found)] = &terrs[..] {
|
||||
let exp_found = self.resolve_vars_if_possible(*exp_found);
|
||||
@ -2475,12 +2540,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
&& self.tcx.trait_impls_of(trait_def_id).is_empty()
|
||||
&& !self.tcx.trait_is_auto(trait_def_id)
|
||||
&& !self.tcx.trait_is_alias(trait_def_id)
|
||||
&& trait_predicate.polarity() == ty::PredicatePolarity::Positive
|
||||
{
|
||||
err.span_help(
|
||||
self.tcx.def_span(trait_def_id),
|
||||
crate::fluent_generated::trait_selection_trait_has_no_impls,
|
||||
);
|
||||
} else if !suggested && !unsatisfied_const {
|
||||
} else if !suggested
|
||||
&& !unsatisfied_const
|
||||
&& trait_predicate.polarity() == ty::PredicatePolarity::Positive
|
||||
{
|
||||
// Can't show anything else useful, try to find similar impls.
|
||||
let impl_candidates = self.find_similar_impl_candidates(trait_predicate);
|
||||
if !self.report_similar_impl_candidates(
|
||||
|
@ -3563,17 +3563,34 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
)]);
|
||||
}
|
||||
ObligationCauseCode::OpaqueReturnType(expr_info) => {
|
||||
if let Some((expr_ty, hir_id)) = expr_info {
|
||||
let expr_ty = self.tcx.short_ty_string(expr_ty, long_ty_file);
|
||||
let expr = self.infcx.tcx.hir().expect_expr(hir_id);
|
||||
err.span_label(
|
||||
expr.span,
|
||||
with_forced_trimmed_paths!(format!(
|
||||
"return type was inferred to be `{expr_ty}` here",
|
||||
)),
|
||||
);
|
||||
suggest_remove_deref(err, &expr);
|
||||
}
|
||||
let (expr_ty, expr) = if let Some((expr_ty, hir_id)) = expr_info {
|
||||
let expr_ty = tcx.short_ty_string(expr_ty, long_ty_file);
|
||||
let expr = tcx.hir().expect_expr(hir_id);
|
||||
(expr_ty, expr)
|
||||
} else if let Some(body_id) = tcx.hir_node_by_def_id(body_id).body_id()
|
||||
&& let body = tcx.hir().body(body_id)
|
||||
&& let hir::ExprKind::Block(block, _) = body.value.kind
|
||||
&& let Some(expr) = block.expr
|
||||
&& let Some(expr_ty) = self
|
||||
.typeck_results
|
||||
.as_ref()
|
||||
.and_then(|typeck| typeck.node_type_opt(expr.hir_id))
|
||||
&& let Some(pred) = predicate.as_clause()
|
||||
&& let ty::ClauseKind::Trait(pred) = pred.kind().skip_binder()
|
||||
&& self.can_eq(param_env, pred.self_ty(), expr_ty)
|
||||
{
|
||||
let expr_ty = tcx.short_ty_string(expr_ty, long_ty_file);
|
||||
(expr_ty, expr)
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
err.span_label(
|
||||
expr.span,
|
||||
with_forced_trimmed_paths!(format!(
|
||||
"return type was inferred to be `{expr_ty}` here",
|
||||
)),
|
||||
);
|
||||
suggest_remove_deref(err, &expr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3680,6 +3697,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
err: &mut Diag<'_>,
|
||||
trait_pred: ty::PolyTraitPredicate<'tcx>,
|
||||
) {
|
||||
if trait_pred.polarity() == ty::PredicatePolarity::Negative {
|
||||
return;
|
||||
}
|
||||
let Some(diagnostic_name) = self.tcx.get_diagnostic_name(trait_pred.def_id()) else {
|
||||
return;
|
||||
};
|
||||
|
@ -2,8 +2,9 @@ error[E0277]: the trait bound `NotClonableUpvar: Clone` is not satisfied in `{as
|
||||
--> $DIR/not-clone-closure.rs:32:15
|
||||
|
|
||||
LL | not_clone.clone();
|
||||
| ^^^^^ within `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}`, the trait `Clone` is not implemented for `NotClonableUpvar`
|
||||
| ^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: within `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}`, the trait `Clone` is not implemented for `NotClonableUpvar`
|
||||
note: required because it's used within this closure
|
||||
--> $DIR/not-clone-closure.rs:29:21
|
||||
|
|
||||
|
@ -3,6 +3,9 @@ error[E0277]: `()` is not a future
|
||||
|
|
||||
LL | fn get_future() -> impl Future<Output = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
|
||||
LL |
|
||||
LL | panic!()
|
||||
| -------- return type was inferred to be `_` here
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `()`
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
//@ edition:2018
|
||||
//@compile-flags: --diagnostic-width=300
|
||||
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
||||
|
||||
use std::future::Future;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
|
||||
--> $DIR/coroutine-not-future.rs:35:21
|
||||
--> $DIR/coroutine-not-future.rs:36:21
|
||||
|
|
||||
LL | takes_coroutine(async_fn());
|
||||
| --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
|
||||
@ -7,13 +7,13 @@ LL | takes_coroutine(async_fn());
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `takes_coroutine`
|
||||
--> $DIR/coroutine-not-future.rs:19:39
|
||||
--> $DIR/coroutine-not-future.rs:20:39
|
||||
|
|
||||
LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
|
||||
|
||||
error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
|
||||
--> $DIR/coroutine-not-future.rs:37:21
|
||||
--> $DIR/coroutine-not-future.rs:38:21
|
||||
|
|
||||
LL | takes_coroutine(returns_async_block());
|
||||
| --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
|
||||
@ -21,27 +21,27 @@ LL | takes_coroutine(returns_async_block());
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `takes_coroutine`
|
||||
--> $DIR/coroutine-not-future.rs:19:39
|
||||
--> $DIR/coroutine-not-future.rs:20:39
|
||||
|
|
||||
LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
|
||||
|
||||
error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}: Coroutine<_>` is not satisfied
|
||||
--> $DIR/coroutine-not-future.rs:39:21
|
||||
error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}: Coroutine<_>` is not satisfied
|
||||
--> $DIR/coroutine-not-future.rs:40:21
|
||||
|
|
||||
LL | takes_coroutine(async {});
|
||||
| --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}`
|
||||
| --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `takes_coroutine`
|
||||
--> $DIR/coroutine-not-future.rs:19:39
|
||||
--> $DIR/coroutine-not-future.rs:20:39
|
||||
|
|
||||
LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
|
||||
|
||||
error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future
|
||||
--> $DIR/coroutine-not-future.rs:43:18
|
||||
--> $DIR/coroutine-not-future.rs:44:18
|
||||
|
|
||||
LL | takes_future(returns_coroutine());
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future
|
||||
@ -50,13 +50,13 @@ LL | takes_future(returns_coroutine());
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
|
||||
note: required by a bound in `takes_future`
|
||||
--> $DIR/coroutine-not-future.rs:18:26
|
||||
--> $DIR/coroutine-not-future.rs:19:26
|
||||
|
|
||||
LL | fn takes_future(_f: impl Future<Output = ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
|
||||
|
||||
error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` is not a future
|
||||
--> $DIR/coroutine-not-future.rs:47:9
|
||||
error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}` is not a future
|
||||
--> $DIR/coroutine-not-future.rs:48:9
|
||||
|
|
||||
LL | takes_future(
|
||||
| ------------ required by a bound introduced by this call
|
||||
@ -65,11 +65,11 @@ LL | / |ctx| {
|
||||
LL | |
|
||||
LL | | ctx = yield ();
|
||||
LL | | },
|
||||
| |_________^ `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` is not a future
|
||||
| |_________^ `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}` is not a future
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}`
|
||||
= help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}`
|
||||
note: required by a bound in `takes_future`
|
||||
--> $DIR/coroutine-not-future.rs:18:26
|
||||
--> $DIR/coroutine-not-future.rs:19:26
|
||||
|
|
||||
LL | fn takes_future(_f: impl Future<Output = ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
|
||||
|
@ -20,10 +20,11 @@ error[E0277]: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as
|
||||
--> $DIR/const_param_ty_bad.rs:8:11
|
||||
|
|
||||
LL | check(|| {});
|
||||
| ----- ^^^^^ the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
|
||||
| ----- ^^^^^ unsatisfied trait bound
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
|
||||
note: required by a bound in `check`
|
||||
--> $DIR/const_param_ty_bad.rs:4:18
|
||||
|
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
|
||||
LL | type Assoc = u16;
|
||||
| ^^^ the trait `Bar<N>` is not implemented for `u16`
|
||||
|
|
||||
= help: the trait `Bar<3>` is implemented for `u16`
|
||||
= help: the trait `Bar<N>` is not implemented for `u16`
|
||||
but trait `Bar<3>` is implemented for it
|
||||
note: required by a bound in `Foo::Assoc`
|
||||
--> $DIR/associated-type-bound-fail.rs:4:17
|
||||
|
|
||||
|
@ -18,7 +18,8 @@ LL |
|
||||
LL | 1_u32
|
||||
| ----- return type was inferred to be `u32` here
|
||||
|
|
||||
= help: the trait `Traitor<N, 2>` is implemented for `u32`
|
||||
= help: the trait `Traitor<N, N>` is not implemented for `u32`
|
||||
but trait `Traitor<N, 2>` is implemented for it
|
||||
|
||||
error[E0277]: the trait bound `u64: Traitor` is not satisfied
|
||||
--> $DIR/rp_impl_trait_fail.rs:21:13
|
||||
@ -29,7 +30,8 @@ LL |
|
||||
LL | 1_u64
|
||||
| ----- return type was inferred to be `u64` here
|
||||
|
|
||||
= help: the trait `Traitor<1, 2>` is implemented for `u64`
|
||||
= help: the trait `Traitor<1, 1>` is not implemented for `u64`
|
||||
but trait `Traitor<1, 2>` is implemented for it
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/rp_impl_trait_fail.rs:28:5
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied
|
||||
LL | foo(&10_u32);
|
||||
| ^^^^^^^ the trait `Trait` is not implemented for `u32`
|
||||
|
|
||||
= help: the trait `Trait<2>` is implemented for `u32`
|
||||
= help: the trait `Trait<12>` is not implemented for `u32`
|
||||
but trait `Trait<2>` is implemented for it
|
||||
= note: required for the cast from `&u32` to `&dyn Trait`
|
||||
|
||||
error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied
|
||||
@ -13,7 +14,8 @@ error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied
|
||||
LL | bar(&true);
|
||||
| ^^^^^ the trait `Traitor<_>` is not implemented for `bool`
|
||||
|
|
||||
= help: the trait `Traitor<2, 3>` is implemented for `bool`
|
||||
= help: the trait `Traitor<_, _>` is not implemented for `bool`
|
||||
but trait `Traitor<2, 3>` is implemented for it
|
||||
= note: required for the cast from `&bool` to `&dyn Traitor<_>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -10,7 +10,8 @@ error[E0277]: the trait bound `(): Trait<2>` is not satisfied
|
||||
LL | (): Trait<N>;
|
||||
| ^^^^^^^^ the trait `Trait<2>` is not implemented for `()`
|
||||
|
|
||||
= help: the trait `Trait<3>` is implemented for `()`
|
||||
= help: the trait `Trait<2>` is not implemented for `()`
|
||||
but trait `Trait<3>` is implemented for it
|
||||
|
||||
error[E0277]: the trait bound `(): Trait<1>` is not satisfied
|
||||
--> $DIR/wfness.rs:18:13
|
||||
@ -18,7 +19,8 @@ error[E0277]: the trait bound `(): Trait<1>` is not satisfied
|
||||
LL | fn foo() -> DependentDefaultWfness {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<1>` is not implemented for `()`
|
||||
|
|
||||
= help: the trait `Trait<3>` is implemented for `()`
|
||||
= help: the trait `Trait<1>` is not implemented for `()`
|
||||
but trait `Trait<3>` is implemented for it
|
||||
note: required by a bound in `WhereClause`
|
||||
--> $DIR/wfness.rs:8:9
|
||||
|
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied
|
||||
LL | let _ = A;
|
||||
| ^ the trait `Bar<_>` is not implemented for `A<_>`
|
||||
|
|
||||
= help: the trait `Bar<_>` is implemented for `A<{ 6 + 1 }>`
|
||||
= help: the trait `Bar<_>` is not implemented for `A<_>`
|
||||
but it is implemented for `A<{ 6 + 1 }>`
|
||||
note: required by a bound in `A`
|
||||
--> $DIR/unused-substs-1.rs:9:11
|
||||
|
|
||||
|
@ -5,7 +5,10 @@ LL | fn foo() -> impl Coroutine<u8> {
|
||||
| ^^^^^^^^^^^^^^^^^^ expected due to this
|
||||
...
|
||||
LL | |_: ()| {}
|
||||
| ------- found signature defined here
|
||||
| ----------
|
||||
| |
|
||||
| found signature defined here
|
||||
| return type was inferred to be `{coroutine@$DIR/arg-count-mismatch-on-unit-input.rs:8:5: 8:12}` here
|
||||
|
|
||||
= note: expected coroutine signature `fn(u8) -> _`
|
||||
found coroutine signature `fn(()) -> _`
|
||||
|
@ -1,6 +1,7 @@
|
||||
// gate-test-coroutine_clone
|
||||
// Verifies that non-static coroutines can be cloned/copied if all their upvars and locals held
|
||||
// across awaits can be cloned/copied.
|
||||
//@compile-flags: --diagnostic-width=300
|
||||
|
||||
#![feature(coroutines, coroutine_clone, stmt_expr_attributes)]
|
||||
|
||||
|
@ -1,76 +1,76 @@
|
||||
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`
|
||||
--> $DIR/clone-impl.rs:49:5
|
||||
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
|
||||
--> $DIR/clone-impl.rs:50:5
|
||||
|
|
||||
LL | move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:47:14
|
||||
--> $DIR/clone-impl.rs:48:14
|
||||
|
|
||||
LL | drop(clonable_0);
|
||||
| ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy`
|
||||
note: required by a bound in `check_copy`
|
||||
--> $DIR/clone-impl.rs:89:18
|
||||
--> $DIR/clone-impl.rs:90:18
|
||||
|
|
||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`
|
||||
--> $DIR/clone-impl.rs:49:5
|
||||
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
|
||||
--> $DIR/clone-impl.rs:50:5
|
||||
|
|
||||
LL | move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
|
|
||||
note: coroutine does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/clone-impl.rs:45:9
|
||||
--> $DIR/clone-impl.rs:46:9
|
||||
|
|
||||
LL | let v = vec!['a'];
|
||||
| - has type `Vec<char>` which does not implement `Copy`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `v` maybe used later
|
||||
note: required by a bound in `check_copy`
|
||||
--> $DIR/clone-impl.rs:89:18
|
||||
--> $DIR/clone-impl.rs:90:18
|
||||
|
|
||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`
|
||||
--> $DIR/clone-impl.rs:70:5
|
||||
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
|
||||
--> $DIR/clone-impl.rs:71:5
|
||||
|
|
||||
LL | move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`, the trait `Copy` is not implemented for `Vec<u32>`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:68:14
|
||||
--> $DIR/clone-impl.rs:69:14
|
||||
|
|
||||
LL | drop(clonable_1);
|
||||
| ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy`
|
||||
note: required by a bound in `check_copy`
|
||||
--> $DIR/clone-impl.rs:89:18
|
||||
--> $DIR/clone-impl.rs:90:18
|
||||
|
|
||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`
|
||||
--> $DIR/clone-impl.rs:70:5
|
||||
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
|
||||
--> $DIR/clone-impl.rs:71:5
|
||||
|
|
||||
LL | move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
|
||||
...
|
||||
LL | check_copy(&gen_clone_1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`, the trait `Copy` is not implemented for `Vec<char>`
|
||||
|
|
||||
note: coroutine does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/clone-impl.rs:64:9
|
||||
--> $DIR/clone-impl.rs:65:9
|
||||
|
|
||||
LL | let v = vec!['a'];
|
||||
| - has type `Vec<char>` which does not implement `Copy`
|
||||
@ -78,27 +78,27 @@ LL | let v = vec!['a'];
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `v` maybe used later
|
||||
note: required by a bound in `check_copy`
|
||||
--> $DIR/clone-impl.rs:89:18
|
||||
--> $DIR/clone-impl.rs:90:18
|
||||
|
|
||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
|
||||
error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`
|
||||
--> $DIR/clone-impl.rs:83:5
|
||||
error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
|
||||
--> $DIR/clone-impl.rs:84:5
|
||||
|
|
||||
LL | move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
|
||||
...
|
||||
LL | check_copy(&gen_non_clone);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`, the trait `Copy` is not implemented for `NonClone`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`, the trait `Copy` is not implemented for `NonClone`
|
||||
|
|
||||
note: captured value does not implement `Copy`
|
||||
--> $DIR/clone-impl.rs:81:14
|
||||
--> $DIR/clone-impl.rs:82:14
|
||||
|
|
||||
LL | drop(non_clonable);
|
||||
| ^^^^^^^^^^^^ has type `NonClone` which does not implement `Copy`
|
||||
note: required by a bound in `check_copy`
|
||||
--> $DIR/clone-impl.rs:89:18
|
||||
--> $DIR/clone-impl.rs:90:18
|
||||
|
|
||||
LL | fn check_copy<T: Copy>(_x: &T) {}
|
||||
| ^^^^ required by this bound in `check_copy`
|
||||
@ -108,22 +108,22 @@ LL + #[derive(Copy)]
|
||||
LL | struct NonClone;
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`
|
||||
--> $DIR/clone-impl.rs:85:5
|
||||
error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
|
||||
--> $DIR/clone-impl.rs:86:5
|
||||
|
|
||||
LL | move || {
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`
|
||||
| ------- within this `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
|
||||
...
|
||||
LL | check_clone(&gen_non_clone);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`, the trait `Clone` is not implemented for `NonClone`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`, the trait `Clone` is not implemented for `NonClone`
|
||||
|
|
||||
note: captured value does not implement `Clone`
|
||||
--> $DIR/clone-impl.rs:81:14
|
||||
--> $DIR/clone-impl.rs:82:14
|
||||
|
|
||||
LL | drop(non_clonable);
|
||||
| ^^^^^^^^^^^^ has type `NonClone` which does not implement `Clone`
|
||||
note: required by a bound in `check_clone`
|
||||
--> $DIR/clone-impl.rs:90:19
|
||||
--> $DIR/clone-impl.rs:91:19
|
||||
|
|
||||
LL | fn check_clone<T: Clone>(_x: &T) {}
|
||||
| ^^^^^ required by this bound in `check_clone`
|
||||
|
@ -3,18 +3,24 @@ error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}: C
|
||||
|
|
||||
LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}`
|
||||
LL | gen { yield 42 }
|
||||
| ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}` here
|
||||
|
||||
error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}: Coroutine` is not satisfied
|
||||
--> $DIR/gen_block_is_coro.rs:10:13
|
||||
|
|
||||
LL | fn bar() -> impl Coroutine<Yield = i64, Return = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}`
|
||||
LL | gen { yield 42 }
|
||||
| ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}` here
|
||||
|
||||
error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}: Coroutine` is not satisfied
|
||||
--> $DIR/gen_block_is_coro.rs:14:13
|
||||
|
|
||||
LL | fn baz() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}`
|
||||
LL | gen { yield 42 }
|
||||
| ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}` here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0277]: `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a fut
|
||||
|
|
||||
LL | fn foo() -> impl std::future::Future {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a future
|
||||
LL | gen { yield 42 }
|
||||
| ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` here
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}`
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
//@compile-flags: --diagnostic-width=300
|
||||
#![feature(coroutines)]
|
||||
#![feature(coroutine_clone)]
|
||||
#![feature(coroutine_trait)]
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0382]: borrow of moved value: `g`
|
||||
--> $DIR/issue-105084.rs:38:14
|
||||
--> $DIR/issue-105084.rs:39:14
|
||||
|
|
||||
LL | let mut g = #[coroutine]
|
||||
| ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`, which does not implement the `Copy` trait
|
||||
| ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, which does not implement the `Copy` trait
|
||||
...
|
||||
LL | let mut h = copy(g);
|
||||
| - value moved here
|
||||
@ -11,7 +11,7 @@ LL | Pin::new(&mut g).resume(());
|
||||
| ^^^^^^ value borrowed here after move
|
||||
|
|
||||
note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary
|
||||
--> $DIR/issue-105084.rs:9:21
|
||||
--> $DIR/issue-105084.rs:10:21
|
||||
|
|
||||
LL | fn copy<T: Copy>(x: T) -> T {
|
||||
| ---- ^ this parameter takes ownership of the value
|
||||
@ -22,17 +22,17 @@ help: consider cloning the value if the performance cost is acceptable
|
||||
LL | let mut h = copy(g.clone());
|
||||
| ++++++++
|
||||
|
||||
error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`
|
||||
--> $DIR/issue-105084.rs:32:17
|
||||
error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
|
||||
--> $DIR/issue-105084.rs:33:17
|
||||
|
|
||||
LL | || {
|
||||
| -- within this `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`
|
||||
| -- within this `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
|
||||
...
|
||||
LL | let mut h = copy(g);
|
||||
| ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
||||
| ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
||||
|
|
||||
note: coroutine does not implement `Copy` as this value is used across a yield
|
||||
--> $DIR/issue-105084.rs:22:22
|
||||
--> $DIR/issue-105084.rs:23:22
|
||||
|
|
||||
LL | Box::new((5, yield));
|
||||
| -------------^^^^^--
|
||||
@ -40,7 +40,7 @@ LL | Box::new((5, yield));
|
||||
| | yield occurs here, with `Box::new((5, yield))` maybe used later
|
||||
| has type `Box<(i32, ())>` which does not implement `Copy`
|
||||
note: required by a bound in `copy`
|
||||
--> $DIR/issue-105084.rs:9:12
|
||||
--> $DIR/issue-105084.rs:10:12
|
||||
|
|
||||
LL | fn copy<T: Copy>(x: T) -> T {
|
||||
| ^^^^ required by this bound in `copy`
|
||||
|
@ -14,6 +14,7 @@ fn foo(bar: bool) -> impl Coroutine<(bool,)> {
|
||||
#[coroutine]
|
||||
|bar| {
|
||||
//~^ NOTE: found signature defined here
|
||||
//~| NOTE: return type was inferred to be
|
||||
if bar {
|
||||
yield bar;
|
||||
}
|
||||
|
@ -1,11 +1,21 @@
|
||||
error[E0631]: type mismatch in coroutine arguments
|
||||
--> $DIR/issue-88653.rs:8:22
|
||||
|
|
||||
LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
|
||||
LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
|
||||
...
|
||||
LL | |bar| {
|
||||
| ----- found signature defined here
|
||||
LL | |bar| {
|
||||
| -----
|
||||
| |
|
||||
| _____found signature defined here
|
||||
| |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | if bar {
|
||||
LL | | yield bar;
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____- return type was inferred to be `{coroutine@$DIR/issue-88653.rs:15:5: 15:10}` here
|
||||
|
|
||||
= note: expected coroutine signature `fn((bool,)) -> _`
|
||||
found coroutine signature `fn(bool) -> _`
|
||||
|
@ -1,15 +1,15 @@
|
||||
error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}` cannot be unpinned
|
||||
--> $DIR/static-not-unpin.rs:18:18
|
||||
error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}` cannot be unpinned
|
||||
--> $DIR/static-not-unpin.rs:19:18
|
||||
|
|
||||
LL | assert_unpin(coroutine);
|
||||
| ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}`
|
||||
| ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: consider using the `pin!` macro
|
||||
consider using `Box::pin` if you need to access the pinned value outside of the current scope
|
||||
note: required by a bound in `assert_unpin`
|
||||
--> $DIR/static-not-unpin.rs:11:20
|
||||
--> $DIR/static-not-unpin.rs:12:20
|
||||
|
|
||||
LL | fn assert_unpin<T: Unpin>(_: T) {}
|
||||
| ^^^^^ required by this bound in `assert_unpin`
|
||||
|
@ -1,15 +1,15 @@
|
||||
error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}` cannot be unpinned
|
||||
--> $DIR/static-not-unpin.rs:18:18
|
||||
error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}` cannot be unpinned
|
||||
--> $DIR/static-not-unpin.rs:19:18
|
||||
|
|
||||
LL | assert_unpin(coroutine);
|
||||
| ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}`
|
||||
| ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: consider using the `pin!` macro
|
||||
consider using `Box::pin` if you need to access the pinned value outside of the current scope
|
||||
note: required by a bound in `assert_unpin`
|
||||
--> $DIR/static-not-unpin.rs:11:20
|
||||
--> $DIR/static-not-unpin.rs:12:20
|
||||
|
|
||||
LL | fn assert_unpin<T: Unpin>(_: T) {}
|
||||
| ^^^^^ required by this bound in `assert_unpin`
|
||||
|
@ -1,6 +1,7 @@
|
||||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
//@[next] compile-flags: -Znext-solver --diagnostic-width=300
|
||||
//@[current] compile-flags: --diagnostic-width=300
|
||||
|
||||
#![feature(coroutines, stmt_expr_attributes)]
|
||||
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied
|
||||
LL | SelectInt.check("bar");
|
||||
| ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
|
|
||||
= help: the trait `AsExpression<Text>` is implemented for `&str`
|
||||
= help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
= help: for that trait implementation, expected `Text`, found `Integer`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -22,7 +22,8 @@ error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied
|
||||
LL | SelectInt.check("bar");
|
||||
| ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
|
|
||||
= help: the trait `AsExpression<Text>` is implemented for `&str`
|
||||
= help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
= help: for that trait implementation, expected `Text`, found `Integer`
|
||||
|
||||
error[E0271]: type mismatch resolving `<SelectInt as Expression>::SqlType == Text`
|
||||
|
@ -16,7 +16,8 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
|
||||
LL | let () = K::<()>;
|
||||
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
||||
|
|
||||
= help: the trait `From<!>` is implemented for `Infallible`
|
||||
= help: the trait `From<()>` is not implemented for `Infallible`
|
||||
but trait `From<!>` is implemented for it
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
note: required by a bound in `K`
|
||||
--> $DIR/unsatisfied-bounds.rs:12:17
|
||||
@ -48,7 +49,8 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
|
||||
LL | let _ = <() as Trait<&'static str>>::B::<()>;
|
||||
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
||||
|
|
||||
= help: the trait `From<!>` is implemented for `Infallible`
|
||||
= help: the trait `From<()>` is not implemented for `Infallible`
|
||||
but trait `From<!>` is implemented for it
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
note: required by a bound in `Trait::B`
|
||||
--> $DIR/unsatisfied-bounds.rs:21:21
|
||||
|
@ -1,4 +1,4 @@
|
||||
<svg width="1104px" height="344px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="1104px" height="398px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
@ -31,31 +31,37 @@
|
||||
</tspan>
|
||||
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">the trait `Bar<i32>` is not implemented for `Struct`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
<tspan x="10px" y="118px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Struct</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: the trait `Bar<()>` </tspan><tspan class="fg-magenta bold">is</tspan><tspan> implemented for `Struct`</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">return type was inferred to be `Struct` here</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: for that trait implementation, expected `</tspan><tspan class="fg-magenta bold">()</tspan><tspan>`, found `</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>`</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="172px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: required for `Struct` to implement `Foo<i32>`</tspan>
|
||||
<tspan x="10px" y="172px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: the trait `Bar<</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is not</tspan><tspan> implemented for `Struct`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="190px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:11:12</tspan>
|
||||
<tspan x="10px" y="190px"><tspan> but trait `Bar<</tspan><tspan class="fg-magenta bold">()</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is</tspan><tspan> implemented for it</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
<tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: for that trait implementation, expected `</tspan><tspan class="fg-magenta bold">()</tspan><tspan>`, found `</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="226px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> impl<T, K> Foo<K> for T where T: Bar<K></tspan>
|
||||
<tspan x="10px" y="226px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: required for `Struct` to implement `Foo<i32>`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unsatisfied trait bound introduced here</tspan>
|
||||
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:11:12</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="262px">
|
||||
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="280px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
|
||||
<tspan x="10px" y="280px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> impl<T, K> Foo<K> for T where T: Bar<K></tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="298px">
|
||||
<tspan x="10px" y="298px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unsatisfied trait bound introduced here</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="316px"><tspan class="bold">For more information about this error, try `rustc --explain E0277`.</tspan>
|
||||
<tspan x="10px" y="316px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="334px">
|
||||
<tspan x="10px" y="334px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="352px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="370px"><tspan class="bold">For more information about this error, try `rustc --explain E0277`.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.4 KiB |
@ -32,7 +32,8 @@ LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
|
||||
LL | self
|
||||
| ---- return type was inferred to be `Bar` here
|
||||
|
|
||||
= help: the trait `Foo<char>` is implemented for `Bar`
|
||||
= help: the trait `Foo<u8>` is not implemented for `Bar`
|
||||
but trait `Foo<char>` is implemented for it
|
||||
= help: for that trait implementation, expected `char`, found `u8`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
@ -12,6 +12,9 @@ error[E0277]: the trait bound `S: Copy` is not satisfied in `(S, T)`
|
||||
|
|
||||
LL | fn foo<T: Default>() -> Self::E {
|
||||
| ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `S`
|
||||
...
|
||||
LL | (S::default(), T::default())
|
||||
| ---------------------------- return type was inferred to be `(S, T)` here
|
||||
|
|
||||
= note: required because it appears within the type `(S, T)`
|
||||
help: consider further restricting this bound
|
||||
@ -24,6 +27,9 @@ error[E0277]: the trait bound `T: Copy` is not satisfied in `(S, T)`
|
||||
|
|
||||
LL | fn foo<T: Default>() -> Self::E {
|
||||
| ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `T`
|
||||
...
|
||||
LL | (S::default(), T::default())
|
||||
| ---------------------------- return type was inferred to be `(S, T)` here
|
||||
|
|
||||
= note: required because it appears within the type `(S, T)`
|
||||
help: consider further restricting this bound
|
||||
|
@ -3,6 +3,9 @@ error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}:
|
||||
|
|
||||
LL | fn foo<T>() -> Self::E {
|
||||
| ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}`
|
||||
LL |
|
||||
LL | async {}
|
||||
| -------- return type was inferred to be `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}` here
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -29,7 +29,8 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
|
||||
LL | WrongImpl::foo(0i32);
|
||||
| ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
||||
|
|
||||
= help: the trait `Raw<[_]>` is implemented for `RawImpl<_>`
|
||||
= help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
||||
but trait `Raw<[_]>` is implemented for it
|
||||
note: required by a bound in `SafeImpl`
|
||||
--> $DIR/issue-62742.rs:33:35
|
||||
|
|
||||
@ -67,7 +68,8 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
|
||||
LL | WrongImpl::<()>::foo(0i32);
|
||||
| ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
||||
|
|
||||
= help: the trait `Raw<[()]>` is implemented for `RawImpl<()>`
|
||||
= help: the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
||||
but trait `Raw<[()]>` is implemented for it
|
||||
= help: for that trait implementation, expected `[()]`, found `()`
|
||||
note: required by a bound in `SafeImpl`
|
||||
--> $DIR/issue-62742.rs:33:35
|
||||
|
@ -83,7 +83,8 @@ error[E0277]: the trait bound `for<'a> &'a (): Qux<'b>` is not satisfied
|
||||
LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {}
|
||||
| ^^^^^^^^^^^^ the trait `for<'a> Qux<'b>` is not implemented for `&'a ()`
|
||||
|
|
||||
= help: the trait `Qux<'_>` is implemented for `()`
|
||||
= help: the trait `Qux<'b>` is not implemented for `&'a ()`
|
||||
but trait `Qux<'_>` is implemented for `()`
|
||||
= help: for that trait implementation, expected `()`, found `&'a ()`
|
||||
|
||||
error: implementation of `Bar` is not general enough
|
||||
@ -101,7 +102,8 @@ error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied
|
||||
LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()`
|
||||
|
|
||||
= help: the trait `Qux<'_>` is implemented for `()`
|
||||
= help: the trait `Qux<'b>` is not implemented for `&'a ()`
|
||||
but trait `Qux<'_>` is implemented for `()`
|
||||
= help: for that trait implementation, expected `()`, found `&'a ()`
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
@ -46,7 +46,9 @@ error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfie
|
||||
--> $DIR/nested_impl_trait.rs:6:46
|
||||
|
|
||||
LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ - return type was inferred to be `impl Into<u32>` here
|
||||
| |
|
||||
| the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
|
||||
|
|
||||
= help: the trait `Into<U>` is implemented for `T`
|
||||
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
|
||||
@ -55,7 +57,9 @@ error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfie
|
||||
--> $DIR/nested_impl_trait.rs:19:34
|
||||
|
|
||||
LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ - return type was inferred to be `impl Into<u32>` here
|
||||
| |
|
||||
| the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
|
||||
|
|
||||
= help: the trait `Into<U>` is implemented for `T`
|
||||
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
|
||||
|
@ -3,6 +3,9 @@ error[E0283]: type annotations needed
|
||||
|
|
||||
LL | fn run() -> Foo<impl Future<Output = ()>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
||||
LL |
|
||||
LL | loop {}
|
||||
| ------- return type was inferred to be `!` here
|
||||
|
|
||||
= note: cannot satisfy `_: Future`
|
||||
|
||||
|
@ -3,6 +3,9 @@ error[E0271]: type mismatch resolving `<() as Super>::Assoc == ()`
|
||||
|
|
||||
LL | fn test() -> impl Test {
|
||||
| ^^^^^^^^^ type mismatch resolving `<() as Super>::Assoc == ()`
|
||||
LL |
|
||||
LL | ()
|
||||
| -- return type was inferred to be `()` here
|
||||
|
|
||||
note: expected this to be `()`
|
||||
--> $DIR/projection-mismatch-in-impl-where-clause.rs:6:18
|
||||
|
@ -5,7 +5,7 @@ LL | x[0i32];
|
||||
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32`
|
||||
= help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `i32`
|
||||
= note: required for `Vec<{integer}>` to implement `Index<i32>`
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | [0][0u8];
|
||||
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`
|
||||
= help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `u8`
|
||||
= note: required for `[{integer}]` to implement `Index<u8>`
|
||||
= note: 1 redundant requirement hidden
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `String: Borrow<&str>` is not satisfied
|
||||
LL | &s
|
||||
| ^^ the trait `Borrow<&str>` is not implemented for `String`
|
||||
|
|
||||
= help: the trait `Borrow<str>` is implemented for `String`
|
||||
= help: the trait `Borrow<&_>` is not implemented for `String`
|
||||
but trait `Borrow<_>` is implemented for it
|
||||
= help: for that trait implementation, expected `str`, found `&str`
|
||||
= note: required for `HashMap<String, String>` to implement `Index<&&str>`
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | v[3u8];
|
||||
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[isize]>` is not implemented for `u8`
|
||||
= help: the trait `SliceIndex<[isize]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `u8`
|
||||
= note: required for `Vec<isize>` to implement `Index<u8>`
|
||||
|
||||
@ -16,7 +16,7 @@ LL | v[3i8];
|
||||
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[isize]>` is not implemented for `i8`
|
||||
= help: the trait `SliceIndex<[isize]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `i8`
|
||||
= note: required for `Vec<isize>` to implement `Index<i8>`
|
||||
|
||||
@ -27,7 +27,7 @@ LL | v[3u32];
|
||||
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[isize]>` is not implemented for `u32`
|
||||
= help: the trait `SliceIndex<[isize]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `u32`
|
||||
= note: required for `Vec<isize>` to implement `Index<u32>`
|
||||
|
||||
@ -38,7 +38,7 @@ LL | v[3i32];
|
||||
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[isize]>` is not implemented for `i32`
|
||||
= help: the trait `SliceIndex<[isize]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `i32`
|
||||
= note: required for `Vec<isize>` to implement `Index<i32>`
|
||||
|
||||
@ -49,7 +49,7 @@ LL | s.as_bytes()[3u8];
|
||||
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[u8]>` is not implemented for `u8`
|
||||
= help: the trait `SliceIndex<[u8]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `u8`
|
||||
= note: required for `[u8]` to implement `Index<u8>`
|
||||
|
||||
@ -60,7 +60,7 @@ LL | s.as_bytes()[3i8];
|
||||
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[u8]>` is not implemented for `i8`
|
||||
= help: the trait `SliceIndex<[u8]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `i8`
|
||||
= note: required for `[u8]` to implement `Index<i8>`
|
||||
|
||||
@ -71,7 +71,7 @@ LL | s.as_bytes()[3u32];
|
||||
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[u8]>` is not implemented for `u32`
|
||||
= help: the trait `SliceIndex<[u8]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `u32`
|
||||
= note: required for `[u8]` to implement `Index<u32>`
|
||||
|
||||
@ -82,7 +82,7 @@ LL | s.as_bytes()[3i32];
|
||||
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[u8]>` is not implemented for `i32`
|
||||
= help: the trait `SliceIndex<[u8]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `i32`
|
||||
= note: required for `[u8]` to implement `Index<i32>`
|
||||
|
||||
|
@ -18,7 +18,7 @@ LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece
|
||||
| ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||
|
|
||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
|
||||
= help: the trait `FromIterator<(u32, _, _)>` is implemented for `Vec<(u32, _, _)>`
|
||||
but trait `FromIterator<(u32, _, _)>` is implemented for it
|
||||
= help: for that trait implementation, expected `(u32, _, _)`, found `()`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/issue-34334.rs:5:43
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `Params: Plugin<i32>` is not satisfied
|
||||
LL | req.get_ref::<Params>();
|
||||
| ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params`
|
||||
|
|
||||
= help: the trait `Plugin<Foo>` is implemented for `Params`
|
||||
= help: the trait `Plugin<i32>` is not implemented for `Params`
|
||||
but trait `Plugin<Foo>` is implemented for it
|
||||
= help: for that trait implementation, expected `Foo`, found `i32`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -4,8 +4,8 @@ error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over e
|
||||
LL | let x2: Vec<f64> = x1.into_iter().collect();
|
||||
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
||||
|
|
||||
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
|
||||
= help: the trait `FromIterator<f64>` is implemented for `Vec<f64>`
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
= help: for that trait implementation, expected `f64`, found `&f64`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/issue-66923-show-error-for-correct-call.rs:8:27
|
||||
@ -25,8 +25,8 @@ LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
|
||||
= help: the trait `FromIterator<f64>` is implemented for `Vec<f64>`
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
= help: for that trait implementation, expected `f64`, found `&f64`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/issue-66923-show-error-for-correct-call.rs:12:17
|
||||
|
@ -6,8 +6,8 @@ LL | let i = i.map(|x| x.clone());
|
||||
LL | i.collect()
|
||||
| ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
|
||||
|
|
||||
= help: the trait `FromIterator<&X>` is not implemented for `Vec<X>`
|
||||
= help: the trait `FromIterator<X>` is implemented for `Vec<X>`
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<X>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
= help: for that trait implementation, expected `X`, found `&X`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain-fixable.rs:5:26
|
||||
@ -124,7 +124,7 @@ LL | let g: Vec<i32> = f.collect();
|
||||
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||
|
|
||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
||||
= help: the trait `FromIterator<i32>` is implemented for `Vec<i32>`
|
||||
but trait `FromIterator<i32>` is implemented for it
|
||||
= help: for that trait implementation, expected `i32`, found `()`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain-fixable.rs:32:15
|
||||
|
@ -6,8 +6,8 @@ LL | let i = i.map(|x| x.clone());
|
||||
LL | i.collect()
|
||||
| ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
|
||||
|
|
||||
= help: the trait `FromIterator<&X>` is not implemented for `Vec<X>`
|
||||
= help: the trait `FromIterator<X>` is implemented for `Vec<X>`
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<X>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
= help: for that trait implementation, expected `X`, found `&X`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain.rs:4:26
|
||||
@ -181,7 +181,7 @@ LL | let g: Vec<i32> = f.collect();
|
||||
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||
|
|
||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
||||
= help: the trait `FromIterator<i32>` is implemented for `Vec<i32>`
|
||||
but trait `FromIterator<i32>` is implemented for it
|
||||
= help: for that trait implementation, expected `i32`, found `()`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain.rs:44:15
|
||||
|
@ -3,6 +3,9 @@ error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied
|
||||
|
|
||||
LL | fn foo() -> impl Future<Item=(), Error=Box<dyn Error>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `Result<(), _>`
|
||||
LL |
|
||||
LL | Ok(())
|
||||
| ------ return type was inferred to be `Result<(), _>` here
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/lifetime-elision-return-type-trait.rs:1:1
|
||||
|
@ -3,6 +3,9 @@ error[E0271]: expected `foo` to be a fn item that returns `i32`, but it returns
|
||||
|
|
||||
LL | fn bar() -> impl Iterator<Item = i32> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `()`
|
||||
...
|
||||
LL | x.iter_mut().map(foo)
|
||||
| --------------------- return type was inferred to be `Map<std::slice::IterMut<'_, Vec<u8>>, for<'a> fn(&'a mut Vec<u8>) {foo}>` here
|
||||
|
|
||||
= note: required for `Map<std::slice::IterMut<'_, Vec<u8>>, for<'a> fn(&'a mut Vec<u8>) {foo}>` to implement `Iterator`
|
||||
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied
|
||||
LL | <E as From<_>>::from(never); // Should the inference fail?
|
||||
| ^ the trait `From<()>` is not implemented for `E`
|
||||
|
|
||||
= help: the trait `From<!>` is implemented for `E`
|
||||
= help: the trait `From<()>` is not implemented for `E`
|
||||
but trait `From<!>` is implemented for it
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
||||
|
|
||||
LL | fn should_ret_unit() -> impl T {
|
||||
| ^^^^^^ the trait `T` is not implemented for `()`
|
||||
LL |
|
||||
LL | panic!()
|
||||
| -------- return type was inferred to be `_` here
|
||||
|
|
||||
= help: the trait `T` is implemented for `i32`
|
||||
|
||||
@ -11,6 +14,9 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
||||
|
|
||||
LL | fn a() -> Foo {
|
||||
| ^^^ the trait `T` is not implemented for `()`
|
||||
LL |
|
||||
LL | panic!()
|
||||
| -------- return type was inferred to be `_` here
|
||||
|
|
||||
= help: the trait `T` is implemented for `i32`
|
||||
|
||||
|
@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
||||
|
|
||||
LL | fn a() -> Foo {
|
||||
| ^^^ the trait `T` is not implemented for `()`
|
||||
...
|
||||
LL | panic!()
|
||||
| -------- return type was inferred to be `_` here
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/impl_trait_fallback3.rs:5:1
|
||||
|
@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
||||
|
|
||||
LL | fn foo() -> impl T {
|
||||
| ^^^^^^ the trait `T` is not implemented for `()`
|
||||
LL |
|
||||
LL | panic!()
|
||||
| -------- return type was inferred to be `_` here
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/impl_trait_fallback4.rs:3:1
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied
|
||||
LL | <E as From<_>>::from(never);
|
||||
| ^ the trait `From<()>` is not implemented for `E`
|
||||
|
|
||||
= help: the trait `From<!>` is implemented for `E`
|
||||
= help: the trait `From<()>` is not implemented for `E`
|
||||
but trait `From<!>` is implemented for it
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -7,7 +7,7 @@ LL | Foo::<usize>::foo((1i32, 1i32, 1i32));
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Foo<usize>` is not implemented for `(i32, i32, i32)`
|
||||
= help: the trait `Foo<i32>` is implemented for `(i32, i32, i32)`
|
||||
but trait `Foo<i32>` is implemented for it
|
||||
= help: for that trait implementation, expected `i32`, found `usize`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -7,7 +7,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Index<u32>` is not implemented for `[i32]`
|
||||
= help: the trait `Index<usize>` is implemented for `[i32]`
|
||||
but trait `Index<usize>` is implemented for it
|
||||
= help: for that trait implementation, expected `usize`, found `u32`
|
||||
|
||||
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
|
||||
@ -17,7 +17,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice
|
||||
|
|
||||
= help: the trait `Index<u32>` is not implemented for `[i32]`
|
||||
= help: the trait `Index<usize>` is implemented for `[i32]`
|
||||
but trait `Index<usize>` is implemented for it
|
||||
= help: for that trait implementation, expected `usize`, found `u32`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -5,7 +5,7 @@ LL | x[1i32];
|
||||
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[i32]>` is not implemented for `i32`
|
||||
= help: the trait `SliceIndex<[i32]>` is implemented for `usize`
|
||||
but it is implemented for `usize`
|
||||
= help: for that trait implementation, expected `usize`, found `i32`
|
||||
= note: required for `[i32]` to implement `Index<i32>`
|
||||
|
||||
|
@ -4,10 +4,10 @@ error[E0277]: the type `str` cannot be indexed by `{integer}`
|
||||
LL | let _: u8 = s[4];
|
||||
| ^ string indices are ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
||||
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
||||
= help: the trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
but trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: for that trait implementation, expected `[_]`, found `str`
|
||||
= note: required for `str` to implement `Index<{integer}>`
|
||||
|
||||
@ -19,10 +19,10 @@ LL | let _ = s.get(4);
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
||||
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
||||
= help: the trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
but trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: for that trait implementation, expected `[_]`, found `str`
|
||||
note: required by a bound in `core::str::<impl str>::get`
|
||||
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
||||
@ -35,10 +35,10 @@ LL | let _ = s.get_unchecked(4);
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
||||
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
||||
= help: the trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
but trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: for that trait implementation, expected `[_]`, found `str`
|
||||
note: required by a bound in `core::str::<impl str>::get_unchecked`
|
||||
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
||||
|
@ -31,7 +31,7 @@ LL | s[1usize] = bot();
|
||||
| ^^^^^^ string indices are ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `usize`
|
||||
= help: the trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
but trait `SliceIndex<[_]>` is implemented for it
|
||||
= help: for that trait implementation, expected `[_]`, found `str`
|
||||
= note: required for `str` to implement `Index<usize>`
|
||||
|
||||
@ -43,10 +43,10 @@ LL | s.get_mut(1);
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
||||
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
||||
= help: the trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
but trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: for that trait implementation, expected `[_]`, found `str`
|
||||
note: required by a bound in `core::str::<impl str>::get_mut`
|
||||
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
||||
@ -59,10 +59,10 @@ LL | s.get_unchecked_mut(1);
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
= note: you can use `.chars().nth()` or `.bytes().nth()`
|
||||
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
|
||||
= help: the trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
|
||||
but trait `SliceIndex<[_]>` is implemented for `usize`
|
||||
= help: for that trait implementation, expected `[_]`, found `str`
|
||||
note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
|
||||
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
||||
|
@ -20,10 +20,11 @@ error[E0277]: the trait bound `{closure@$DIR/fn-ctor-passed-as-arg-where-it-shou
|
||||
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9
|
||||
|
|
||||
LL | bar(closure);
|
||||
| --- ^^^^^^^ the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}`
|
||||
| --- ^^^^^^^ unsatisfied trait bound
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}`
|
||||
note: required by a bound in `bar`
|
||||
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16
|
||||
|
|
||||
|
@ -7,7 +7,8 @@ LL | Trait::do_stuff({ fun(&mut *inner) });
|
||||
| | the trait `Trait<'_>` is not implemented for `*mut ()`
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Trait<'_>` is implemented for `()`
|
||||
= help: the trait `Trait<'_>` is not implemented for `*mut ()`
|
||||
but it is implemented for `()`
|
||||
= help: for that trait implementation, expected `()`, found `*mut ()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Checks that certain traits for which we don't want to suggest borrowing
|
||||
// are blacklisted and don't cause the suggestion to be issued.
|
||||
//@compile-flags: --diagnostic-width=300
|
||||
|
||||
#![feature(coroutines)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `String: Copy` is not satisfied
|
||||
--> $DIR/issue-84973-blacklist.rs:15:12
|
||||
--> $DIR/issue-84973-blacklist.rs:16:12
|
||||
|
|
||||
LL | f_copy("".to_string());
|
||||
| ------ ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
||||
@ -7,7 +7,7 @@ LL | f_copy("".to_string());
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `f_copy`
|
||||
--> $DIR/issue-84973-blacklist.rs:6:14
|
||||
--> $DIR/issue-84973-blacklist.rs:7:14
|
||||
|
|
||||
LL | fn f_copy<T: Copy>(t: T) {}
|
||||
| ^^^^ required by this bound in `f_copy`
|
||||
@ -18,7 +18,7 @@ LL + f_copy("");
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `S: Clone` is not satisfied
|
||||
--> $DIR/issue-84973-blacklist.rs:16:13
|
||||
--> $DIR/issue-84973-blacklist.rs:17:13
|
||||
|
|
||||
LL | f_clone(S);
|
||||
| ------- ^ the trait `Clone` is not implemented for `S`
|
||||
@ -26,7 +26,7 @@ LL | f_clone(S);
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `f_clone`
|
||||
--> $DIR/issue-84973-blacklist.rs:7:15
|
||||
--> $DIR/issue-84973-blacklist.rs:8:15
|
||||
|
|
||||
LL | fn f_clone<T: Clone>(t: T) {}
|
||||
| ^^^^^ required by this bound in `f_clone`
|
||||
@ -36,24 +36,24 @@ LL + #[derive(Clone)]
|
||||
LL | struct S;
|
||||
|
|
||||
|
||||
error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:17:26: 17:35}` cannot be unpinned
|
||||
--> $DIR/issue-84973-blacklist.rs:17:26
|
||||
error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:18:26: 18:35}` cannot be unpinned
|
||||
--> $DIR/issue-84973-blacklist.rs:18:26
|
||||
|
|
||||
LL | f_unpin(#[coroutine] static || { yield; });
|
||||
| ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:17:26: 17:35}`
|
||||
| ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:18:26: 18:35}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: consider using the `pin!` macro
|
||||
consider using `Box::pin` if you need to access the pinned value outside of the current scope
|
||||
note: required by a bound in `f_unpin`
|
||||
--> $DIR/issue-84973-blacklist.rs:8:15
|
||||
--> $DIR/issue-84973-blacklist.rs:9:15
|
||||
|
|
||||
LL | fn f_unpin<T: Unpin>(t: T) {}
|
||||
| ^^^^^ required by this bound in `f_unpin`
|
||||
|
||||
error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilation time
|
||||
--> $DIR/issue-84973-blacklist.rs:22:13
|
||||
--> $DIR/issue-84973-blacklist.rs:23:13
|
||||
|
|
||||
LL | f_sized(*ref_cl);
|
||||
| ------- ^^^^^^^ doesn't have a size known at compile-time
|
||||
@ -62,7 +62,7 @@ LL | f_sized(*ref_cl);
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `dyn Fn()`
|
||||
note: required by a bound in `f_sized`
|
||||
--> $DIR/issue-84973-blacklist.rs:9:15
|
||||
--> $DIR/issue-84973-blacklist.rs:10:15
|
||||
|
|
||||
LL | fn f_sized<T: Sized>(t: T) {}
|
||||
| ^^^^^ required by this bound in `f_sized`
|
||||
@ -73,7 +73,7 @@ LL + f_sized(ref_cl);
|
||||
|
|
||||
|
||||
error[E0277]: `Rc<{integer}>` cannot be sent between threads safely
|
||||
--> $DIR/issue-84973-blacklist.rs:27:12
|
||||
--> $DIR/issue-84973-blacklist.rs:28:12
|
||||
|
|
||||
LL | f_send(rc);
|
||||
| ------ ^^ `Rc<{integer}>` cannot be sent between threads safely
|
||||
@ -82,7 +82,7 @@ LL | f_send(rc);
|
||||
|
|
||||
= help: the trait `Send` is not implemented for `Rc<{integer}>`
|
||||
note: required by a bound in `f_send`
|
||||
--> $DIR/issue-84973-blacklist.rs:10:14
|
||||
--> $DIR/issue-84973-blacklist.rs:11:14
|
||||
|
|
||||
LL | fn f_send<T: Send>(t: T) {}
|
||||
| ^^^^ required by this bound in `f_send`
|
||||
|
@ -4,8 +4,8 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `&usize`
|
||||
LL | let one_item_please: i32 = [1, 2, 3][i];
|
||||
| ^ slice indices are of type `usize` or ranges of `usize`
|
||||
|
|
||||
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `&usize`
|
||||
= help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
|
||||
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `&_`
|
||||
but it is implemented for `_`
|
||||
= help: for that trait implementation, expected `usize`, found `&usize`
|
||||
= note: required for `[{integer}]` to implement `Index<&usize>`
|
||||
= note: 1 redundant requirement hidden
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `Struct: Trait<isize>` is not satisfied
|
||||
LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct`
|
||||
|
|
||||
= help: the trait `Trait<&'static str>` is implemented for `Struct`
|
||||
= help: the trait `Trait<isize>` is not implemented for `Struct`
|
||||
but trait `Trait<&'static str>` is implemented for it
|
||||
= help: for that trait implementation, expected `&'static str`, found `isize`
|
||||
= note: required for the cast from `Box<Struct>` to `Box<dyn Trait<isize>>`
|
||||
|
||||
|
@ -20,10 +20,11 @@ error[E0277]: the trait bound `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:
|
||||
--> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11
|
||||
|
|
||||
LL | takes(|_: Argument| -> Return { todo!() });
|
||||
| ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`
|
||||
| ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`
|
||||
= help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return`
|
||||
note: required by a bound in `takes`
|
||||
--> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:18
|
||||
|
@ -6,12 +6,6 @@ LL | fn hello() -> impl !Foo {
|
||||
LL |
|
||||
LL | NotFoo
|
||||
| ------ return type was inferred to be `NotFoo` here
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/on-unimplemented.rs:4:1
|
||||
|
|
||||
LL | trait Foo {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -28,17 +28,11 @@ error[E0277]: the trait bound `Copyable: !Copy` is not satisfied
|
||||
LL | not_copy::<Copyable>();
|
||||
| ^^^^^^^^ the trait bound `Copyable: !Copy` is not satisfied
|
||||
|
|
||||
= help: the trait `Copy` is implemented for `Copyable`
|
||||
note: required by a bound in `not_copy`
|
||||
--> $DIR/simple.rs:3:16
|
||||
|
|
||||
LL | fn not_copy<T: !Copy>() {}
|
||||
| ^^^^^ required by this bound in `not_copy`
|
||||
help: consider annotating `Copyable` with `#[derive(Copy)]`
|
||||
|
|
||||
LL + #[derive(Copy)]
|
||||
LL | struct Copyable;
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotNecessarilyCopyable: !Copy` is not satisfied
|
||||
--> $DIR/simple.rs:37:16
|
||||
@ -51,11 +45,6 @@ note: required by a bound in `not_copy`
|
||||
|
|
||||
LL | fn not_copy<T: !Copy>() {}
|
||||
| ^^^^^ required by this bound in `not_copy`
|
||||
help: consider annotating `NotNecessarilyCopyable` with `#[derive(Copy)]`
|
||||
|
|
||||
LL + #[derive(Copy)]
|
||||
LL | struct NotNecessarilyCopyable;
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ compile-flags: -Znext-solver --diagnostic-width=300
|
||||
//@ edition: 2021
|
||||
//@ revisions: pass fail
|
||||
//@[pass] check-pass
|
||||
|
@ -2,8 +2,9 @@ error[E0277]: the trait bound `<T as A>::AssocA: TransmuteFrom<(), Assume { alig
|
||||
--> $DIR/assoc-bound.rs:16:19
|
||||
|
|
||||
LL | type AssocB = T::AssocA;
|
||||
| ^^^^^^^^^ the trait `TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `<T as A>::AssocA`
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `<T as A>::AssocA`
|
||||
note: required by a bound in `B::AssocB`
|
||||
--> $DIR/assoc-bound.rs:9:18
|
||||
|
|
||||
|
@ -7,7 +7,8 @@ LL | Err("")?;
|
||||
| this can't be annotated with `?` because it has type `Result<_, &str>`
|
||||
|
|
||||
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
|
||||
= help: the trait `From<Infallible>` is implemented for `TryFromSliceError`
|
||||
= help: the trait `From<&str>` is not implemented for `TryFromSliceError`
|
||||
but trait `From<Infallible>` is implemented for it
|
||||
= help: for that trait implementation, expected `Infallible`, found `&str`
|
||||
= note: required for `Result<u32, TryFromSliceError>` to implement `FromResidual<Result<Infallible, &str>>`
|
||||
|
||||
|
@ -67,7 +67,7 @@ LL | ControlFlow::Continue(Err("hello")?)
|
||||
| ^ this `?` produces `Result<Infallible, &str>`, which is incompatible with `ControlFlow<String>`
|
||||
|
|
||||
= help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>`
|
||||
= help: the trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for `ControlFlow<String>`
|
||||
but trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for it
|
||||
= help: for that trait implementation, expected `ControlFlow<String, Infallible>`, found `Result<Infallible, &str>`
|
||||
|
||||
error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
|
||||
@ -79,7 +79,7 @@ LL | Some(3)?;
|
||||
| ^ this `?` produces `Option<Infallible>`, which is incompatible with `ControlFlow<u64>`
|
||||
|
|
||||
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>`
|
||||
= help: the trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for `ControlFlow<u64>`
|
||||
but trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for it
|
||||
= help: for that trait implementation, expected `ControlFlow<u64, Infallible>`, found `Option<Infallible>`
|
||||
|
||||
error[E0277]: the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s (with the same Break type)
|
||||
@ -90,9 +90,9 @@ LL | fn control_flow_to_control_flow() -> ControlFlow<i64> {
|
||||
LL | ControlFlow::Break(4_u8)?;
|
||||
| ^ this `?` produces `ControlFlow<u8, Infallible>`, which is incompatible with `ControlFlow<i64>`
|
||||
|
|
||||
= help: the trait `FromResidual<ControlFlow<u8, Infallible>>` is not implemented for `ControlFlow<i64>`
|
||||
= note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow`
|
||||
= help: the trait `FromResidual<ControlFlow<i64, Infallible>>` is implemented for `ControlFlow<i64>`
|
||||
= help: the trait `FromResidual<ControlFlow<u8, _>>` is not implemented for `ControlFlow<i64>`
|
||||
but trait `FromResidual<ControlFlow<i64, _>>` is implemented for it
|
||||
= help: for that trait implementation, expected `i64`, found `u8`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
|
||||
LL | let x = <Foo as Trait<Bar>>::Assoc::default();
|
||||
| ^^^ the trait `Trait<Bar>` is not implemented for `Foo`
|
||||
|
|
||||
= help: the trait `Trait<()>` is implemented for `Foo`
|
||||
= help: the trait `Trait<Bar>` is not implemented for `Foo`
|
||||
but trait `Trait<()>` is implemented for it
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -4,7 +4,10 @@ error[E0283]: type annotations needed
|
||||
LL | fn unconstrained_foo() -> Wrapper<Foo> {
|
||||
| ------------ type must be known at this point
|
||||
LL | Wrapper::Second
|
||||
| ^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the enum `Wrapper`
|
||||
| ^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| cannot infer type of the type parameter `T` declared on the enum `Wrapper`
|
||||
| return type was inferred to be `Wrapper<_>` here
|
||||
|
|
||||
= note: cannot satisfy `_: Copy`
|
||||
help: consider specifying the generic argument
|
||||
|
@ -7,7 +7,8 @@ LL | fn foo() -> impl Foo<FooX> {
|
||||
LL | ()
|
||||
| -- return type was inferred to be `()` here
|
||||
|
|
||||
= help: the trait `Foo<()>` is implemented for `()`
|
||||
= help: the trait `Foo<FooX>` is not implemented for `()`
|
||||
but trait `Foo<()>` is implemented for it
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -17,6 +17,9 @@ error[E0277]: the trait bound `{integer}: Trait<()>` is not satisfied
|
||||
|
|
||||
LL | fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<()>` is not implemented for `{integer}`
|
||||
...
|
||||
LL | 16
|
||||
| -- return type was inferred to be `{integer}` here
|
||||
|
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/non-lifetime-binder-in-constraint.rs:4:1
|
||||
|
@ -7,7 +7,7 @@ LL | 42_i32
|
||||
| ------ return type was inferred to be `i32` here
|
||||
|
|
||||
= help: the trait `PartialEq<Foo>` is not implemented for `i32`
|
||||
= help: the trait `PartialEq` is implemented for `i32`
|
||||
but trait `PartialEq<i32>` is implemented for it
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -4,7 +4,8 @@ error[E0277]: the trait bound `((),): Into<Bar>` is not satisfied
|
||||
LL | let _: Bar = ((),).into();
|
||||
| ^^^^ the trait `Foo<'_>` is not implemented for `((),)`
|
||||
|
|
||||
= help: the trait `Foo<'_>` is implemented for `()`
|
||||
= help: the trait `Foo<'_>` is not implemented for `((),)`
|
||||
but it is implemented for `()`
|
||||
= help: for that trait implementation, expected `()`, found `((),)`
|
||||
note: required for `Bar` to implement `From<((),)>`
|
||||
--> $DIR/suggest-similar-impls-for-root-obligation.rs:7:22
|
||||
|
@ -2,8 +2,9 @@ error[E0277]: the trait bound `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_t
|
||||
--> $DIR/higher-ranked-fn-type.rs:20:5
|
||||
|
|
||||
LL | called()
|
||||
| ^^^^^^^^ the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ())`
|
||||
| ^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ())`
|
||||
help: this trait has no implementations, consider adding one
|
||||
--> $DIR/higher-ranked-fn-type.rs:6:1
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user