summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-11 23:05:58 +0000
committerbors <bors@rust-lang.org>2023-01-11 23:05:58 +0000
commit56ee65aeb6d1fad67d903d5ee1359abcf7b94231 (patch)
tree2ddda23b3e396ddddfa76f9f282647e3233e0898
parent1e4f90061cc4bc566f99ab21b1f101182b10cf0c (diff)
parent106df9ec98012c6fbeb0ffe636f5f566333cfaa1 (diff)
downloadrust-56ee65aeb6d1fad67d903d5ee1359abcf7b94231.tar.gz
Auto merge of #106743 - matthiaskrgr:rollup-q5dpxms, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #106620 (Detect struct literal needing parentheses) - #106622 (Detect out of bounds range pattern value) - #106703 (Note predicate span on `ImplDerivedObligation`) - #106705 (Report fulfillment errors in new trait solver) - #106726 (Fix some typos in code comments.) - #106734 (Deny having src/test exisiting in tidy) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs18
-rw-r--r--compiler/rustc_error_messages/locales/en-US/mir_build.ftl4
-rw-r--r--compiler/rustc_error_messages/locales/en-US/parse.ftl4
-rw-r--r--compiler/rustc_mir_build/src/errors.rs10
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/mod.rs68
-rw-r--r--compiler/rustc_parse/src/errors.rs18
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs37
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs2
-rw-r--r--compiler/rustc_parse/src/parser/item.rs3
-rw-r--r--compiler/rustc_parse/src/parser/stmt.rs11
-rw-r--r--compiler/rustc_trait_selection/src/solve/fulfill.rs36
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs28
-rw-r--r--src/tools/tidy/src/lib.rs1
-rw-r--r--src/tools/tidy/src/main.rs1
-rw-r--r--src/tools/tidy/src/tests_placement.rs15
-rw-r--r--tests/ui/associated-types/hr-associated-type-bound-2.stderr3
-rw-r--r--tests/ui/associated-types/impl-wf-cycle-1.stderr3
-rw-r--r--tests/ui/associated-types/impl-wf-cycle-2.stderr3
-rw-r--r--tests/ui/associated-types/issue-44153.stderr2
-rw-r--r--tests/ui/associated-types/issue-65774-1.stderr4
-rw-r--r--tests/ui/associated-types/substs-ppaux.normal.stderr4
-rw-r--r--tests/ui/associated-types/substs-ppaux.verbose.stderr4
-rw-r--r--tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr4
-rw-r--r--tests/ui/block-result/issue-22645.stderr4
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-85848.stderr10
-rw-r--r--tests/ui/consts/const-blocks/trait-error.stderr2
-rw-r--r--tests/ui/derives/deriving-copyclone.stderr6
-rw-r--r--tests/ui/error-codes/E0275.stderr2
-rw-r--r--tests/ui/generic-associated-types/impl_bounds.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-101020.stderr2
-rw-r--r--tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr3
-rw-r--r--tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr12
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.stderr4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.stderr4
-rw-r--r--tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr2
-rw-r--r--tests/ui/inference/issue-80816.rs1
-rw-r--r--tests/ui/inference/issue-80816.stderr8
-rw-r--r--tests/ui/issues/issue-20413.stderr10
-rw-r--r--tests/ui/issues/issue-22872.stderr3
-rw-r--r--tests/ui/issues/issue-23122-2.stderr4
-rw-r--r--tests/ui/issues/issue-38821.stderr4
-rw-r--r--tests/ui/issues/issue-39970.stderr3
-rw-r--r--tests/ui/kindck/kindck-impl-type-params-2.stderr4
-rw-r--r--tests/ui/kindck/kindck-impl-type-params.stderr24
-rw-r--r--tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr4
-rw-r--r--tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr4
-rw-r--r--tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs13
-rw-r--r--tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr13
-rw-r--r--tests/ui/phantom-auto-trait.stderr4
-rw-r--r--tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr2
-rw-r--r--tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs13
-rw-r--r--tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr26
-rw-r--r--tests/ui/rfc-2397-do-not-recommend/feature-gate-do_not_recommend.stderr4
-rw-r--r--tests/ui/rfc-2632-const-trait-impl/specializing-constness-2.stderr4
-rw-r--r--tests/ui/specialization/issue-38091-2.stderr3
-rw-r--r--tests/ui/specialization/issue-39448.stderr7
-rw-r--r--tests/ui/suggestions/derive-clone-for-eq.stderr4
-rw-r--r--tests/ui/suggestions/derive-macro-missing-bounds.stderr10
-rw-r--r--tests/ui/suggestions/issue-96223.stderr5
-rw-r--r--tests/ui/traits/cycle-cache-err-60010.stderr6
-rw-r--r--tests/ui/traits/inductive-overflow/lifetime.rs1
-rw-r--r--tests/ui/traits/inductive-overflow/lifetime.stderr8
-rw-r--r--tests/ui/traits/inductive-overflow/simultaneous.stderr4
-rw-r--r--tests/ui/traits/inductive-overflow/supertrait.stderr4
-rw-r--r--tests/ui/traits/issue-18400.stderr4
-rw-r--r--tests/ui/traits/issue-91594.stderr4
-rw-r--r--tests/ui/traits/negative-impls/negated-auto-traits-error.stderr4
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr3
-rw-r--r--tests/ui/type-alias-impl-trait/issue-90400-2.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/underconstrained_generic.stderr4
70 files changed, 452 insertions, 109 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index 7aadcdd2228..25dc88c535d 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -1098,7 +1098,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
// There are a few environmental pre-conditions that shape how the system
// is set up:
//
- // - Error reporting only can happen on the main thread because that's the
+ // - Error reporting can only happen on the main thread because that's the
// only place where we have access to the compiler `Session`.
// - LLVM work can be done on any thread.
// - Codegen can only happen on the main thread.
@@ -1110,16 +1110,16 @@ fn start_executing_work<B: ExtraBackendMethods>(
// Error Reporting
// ===============
// The error reporting restriction is handled separately from the rest: We
- // set up a `SharedEmitter` the holds an open channel to the main thread.
+ // set up a `SharedEmitter` that holds an open channel to the main thread.
// When an error occurs on any thread, the shared emitter will send the
// error message to the receiver main thread (`SharedEmitterMain`). The
// main thread will periodically query this error message queue and emit
// any error messages it has received. It might even abort compilation if
- // has received a fatal error. In this case we rely on all other threads
+ // it has received a fatal error. In this case we rely on all other threads
// being torn down automatically with the main thread.
// Since the main thread will often be busy doing codegen work, error
// reporting will be somewhat delayed, since the message queue can only be
- // checked in between to work packages.
+ // checked in between two work packages.
//
// Work Processing Infrastructure
// ==============================
@@ -1133,7 +1133,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
// thread about what work to do when, and it will spawn off LLVM worker
// threads as open LLVM WorkItems become available.
//
- // The job of the main thread is to codegen CGUs into LLVM work package
+ // The job of the main thread is to codegen CGUs into LLVM work packages
// (since the main thread is the only thread that can do this). The main
// thread will block until it receives a message from the coordinator, upon
// which it will codegen one CGU, send it to the coordinator and block
@@ -1142,10 +1142,10 @@ fn start_executing_work<B: ExtraBackendMethods>(
//
// The coordinator keeps a queue of LLVM WorkItems, and when a `Token` is
// available, it will spawn off a new LLVM worker thread and let it process
- // that a WorkItem. When a LLVM worker thread is done with its WorkItem,
+ // a WorkItem. When a LLVM worker thread is done with its WorkItem,
// it will just shut down, which also frees all resources associated with
// the given LLVM module, and sends a message to the coordinator that the
- // has been completed.
+ // WorkItem has been completed.
//
// Work Scheduling
// ===============
@@ -1165,7 +1165,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
//
// Doing LLVM Work on the Main Thread
// ----------------------------------
- // Since the main thread owns the compiler processes implicit `Token`, it is
+ // Since the main thread owns the compiler process's implicit `Token`, it is
// wasteful to keep it blocked without doing any work. Therefore, what we do
// in this case is: We spawn off an additional LLVM worker thread that helps
// reduce the queue. The work it is doing corresponds to the implicit
@@ -1216,7 +1216,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
// ------------------------------
//
// The final job the coordinator thread is responsible for is managing LTO
- // and how that works. When LTO is requested what we'll to is collect all
+ // and how that works. When LTO is requested what we'll do is collect all
// optimized LLVM modules into a local vector on the coordinator. Once all
// modules have been codegened and optimized we hand this to the `lto`
// module for further optimization. The `lto` module will return back a list
diff --git a/compiler/rustc_error_messages/locales/en-US/mir_build.ftl b/compiler/rustc_error_messages/locales/en-US/mir_build.ftl
index 60d3d3e69ab..aacaafeede6 100644
--- a/compiler/rustc_error_messages/locales/en-US/mir_build.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/mir_build.ftl
@@ -206,6 +206,10 @@ mir_build_lower_range_bound_must_be_less_than_or_equal_to_upper =
.label = lower bound larger than upper bound
.teach_note = When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
+mir_build_literal_in_range_out_of_bounds =
+ literal out of range for `{$ty}`
+ .label = this value doesn't fit in `{$ty}` whose maximum value is `{$max}`
+
mir_build_lower_range_bound_must_be_less_than_upper = lower range bound must be less than upper
mir_build_leading_irrefutable_let_patterns = leading irrefutable {$count ->
diff --git a/compiler/rustc_error_messages/locales/en-US/parse.ftl b/compiler/rustc_error_messages/locales/en-US/parse.ftl
index 3401978caf5..f3f00fff230 100644
--- a/compiler/rustc_error_messages/locales/en-US/parse.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/parse.ftl
@@ -2,6 +2,10 @@ parse_struct_literal_body_without_path =
struct literal body without path
.suggestion = you might have forgotten to add the struct literal inside the block
+parse_struct_literal_needing_parens =
+ invalid struct literal
+ .suggestion = you might need to surround the struct literal in parentheses
+
parse_maybe_report_ambiguous_plus =
ambiguous `+` in a type
.suggestion = use parentheses to disambiguate
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index 68179001b91..233eecbd5b4 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -494,6 +494,16 @@ pub struct LowerRangeBoundMustBeLessThanOrEqualToUpper {
}
#[derive(Diagnostic)]
+#[diag(mir_build_literal_in_range_out_of_bounds)]
+pub struct LiteralOutOfRange<'tcx> {
+ #[primary_span]
+ #[label]
+ pub span: Span,
+ pub ty: Ty<'tcx>,
+ pub max: u128,
+}
+
+#[derive(Diagnostic)]
#[diag(mir_build_lower_range_bound_must_be_less_than_upper, code = "E0579")]
pub struct LowerRangeBoundMustBeLessThanUpper {
#[primary_span]
diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
index 2c775b39718..7d4353c5292 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
@@ -129,10 +129,20 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
hi: mir::ConstantKind<'tcx>,
end: RangeEnd,
span: Span,
+ lo_expr: Option<&hir::Expr<'tcx>>,
+ hi_expr: Option<&hir::Expr<'tcx>>,
) -> PatKind<'tcx> {
assert_eq!(lo.ty(), ty);
assert_eq!(hi.ty(), ty);
let cmp = compare_const_vals(self.tcx, lo, hi, self.param_env);
+ let max = || {
+ self.tcx
+ .layout_of(self.param_env.with_reveal_all_normalized(self.tcx).and(ty))
+ .ok()
+ .unwrap()
+ .size
+ .unsigned_int_max()
+ };
match (end, cmp) {
// `x..y` where `x < y`.
// Non-empty because the range includes at least `x`.
@@ -141,7 +151,27 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
}
// `x..y` where `x >= y`. The range is empty => error.
(RangeEnd::Excluded, _) => {
- self.tcx.sess.emit_err(LowerRangeBoundMustBeLessThanUpper { span });
+ let mut lower_overflow = false;
+ let mut higher_overflow = false;
+ if let Some(hir::Expr { kind: hir::ExprKind::Lit(lit), .. }) = lo_expr
+ && let rustc_ast::ast::LitKind::Int(val, _) = lit.node
+ {
+ if lo.eval_bits(self.tcx, self.param_env, ty) != val {
+ lower_overflow = true;
+ self.tcx.sess.emit_err(LiteralOutOfRange { span: lit.span, ty, max: max() });
+ }
+ }
+ if let Some(hir::Expr { kind: hir::ExprKind::Lit(lit), .. }) = hi_expr
+ && let rustc_ast::ast::LitKind::Int(val, _) = lit.node
+ {
+ if hi.eval_bits(self.tcx, self.param_env, ty) != val {
+ higher_overflow = true;
+ self.tcx.sess.emit_err(LiteralOutOfRange { span: lit.span, ty, max: max() });
+ }
+ }
+ if !lower_overflow && !higher_overflow {
+ self.tcx.sess.emit_err(LowerRangeBoundMustBeLessThanUpper { span });
+ }
PatKind::Wild
}
// `x..=y` where `x == y`.
@@ -152,10 +182,34 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
}
// `x..=y` where `x > y` hence the range is empty => error.
(RangeEnd::Included, _) => {
- self.tcx.sess.emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper {
- span,
- teach: if self.tcx.sess.teach(&error_code!(E0030)) { Some(()) } else { None },
- });
+ let mut lower_overflow = false;
+ let mut higher_overflow = false;
+ if let Some(hir::Expr { kind: hir::ExprKind::Lit(lit), .. }) = lo_expr
+ && let rustc_ast::ast::LitKind::Int(val, _) = lit.node
+ {
+ if lo.eval_bits(self.tcx, self.param_env, ty) != val {
+ lower_overflow = true;
+ self.tcx.sess.emit_err(LiteralOutOfRange { span: lit.span, ty, max: max() });
+ }
+ }
+ if let Some(hir::Expr { kind: hir::ExprKind::Lit(lit), .. }) = hi_expr
+ && let rustc_ast::ast::LitKind::Int(val, _) = lit.node
+ {
+ if hi.eval_bits(self.tcx, self.param_env, ty) != val {
+ higher_overflow = true;
+ self.tcx.sess.emit_err(LiteralOutOfRange { span: lit.span, ty, max: max() });
+ }
+ }
+ if !lower_overflow && !higher_overflow {
+ self.tcx.sess.emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper {
+ span,
+ teach: if self.tcx.sess.teach(&error_code!(E0030)) {
+ Some(())
+ } else {
+ None
+ },
+ });
+ }
PatKind::Wild
}
}
@@ -201,7 +255,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
let (lp, hp) = (lo.as_ref().map(|(x, _)| x), hi.as_ref().map(|(x, _)| x));
let mut kind = match self.normalize_range_pattern_ends(ty, lp, hp) {
- Some((lc, hc)) => self.lower_pattern_range(ty, lc, hc, end, lo_span),
+ Some((lc, hc)) => {
+ self.lower_pattern_range(ty, lc, hc, end, lo_span, lo_expr, hi_expr)
+ }
None => {
let msg = &format!(
"found bad range pattern `{:?}` outside of error recovery",
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs
index 574591529f3..19eeb069a25 100644
--- a/compiler/rustc_parse/src/errors.rs
+++ b/compiler/rustc_parse/src/errors.rs
@@ -971,6 +971,24 @@ pub(crate) struct StructLiteralBodyWithoutPathSugg {
}
#[derive(Diagnostic)]
+#[diag(parse_struct_literal_needing_parens)]
+pub(crate) struct StructLiteralNeedingParens {
+ #[primary_span]
+ pub span: Span,
+ #[subdiagnostic]
+ pub sugg: StructLiteralNeedingParensSugg,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(suggestion, applicability = "machine-applicable")]
+pub(crate) struct StructLiteralNeedingParensSugg {
+ #[suggestion_part(code = "(")]
+ pub before: Span,
+ #[suggestion_part(code = ")")]
+ pub after: Span,
+}
+
+#[derive(Diagnostic)]
#[diag(parse_unmatched_angle_brackets)]
pub(crate) struct UnmatchedAngleBrackets {
#[primary_span]
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index d9fa3e31db9..4c918c6702e 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -12,9 +12,10 @@ use crate::errors::{
IncorrectAwait, IncorrectSemicolon, IncorrectUseOfAwait, ParenthesesInForHead,
ParenthesesInForHeadSugg, PatternMethodParamWithoutBody, QuestionMarkInType,
QuestionMarkInTypeSugg, SelfParamNotFirst, StructLiteralBodyWithoutPath,
- StructLiteralBodyWithoutPathSugg, SuggEscapeToUseAsIdentifier, SuggRemoveComma,
- UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration,
- UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets, UseEqInstead,
+ StructLiteralBodyWithoutPathSugg, StructLiteralNeedingParens, StructLiteralNeedingParensSugg,
+ SuggEscapeToUseAsIdentifier, SuggRemoveComma, UnexpectedConstInGenericParam,
+ UnexpectedConstParamDeclaration, UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets,
+ UseEqInstead,
};
use crate::lexer::UnmatchedBrace;
@@ -623,12 +624,15 @@ impl<'a> Parser<'a> {
&mut self,
lo: Span,
s: BlockCheckMode,
+ maybe_struct_name: token::Token,
+ can_be_struct_literal: bool,
) -> Option<PResult<'a, P<Block>>> {
if self.token.is_ident() && self.look_ahead(1, |t| t == &token::Colon) {
// We might be having a struct literal where people forgot to include the path:
// fn foo() -> Foo {
// field: value,
// }
+ info!(?maybe_struct_name, ?self.token);
let mut snapshot = self.create_snapshot_for_diagnostic();
let path = Path {
segments: ThinVec::new(),
@@ -648,13 +652,6 @@ impl<'a> Parser<'a> {
// field: value,
// } }
err.delay_as_bug();
- self.sess.emit_err(StructLiteralBodyWithoutPath {
- span: expr.span,
- sugg: StructLiteralBodyWithoutPathSugg {
- before: expr.span.shrink_to_lo(),
- after: expr.span.shrink_to_hi(),
- },
- });
self.restore_snapshot(snapshot);
let mut tail = self.mk_block(
vec![self.mk_stmt_err(expr.span)],
@@ -662,7 +659,25 @@ impl<'a> Parser<'a> {
lo.to(self.prev_token.span),
);
tail.could_be_bare_literal = true;
- Ok(tail)
+ if maybe_struct_name.is_ident() && can_be_struct_literal {
+ // Account for `if Example { a: one(), }.is_pos() {}`.
+ Err(self.sess.create_err(StructLiteralNeedingParens {
+ span: maybe_struct_name.span.to(expr.span),
+ sugg: StructLiteralNeedingParensSugg {
+ before: maybe_struct_name.span.shrink_to_lo(),
+ after: expr.span.shrink_to_hi(),
+ },
+ }))
+ } else {
+ self.sess.emit_err(StructLiteralBodyWithoutPath {
+ span: expr.span,
+ sugg: StructLiteralBodyWithoutPathSugg {
+ before: expr.span.shrink_to_lo(),
+ after: expr.span.shrink_to_hi(),
+ },
+ });
+ Ok(tail)
+ }
}
(Err(err), Ok(tail)) => {
// We have a block tail that contains a somehow valid type ascription expr.
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 9f436783ced..f5093fb02a8 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2039,7 +2039,7 @@ impl<'a> Parser<'a> {
});
}
- let (attrs, blk) = self.parse_block_common(lo, blk_mode)?;
+ let (attrs, blk) = self.parse_block_common(lo, blk_mode, true)?;
Ok(self.mk_expr_with_attrs(blk.span, ExprKind::Block(blk, opt_label), attrs))
}
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index a958c294930..a251e3ded2f 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -2214,7 +2214,8 @@ impl<'a> Parser<'a> {
*sig_hi = self.prev_token.span;
(AttrVec::new(), None)
} else if self.check(&token::OpenDelim(Delimiter::Brace)) || self.token.is_whole_block() {
- self.parse_inner_attrs_and_block().map(|(attrs, body)| (attrs, Some(body)))?
+ self.parse_block_common(self.token.span, BlockCheckMode::Default, false)
+ .map(|(attrs, body)| (attrs, Some(body)))?
} else if self.token.kind == token::Eq {
// Recover `fn foo() = $expr;`.
self.bump(); // `=`
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs
index 0daae457d30..1e5c2834960 100644
--- a/compiler/rustc_parse/src/parser/stmt.rs
+++ b/compiler/rustc_parse/src/parser/stmt.rs
@@ -498,7 +498,7 @@ impl<'a> Parser<'a> {
/// Parses a block. Inner attributes are allowed.
pub(super) fn parse_inner_attrs_and_block(&mut self) -> PResult<'a, (AttrVec, P<Block>)> {
- self.parse_block_common(self.token.span, BlockCheckMode::Default)
+ self.parse_block_common(self.token.span, BlockCheckMode::Default, true)
}
/// Parses a block. Inner attributes are allowed.
@@ -506,16 +506,23 @@ impl<'a> Parser<'a> {
&mut self,
lo: Span,
blk_mode: BlockCheckMode,
+ can_be_struct_literal: bool,
) -> PResult<'a, (AttrVec, P<Block>)> {
maybe_whole!(self, NtBlock, |x| (AttrVec::new(), x));
+ let maybe_ident = self.prev_token.clone();
self.maybe_recover_unexpected_block_label();
if !self.eat(&token::OpenDelim(Delimiter::Brace)) {
return self.error_block_no_opening_brace();
}
let attrs = self.parse_inner_attributes()?;
- let tail = match self.maybe_suggest_struct_literal(lo, blk_mode) {
+ let tail = match self.maybe_suggest_struct_literal(
+ lo,
+ blk_mode,
+ maybe_ident,
+ can_be_struct_literal,
+ ) {
Some(tail) => tail?,
None => self.parse_block_tail(lo, blk_mode, AttemptLocalParseRecovery::Yes)?,
};
diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs
index 80115d78d88..c014d682a9a 100644
--- a/compiler/rustc_trait_selection/src/solve/fulfill.rs
+++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs
@@ -3,7 +3,10 @@ use std::mem;
use rustc_data_structures::fx::FxHashMap;
use rustc_infer::{
infer::InferCtxt,
- traits::{query::NoSolution, FulfillmentError, PredicateObligation, TraitEngine},
+ traits::{
+ query::NoSolution, FulfillmentError, FulfillmentErrorCode, PredicateObligation,
+ SelectionError, TraitEngine,
+ },
};
use rustc_middle::ty;
@@ -45,32 +48,43 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
return errors;
}
- if self.obligations.is_empty() {
- Vec::new()
- } else {
- unimplemented!("ambiguous obligations")
- }
+ self.obligations
+ .drain(..)
+ .map(|obligation| FulfillmentError {
+ obligation: obligation.clone(),
+ code: FulfillmentErrorCode::CodeSelectionError(SelectionError::Unimplemented),
+ root_obligation: obligation,
+ })
+ .collect()
}
fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>> {
- let errors = Vec::new();
+ let mut errors = Vec::new();
for i in 0.. {
if !infcx.tcx.recursion_limit().value_within_limit(i) {
unimplemented!("overflow")
}
let mut has_changed = false;
- for o in mem::take(&mut self.obligations) {
+ for obligation in mem::take(&mut self.obligations) {
let mut cx = EvalCtxt::new(infcx.tcx);
- let (changed, certainty) = match cx.evaluate_goal(infcx, o.clone().into()) {
+ let (changed, certainty) = match cx.evaluate_goal(infcx, obligation.clone().into())
+ {
Ok(result) => result,
- Err(NoSolution) => unimplemented!("error"),
+ Err(NoSolution) => {
+ errors.push(FulfillmentError {
+ obligation: obligation.clone(),
+ code: FulfillmentErrorCode::CodeAmbiguity,
+ root_obligation: obligation,
+ });
+ continue;
+ }
};
has_changed |= changed;
match certainty {
Certainty::Yes => {}
- Certainty::Maybe(_) => self.obligations.push(o),
+ Certainty::Maybe(_) => self.obligations.push(obligation),
}
}
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 43985495827..53769742c47 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -36,7 +36,7 @@ use rustc_middle::ty::{
TypeSuperFoldable, TypeVisitable, TypeckResults,
};
use rustc_span::symbol::{sym, Ident, Symbol};
-use rustc_span::{BytePos, DesugaringKind, ExpnKind, Span, DUMMY_SP};
+use rustc_span::{BytePos, DesugaringKind, ExpnKind, MacroKind, Span, DUMMY_SP};
use rustc_target::spec::abi;
use std::ops::Deref;
@@ -2949,7 +2949,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
// FIXME: we should do something else so that it works even on crate foreign
// auto traits.
is_auto_trait = matches!(is_auto, hir::IsAuto::Yes);
- err.span_note(ident.span, &msg)
+ err.span_note(ident.span, &msg);
}
Some(Node::Item(hir::Item {
kind: hir::ItemKind::Impl(hir::Impl { of_trait, self_ty, .. }),
@@ -2960,9 +2960,29 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
spans.push(trait_ref.path.span);
}
spans.push(self_ty.span);
- err.span_note(spans, &msg)
+ let mut spans: MultiSpan = spans.into();
+ if matches!(
+ self_ty.span.ctxt().outer_expn_data().kind,
+ ExpnKind::Macro(MacroKind::Derive, _)
+ ) || matches!(
+ of_trait.as_ref().map(|t| t.path.span.ctxt().outer_expn_data().kind),
+ Some(ExpnKind::Macro(MacroKind::Derive, _))
+ ) {
+ spans.push_span_label(
+ data.span,
+ "unsatisfied trait bound introduced in this `derive` macro",
+ );
+ } else if !data.span.is_dummy() && !data.span.overlaps(self_ty.span) {
+ spans.push_span_label(
+ data.span,
+ "unsatisfied trait bound introduced here",
+ );
+ }
+ err.span_note(spans, &msg);
+ }
+ _ => {
+ err.note(&msg);
}
- _ => err.note(&msg),
};
if let Some(file) = file {
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index 15c641d748c..1eb146989e4 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -64,6 +64,7 @@ pub mod pal;
pub mod primitive_docs;
pub mod style;
pub mod target_specific_tests;
+pub mod tests_placement;
pub mod ui_tests;
pub mod unit_tests;
pub mod unstable_book;
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index 2a4853b37be..79441cda64c 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -76,6 +76,7 @@ fn main() {
check!(extdeps, &root_path);
// Checks over tests.
+ check!(tests_placement, &root_path);
check!(debug_artifacts, &tests_path);
check!(ui_tests, &tests_path);
check!(mir_opt_tests, &tests_path, bless);
diff --git a/src/tools/tidy/src/tests_placement.rs b/src/tools/tidy/src/tests_placement.rs
new file mode 100644
index 00000000000..9d0057df8bc
--- /dev/null
+++ b/src/tools/tidy/src/tests_placement.rs
@@ -0,0 +1,15 @@
+use std::path::Path;
+
+const FORBIDDEN_PATH: &str = "src/test";
+const ALLOWED_PATH: &str = "tests";
+
+pub fn check(root_path: impl AsRef<Path>, bad: &mut bool) {
+ if root_path.as_ref().join(FORBIDDEN_PATH).exists() {
+ tidy_error!(
+ bad,
+ "Tests have been moved, please move them from {} to {}",
+ root_path.as_ref().join(FORBIDDEN_PATH).display(),
+ root_path.as_ref().join(ALLOWED_PATH).display()
+ )
+ }
+}
diff --git a/tests/ui/associated-types/hr-associated-type-bound-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-2.stderr
index a85edd7a08d..749986f09c6 100644
--- a/tests/ui/associated-types/hr-associated-type-bound-2.stderr
+++ b/tests/ui/associated-types/hr-associated-type-bound-2.stderr
@@ -10,6 +10,9 @@ note: required for `u32` to implement `for<'b> X<'b>`
|
LL | impl X<'_> for u32
| ^^^^^ ^^^
+LL | where
+LL | for<'b> <Self as X<'b>>::U: Clone,
+ | ----- unsatisfied trait bound introduced here
= note: 128 redundant requirements hidden
= note: required for `u32` to implement `for<'b> X<'b>`
diff --git a/tests/ui/associated-types/impl-wf-cycle-1.stderr b/tests/ui/associated-types/impl-wf-cycle-1.stderr
index 6661347e4f8..206060f1980 100644
--- a/tests/ui/associated-types/impl-wf-cycle-1.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-1.stderr
@@ -9,6 +9,9 @@ note: required for `(T,)` to implement `Grault`
|
LL | impl<T: Grault> Grault for (T,)
| ^^^^^^ ^^^^
+...
+LL | Self::A: Baz,
+ | --- unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `(T,)` to implement `Grault`
diff --git a/tests/ui/associated-types/impl-wf-cycle-2.stderr b/tests/ui/associated-types/impl-wf-cycle-2.stderr
index ec4ffe27c5f..771ba751e8c 100644
--- a/tests/ui/associated-types/impl-wf-cycle-2.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-2.stderr
@@ -9,6 +9,9 @@ note: required for `(T,)` to implement `Grault`
|
LL | impl<T: Grault> Grault for (T,)
| ^^^^^^ ^^^^
+...
+LL | Self::A: Copy,
+ | ---- unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/associated-types/issue-44153.stderr b/tests/ui/associated-types/issue-44153.stderr
index 9c92f19d8bf..8bddcd95568 100644
--- a/tests/ui/associated-types/issue-44153.stderr
+++ b/tests/ui/associated-types/issue-44153.stderr
@@ -14,6 +14,8 @@ note: required for `()` to implement `Visit`
|
LL | impl<'a> Visit for () where
| ^^^^^ ^^
+LL | (): Array<Element=&'a ()>,
+ | -------------- unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/associated-types/issue-65774-1.stderr b/tests/ui/associated-types/issue-65774-1.stderr
index 3b294d65d56..91b557555d5 100644
--- a/tests/ui/associated-types/issue-65774-1.stderr
+++ b/tests/ui/associated-types/issue-65774-1.stderr
@@ -22,7 +22,9 @@ note: required for `&mut T` to implement `MyDisplay`
--> $DIR/issue-65774-1.rs:5:24
|
LL | impl<'a, T: MyDisplay> MyDisplay for &'a mut T { }
- | ^^^^^^^^^ ^^^^^^^^^
+ | --------- ^^^^^^^^^ ^^^^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: required for the cast from `&mut T` to the object type `dyn MyDisplay`
error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-types/substs-ppaux.normal.stderr b/tests/ui/associated-types/substs-ppaux.normal.stderr
index 3f180cf4f1f..eadaa35b65e 100644
--- a/tests/ui/associated-types/substs-ppaux.normal.stderr
+++ b/tests/ui/associated-types/substs-ppaux.normal.stderr
@@ -81,7 +81,9 @@ note: required for `str` to implement `Foo<'_, '_, u8>`
--> $DIR/substs-ppaux.rs:11:17
|
LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
- | ^^^^^^^^^^^^^^ ^
+ | - ^^^^^^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
error: aborting due to 5 previous errors
diff --git a/tests/ui/associated-types/substs-ppaux.verbose.stderr b/tests/ui/associated-types/substs-ppaux.verbose.stderr
index 16dd29de2c5..2077543ce30 100644
--- a/tests/ui/associated-types/substs-ppaux.verbose.stderr
+++ b/tests/ui/associated-types/substs-ppaux.verbose.stderr
@@ -81,7 +81,9 @@ note: required for `str` to implement `Foo<'_#0r, '_#1r, u8>`
--> $DIR/substs-ppaux.rs:11:17
|
LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
- | ^^^^^^^^^^^^^^ ^
+ | - ^^^^^^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
error: aborting due to 5 previous errors
diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr
index ce7095664c1..9aae9013d1b 100644
--- a/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr
+++ b/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr
@@ -9,7 +9,9 @@ note: required for `&'static u32` to implement `Defaulted`
--> $DIR/typeck-default-trait-impl-precedence.rs:10:19
|
LL | impl<'a,T:Signed> Defaulted for &'a T { }
- | ^^^^^^^^^ ^^^^^
+ | ------ ^^^^^^^^^ ^^^^^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `is_defaulted`
--> $DIR/typeck-default-trait-impl-precedence.rs:12:19
|
diff --git a/tests/ui/block-result/issue-22645.stderr b/tests/ui/block-result/issue-22645.stderr
index 28debd60a99..24341c0f58a 100644
--- a/tests/ui/block-result/issue-22645.stderr
+++ b/tests/ui/block-result/issue-22645.stderr
@@ -9,7 +9,9 @@ note: required for `Bob` to implement `Add<{integer}>`
--> $DIR/issue-22645.rs:8:19
|
LL | impl<RHS: Scalar> Add <RHS> for Bob {
- | ^^^^^^^^^ ^^^
+ | ------ ^^^^^^^^^ ^^^
+ | |
+ | unsatisfied trait bound introduced here
error[E0308]: mismatched types
--> $DIR/issue-22645.rs:15:3
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
index 09bcb0860b7..e50ac671eca 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
@@ -11,12 +11,12 @@ note: required for `&C` to implement `Contains<(), true>`
--> $DIR/issue-85848.rs:21:12
|
LL | impl<T, U> Contains<T, { contains::<T, U>() }> for U where T: _Contains<U> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ ------------ unsatisfied trait bound introduced here
note: required for `&C` to implement `Delegates<()>`
--> $DIR/issue-85848.rs:12:12
|
LL | impl<T, U> Delegates<U> for T where T: Contains<U, true> {}
- | ^^^^^^^^^^^^ ^
+ | ^^^^^^^^^^^^ ^ ----------------- unsatisfied trait bound introduced here
note: required by a bound in `writes_to_specific_path`
--> $DIR/issue-85848.rs:30:31
|
@@ -36,12 +36,14 @@ note: required for `&C` to implement `Contains<(), true>`
--> $DIR/issue-85848.rs:21:12
|
LL | impl<T, U> Contains<T, { contains::<T, U>() }> for U where T: _Contains<U> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | ^^^^^^^^^^^^----------------------^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required for `&C` to implement `Delegates<()>`
--> $DIR/issue-85848.rs:12:12
|
LL | impl<T, U> Delegates<U> for T where T: Contains<U, true> {}
- | ^^^^^^^^^^^^ ^
+ | ^^^^^^^^^^^^ ^ ----------------- unsatisfied trait bound introduced here
note: required by a bound in `writes_to_specific_path`
--> $DIR/issue-85848.rs:30:31
|
diff --git a/tests/ui/consts/const-blocks/trait-error.stderr b/tests/ui/consts/const-blocks/trait-error.stderr
index b11dd4b8087..06fa4b0b1f3 100644
--- a/tests/ui/consts/const-blocks/trait-error.stderr
+++ b/tests/ui/consts/const-blocks/trait-error.stderr
@@ -8,7 +8,7 @@ note: required for `Foo<String>` to implement `Copy`
--> $DIR/trait-error.rs:1:10
|
LL | #[derive(Copy, Clone)]
- | ^^^^
+ | ^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
diff --git a/tests/ui/derives/deriving-copyclone.stderr b/tests/ui/derives/deriving-copyclone.stderr
index 80e2dd7fede..9c4ca01ff37 100644
--- a/tests/ui/derives/deriving-copyclone.stderr
+++ b/tests/ui/derives/deriving-copyclone.stderr
@@ -10,7 +10,7 @@ note: required for `B<C>` to implement `Copy`
--> $DIR/deriving-copyclone.rs:9:10
|
LL | #[derive(Copy, Clone)]
- | ^^^^
+ | ^^^^ unsatisfied trait bound introduced in this `derive` macro
note: required by a bound in `is_copy`
--> $DIR/deriving-copyclone.rs:18:15
|
@@ -34,7 +34,7 @@ note: required for `B<C>` to implement `Clone`
--> $DIR/deriving-copyclone.rs:9:16
|
LL | #[derive(Copy, Clone)]
- | ^^^^^
+ | ^^^^^ unsatisfied trait bound introduced in this `derive` macro
note: required by a bound in `is_clone`
--> $DIR/deriving-copyclone.rs:19:16
|
@@ -58,7 +58,7 @@ note: required for `B<D>` to implement `Copy`
--> $DIR/deriving-copyclone.rs:9:10
|
LL | #[derive(Copy, Clone)]
- | ^^^^
+ | ^^^^ unsatisfied trait bound introduced in this `derive` macro
note: required by a bound in `is_copy`
--> $DIR/deriving-copyclone.rs:18:15
|
diff --git a/tests/ui/error-codes/E0275.stderr b/tests/ui/error-codes/E0275.stderr
index 451a683ac8a..cf9a7f69bfb 100644
--- a/tests/ui/error-codes/E0275.stderr
+++ b/tests/ui/error-codes/E0275.stderr
@@ -9,7 +9,7 @@ note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<
--> $DIR/E0275.rs:6:9
|
LL | impl<T> Foo for T where Bar<T>: Foo {}
- | ^^^ ^
+ | ^^^ ^ --- unsatisfied trait bound introduced here
= note: the full type name has been written to '$TEST_BUILD_DIR/error-codes/E0275/E0275.long-type-hash.txt'
= note: 127 redundant requirements hidden
= note: required for `Bar<T>` to implement `Foo`
diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr
index 3456b345cc2..261070d1db4 100644
--- a/tests/ui/generic-associated-types/impl_bounds.stderr
+++ b/tests/ui/generic-associated-types/impl_bounds.stderr
@@ -31,7 +31,7 @@ note: required for `Fooy<T>` to implement `Copy`
--> $DIR/impl_bounds.rs:10:10
|
LL | #[derive(Copy, Clone)]
- | ^^^^
+ | ^^^^ unsatisfied trait bound introduced in this `derive` macro
note: the requirement `Fooy<T>: Copy` appears on the `impl`'s associated type `C` but not on the corresponding trait's associated type
--> $DIR/impl_bounds.rs:6:10
|
@@ -56,7 +56,7 @@ note: required for `Fooy<T>` to implement `Copy`
--> $DIR/impl_bounds.rs:10:10
|
LL | #[derive(Copy, Clone)]
- | ^^^^
+ | ^^^^ unsatisfied trait bound introduced in this `derive` macro
note: the requirement `Fooy<T>: Copy` appears on the `impl`'s method `d` but not on the corresponding trait's method
--> $DIR/impl_bounds.rs:7:8
|
diff --git a/tests/ui/generic-associated-types/issue-101020.stderr b/tests/ui/generic-associated-types/issue-101020.stderr
index 422ac548427..1f9273a8c4a 100644
--- a/tests/ui/generic-associated-types/issue-101020.stderr
+++ b/tests/ui/generic-associated-types/issue-101020.stderr
@@ -8,7 +8,7 @@ note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>`
--> $DIR/issue-101020.rs:27:20
|
LL | impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {}
- | ^^^^^^^^^^^^^^^^ ^
+ | ^^^^^^^^^^^^^^^^ ^ ------ unsatisfied trait bound introduced here
note: required by a bound in `LendingIterator::consume`
--> $DIR/issue-101020.rs:9:33
|
diff --git a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr
index fdd192f4313..381865db07d 100644
--- a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr
+++ b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr
@@ -49,6 +49,9 @@ note: required for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]>` to i
|
LL | impl<'a, A, T> T0<'a, A> for L<T>
| ^^^^^^^^^ ^^^^
+LL | where
+LL | T: FnMut(A) -> Unit3,
+ | ----- unsatisfied trait bound introduced here
note: required by a bound in `T1::m`
--> $DIR/issue-62203-hrtb-ice.rs:27:12
|
diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
index 14fe1803b73..62d0128fd85 100644
--- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
+++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
@@ -8,7 +8,9 @@ note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>
--> $DIR/issue-89118.rs:5:23
|
LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | --------- ^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `StackContext`
--> $DIR/issue-89118.rs:9:14
|
@@ -28,7 +30,9 @@ note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>
--> $DIR/issue-89118.rs:5:23
|
LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | --------- ^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `EthernetWorker`
--> $DIR/issue-89118.rs:28:14
|
@@ -48,7 +52,9 @@ note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>
--> $DIR/issue-89118.rs:5:23
|
LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | --------- ^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `StackContext`
--> $DIR/issue-89118.rs:9:14
|
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.stderr b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
index 348c737b0b1..b85bb5efd10 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
@@ -9,7 +9,9 @@ note: required for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7]` to i
--> $DIR/nested-return-type2-tait2.rs:14:31
|
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | ^^^^^ ^
+ | --- ^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.stderr b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
index 6ac67141557..19fd3c134ac 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
@@ -9,7 +9,9 @@ note: required for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7]` to i
--> $DIR/nested-return-type2-tait3.rs:14:31
|
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | ^^^^^ ^
+ | --- ^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr b/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr
index cf2998bbf40..a4ff510477a 100644
--- a/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr
+++ b/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr
@@ -13,7 +13,7 @@ note: required for `()` to implement `Test`
--> $DIR/projection-mismatch-in-impl-where-clause.rs:11:9
|
LL | impl<T> Test for T where T: Super<Assoc = ()> {}
- | ^^^^ ^
+ | ^^^^ ^ ---------- unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/inference/issue-80816.rs b/tests/ui/inference/issue-80816.rs
index ead320a4fe4..4d319b44987 100644
--- a/tests/ui/inference/issue-80816.rs
+++ b/tests/ui/inference/issue-80816.rs
@@ -30,6 +30,7 @@ pub trait Access<T> {
}
impl<T, A: Access<T>, P: Deref<Target = A>> Access<T> for P {
//~^ NOTE: required for `Arc<ArcSwapAny<Arc<usize>>>` to implement `Access<_>`
+ //~| NOTE unsatisfied trait bound introduced here
type Guard = A::Guard;
}
impl<T> Access<T> for ArcSwapAny<T> {
diff --git a/tests/ui/inference/issue-80816.stderr b/tests/ui/inference/issue-80816.stderr
index bd833340df4..80c0c8abec6 100644
--- a/tests/ui/inference/issue-80816.stderr
+++ b/tests/ui/inference/issue-80816.stderr
@@ -1,11 +1,11 @@
error[E0283]: type annotations needed
- --> $DIR/issue-80816.rs:49:38
+ --> $DIR/issue-80816.rs:50:38
|
LL | let guard: Guard<Arc<usize>> = s.load();
| ^^^^
|
note: multiple `impl`s satisfying `ArcSwapAny<Arc<usize>>: Access<_>` found
- --> $DIR/issue-80816.rs:35:1
+ --> $DIR/issue-80816.rs:36:1
|
LL | impl<T> Access<T> for ArcSwapAny<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -16,7 +16,9 @@ note: required for `Arc<ArcSwapAny<Arc<usize>>>` to implement `Access<_>`
--> $DIR/issue-80816.rs:31:45
|
LL | impl<T, A: Access<T>, P: Deref<Target = A>> Access<T> for P {
- | ^^^^^^^^^ ^
+ | --------- ^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
help: try using a fully qualified path to specify the expected types
|
LL | let guard: Guard<Arc<usize>> = <Arc<ArcSwapAny<Arc<usize>>> as Access<T>>::load(&s);
diff --git a/tests/ui/issues/issue-20413.stderr b/tests/ui/issues/issue-20413.stderr
index 78df445972c..202e8463145 100644
--- a/tests/ui/issues/issue-20413.stderr
+++ b/tests/ui/issues/issue-20413.stderr
@@ -18,7 +18,7 @@ note: required for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoDa
--> $DIR/issue-20413.rs:9:9
|
LL | impl<T> Foo for T where NoData<T>: Foo {
- | ^^^ ^
+ | ^^^ ^ --- unsatisfied trait bound introduced here
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
= note: 127 redundant requirements hidden
= note: required for `NoData<T>` to implement `Foo`
@@ -34,13 +34,13 @@ note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNo
--> $DIR/issue-20413.rs:28:9
|
LL | impl<T> Bar for T where EvenLessData<T>: Baz {
- | ^^^ ^
+ | ^^^ ^ --- unsatisfied trait bound introduced here
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>` to implement `Baz`
--> $DIR/issue-20413.rs:35:9
|
LL | impl<T> Baz for T where AlmostNoData<T>: Bar {
- | ^^^ ^
+ | ^^^ ^ --- unsatisfied trait bound introduced here
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
= note: 126 redundant requirements hidden
= note: required for `EvenLessData<T>` to implement `Baz`
@@ -56,13 +56,13 @@ note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLess
--> $DIR/issue-20413.rs:35:9
|
LL | impl<T> Baz for T where AlmostNoData<T>: Bar {
- | ^^^ ^
+ | ^^^ ^ --- unsatisfied trait bound introduced here
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>` to implement `Bar`
--> $DIR/issue-20413.rs:28:9
|
LL | impl<T> Bar for T where EvenLessData<T>: Baz {
- | ^^^ ^
+ | ^^^ ^ --- unsatisfied trait bound introduced here
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
= note: 126 redundant requirements hidden
= note: required for `AlmostNoData<T>` to implement `Bar`
diff --git a/tests/ui/issues/issue-22872.stderr b/tests/ui/issues/issue-22872.stderr
index 7382d40c010..9510197197a 100644
--- a/tests/ui/issues/issue-22872.stderr
+++ b/tests/ui/issues/issue-22872.stderr
@@ -10,6 +10,9 @@ note: required for `Wrapper<P>` to implement `for<'b> Wrap<'b>`
|
LL | impl<'b, P> Wrap<'b> for Wrapper<P>
| ^^^^^^^^ ^^^^^^^^^^
+LL | where P: Process<'b>,
+LL | <P as Process<'b>>::Item: Iterator {
+ | -------- unsatisfied trait bound introduced here
= note: required for the cast from `Wrapper<P>` to the object type `dyn for<'b> Wrap<'b>`
help: consider further restricting the associated type
|
diff --git a/tests/ui/issues/issue-23122-2.stderr b/tests/ui/issues/issue-23122-2.stderr
index 1f50b06a0e4..06e5b711a82 100644
--- a/tests/ui/issues/issue-23122-2.stderr
+++ b/tests/ui/issues/issue-23122-2.stderr
@@ -9,7 +9,9 @@ note: required for `GetNext<<<<<<<... as Next>::Next as Next>::Next as Next>::Ne
--> $DIR/issue-23122-2.rs:10:15
|
LL | impl<T: Next> Next for GetNext<T> {
- | ^^^^ ^^^^^^^^^^
+ | - ^^^^ ^^^^^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-23122-2/issue-23122-2.long-type-hash.txt'
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-38821.stderr b/tests/ui/issues/issue-38821.stderr
index 9abd2436b8a..a52a9c138f1 100644
--- a/tests/ui/issues/issue-38821.stderr
+++ b/tests/ui/issues/issue-38821.stderr
@@ -8,7 +8,9 @@ note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
- | ^^^^^^^^^^^^ ^
+ | ------- ^^^^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting the associated type
|
diff --git a/tests/ui/issues/issue-39970.stderr b/tests/ui/issues/issue-39970.stderr
index 774575d1d01..0cabdf7f234 100644
--- a/tests/ui/issues/issue-39970.stderr
+++ b/tests/ui/issues/issue-39970.stderr
@@ -14,6 +14,9 @@ note: required for `()` to implement `Visit`
|
LL | impl Visit for () where
| ^^^^^ ^^
+LL | //(): for<'a> Array<'a, Element=&'a ()>, // No ICE
+LL | (): for<'a> Array<'a, Element=()>, // ICE
+ | ---------- unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/kindck/kindck-impl-type-params-2.stderr b/tests/ui/kindck/kindck-impl-type-params-2.stderr
index 930d96375bf..1d26ae51f44 100644
--- a/tests/ui/kindck/kindck-impl-type-params-2.stderr
+++ b/tests/ui/kindck/kindck-impl-type-params-2.stderr
@@ -10,7 +10,9 @@ note: required for `Box<{integer}>` to implement `Foo`
--> $DIR/kindck-impl-type-params-2.rs:6:14
|
LL | impl<T:Copy> Foo for T {
- | ^^^ ^
+ | ---- ^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `take_param`
--> $DIR/kindck-impl-type-params-2.rs:9:17
|
diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr
index 8dbe0c38c1e..6fd1fc3f7a1 100644
--- a/tests/ui/kindck/kindck-impl-type-params.stderr
+++ b/tests/ui/kindck/kindck-impl-type-params.stderr
@@ -8,7 +8,9 @@ note: required for `S<T>` to implement `Gettable<T>`
--> $DIR/kindck-impl-type-params.rs:12:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
- | ^^^^^^^^^^^ ^^^^
+ | ---- ^^^^^^^^^^^ ^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`
|
@@ -25,7 +27,9 @@ note: required for `S<T>` to implement `Gettable<T>`
--> $DIR/kindck-impl-type-params.rs:12:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
- | ^^^^^^^^^^^ ^^^^
+ | ---- ^^^^^^^^^^^ ^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`
|
@@ -42,7 +46,9 @@ note: required for `S<T>` to implement `Gettable<T>`
--> $DIR/kindck-impl-type-params.rs:12:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
- | ^^^^^^^^^^^ ^^^^
+ | ---- ^^^^^^^^^^^ ^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`
|
@@ -59,7 +65,9 @@ note: required for `S<T>` to implement `Gettable<T>`
--> $DIR/kindck-impl-type-params.rs:12:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
- | ^^^^^^^^^^^ ^^^^
+ | ---- ^^^^^^^^^^^ ^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
help: consider restricting type parameter `T`
|
@@ -77,7 +85,9 @@ note: required for `S<String>` to implement `Gettable<String>`
--> $DIR/kindck-impl-type-params.rs:12:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
- | ^^^^^^^^^^^ ^^^^
+ | ---- ^^^^^^^^^^^ ^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: required for the cast from `S<String>` to the object type `dyn Gettable<String>`
error[E0277]: the trait bound `Foo: Copy` is not satisfied
@@ -91,7 +101,9 @@ note: required for `S<Foo>` to implement `Gettable<Foo>`
--> $DIR/kindck-impl-type-params.rs:12:32
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
- | ^^^^^^^^^^^ ^^^^
+ | ---- ^^^^^^^^^^^ ^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: required for the cast from `S<Foo>` to the object type `dyn Gettable<Foo>`
help: consider annotating `Foo` with `#[derive(Copy)]`
|
diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr
index e81d2441e6e..8d45748a6c4 100644
--- a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr
+++ b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr
@@ -10,7 +10,9 @@ note: required for `Box<{integer}>` to implement `Foo`
--> $DIR/kindck-inherited-copy-bound.rs:14:14
|
LL | impl<T:Copy> Foo for T {
- | ^^^ ^
+ | ---- ^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `take_param`
--> $DIR/kindck-inherited-copy-bound.rs:17:17
|
diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
index 2380533b9c3..2fbb5a98a8d 100644
--- a/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
+++ b/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
@@ -10,7 +10,9 @@ note: required for `Box<{integer}>` to implement `Foo`
--> $DIR/kindck-inherited-copy-bound.rs:14:14
|
LL | impl<T:Copy> Foo for T {
- | ^^^ ^
+ | ---- ^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `take_param`
--> $DIR/kindck-inherited-copy-bound.rs:17:17
|
diff --git a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs
new file mode 100644
index 00000000000..8be7c9ee8ac
--- /dev/null
+++ b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.rs
@@ -0,0 +1,13 @@
+pub struct Example { a: i32 }
+
+impl Example {
+ fn is_pos(&self) -> bool { self.a > 0 }
+}
+
+fn one() -> i32 { 1 }
+
+fn main() {
+ if Example { a: one(), }.is_pos() { //~ ERROR invalid struct literal
+ println!("Positive!");
+ }
+}
diff --git a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr
new file mode 100644
index 00000000000..7fd7ffc94a5
--- /dev/null
+++ b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr
@@ -0,0 +1,13 @@
+error: invalid struct literal
+ --> $DIR/method-call-on-struct-literal-in-if-condition.rs:10:8
+ |
+LL | if Example { a: one(), }.is_pos() {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+help: you might need to surround the struct literal in parentheses
+ |
+LL | if (Example { a: one(), }).is_pos() {
+ | + +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/phantom-auto-trait.stderr b/tests/ui/phantom-auto-trait.stderr
index 015c8fa4cd1..4769d53eb35 100644
--- a/tests/ui/phantom-auto-trait.stderr
+++ b/tests/ui/phantom-auto-trait.stderr
@@ -10,7 +10,7 @@ note: required for `&T` to implement `Zen`
--> $DIR/phantom-auto-trait.rs:10:24
|
LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
- | ^^^ ^^^^^
+ | ^^^ ^^^^^ ---- unsatisfied trait bound introduced here
= note: required because it appears within the type `PhantomData<&T>`
note: required because it appears within the type `Guard<'_, T>`
--> $DIR/phantom-auto-trait.rs:12:8
@@ -39,7 +39,7 @@ note: required for `&T` to implement `Zen`
--> $DIR/phantom-auto-trait.rs:10:24
|
LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
- | ^^^ ^^^^^
+ | ^^^ ^^^^^ ---- unsatisfied trait bound introduced here
= note: required because it appears within the type `PhantomData<&T>`
note: required because it appears within the type `Guard<'_, T>`
--> $DIR/phantom-auto-trait.rs:12:8
diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
index 14e5df21ef6..3b2a5e70188 100644
--- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
+++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
@@ -29,7 +29,7 @@ note: required for `PriorityQueue<T>` to implement `PartialOrd`
--> $DIR/issue-104884-trait-impl-sugg-err.rs:13:10
|
LL | #[derive(PartialOrd, AddImpl)]
- | ^^^^^^^^^^
+ | ^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
note: required by a bound in `Ord`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: this error originates in the derive macro `AddImpl` which comes from the expansion of the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs
new file mode 100644
index 00000000000..d02caff1feb
--- /dev/null
+++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs
@@ -0,0 +1,13 @@
+#![feature(exclusive_range_pattern)]
+#![allow(unreachable_patterns)]
+fn main() {
+ match 0u8 {
+ 251..257 => {}
+ //~^ ERROR literal out of range
+ //~| ERROR literal out of range
+ 251..=256 => {}
+ //~^ ERROR literal out of range
+ //~| ERROR literal out of range
+ _ => {}
+ }
+}
diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
new file mode 100644
index 00000000000..7b8309b9bc2
--- /dev/null
+++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
@@ -0,0 +1,26 @@
+error: literal out of range for `u8`
+ --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:5:14
+ |
+LL | 251..257 => {}
+ | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+
+error: literal out of range for `u8`
+ --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:8:15
+ |
+LL | 251..=256 => {}
+ | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+
+error: literal out of range for `u8`
+ --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:5:14
+ |
+LL | 251..257 => {}
+ | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+
+error: literal out of range for `u8`
+ --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:8:15
+ |
+LL | 251..=256 => {}
+ | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/rfc-2397-do-not-recommend/feature-gate-do_not_recommend.stderr b/tests/ui/rfc-2397-do-not-recommend/feature-gate-do_not_recommend.stderr
index 2749add82ac..a3e559054f9 100644
--- a/tests/ui/rfc-2397-do-not-recommend/feature-gate-do_not_recommend.stderr
+++ b/tests/ui/rfc-2397-do-not-recommend/feature-gate-do_not_recommend.stderr
@@ -11,7 +11,9 @@ note: required for `u8` to implement `Bar`
--> $DIR/feature-gate-do_not_recommend.rs:13:14
|
LL | impl<T: Foo> Bar for T {
- | ^^^ ^
+ | --- ^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `stuff`
--> $DIR/feature-gate-do_not_recommend.rs:16:13
|
diff --git a/tests/ui/rfc-2632-const-trait-impl/specializing-constness-2.stderr b/tests/ui/rfc-2632-const-trait-impl/specializing-constness-2.stderr
index c554671e18d..8923416f4c7 100644
--- a/tests/ui/rfc-2632-const-trait-impl/specializing-constness-2.stderr
+++ b/tests/ui/rfc-2632-const-trait-impl/specializing-constness-2.stderr
@@ -8,7 +8,9 @@ note: required for `T` to implement `~const A`
--> $DIR/specializing-constness-2.rs:20:37
|
LL | impl<T: Default + ~const Sup> const A for T {
- | ^ ^
+ | ---------- ^ ^
+ | |
+ | unsatisfied trait bound introduced here
help: consider further restricting this bound
|
LL | const fn generic<T: Default + ~const Sup>() {
diff --git a/tests/ui/specialization/issue-38091-2.stderr b/tests/ui/specialization/issue-38091-2.stderr
index 117fb10bb7e..5a05f9c270a 100644
--- a/tests/ui/specialization/issue-38091-2.stderr
+++ b/tests/ui/specialization/issue-38091-2.stderr
@@ -15,6 +15,9 @@ note: required for `i32` to implement `Iterate<'_>`
|
LL | impl<'a, T> Iterate<'a> for T
| ^^^^^^^^^^^ ^
+LL | where
+LL | T: Check,
+ | ----- unsatisfied trait bound introduced here
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/specialization/issue-39448.stderr b/tests/ui/specialization/issue-39448.stderr
index 60157d9a3e1..9ce51d1136d 100644
--- a/tests/ui/specialization/issue-39448.stderr
+++ b/tests/ui/specialization/issue-39448.stderr
@@ -18,12 +18,17 @@ note: required for `T` to implement `FromA<U>`
--> $DIR/issue-39448.rs:24:29
|
LL | impl<T: A, U: A + FromA<T>> FromA<T> for U {
- | ^^^^^^^^ ^
+ | -------- ^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required for `U` to implement `ToA<T>`
--> $DIR/issue-39448.rs:34:12
|
LL | impl<T, U> ToA<U> for T
| ^^^^^^ ^
+LL | where
+LL | U: FromA<T>,
+ | -------- unsatisfied trait bound introduced here
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/suggestions/derive-clone-for-eq.stderr b/tests/ui/suggestions/derive-clone-for-eq.stderr
index 0a18b770405..9d843c2514b 100644
--- a/tests/ui/suggestions/derive-clone-for-eq.stderr
+++ b/tests/ui/suggestions/derive-clone-for-eq.stderr
@@ -8,7 +8,9 @@ note: required for `Struct<T>` to implement `PartialEq`
--> $DIR/derive-clone-for-eq.rs:9:19
|
LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
- | ^^^^^^^^^^^^ ^^^^^^^^^
+ | ----- ^^^^^^^^^^^^ ^^^^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `Eq`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
index b9f7739654a..79036279df9 100644
--- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr
+++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
@@ -30,7 +30,9 @@ note: required for `c::Inner<T>` to implement `Debug`
--> $DIR/derive-macro-missing-bounds.rs:34:28
|
LL | impl<T: Debug + Trait> Debug for Inner<T> {
- | ^^^^^ ^^^^^^^^
+ | ----- ^^^^^ ^^^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&c::Inner<T>` to implement `Debug`
= note: required for the cast from `&c::Inner<T>` to the object type `dyn Debug`
@@ -52,7 +54,7 @@ note: required for `d::Inner<T>` to implement `Debug`
--> $DIR/derive-macro-missing-bounds.rs:49:13
|
LL | impl<T> Debug for Inner<T> where T: Debug, T: Trait {
- | ^^^^^ ^^^^^^^^
+ | ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&d::Inner<T>` to implement `Debug`
= note: required for the cast from `&d::Inner<T>` to the object type `dyn Debug`
@@ -74,7 +76,7 @@ note: required for `e::Inner<T>` to implement `Debug`
--> $DIR/derive-macro-missing-bounds.rs:64:13
|
LL | impl<T> Debug for Inner<T> where T: Debug + Trait {
- | ^^^^^ ^^^^^^^^
+ | ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&e::Inner<T>` to implement `Debug`
= note: required for the cast from `&e::Inner<T>` to the object type `dyn Debug`
@@ -96,7 +98,7 @@ note: required for `f::Inner<T>` to implement `Debug`
--> $DIR/derive-macro-missing-bounds.rs:79:20
|
LL | impl<T: Debug> Debug for Inner<T> where T: Trait {
- | ^^^^^ ^^^^^^^^
+ | ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `&f::Inner<T>` to implement `Debug`
= note: required for the cast from `&f::Inner<T>` to the object type `dyn Debug`
diff --git a/tests/ui/suggestions/issue-96223.stderr b/tests/ui/suggestions/issue-96223.stderr
index 72a9a739a64..d4e9433dfda 100644
--- a/tests/ui/suggestions/issue-96223.stderr
+++ b/tests/ui/suggestions/issue-96223.stderr
@@ -11,12 +11,15 @@ note: required for `Baz<EmptyBis<'de>>` to implement `for<'de> Foo<'de>`
--> $DIR/issue-96223.rs:16:14
|
LL | impl<'de, T> Foo<'de> for Baz<T> where T: Foo<'de> {}
- | ^^^^^^^^ ^^^^^^
+ | ^^^^^^^^ ^^^^^^ -------- unsatisfied trait bound introduced here
note: required for `Empty` to implement `Dummy<EmptyMarker>`
--> $DIR/issue-96223.rs:20:9
|
LL | impl<M> Dummy<M> for Empty
| ^^^^^^^^ ^^^^^
+...
+LL | for<'de> Baz<<M::Bar as Bar<'de>>::Inner>: Foo<'de>,
+ | -------- unsatisfied trait bound introduced here
note: required by a bound in `icey_bounds`
--> $DIR/issue-96223.rs:45:19
|
diff --git a/tests/ui/traits/cycle-cache-err-60010.stderr b/tests/ui/traits/cycle-cache-err-60010.stderr
index 2478eb35422..eeee997608e 100644
--- a/tests/ui/traits/cycle-cache-err-60010.stderr
+++ b/tests/ui/traits/cycle-cache-err-60010.stderr
@@ -22,11 +22,17 @@ note: required for `RootDatabase` to implement `SourceDatabase`
|
LL | impl<T> SourceDatabase for T
| ^^^^^^^^^^^^^^ ^
+LL | where
+LL | T: RefUnwindSafe,
+ | ------------- unsatisfied trait bound introduced here
note: required for `ParseQuery` to implement `Query<RootDatabase>`
--> $DIR/cycle-cache-err-60010.rs:37:10
|
LL | impl<DB> Query<DB> for ParseQuery
| ^^^^^^^^^ ^^^^^^^^^^
+LL | where
+LL | DB: SourceDatabase,
+ | -------------- unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/traits/inductive-overflow/lifetime.rs b/tests/ui/traits/inductive-overflow/lifetime.rs
index 004e477374a..bf536d21cf9 100644
--- a/tests/ui/traits/inductive-overflow/lifetime.rs
+++ b/tests/ui/traits/inductive-overflow/lifetime.rs
@@ -16,6 +16,7 @@ struct C<'a>(&'a ());
struct X<T: Y>(T::P);
impl<T: NotAuto> NotAuto for Box<T> {} //~ NOTE: required
+//~^ NOTE unsatisfied trait bound introduced here
impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
impl<'a> NotAuto for C<'a> {}
diff --git a/tests/ui/traits/inductive-overflow/lifetime.stderr b/tests/ui/traits/inductive-overflow/lifetime.stderr
index b72d53bddbc..357e59991a3 100644
--- a/tests/ui/traits/inductive-overflow/lifetime.stderr
+++ b/tests/ui/traits/inductive-overflow/lifetime.stderr
@@ -1,5 +1,5 @@
error[E0275]: overflow evaluating the requirement `X<C<'_>>: NotAuto`
- --> $DIR/lifetime.rs:28:5
+ --> $DIR/lifetime.rs:29:5
|
LL | is_send::<X<C<'static>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,11 +8,13 @@ note: required for `Box<X<C<'_>>>` to implement `NotAuto`
--> $DIR/lifetime.rs:18:18
|
LL | impl<T: NotAuto> NotAuto for Box<T> {}
- | ^^^^^^^ ^^^^^^
+ | ------- ^^^^^^^ ^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
= note: 3 redundant requirements hidden
= note: required for `X<C<'static>>` to implement `NotAuto`
note: required by a bound in `is_send`
- --> $DIR/lifetime.rs:22:15
+ --> $DIR/lifetime.rs:23:15
|
LL | fn is_send<S: NotAuto>() {}
| ^^^^^^^ required by this bound in `is_send`
diff --git a/tests/ui/traits/inductive-overflow/simultaneous.stderr b/tests/ui/traits/inductive-overflow/simultaneous.stderr
index 09930e60efe..e3b4ec07d23 100644
--- a/tests/ui/traits/inductive-overflow/simultaneous.stderr
+++ b/tests/ui/traits/inductive-overflow/simultaneous.stderr
@@ -8,7 +8,9 @@ note: required for `{integer}` to implement `Combo`
--> $DIR/simultaneous.rs:11:34
|
LL | impl<T: Tweedledee + Tweedledum> Combo for T {}
- | ^^^^^ ^
+ | ---------- ^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `is_ee`
--> $DIR/simultaneous.rs:13:13
|
diff --git a/tests/ui/traits/inductive-overflow/supertrait.stderr b/tests/ui/traits/inductive-overflow/supertrait.stderr
index 4b862cf79ce..b537ecf1721 100644
--- a/tests/ui/traits/inductive-overflow/supertrait.stderr
+++ b/tests/ui/traits/inductive-overflow/supertrait.stderr
@@ -8,7 +8,9 @@ note: required for `NoClone` to implement `Magic`
--> $DIR/supertrait.rs:5:16
|
LL | impl<T: Magic> Magic for T {}
- | ^^^^^ ^
+ | ----- ^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `copy`
--> $DIR/supertrait.rs:7:12
|
diff --git a/tests/ui/traits/issue-18400.stderr b/tests/ui/traits/issue-18400.stderr
index 4394e6f7e05..edaf08f490f 100644
--- a/tests/ui/traits/issue-18400.stderr
+++ b/tests/ui/traits/issue-18400.stderr
@@ -9,7 +9,9 @@ note: required for `{integer}` to implement `Set<&[_]>`
--> $DIR/issue-18400.rs:6:16
|
LL | impl<'a, T, S> Set<&'a [T]> for S where
- | ^^^^^^^^^^^^ ^
+ | - ^^^^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
= note: 128 redundant requirements hidden
= note: required for `{integer}` to implement `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>`
diff --git a/tests/ui/traits/issue-91594.stderr b/tests/ui/traits/issue-91594.stderr
index 9f9acf85113..6b314fa586d 100644
--- a/tests/ui/traits/issue-91594.stderr
+++ b/tests/ui/traits/issue-91594.stderr
@@ -9,7 +9,9 @@ note: required for `Foo` to implement `Component<Foo>`
--> $DIR/issue-91594.rs:13:27
|
LL | impl<M: HasComponent<()>> Component<M> for Foo {
- | ^^^^^^^^^^^^ ^^^
+ | ---------------- ^^^^^^^^^^^^ ^^^
+ | |
+ | unsatisfied trait bound introduced here
error: aborting due to previous error
diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr
index 30cc76b2e1a..ce690b749f5 100644
--- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr
+++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr
@@ -113,7 +113,9 @@ note: required for `Outer2<main::TestType>` to implement `Sync`
--> $DIR/negated-auto-traits-error.rs:14:22
|
LL | unsafe impl<T: Send> Sync for Outer2<T> {}
- | ^^^^ ^^^^^^^^^
+ | ---- ^^^^ ^^^^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
note: required by a bound in `is_sync`
--> $DIR/negated-auto-traits-error.rs:17:15
|
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
index 53178328c56..92d9d32cf9c 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
@@ -27,6 +27,9 @@ note: required for `A<B>` to implement `V<_>`
|
LL | impl<T, U> V<U> for A<T>
| ^^^^ ^^^^
+LL | where
+LL | T: I<U>,
+ | ---- unsatisfied trait bound introduced here
help: try using a fully qualified path to specify the expected types
|
LL | <A<B> as V<U>>::method(a);
diff --git a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr
index 50b2dc0495d..0c45046f5f5 100644
--- a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr
@@ -8,7 +8,9 @@ note: required for `MyBaz<B>` to implement `Baz`
--> $DIR/issue-90400-2.rs:30:14
|
LL | impl<B: Bar> Baz for MyBaz<B> {
- | ^^^ ^^^^^^^^
+ | --- ^^^ ^^^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
help: consider restricting type parameter `B`
|
LL | type FooFn<B: Bar> = impl Baz;
diff --git a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr
index 95fb6f6a55a..103636b6cdd 100644
--- a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr
+++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr
@@ -8,7 +8,9 @@ note: required for `()` to implement `ProofForConversion<T>`
--> $DIR/underconstrained_generic.rs:13:16
|
LL | impl<X: Trait> ProofForConversion<X> for () {
- | ^^^^^^^^^^^^^^^^^^^^^ ^^
+ | ----- ^^^^^^^^^^^^^^^^^^^^^ ^^
+ | |
+ | unsatisfied trait bound introduced here
help: consider restricting type parameter `T`
|
LL | type Converter<T: Trait> = impl ProofForConversion<T>;