diff options
Diffstat (limited to 'src/test')
495 files changed, 5083 insertions, 2512 deletions
diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-1.rs b/src/test/incremental/const-generics/hash-tyvid-regression-1.rs new file mode 100644 index 00000000000..f98ae59ddfe --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-1.rs @@ -0,0 +1,15 @@ +// revisions: cfail +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] +// regression test for #77650 +fn c<T, const N: std::num::NonZeroUsize>() +where + [T; N.get()]: Sized, +{ + use std::convert::TryFrom; + <[T; N.get()]>::try_from(()) + //~^ error: the trait bound + //~^^ error: mismatched types +} + +fn main() {} diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-1.stderr b/src/test/incremental/const-generics/hash-tyvid-regression-1.stderr new file mode 100644 index 00000000000..cb8ca3abd7f --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-1.stderr @@ -0,0 +1,35 @@ +error[E0277]: the trait bound `[T; _]: From<()>` is not satisfied + --> $DIR/hash-tyvid-regression-1.rs:9:5 + | +LL | <[T; N.get()]>::try_from(()) + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `[T; _]` + | + = note: required because of the requirements on the impl of `Into<[T; _]>` for `()` + = note: required because of the requirements on the impl of `TryFrom<()>` for `[T; _]` +note: required by `try_from` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn try_from(value: T) -> Result<Self, Self::Error>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/hash-tyvid-regression-1.rs:9:5 + | +LL | <[T; N.get()]>::try_from(()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Result` + | + = note: expected unit type `()` + found enum `Result<[T; _], Infallible>` +help: consider using a semicolon here + | +LL | <[T; N.get()]>::try_from(()); + | + +help: try adding a return type + | +LL | -> Result<[T; _], Infallible> where + | +++++++++++++++++++++++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-2.rs b/src/test/incremental/const-generics/hash-tyvid-regression-2.rs new file mode 100644 index 00000000000..22536ff56d7 --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-2.rs @@ -0,0 +1,18 @@ +// revisions: cfail +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] +// regression test for #77650 +struct C<T, const N: core::num::NonZeroUsize>([T; N.get()]) +where + [T; N.get()]: Sized; +impl<'a, const N: core::num::NonZeroUsize, A, B: PartialEq<A>> PartialEq<&'a [A]> for C<B, N> +where + [B; N.get()]: Sized, +{ + fn eq(&self, other: &&'a [A]) -> bool { + self.0 == other + //~^ error: can't compare + } +} + +fn main() {} diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-2.stderr b/src/test/incremental/const-generics/hash-tyvid-regression-2.stderr new file mode 100644 index 00000000000..0e6040ef02e --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-2.stderr @@ -0,0 +1,11 @@ +error[E0277]: can't compare `[B; _]` with `&&[A]` + --> $DIR/hash-tyvid-regression-2.rs:12:16 + | +LL | self.0 == other + | ^^ no implementation for `[B; _] == &&[A]` + | + = help: the trait `PartialEq<&&[A]>` is not implemented for `[B; _]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-3.rs b/src/test/incremental/const-generics/hash-tyvid-regression-3.rs new file mode 100644 index 00000000000..76b1ae11c7d --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-3.rs @@ -0,0 +1,26 @@ +// revisions: cfail +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] +// regression test for #79251 +struct Node<const D: usize> +where + SmallVec<{ D * 2 }>: , +{ + keys: SmallVec<{ D * 2 }>, +} + +impl<const D: usize> Node<D> +where + SmallVec<{ D * 2 }>: , +{ + fn new() -> Self { + let mut node = Node::new(); + node.keys.some_function(); + //~^ error: no method named + node + } +} + +struct SmallVec<const D: usize> {} + +fn main() {} diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-3.stderr b/src/test/incremental/const-generics/hash-tyvid-regression-3.stderr new file mode 100644 index 00000000000..555d46756dc --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-3.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `some_function` found for struct `SmallVec` in the current scope + --> $DIR/hash-tyvid-regression-3.rs:17:19 + | +LL | node.keys.some_function(); + | ^^^^^^^^^^^^^ method not found in `SmallVec<{ D * 2 }>` +... +LL | struct SmallVec<const D: usize> {} + | ------------------------------- method `some_function` not found for this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-4.rs b/src/test/incremental/const-generics/hash-tyvid-regression-4.rs new file mode 100644 index 00000000000..35a675a2ab4 --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-4.rs @@ -0,0 +1,40 @@ +// revisions: cfail +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] +// regression test for #79251 +#[derive(Debug)] +struct Node<K, const D: usize> +where + SmallVec<K, { D * 2 }>: , +{ + keys: SmallVec<K, { D * 2 }>, +} + +impl<K, const D: usize> Node<K, D> +where + SmallVec<K, { D * 2 }>: , +{ + fn new() -> Self { + panic!() + } + + #[inline(never)] + fn split(&mut self, i: usize, k: K, right: bool) -> Node<K, D> { + let mut node = Node::new(); + node.keys.push(k); + //~^ error: no method named + node + } +} + +#[derive(Debug)] +struct SmallVec<T, const D: usize> { + data: [T; D], +} +impl<T, const D: usize> SmallVec<T, D> { + fn new() -> Self { + panic!() + } +} + +fn main() {} diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-4.stderr b/src/test/incremental/const-generics/hash-tyvid-regression-4.stderr new file mode 100644 index 00000000000..c9a6715e571 --- /dev/null +++ b/src/test/incremental/const-generics/hash-tyvid-regression-4.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `push` found for struct `SmallVec` in the current scope + --> $DIR/hash-tyvid-regression-4.rs:23:19 + | +LL | node.keys.push(k); + | ^^^^ method not found in `SmallVec<_, { D * 2 }>` +... +LL | struct SmallVec<T, const D: usize> { + | ---------------------------------- method `push` not found for this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/run-make-fulldeps/obtain-borrowck/Makefile b/src/test/run-make-fulldeps/obtain-borrowck/Makefile new file mode 100644 index 00000000000..223993125c8 --- /dev/null +++ b/src/test/run-make-fulldeps/obtain-borrowck/Makefile @@ -0,0 +1,26 @@ +include ../tools.mk + +# This example shows how to implement a rustc driver that retrieves MIR bodies +# together with the borrow checker information. + +# How to run this +# $ ./x.py test src/test/run-make-fulldeps/obtain-borrowck + +DRIVER_BINARY := "$(TMPDIR)"/driver +SYSROOT := $(shell $(RUSTC) --print sysroot) + +ifdef IS_WINDOWS +LIBSTD := -L "$(SYSROOT)\\lib\\rustlib\\$(TARGET)\\lib" +else +LIBSTD := +endif + +all: + $(RUSTC) driver.rs -o "$(DRIVER_BINARY)" + $(TARGET_RPATH_ENV) "$(DRIVER_BINARY)" --sysroot $(SYSROOT) $(LIBSTD) test.rs -o "$(TMPDIR)/driver_test" > "$(TMPDIR)"/output.stdout + +ifdef RUSTC_BLESS_TEST + cp "$(TMPDIR)"/output.stdout output.stdout +else + $(DIFF) output.stdout "$(TMPDIR)"/output.stdout +endif diff --git a/src/test/run-make-fulldeps/obtain-borrowck/driver.rs b/src/test/run-make-fulldeps/obtain-borrowck/driver.rs new file mode 100644 index 00000000000..308df0b030c --- /dev/null +++ b/src/test/run-make-fulldeps/obtain-borrowck/driver.rs @@ -0,0 +1,171 @@ +#![feature(rustc_private)] + +//! This program implements a rustc driver that retrieves MIR bodies with +//! borrowck information. This cannot be done in a straightforward way because +//! `get_body_with_borrowck_facts`–the function for retrieving a MIR body with +//! borrowck facts–can panic if the body is stolen before it is invoked. +//! Therefore, the driver overrides `mir_borrowck` query (this is done in the +//! `config` callback), which retrieves the body that is about to be borrow +//! checked and stores it in a thread local `MIR_BODIES`. Then, `after_analysis` +//! callback triggers borrow checking of all MIR bodies by retrieving +//! `optimized_mir` and pulls out the MIR bodies with the borrowck information +//! from the thread local storage. + +extern crate rustc_driver; +extern crate rustc_hir; +extern crate rustc_interface; +extern crate rustc_middle; +extern crate rustc_mir; +extern crate rustc_session; + +use rustc_driver::Compilation; +use rustc_hir::def_id::LocalDefId; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_interface::interface::Compiler; +use rustc_interface::{Config, Queries}; +use rustc_middle::ty::query::query_values::mir_borrowck; +use rustc_middle::ty::query::Providers; +use rustc_middle::ty::{self, TyCtxt}; +use rustc_mir::consumers::BodyWithBorrowckFacts; +use rustc_session::Session; +use std::cell::RefCell; +use std::collections::HashMap; +use std::thread_local; + +fn main() { + let exit_code = rustc_driver::catch_with_exit_code(move || { + let mut rustc_args: Vec<_> = std::env::args().collect(); + // We must pass -Zpolonius so that the borrowck information is computed. + rustc_args.push("-Zpolonius".to_owned()); + let mut callbacks = CompilerCalls::default(); + // Call the Rust compiler with our callbacks. + rustc_driver::RunCompiler::new(&rustc_args, &mut callbacks).run() + }); + std::process::exit(exit_code); +} + +#[derive(Default)] +pub struct CompilerCalls; + +impl rustc_driver::Callbacks for CompilerCalls { + + // In this callback we override the mir_borrowck query. + fn config(&mut self, config: &mut Config) { + assert!(config.override_queries.is_none()); + config.override_queries = Some(override_queries); + } + + // In this callback we trigger borrow checking of all functions and obtain + // the result. + fn after_analysis<'tcx>( + &mut self, + compiler: &Compiler, + queries: &'tcx Queries<'tcx>, + ) -> Compilation { + compiler.session().abort_if_errors(); + queries.global_ctxt().unwrap().peek_mut().enter(|tcx| { + + // Collect definition ids of MIR bodies. + let hir = tcx.hir(); + let krate = hir.krate(); + let mut visitor = HirVisitor { bodies: Vec::new() }; + krate.visit_all_item_likes(&mut visitor); + + // Trigger borrow checking of all bodies. + for def_id in visitor.bodies { + let _ = tcx.optimized_mir(def_id); + } + + // See what bodies were borrow checked. + let mut bodies = get_bodies(tcx); + bodies.sort_by(|(def_id1, _), (def_id2, _)| def_id1.cmp(def_id2)); + println!("Bodies retrieved for:"); + for (def_id, body) in bodies { + println!("{}", def_id); + assert!(body.input_facts.cfg_edge.len() > 0); + } + }); + + Compilation::Continue + } +} + +fn override_queries(_session: &Session, local: &mut Providers, external: &mut Providers) { + local.mir_borrowck = mir_borrowck; + external.mir_borrowck = mir_borrowck; +} + +// Since mir_borrowck does not have access to any other state, we need to use a +// thread-local for storing the obtained MIR bodies. +// +// Note: We are using 'static lifetime here, which is in general unsound. +// Unfortunately, that is the only lifetime allowed here. Our use is safe +// because we cast it back to `'tcx` before using. +thread_local! { + pub static MIR_BODIES: + RefCell<HashMap<LocalDefId, BodyWithBorrowckFacts<'static>>> = + RefCell::new(HashMap::new()); +} + +fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> mir_borrowck<'tcx> { + let body_with_facts = rustc_mir::consumers::get_body_with_borrowck_facts( + tcx, + ty::WithOptConstParam::unknown(def_id), + ); + // SAFETY: The reader casts the 'static lifetime to 'tcx before using it. + let body_with_facts: BodyWithBorrowckFacts<'static> = + unsafe { std::mem::transmute(body_with_facts) }; + MIR_BODIES.with(|state| { + let mut map = state.borrow_mut(); + assert!(map.insert(def_id, body_with_facts).is_none()); + }); + let mut providers = Providers::default(); + rustc_mir::provide(&mut providers); + let original_mir_borrowck = providers.mir_borrowck; + original_mir_borrowck(tcx, def_id) +} + +/// Visitor that collects all body definition ids mentioned in the program. +struct HirVisitor { + bodies: Vec<LocalDefId>, +} + +impl<'tcx> ItemLikeVisitor<'tcx> for HirVisitor { + fn visit_item(&mut self, item: &rustc_hir::Item) { + if let rustc_hir::ItemKind::Fn(..) = item.kind { + self.bodies.push(item.def_id); + } + } + + fn visit_trait_item(&mut self, trait_item: &rustc_hir::TraitItem) { + if let rustc_hir::TraitItemKind::Fn(_, trait_fn) = &trait_item.kind { + if let rustc_hir::TraitFn::Provided(_) = trait_fn { + self.bodies.push(trait_item.def_id); + } + } + } + + fn visit_impl_item(&mut self, impl_item: &rustc_hir::ImplItem) { + if let rustc_hir::ImplItemKind::Fn(..) = impl_item.kind { + self.bodies.push(impl_item.def_id); + } + } + + fn visit_foreign_item(&mut self, _foreign_item: &rustc_hir::ForeignItem) {} +} + +/// Pull MIR bodies stored in the thread-local. +fn get_bodies<'tcx>(tcx: TyCtxt<'tcx>) -> Vec<(String, BodyWithBorrowckFacts<'tcx>)> { + MIR_BODIES.with(|state| { + let mut map = state.borrow_mut(); + map.drain() + .map(|(def_id, body)| { + let def_path = tcx.def_path(def_id.to_def_id()); + // SAFETY: For soundness we need to ensure that the bodies have + // the same lifetime (`'tcx`), which they had before they were + // stored in the thread local. + (def_path.to_string_no_crate_verbose(), body) + }) + .collect() + }) +} diff --git a/src/test/run-make-fulldeps/obtain-borrowck/output.stdout b/src/test/run-make-fulldeps/obtain-borrowck/output.stdout new file mode 100644 index 00000000000..e011622e6b2 --- /dev/null +++ b/src/test/run-make-fulldeps/obtain-borrowck/output.stdout @@ -0,0 +1,8 @@ +Bodies retrieved for: +::X::provided +::foo +::main +::main::{constant#0} +::{impl#0}::new +::{impl#1}::provided +::{impl#1}::required diff --git a/src/test/run-make-fulldeps/obtain-borrowck/test.rs b/src/test/run-make-fulldeps/obtain-borrowck/test.rs new file mode 100644 index 00000000000..f7b4b41feaf --- /dev/null +++ b/src/test/run-make-fulldeps/obtain-borrowck/test.rs @@ -0,0 +1,32 @@ +trait X { + fn provided(&self) -> usize { + 5 + } + fn required(&self) -> u32; +} + +struct Bar; + +impl Bar { + fn new() -> Self { + Self + } +} + +impl X for Bar { + fn provided(&self) -> usize { + 1 + } + fn required(&self) -> u32 { + 7 + } +} + +const fn foo() -> usize { + 1 +} + +fn main() { + let bar: [Bar; foo()] = [Bar::new()]; + assert_eq!(bar[0].provided(), foo()); +} diff --git a/src/test/run-make/issue-85019-moved-src-dir/Makefile b/src/test/run-make/issue-85019-moved-src-dir/Makefile new file mode 100644 index 00000000000..3606d4fdf57 --- /dev/null +++ b/src/test/run-make/issue-85019-moved-src-dir/Makefile @@ -0,0 +1,28 @@ +include ../../run-make-fulldeps/tools.mk + +INCR=$(TMPDIR)/incr +FIRST_SRC=$(TMPDIR)/first_src +SECOND_SRC=$(TMPDIR)/second_src + +# ignore-none no-std is not supported +# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std' + +# Tests that we don't get an ICE when the working directory +# (but not the build directory!) changes between compilation +# sessions + +all: + mkdir $(INCR) + # Build from 'FIRST_SRC' + mkdir $(FIRST_SRC) + cp my_lib.rs $(FIRST_SRC)/my_lib.rs + cp main.rs $(FIRST_SRC)/main.rs + cd $(FIRST_SRC) && \ + $(RUSTC) -C incremental=$(INCR) --crate-type lib my_lib.rs --target $(TARGET) && \ + $(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs --target $(TARGET) + # Build from 'SECOND_SRC', keeping the output directory and incremental directory + # the same + mv $(FIRST_SRC) $(SECOND_SRC) + cd $(SECOND_SRC) && \ + $(RUSTC) -C incremental=$(INCR) --crate-type lib my_lib.rs --target $(TARGET) && \ + $(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs --target $(TARGET) diff --git a/src/test/run-make/issue-85019-moved-src-dir/main.rs b/src/test/run-make/issue-85019-moved-src-dir/main.rs new file mode 100644 index 00000000000..543559a5c53 --- /dev/null +++ b/src/test/run-make/issue-85019-moved-src-dir/main.rs @@ -0,0 +1,5 @@ +extern crate my_lib; + +fn main() { + my_lib::my_fn("hi"); +} diff --git a/src/test/run-make/issue-85019-moved-src-dir/my_lib.rs b/src/test/run-make/issue-85019-moved-src-dir/my_lib.rs new file mode 100644 index 00000000000..432875739af --- /dev/null +++ b/src/test/run-make/issue-85019-moved-src-dir/my_lib.rs @@ -0,0 +1 @@ +pub fn my_fn<T: Copy>(_val: T) {} diff --git a/src/test/rustdoc-gui/code-tags.goml b/src/test/rustdoc-gui/code-tags.goml new file mode 100644 index 00000000000..200569a28d4 --- /dev/null +++ b/src/test/rustdoc-gui/code-tags.goml @@ -0,0 +1,20 @@ +// This test ensures that items and documentation code blocks are wrapped in <pre><code> +goto: file://|DOC_PATH|/test_docs/fn.foo.html +size: (1080, 600) +// There should be three doc codeblocks +// Check that their content is inside <pre><code> +assert-count: (".example-wrap pre > code", 3) +// Check that function signature is inside <pre><code> +assert: "pre.rust.fn > code" + +goto: file://|DOC_PATH|/test_docs/struct.Foo.html +assert: "pre.rust.struct > code" + +goto: file://|DOC_PATH|/test_docs/enum.AnEnum.html +assert: "pre.rust.enum > code" + +goto: file://|DOC_PATH|/test_docs/trait.AnotherOne.html +assert: "pre.rust.trait > code" + +goto: file://|DOC_PATH|/test_docs/type.SomeType.html +assert: "pre.rust.typedef > code" diff --git a/src/test/rustdoc-gui/module-items-font.goml b/src/test/rustdoc-gui/module-items-font.goml index 817b148bee1..ab595d28019 100644 --- a/src/test/rustdoc-gui/module-items-font.goml +++ b/src/test/rustdoc-gui/module-items-font.goml @@ -2,3 +2,22 @@ goto: file://|DOC_PATH|/test_docs/index.html assert-css: (".item-table .module-item a", {"font-family": '"Fira Sans", Arial, sans-serif'}, ALL) assert-css: (".item-table .docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}, ALL) + +// modules +assert-css: ("#modules + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'}) +assert-css: ("#modules + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}) +// structs +assert-css: ("#structs + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'}) +assert-css: ("#structs + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}) +// enums +assert-css: ("#enums + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'}) +assert-css: ("#enums + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}) +// traits +assert-css: ("#traits + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'}) +assert-css: ("#traits + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}) +// functions +assert-css: ("#functions + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'}) +assert-css: ("#functions + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}) +// keywords +assert-css: ("#keywords + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'}) +assert-css: ("#keywords + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}) diff --git a/src/test/rustdoc-gui/source-code-page.goml b/src/test/rustdoc-gui/source-code-page.goml index d7bae93c211..5a49807e180 100644 --- a/src/test/rustdoc-gui/source-code-page.goml +++ b/src/test/rustdoc-gui/source-code-page.goml @@ -12,4 +12,4 @@ assert-attribute: (".line-numbers > span:nth-child(5)", {"class": "line-highligh assert-attribute: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"}) assert-attribute-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"}) // This is to ensure that the content is correctly align with the line numbers. -compare-elements-position: ("//*[@id='1']", ".rust > span", ("y")) +compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y")) diff --git a/src/test/rustdoc-ui/coverage/exotic.rs b/src/test/rustdoc-ui/coverage/exotic.rs index 281ce571aa0..18f2014d9e4 100644 --- a/src/test/rustdoc-ui/coverage/exotic.rs +++ b/src/test/rustdoc-ui/coverage/exotic.rs @@ -2,6 +2,7 @@ // check-pass #![feature(doc_keyword)] +#![feature(doc_primitive)] //! the features only used in std also have entries in the table, so make sure those get pulled out //! properly as well diff --git a/src/test/rustdoc-ui/doc-test-attr-pass.rs b/src/test/rustdoc-ui/doc-test-attr-pass.rs new file mode 100644 index 00000000000..12608f24450 --- /dev/null +++ b/src/test/rustdoc-ui/doc-test-attr-pass.rs @@ -0,0 +1,8 @@ +// check-pass + +#![crate_type = "lib"] +#![deny(invalid_doc_attributes)] +#![doc(test(no_crate_inject))] +#![doc(test(attr(deny(warnings))))] + +pub fn foo() {} diff --git a/src/test/rustdoc-ui/doc-test-attr.rs b/src/test/rustdoc-ui/doc-test-attr.rs new file mode 100644 index 00000000000..46178ad865a --- /dev/null +++ b/src/test/rustdoc-ui/doc-test-attr.rs @@ -0,0 +1,14 @@ +#![crate_type = "lib"] +#![deny(invalid_doc_attributes)] + +#![doc(test)] +//~^ ERROR `#[doc(test(...)]` takes a list of attributes +//~^^ WARN this was previously accepted by the compiler +#![doc(test = "hello")] +//~^ ERROR `#[doc(test(...)]` takes a list of attributes +//~^^ WARN this was previously accepted by the compiler +#![doc(test(a))] +//~^ ERROR unknown `doc(test)` attribute `a` +//~^^ WARN this was previously accepted by the compiler + +pub fn foo() {} diff --git a/src/test/rustdoc-ui/doc-test-attr.stderr b/src/test/rustdoc-ui/doc-test-attr.stderr new file mode 100644 index 00000000000..7f5e2d6bc70 --- /dev/null +++ b/src/test/rustdoc-ui/doc-test-attr.stderr @@ -0,0 +1,34 @@ +error: `#[doc(test(...)]` takes a list of attributes + --> $DIR/doc-test-attr.rs:4:8 + | +LL | #![doc(test)] + | ^^^^ + | +note: the lint level is defined here + --> $DIR/doc-test-attr.rs:2:9 + | +LL | #![deny(invalid_doc_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + +error: `#[doc(test(...)]` takes a list of attributes + --> $DIR/doc-test-attr.rs:7:8 + | +LL | #![doc(test = "hello")] + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + +error: unknown `doc(test)` attribute `a` + --> $DIR/doc-test-attr.rs:10:13 + | +LL | #![doc(test(a))] + | ^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 576fcc6fade..c7fb85c8f82 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -5,9 +5,12 @@ LL | f1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _` -... + | +note: required by a bound in `f1` + --> $DIR/anonymous-higher-ranked-lifetime.rs:16:25 + | LL | fn f1<F>(_: F) where F: Fn(&(), &()) {} - | ------------ required by this bound in `f1` + | ^^^^^^^^^^^^ required by this bound in `f1` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:3:5 @@ -16,9 +19,12 @@ LL | f2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _` -... + | +note: required by a bound in `f2` + --> $DIR/anonymous-higher-ranked-lifetime.rs:17:25 + | LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {} - | ----------------------- required by this bound in `f2` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 @@ -27,9 +33,12 @@ LL | f3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&(), &'r ()) -> _` -... + | +note: required by a bound in `f3` + --> $DIR/anonymous-higher-ranked-lifetime.rs:18:29 + | LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} - | --------------- required by this bound in `f3` + | ^^^^^^^^^^^^^^^ required by this bound in `f3` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:5:5 @@ -38,9 +47,12 @@ LL | f4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _` -... + | +note: required by a bound in `f4` + --> $DIR/anonymous-higher-ranked-lifetime.rs:19:25 + | LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {} - | ----------------------- required by this bound in `f4` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 @@ -49,9 +61,12 @@ LL | f5(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), &'r ()) -> _` -... + | +note: required by a bound in `f5` + --> $DIR/anonymous-higher-ranked-lifetime.rs:20:25 + | LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} - | -------------------------- required by this bound in `f5` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:7:5 @@ -60,9 +75,12 @@ LL | g1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), Box<(dyn for<'s> Fn(&'s ()) + 'static)>) -> _` -... + | +note: required by a bound in `g1` + --> $DIR/anonymous-higher-ranked-lifetime.rs:23:25 + | LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {} - | ------------------------- required by this bound in `g1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 @@ -71,9 +89,12 @@ LL | g2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _` -... + | +note: required by a bound in `g2` + --> $DIR/anonymous-higher-ranked-lifetime.rs:24:25 + | LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {} - | ---------------- required by this bound in `g2` + | ^^^^^^^^^^^^^^^^ required by this bound in `g2` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 @@ -82,9 +103,12 @@ LL | g3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>) -> _` -... + | +note: required by a bound in `g3` + --> $DIR/anonymous-higher-ranked-lifetime.rs:25:25 + | LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {} - | ------------------------------------ required by this bound in `g3` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 @@ -93,9 +117,12 @@ LL | g4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` -... + | +note: required by a bound in `g4` + --> $DIR/anonymous-higher-ranked-lifetime.rs:26:25 + | LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} - | --------------------------- required by this bound in `g4` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5 @@ -104,9 +131,12 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), Box<(dyn for<'t0> Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _` -... + | +note: required by a bound in `h1` + --> $DIR/anonymous-higher-ranked-lifetime.rs:29:25 + | LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {} - | -------------------------------------------- required by this bound in `h1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1` error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 @@ -115,9 +145,12 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 't0> fn(&'r (), Box<(dyn for<'s> Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _` -... + | +note: required by a bound in `h2` + --> $DIR/anonymous-higher-ranked-lifetime.rs:30:25 + | LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {} - | --------------------------------------------------------- required by this bound in `h2` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2` error: aborting due to 11 previous errors diff --git a/src/test/ui/asm/issue-87802.rs b/src/test/ui/asm/issue-87802.rs new file mode 100644 index 00000000000..b1fc13b6a7e --- /dev/null +++ b/src/test/ui/asm/issue-87802.rs @@ -0,0 +1,17 @@ +// only-x86_64 +// Make sure rustc doesn't ICE on asm! when output type is !. + +#![feature(asm)] + +fn hmm() -> ! { + let x; + unsafe { + asm!("/* {0} */", out(reg) x); + //~^ ERROR cannot use value of type `!` for inline assembly + } + x +} + +fn main() { + hmm(); +} diff --git a/src/test/ui/asm/issue-87802.stderr b/src/test/ui/asm/issue-87802.stderr new file mode 100644 index 00000000000..1eb72b68a7f --- /dev/null +++ b/src/test/ui/asm/issue-87802.stderr @@ -0,0 +1,10 @@ +error: cannot use value of type `!` for inline assembly + --> $DIR/issue-87802.rs:9:36 + | +LL | asm!("/* {0} */", out(reg) x); + | ^ + | + = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly + +error: aborting due to previous error + diff --git a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index 703d790e92c..a694f88192e 100644 --- a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -4,12 +4,12 @@ error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be sent between th LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>; | ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely | - ::: $SRC_DIR/core/src/marker.rs:LL:COL + = help: the trait `Send` is not implemented for `<<Self as Case1>::C as Iterator>::Item` +note: required by a bound in `Send` + --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub unsafe auto trait Send { - | -------------------------- required by this bound in `Send` - | - = help: the trait `Send` is not implemented for `<<Self as Case1>::C as Iterator>::Item` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Send` help: consider further restricting the associated type | LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Send { @@ -21,12 +21,12 @@ error[E0277]: `<<Self as Case1>::C as Iterator>::Item` is not an iterator LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<<Self as Case1>::C as Iterator>::Item` is not an iterator | - ::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + = help: the trait `Iterator` is not implemented for `<<Self as Case1>::C as Iterator>::Item` +note: required by a bound in `Iterator` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | pub trait Iterator { - | ------------------ required by this bound in `Iterator` - | - = help: the trait `Iterator` is not implemented for `<<Self as Case1>::C as Iterator>::Item` + | ^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator` help: consider further restricting the associated type | LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Iterator { @@ -38,12 +38,12 @@ error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be shared between LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>; | ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely | - ::: $SRC_DIR/core/src/marker.rs:LL:COL + = help: the trait `Sync` is not implemented for `<<Self as Case1>::C as Iterator>::Item` +note: required by a bound in `Sync` + --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub unsafe auto trait Sync { - | -------------------------- required by this bound in `Sync` - | - = help: the trait `Sync` is not implemented for `<<Self as Case1>::C as Iterator>::Item` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Sync` help: consider further restricting the associated type | LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Sync { diff --git a/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr index f3bd48f8c37..775fe28f00d 100644 --- a/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr @@ -4,12 +4,12 @@ error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug` LL | type A: Iterator<Item: Debug>; | ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL + = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item` +note: required by a bound in `Debug` + --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | LL | pub trait Debug { - | --------------- required by this bound in `Debug` - | - = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item` + | ^^^^^^^^^^^^^^^ required by this bound in `Debug` help: consider further restricting the associated type | LL | trait Case1 where <<Self as Case1>::A as Iterator>::Item: Debug { @@ -21,11 +21,11 @@ error[E0277]: the trait bound `<<Self as Foo>::Out as Baz>::Assoc: Default` is n LL | pub trait Foo { type Out: Baz<Assoc: Default>; } | ^^^^^^^ the trait `Default` is not implemented for `<<Self as Foo>::Out as Baz>::Assoc` | - ::: $SRC_DIR/core/src/default.rs:LL:COL +note: required by a bound in `Default` + --> $SRC_DIR/core/src/default.rs:LL:COL | LL | pub trait Default: Sized { - | ------------------------ required by this bound in `Default` - | + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Default` help: consider further restricting the associated type | LL | pub trait Foo where <<Self as Foo>::Out as Baz>::Assoc: Default { type Out: Baz<Assoc: Default>; } diff --git a/src/test/ui/associated-type-bounds/issue-83017.stderr b/src/test/ui/associated-type-bounds/issue-83017.stderr index 4eb71fd0287..af86990ac66 100644 --- a/src/test/ui/associated-type-bounds/issue-83017.stderr +++ b/src/test/ui/associated-type-bounds/issue-83017.stderr @@ -1,26 +1,32 @@ error[E0277]: the trait bound `for<'a, 'b> <Z as TraitA<'a>>::AsA: TraitB<'a, 'b>` is not satisfied --> $DIR/issue-83017.rs:36:5 | +LL | foo::<Z>(); + | ^^^^^^^^ the trait `for<'a, 'b> TraitB<'a, 'b>` is not implemented for `<Z as TraitA<'a>>::AsA` + | +note: required by a bound in `foo` + --> $DIR/issue-83017.rs:31:32 + | LL | fn foo<T>() | --- required by a bound in this LL | where LL | for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>, - | ------------------------------------------------------- required by this bound in `foo` -... -LL | foo::<Z>(); - | ^^^^^^^^ the trait `for<'a, 'b> TraitB<'a, 'b>` is not implemented for `<Z as TraitA<'a>>::AsA` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` error[E0277]: the trait bound `for<'a, 'b, 'c> <<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB: TraitC<'a, 'b, 'c>` is not satisfied --> $DIR/issue-83017.rs:36:5 | +LL | foo::<Z>(); + | ^^^^^^^^ the trait `for<'a, 'b, 'c> TraitC<'a, 'b, 'c>` is not implemented for `<<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB` + | +note: required by a bound in `foo` + --> $DIR/issue-83017.rs:31:60 + | LL | fn foo<T>() | --- required by a bound in this LL | where LL | for<'a> T: TraitA<'a, AsA: for<'b> TraitB<'a, 'b, AsB: for<'c> TraitC<'a, 'b, 'c>>>, - | -------------------------- required by this bound in `foo` -... -LL | foo::<Z>(); - | ^^^^^^^^ the trait `for<'a, 'b, 'c> TraitC<'a, 'b, 'c>` is not implemented for `<<Z as TraitA<'a>>::AsA as TraitB<'a, 'b>>::AsB` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr index 029c923aa7d..924a09c87f0 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr @@ -1,20 +1,26 @@ error[E0271]: type mismatch resolving `<ModelT as Vehicle>::Color == Blue` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:31:10 | -LL | fn blue_car<C:Car<Color=Blue>>(c: C) { - | ---------- required by this bound in `blue_car` -... LL | fn b() { blue_car(ModelT); } | ^^^^^^^^ expected struct `Blue`, found struct `Black` + | +note: required by a bound in `blue_car` + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:27:19 + | +LL | fn blue_car<C:Car<Color=Blue>>(c: C) { + | ^^^^^^^^^^ required by this bound in `blue_car` error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10 | -LL | fn black_car<C:Car<Color=Black>>(c: C) { - | ----------- required by this bound in `black_car` -... LL | fn c() { black_car(ModelU); } | ^^^^^^^^^ expected struct `Black`, found struct `Blue` + | +note: required by a bound in `black_car` + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:24:20 + | +LL | fn black_car<C:Car<Color=Black>>(c: C) { + | ^^^^^^^^^^^ required by this bound in `black_car` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr index 5992b0d6bf1..5f227a3b480 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.stderr +++ b/src/test/ui/associated-types/associated-types-eq-3.stderr @@ -16,11 +16,14 @@ LL | fn foo2<I: Foo<A = Bar>>(x: I) { error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar` --> $DIR/associated-types-eq-3.rs:38:5 | -LL | fn foo1<I: Foo<A=Bar>>(x: I) { - | ----- required by this bound in `foo1` -... LL | foo1(a); | ^^^^ expected struct `Bar`, found `usize` + | +note: required by a bound in `foo1` + --> $DIR/associated-types-eq-3.rs:18:16 + | +LL | fn foo1<I: Foo<A=Bar>>(x: I) { + | ^^^^^ required by this bound in `foo1` error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar` --> $DIR/associated-types-eq-3.rs:41:9 diff --git a/src/test/ui/associated-types/associated-types-eq-hr.nll.stderr b/src/test/ui/associated-types/associated-types-eq-hr.nll.stderr index 25e9f726ba5..1da82aba5bc 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.nll.stderr +++ b/src/test/ui/associated-types/associated-types-eq-hr.nll.stderr @@ -1,32 +1,36 @@ error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize` --> $DIR/associated-types-eq-hr.rs:87:5 | -LL | fn foo<T>() - | --- required by a bound in this -LL | where -LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>, - | ------------- required by this bound in `foo` -... LL | foo::<UintStruct>(); | ^^^^^^^^^^^^^^^^^ expected `isize`, found `usize` | = note: expected reference `&isize` found reference `&usize` +note: required by a bound in `foo` + --> $DIR/associated-types-eq-hr.rs:45:36 + | +LL | fn foo<T>() + | --- required by a bound in this +LL | where +LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>, + | ^^^^^^^^^^^^^ required by this bound in `foo` error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize` --> $DIR/associated-types-eq-hr.rs:91:5 | -LL | fn bar<T>() - | --- required by a bound in this -LL | where -LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, - | ------------- required by this bound in `bar` -... LL | bar::<IntStruct>(); | ^^^^^^^^^^^^^^^^ expected `usize`, found `isize` | = note: expected reference `&usize` found reference `&isize` +note: required by a bound in `bar` + --> $DIR/associated-types-eq-hr.rs:52:36 + | +LL | fn bar<T>() + | --- required by a bound in this +LL | where +LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, + | ^^^^^^^^^^^^^ required by this bound in `bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-eq-hr.stderr b/src/test/ui/associated-types/associated-types-eq-hr.stderr index 6897b31fe46..e34b4f1c772 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.stderr +++ b/src/test/ui/associated-types/associated-types-eq-hr.stderr @@ -1,32 +1,36 @@ error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize` --> $DIR/associated-types-eq-hr.rs:87:5 | -LL | fn foo<T>() - | --- required by a bound in this -LL | where -LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>, - | ------------- required by this bound in `foo` -... LL | foo::<UintStruct>(); | ^^^^^^^^^^^^^^^^^ expected `isize`, found `usize` | = note: expected reference `&isize` found reference `&usize` +note: required by a bound in `foo` + --> $DIR/associated-types-eq-hr.rs:45:36 + | +LL | fn foo<T>() + | --- required by a bound in this +LL | where +LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>, + | ^^^^^^^^^^^^^ required by this bound in `foo` error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize` --> $DIR/associated-types-eq-hr.rs:91:5 | -LL | fn bar<T>() - | --- required by a bound in this -LL | where -LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, - | ------------- required by this bound in `bar` -... LL | bar::<IntStruct>(); | ^^^^^^^^^^^^^^^^ expected `usize`, found `isize` | = note: expected reference `&usize` found reference `&isize` +note: required by a bound in `bar` + --> $DIR/associated-types-eq-hr.rs:52:36 + | +LL | fn bar<T>() + | --- required by a bound in this +LL | where +LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, + | ^^^^^^^^^^^^^ required by this bound in `bar` error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 diff --git a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr index f2195ca694b..92c963a9ef9 100644 --- a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr +++ b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Get` is not satisfied --> $DIR/associated-types-for-unimpl-trait.rs:10:40 | -LL | trait Get { - | --------- required by this bound in `Get` -... LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | +note: required by a bound in `Get` + --> $DIR/associated-types-for-unimpl-trait.rs:4:1 + | +LL | trait Get { + | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} diff --git a/src/test/ui/associated-types/associated-types-issue-20346.stderr b/src/test/ui/associated-types/associated-types-issue-20346.stderr index 7193d4163b9..1c24ce05ef4 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.stderr +++ b/src/test/ui/associated-types/associated-types-issue-20346.stderr @@ -1,9 +1,6 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>` --> $DIR/associated-types-issue-20346.rs:34:5 | -LL | fn is_iterator_of<A, I: Iterator<Item=A>>(_: &I) {} - | ------ required by this bound in `is_iterator_of` -... LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) { | - this type parameter ... @@ -12,6 +9,11 @@ LL | is_iterator_of::<Option<T>, _>(&adapter); | = note: expected enum `Option<T>` found type `T` +note: required by a bound in `is_iterator_of` + --> $DIR/associated-types-issue-20346.rs:15:34 + | +LL | fn is_iterator_of<A, I: Iterator<Item=A>>(_: &I) {} + | ^^^^^^ required by this bound in `is_iterator_of` error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr index cfc75652a61..922cf88a049 100644 --- a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr +++ b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr @@ -3,12 +3,14 @@ error[E0271]: type mismatch resolving `<T as Foo>::Y == i32` | LL | want_y(t); | ^^^^^^ expected `i32`, found associated type -... -LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } - | ----- required by this bound in `want_y` | = note: expected type `i32` found associated type `<T as Foo>::Y` +note: required by a bound in `want_y` + --> $DIR/associated-types-multiple-types-one-trait.rs:44:17 + | +LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } + | ^^^^^ required by this bound in `want_y` help: consider constraining the associated type `<T as Foo>::Y` to `i32` | LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T) @@ -19,12 +21,14 @@ error[E0271]: type mismatch resolving `<T as Foo>::X == u32` | LL | want_x(t); | ^^^^^^ expected `u32`, found associated type -... -LL | fn want_x<T:Foo<X=u32>>(t: &T) { } - | ----- required by this bound in `want_x` | = note: expected type `u32` found associated type `<T as Foo>::X` +note: required by a bound in `want_x` + --> $DIR/associated-types-multiple-types-one-trait.rs:42:17 + | +LL | fn want_x<T:Foo<X=u32>>(t: &T) { } + | ^^^^^ required by this bound in `want_x` help: consider constraining the associated type `<T as Foo>::X` to `u32` | LL | fn have_y_want_x<T:Foo<Y=i32, X = u32>>(t: &T) diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr index 75f0354b81a..509d548c69d 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Get` is not satisfied --> $DIR/associated-types-no-suitable-bound.rs:11:21 | -LL | trait Get { - | --------- required by this bound in `Get` -... LL | fn uhoh<T>(foo: <T as Get>::Value) {} | ^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | +note: required by a bound in `Get` + --> $DIR/associated-types-no-suitable-bound.rs:1:1 + | +LL | trait Get { + | ^^^^^^^^^ required by this bound in `Get` help: consider restricting type parameter `T` | LL | fn uhoh<T: Get>(foo: <T as Get>::Value) {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr index a432805ced8..1cb9ac8fdef 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Get` is not satisfied --> $DIR/associated-types-no-suitable-supertrait-2.rs:17:40 | -LL | trait Get { - | --------- required by this bound in `Get` -... LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | +note: required by a bound in `Get` + --> $DIR/associated-types-no-suitable-supertrait-2.rs:12:1 + | +LL | trait Get { + | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr index 10b2ab5e974..e3185fbe939 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Get` is not satisfied --> $DIR/associated-types-no-suitable-supertrait.rs:17:40 | -LL | trait Get { - | --------- required by this bound in `Get` -... LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | +note: required by a bound in `Get` + --> $DIR/associated-types-no-suitable-supertrait.rs:12:1 + | +LL | trait Get { + | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} @@ -15,11 +17,14 @@ LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Ge error[E0277]: the trait bound `(T, U): Get` is not satisfied --> $DIR/associated-types-no-suitable-supertrait.rs:22:40 | -LL | trait Get { - | --------- required by this bound in `Get` -... LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` + | +note: required by a bound in `Get` + --> $DIR/associated-types-no-suitable-supertrait.rs:12:1 + | +LL | trait Get { + | ^^^^^^^^^ required by this bound in `Get` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index 87612679af6..dc087e4185f 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -1,18 +1,26 @@ error[E0284]: type annotations needed: cannot satisfy `<Self as Iterator>::Item == i32` --> $DIR/associated-types-overridden-binding.rs:4:12 | -LL | trait Foo: Iterator<Item = i32> {} - | ---------- required by this bound in `Foo` LL | trait Bar: Foo<Item = u32> {} | ^^^^^^^^^^^^^^^ cannot satisfy `<Self as Iterator>::Item == i32` + | +note: required by a bound in `Foo` + --> $DIR/associated-types-overridden-binding.rs:3:21 + | +LL | trait Foo: Iterator<Item = i32> {} + | ^^^^^^^^^^ required by this bound in `Foo` error[E0284]: type annotations needed: cannot satisfy `<Self as Iterator>::Item == i32` --> $DIR/associated-types-overridden-binding.rs:7:21 | -LL | trait I32Iterator = Iterator<Item = i32>; - | ---------- required by this bound in `I32Iterator` LL | trait U32Iterator = I32Iterator<Item = u32>; | ^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Self as Iterator>::Item == i32` + | +note: required by a bound in `I32Iterator` + --> $DIR/associated-types-overridden-binding.rs:6:30 + | +LL | trait I32Iterator = Iterator<Item = i32>; + | ^^^^^^^^^^ required by this bound in `I32Iterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index 77b638b703b..c4ea4ae6bc0 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -12,11 +12,14 @@ LL | f1(2i32, 4u32); error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:29:5 | -LL | pub fn f1<T: Foo>(a: T, x: T::A) {} - | --- required by this bound in `f1` -... LL | f1(2u32, 4u32); | ^^ the trait `Foo` is not implemented for `u32` + | +note: required by a bound in `f1` + --> $DIR/associated-types-path-2.rs:13:14 + | +LL | pub fn f1<T: Foo>(a: T, x: T::A) {} + | ^^^ required by this bound in `f1` error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:29:5 @@ -27,11 +30,14 @@ LL | f1(2u32, 4u32); error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:35:5 | -LL | pub fn f1<T: Foo>(a: T, x: T::A) {} - | --- required by this bound in `f1` -... LL | f1(2u32, 4i32); | ^^ the trait `Foo` is not implemented for `u32` + | +note: required by a bound in `f1` + --> $DIR/associated-types-path-2.rs:13:14 + | +LL | pub fn f1<T: Foo>(a: T, x: T::A) {} + | ^^^ required by this bound in `f1` error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:35:5 diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr index 7bbf060fdb6..09ec0e11617 100644 --- a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr +++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Get` is not satisfied --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:10:40 | -LL | trait Get { - | --------- required by this bound in `Get` -... LL | fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value); | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | +note: required by a bound in `Get` + --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:5:1 + | +LL | trait Get { + | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get; diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index 7023516e37f..8a8211ff858 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -2,33 +2,41 @@ error[E0277]: the trait bound `NotClone: Clone` is not satisfied --> $DIR/defaults-suitability.rs:13:5 | LL | type Ty: Clone = NotClone; - | ^^^^^^^^^-----^^^^^^^^^^^^ - | | | - | | required by this bound in `Tr::Ty` - | the trait `Clone` is not implemented for `NotClone` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NotClone` + | +note: required by a bound in `Tr::Ty` + --> $DIR/defaults-suitability.rs:13:14 + | +LL | type Ty: Clone = NotClone; + | ^^^^^ required by this bound in `Tr::Ty` error[E0277]: the trait bound `NotClone: Clone` is not satisfied --> $DIR/defaults-suitability.rs:22:5 | +LL | type Ty = NotClone; + | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NotClone` + | +note: required by a bound in `Tr2::Ty` + --> $DIR/defaults-suitability.rs:20:15 + | LL | Self::Ty: Clone, - | ----- required by this bound in `Tr2::Ty` + | ^^^^^ required by this bound in `Tr2::Ty` LL | { LL | type Ty = NotClone; - | ^^^^^--^^^^^^^^^^^^ - | | | - | | required by a bound in this - | the trait `Clone` is not implemented for `NotClone` + | -- required by a bound in this error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/defaults-suitability.rs:28:5 | LL | type Bar: Clone = Vec<T>; - | ^^^^^^^^^^-----^^^^^^^^^^ - | | | - | | required by this bound in `Foo::Bar` - | the trait `Clone` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `T` | = note: required because of the requirements on the impl of `Clone` for `Vec<T>` +note: required by a bound in `Foo::Bar` + --> $DIR/defaults-suitability.rs:28:15 + | +LL | type Bar: Clone = Vec<T>; + | ^^^^^ required by this bound in `Foo::Bar` help: consider restricting type parameter `T` | LL | trait Foo<T: std::clone::Clone> { @@ -38,33 +46,41 @@ error[E0277]: the trait bound `(): Foo<Self>` is not satisfied --> $DIR/defaults-suitability.rs:34:5 | LL | type Assoc: Foo<Self> = (); - | ^^^^^^^^^^^^---------^^^^^^ - | | | - | | required by this bound in `Bar::Assoc` - | the trait `Foo<Self>` is not implemented for `()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<Self>` is not implemented for `()` + | +note: required by a bound in `Bar::Assoc` + --> $DIR/defaults-suitability.rs:34:17 + | +LL | type Assoc: Foo<Self> = (); + | ^^^^^^^^^ required by this bound in `Bar::Assoc` error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied --> $DIR/defaults-suitability.rs:56:5 | +LL | type Assoc = NotClone; + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `IsU8<NotClone>` is not implemented for `NotClone` + | +note: required by a bound in `D::Assoc` + --> $DIR/defaults-suitability.rs:53:18 + | LL | Self::Assoc: IsU8<Self::Assoc>, - | ----------------- required by this bound in `D::Assoc` + | ^^^^^^^^^^^^^^^^^ required by this bound in `D::Assoc` ... LL | type Assoc = NotClone; - | ^^^^^-----^^^^^^^^^^^^ - | | | - | | required by a bound in this - | the trait `IsU8<NotClone>` is not implemented for `NotClone` + | ----- required by a bound in this error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:65:5 | LL | type Bar: Clone = Vec<Self::Baz>; - | ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `Foo2::Bar` - | the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz` | = note: required because of the requirements on the impl of `Clone` for `Vec<<Self as Foo2<T>>::Baz>` +note: required by a bound in `Foo2::Bar` + --> $DIR/defaults-suitability.rs:65:15 + | +LL | type Bar: Clone = Vec<Self::Baz>; + | ^^^^^ required by this bound in `Foo2::Bar` help: consider further restricting the associated type | LL | trait Foo2<T> where <Self as Foo2<T>>::Baz: Clone { @@ -74,12 +90,14 @@ error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:74:5 | LL | type Bar: Clone = Vec<Self::Baz>; - | ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `Foo25::Bar` - | the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz` | = note: required because of the requirements on the impl of `Clone` for `Vec<<Self as Foo25<T>>::Baz>` +note: required by a bound in `Foo25::Bar` + --> $DIR/defaults-suitability.rs:74:15 + | +LL | type Bar: Clone = Vec<Self::Baz>; + | ^^^^^ required by this bound in `Foo25::Bar` help: consider further restricting the associated type | LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: Clone { @@ -88,15 +106,17 @@ LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: Clone { error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/defaults-suitability.rs:87:5 | +LL | type Baz = T; + | ^^^^^^^^^^^^^ the trait `Clone` is not implemented for `T` + | +note: required by a bound in `Foo3::Baz` + --> $DIR/defaults-suitability.rs:84:16 + | LL | Self::Baz: Clone, - | ----- required by this bound in `Foo3::Baz` + | ^^^^^ required by this bound in `Foo3::Baz` ... LL | type Baz = T; - | ^^^^^---^^^^^ - | | | - | | required by a bound in this - | the trait `Clone` is not implemented for `T` - | + | --- required by a bound in this help: consider further restricting type parameter `T` | LL | Self::Baz: Clone, T: std::clone::Clone diff --git a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr index 3449272238c..b21cae311a0 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr @@ -2,12 +2,14 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display` --> $DIR/defaults-unsound-62211-1.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | `Self` cannot be formatted with the default formatter + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Self` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:20:86 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + std::fmt::Display { @@ -17,11 +19,13 @@ error[E0277]: cannot add-assign `&'static str` to `Self` --> $DIR/defaults-unsound-62211-1.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | no implementation for `Self += &'static str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str` | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:20:47 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { @@ -31,11 +35,13 @@ error[E0277]: the trait bound `Self: Deref` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^^^^^^^^-------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | the trait `Deref` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Deref` is not implemented for `Self` | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:20:25 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + Deref { @@ -45,11 +51,13 @@ error[E0277]: the trait bound `Self: Copy` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | the trait `Copy` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Self` | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:20:18 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + Copy { diff --git a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr index 3b86c534d58..2eebfb0a487 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr @@ -2,12 +2,14 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display` --> $DIR/defaults-unsound-62211-2.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | `Self` cannot be formatted with the default formatter + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Self` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:20:86 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + std::fmt::Display { @@ -17,11 +19,13 @@ error[E0277]: cannot add-assign `&'static str` to `Self` --> $DIR/defaults-unsound-62211-2.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | no implementation for `Self += &'static str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str` | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:20:47 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { @@ -31,11 +35,13 @@ error[E0277]: the trait bound `Self: Deref` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^^^^^^^^-------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | the trait `Deref` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Deref` is not implemented for `Self` | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:20:25 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + Deref { @@ -45,11 +51,13 @@ error[E0277]: the trait bound `Self: Copy` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:20:5 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - | ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `UncheckedCopy::Output` - | the trait `Copy` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Self` | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:20:18 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ required by this bound in `UncheckedCopy::Output` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + Copy { diff --git a/src/test/ui/associated-types/defaults-wf.stderr b/src/test/ui/associated-types/defaults-wf.stderr index e837150c05d..8455f88f18e 100644 --- a/src/test/ui/associated-types/defaults-wf.stderr +++ b/src/test/ui/associated-types/defaults-wf.stderr @@ -4,12 +4,12 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | type Ty = Vec<[u8]>; | ^^^^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | - required by this bound in `Vec` - | - = help: the trait `Sized` is not implemented for `[u8]` + | ^ required by this bound in `Vec` error: aborting due to previous error diff --git a/src/test/ui/associated-types/higher-ranked-projection.bad.nll.stderr b/src/test/ui/associated-types/higher-ranked-projection.bad.nll.stderr index 2e03986a9ed..59e27cd2e7d 100644 --- a/src/test/ui/associated-types/higher-ranked-projection.bad.nll.stderr +++ b/src/test/ui/associated-types/higher-ranked-projection.bad.nll.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/higher-ranked-projection.rs:25:5 | LL | foo(()); - | ^^^^^^^ + | ^^^^^^^ one type is more general than the other + | + = note: expected type `&'a ()` + found reference `&()` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/associated-types/hr-associated-type-bound-1.stderr b/src/test/ui/associated-types/hr-associated-type-bound-1.stderr index 042223f3e95..0bcc9be5c43 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-1.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-1.stderr @@ -1,17 +1,19 @@ error[E0277]: the trait bound `for<'b> <i32 as X<'b>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-1.rs:12:14 | -LL | trait X<'a> - | - required by a bound in this -LL | where -LL | for<'b> <Self as X<'b>>::U: Clone, - | ----- required by this bound in `X` -... LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<i32 as X<'b>>::U` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-1.rs:3:33 + | +LL | trait X<'a> + | - required by a bound in this +LL | where +LL | for<'b> <Self as X<'b>>::U: Clone, + | ^^^^^ required by this bound in `X` error: aborting due to previous error diff --git a/src/test/ui/associated-types/hr-associated-type-bound-object.stderr b/src/test/ui/associated-types/hr-associated-type-bound-object.stderr index 848924bf58e..354f5ae4597 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-object.stderr @@ -1,17 +1,19 @@ error[E0277]: the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-object.rs:7:13 | -LL | trait X<'a> - | - required by a bound in this -LL | where -LL | for<'b> <Self as X<'b>>::U: Clone, - | ----- required by this bound in `X` -... LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) { | ^^^^^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-object.rs:3:33 + | +LL | trait X<'a> + | - required by a bound in this +LL | where +LL | for<'b> <Self as X<'b>>::U: Clone, + | ^^^^^ required by this bound in `X` error: aborting due to previous error diff --git a/src/test/ui/associated-types/hr-associated-type-bound-param-1.stderr b/src/test/ui/associated-types/hr-associated-type-bound-param-1.stderr index d35c1279264..e16931ee09f 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-param-1.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-param-1.stderr @@ -1,17 +1,19 @@ error[E0277]: the trait bound `for<'b> <u8 as Y<'b, u8>>::V: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-1.rs:14:14 | -LL | trait Y<'a, T: ?Sized> - | - required by a bound in this -... -LL | for<'b> <Self as Y<'b, T>>::V: Clone, - | ----- required by this bound in `Y` -... LL | type V = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<u8 as Y<'b, u8>>::V` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `Y` + --> $DIR/hr-associated-type-bound-param-1.rs:4:36 + | +LL | trait Y<'a, T: ?Sized> + | - required by a bound in this +... +LL | for<'b> <Self as Y<'b, T>>::V: Clone, + | ^^^^^ required by this bound in `Y` error: aborting due to previous error diff --git a/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr b/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr index 853705dae09..0c9f2a3978c 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -1,47 +1,53 @@ error[E0277]: the trait bound `for<'b> <u16 as Z<'b, u16>>::W: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-2.rs:4:8 | -LL | trait Z<'a, T: ?Sized> - | - required by a bound in this -LL | where LL | T: Z<'a, u16>, | ^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `<u16 as Z<'b, u16>>::W` -... -LL | for<'b> <T as Z<'b, u16>>::W: Clone, - | ----- required by this bound in `Z` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `Z` + --> $DIR/hr-associated-type-bound-param-2.rs:7:35 + | +LL | trait Z<'a, T: ?Sized> + | - required by a bound in this +... +LL | for<'b> <T as Z<'b, u16>>::W: Clone, + | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `for<'b> <u16 as Z<'b, u16>>::W: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-2.rs:4:8 | -LL | trait Z<'a, T: ?Sized> - | - required by a bound in this -LL | where LL | T: Z<'a, u16>, | ^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `<u16 as Z<'b, u16>>::W` -... -LL | for<'b> <T as Z<'b, u16>>::W: Clone, - | ----- required by this bound in `Z` | = help: the following implementations were found: <&T as Clone> - -error[E0277]: the trait bound `for<'b> <u16 as Z<'b, u16>>::W: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:16:14 +note: required by a bound in `Z` + --> $DIR/hr-associated-type-bound-param-2.rs:7:35 | LL | trait Z<'a, T: ?Sized> | - required by a bound in this ... LL | for<'b> <T as Z<'b, u16>>::W: Clone, - | ----- required by this bound in `Z` -... + | ^^^^^ required by this bound in `Z` + +error[E0277]: the trait bound `for<'b> <u16 as Z<'b, u16>>::W: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-2.rs:16:14 + | LL | type W = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<u16 as Z<'b, u16>>::W` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `Z` + --> $DIR/hr-associated-type-bound-param-2.rs:7:35 + | +LL | trait Z<'a, T: ?Sized> + | - required by a bound in this +... +LL | for<'b> <T as Z<'b, u16>>::W: Clone, + | ^^^^^ required by this bound in `Z` error: aborting due to 3 previous errors diff --git a/src/test/ui/associated-types/hr-associated-type-bound-param-3.stderr b/src/test/ui/associated-types/hr-associated-type-bound-param-3.stderr index 79e1e00e98d..b1bc1dfbb11 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-param-3.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-param-3.stderr @@ -1,17 +1,19 @@ error[E0277]: the trait bound `for<'b> <(T,) as X<'b, (T,)>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-3.rs:13:14 | -LL | trait X<'a, T> - | - required by a bound in this -... -LL | for<'b> <T as X<'b, T>>::U: Clone, - | ----- required by this bound in `X` -... LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<(T,) as X<'b, (T,)>>::U` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-3.rs:4:33 + | +LL | trait X<'a, T> + | - required by a bound in this +... +LL | for<'b> <T as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X` error: aborting due to previous error diff --git a/src/test/ui/associated-types/hr-associated-type-bound-param-4.stderr b/src/test/ui/associated-types/hr-associated-type-bound-param-4.stderr index e23ac5f5650..0bd404f8a41 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-param-4.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-param-4.stderr @@ -1,17 +1,19 @@ error[E0277]: the trait bound `for<'b> <(T,) as X<'b, T>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-4.rs:13:14 | -LL | trait X<'a, T> - | - required by a bound in this -... -LL | for<'b> <(T,) as X<'b, T>>::U: Clone, - | ----- required by this bound in `X` -... LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<(T,) as X<'b, T>>::U` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-4.rs:4:36 + | +LL | trait X<'a, T> + | - required by a bound in this +... +LL | for<'b> <(T,) as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X` error: aborting due to previous error diff --git a/src/test/ui/associated-types/hr-associated-type-bound-param-5.stderr b/src/test/ui/associated-types/hr-associated-type-bound-param-5.stderr index 38909be59f2..59c0a7268cc 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-param-5.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-param-5.stderr @@ -1,62 +1,70 @@ error[E0277]: the trait bound `for<'b> <Box<T> as X<'b, Box<T>>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-5.rs:27:14 | -LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> - | - required by a bound in this -... -LL | for<'b> <T::Next as X<'b, T::Next>>::U: Clone, - | ----- required by this bound in `X` -... LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<Box<T> as X<'b, Box<T>>>::U` | = help: the following implementations were found: <&T as Clone> - -error[E0277]: the trait bound `for<'b> <Vec<T> as X<'b, Vec<T>>>::U: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-5.rs:27:14 +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-5.rs:18:45 | LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> | - required by a bound in this -LL | where -LL | for<'b> <T as X<'b, T>>::U: Clone, - | ----- required by this bound in `X` ... +LL | for<'b> <T::Next as X<'b, T::Next>>::U: Clone, + | ^^^^^ required by this bound in `X` + +error[E0277]: the trait bound `for<'b> <Vec<T> as X<'b, Vec<T>>>::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-5.rs:27:14 + | LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<Vec<T> as X<'b, Vec<T>>>::U` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-5.rs:16:33 + | +LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> + | - required by a bound in this +LL | where +LL | for<'b> <T as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X` error[E0277]: the trait bound `for<'b> <Vec<T> as X<'b, Vec<T>>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-5.rs:33:14 | -LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> - | - required by a bound in this -... -LL | for<'b> <T::Next as X<'b, T::Next>>::U: Clone, - | ----- required by this bound in `X` -... LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<Vec<T> as X<'b, Vec<T>>>::U` | = help: the following implementations were found: <&T as Clone> - -error[E0277]: the trait bound `for<'b> <Box<T> as X<'b, Box<T>>>::U: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-5.rs:33:14 +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-5.rs:18:45 | LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> | - required by a bound in this -LL | where -LL | for<'b> <T as X<'b, T>>::U: Clone, - | ----- required by this bound in `X` ... +LL | for<'b> <T::Next as X<'b, T::Next>>::U: Clone, + | ^^^^^ required by this bound in `X` + +error[E0277]: the trait bound `for<'b> <Box<T> as X<'b, Box<T>>>::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-5.rs:33:14 + | LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<Box<T> as X<'b, Box<T>>>::U` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-5.rs:16:33 + | +LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> + | - required by a bound in this +LL | where +LL | for<'b> <T as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X` error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/hr-associated-type-bound-param-6.stderr b/src/test/ui/associated-types/hr-associated-type-bound-param-6.stderr index 22bc0281d34..bce5737af1b 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-param-6.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-param-6.stderr @@ -1,30 +1,34 @@ error[E0277]: the trait bound `for<'b> <T as X<'b, T>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-6.rs:14:14 | -LL | trait X<'a, T> - | - required by a bound in this -... -LL | for<'b> <T as X<'b, T>>::U: Clone, - | ----- required by this bound in `X` -... LL | type U = str; | ^^^ the trait `for<'b> Clone` is not implemented for `<T as X<'b, T>>::U` | = help: the following implementations were found: <&T as Clone> +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-6.rs:4:33 + | +LL | trait X<'a, T> + | - required by a bound in this +... +LL | for<'b> <T as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X` error[E0277]: the trait bound `for<'b> T: X<'b, T>` is not satisfied --> $DIR/hr-associated-type-bound-param-6.rs:12:12 | +LL | impl<S, T> X<'_, T> for (S,) { + | ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T` + | +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-6.rs:3:16 + | LL | trait X<'a, T> | - required by a bound in this LL | where LL | for<'b> T: X<'b, T>, - | -------- required by this bound in `X` -... -LL | impl<S, T> X<'_, T> for (S,) { - | ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T` - | + | ^^^^^^^^ required by this bound in `X` help: consider restricting type parameter `T` | LL | impl<S, T: for<'b> X<'b, T>> X<'_, T> for (S,) { diff --git a/src/test/ui/associated-types/hr-associated-type-projection-1.stderr b/src/test/ui/associated-types/hr-associated-type-projection-1.stderr index 149279e417c..20d7a206754 100644 --- a/src/test/ui/associated-types/hr-associated-type-projection-1.stderr +++ b/src/test/ui/associated-types/hr-associated-type-projection-1.stderr @@ -1,18 +1,20 @@ error[E0277]: the trait bound `for<'b> <T as UnsafeCopy<'b, T>>::Item: Deref` is not satisfied --> $DIR/hr-associated-type-projection-1.rs:15:17 | -LL | trait UnsafeCopy<'a, T: Copy> - | ---------- required by a bound in this -LL | where -LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>, - | --------------------------- required by this bound in `UnsafeCopy` -... LL | type Item = T; | ^ the trait `for<'b> Deref` is not implemented for `<T as UnsafeCopy<'b, T>>::Item` | = help: the following implementations were found: <&T as Deref> <&mut T as Deref> +note: required by a bound in `UnsafeCopy` + --> $DIR/hr-associated-type-projection-1.rs:3:48 + | +LL | trait UnsafeCopy<'a, T: Copy> + | ---------- required by a bound in this +LL | where +LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UnsafeCopy` error[E0277]: the trait bound `for<'b> <T as UnsafeCopy<'b, T>>::Item: Deref` is not satisfied --> $DIR/hr-associated-type-projection-1.rs:13:33 diff --git a/src/test/ui/associated-types/issue-20005.stderr b/src/test/ui/associated-types/issue-20005.stderr index 1f14b5bb787..c8e57df0d9f 100644 --- a/src/test/ui/associated-types/issue-20005.stderr +++ b/src/test/ui/associated-types/issue-20005.stderr @@ -1,12 +1,14 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-20005.rs:10:49 | -LL | trait From<Src> { - | --- required by this bound in `From` -... LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> { | ^^^^^^^^^^ doesn't have a size known at compile-time | +note: required by a bound in `From` + --> $DIR/issue-20005.rs:1:12 + | +LL | trait From<Src> { + | ^^^ required by this bound in `From` help: consider further restricting `Self` | LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self>, Self: Sized { diff --git a/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr index 2bb8398c93e..e36572740f6 100644 --- a/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr +++ b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/issue-27675-unchecked-bounds.rs:15:31 | -LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From { - | ----- required by this bound in `copy` -... LL | copy::<dyn Setup<From=T>>(t) | ^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `copy` + --> $DIR/issue-27675-unchecked-bounds.rs:10:12 + | +LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From { + | ^^^^^ required by this bound in `copy` help: consider restricting type parameter `T` | LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T { diff --git a/src/test/ui/associated-types/issue-43784-associated-type.stderr b/src/test/ui/associated-types/issue-43784-associated-type.stderr index c5e0cbc8a4a..a3ed1c1fe74 100644 --- a/src/test/ui/associated-types/issue-43784-associated-type.stderr +++ b/src/test/ui/associated-types/issue-43784-associated-type.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/issue-43784-associated-type.rs:14:5 | -LL | type Assoc: Partial<Self>; - | ------------- required by this bound in `Complete::Assoc` -... LL | type Assoc = T; | ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `Complete::Assoc` + --> $DIR/issue-43784-associated-type.rs:5:17 + | +LL | type Assoc: Partial<Self>; + | ^^^^^^^^^^^^^ required by this bound in `Complete::Assoc` help: consider restricting type parameter `T` | LL | impl<T: std::marker::Copy> Complete for T { diff --git a/src/test/ui/associated-types/issue-43924.stderr b/src/test/ui/associated-types/issue-43924.stderr index 8d4ecac7502..b7fbf893bb0 100644 --- a/src/test/ui/associated-types/issue-43924.stderr +++ b/src/test/ui/associated-types/issue-43924.stderr @@ -2,10 +2,13 @@ error[E0277]: the trait bound `(dyn ToString + 'static): Default` is not satisfi --> $DIR/issue-43924.rs:7:5 | LL | type Out: Default + ToString + ?Sized = dyn ToString; - | ^^^^^^^^^^-------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | required by this bound in `Foo::Out` - | the trait `Default` is not implemented for `(dyn ToString + 'static)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `(dyn ToString + 'static)` + | +note: required by a bound in `Foo::Out` + --> $DIR/issue-43924.rs:7:15 + | +LL | type Out: Default + ToString + ?Sized = dyn ToString; + | ^^^^^^^ required by this bound in `Foo::Out` error[E0599]: no function or associated item named `default` found for trait object `(dyn ToString + 'static)` in the current scope --> $DIR/issue-43924.rs:14:39 diff --git a/src/test/ui/associated-types/issue-54108.stderr b/src/test/ui/associated-types/issue-54108.stderr index 84012e651df..70e688ba773 100644 --- a/src/test/ui/associated-types/issue-54108.stderr +++ b/src/test/ui/associated-types/issue-54108.stderr @@ -1,13 +1,15 @@ error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize` --> $DIR/issue-54108.rs:19:5 | -LL | type Size: Add<Output = Self::Size>; - | ------------------------ required by this bound in `Encoder::Size` -... LL | type Size = <Self as SubEncoder>::ActualSize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `<T as SubEncoder>::ActualSize + <T as SubEncoder>::ActualSize` | = help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize` +note: required by a bound in `Encoder::Size` + --> $DIR/issue-54108.rs:4:16 + | +LL | type Size: Add<Output = Self::Size>; + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` help: consider further restricting the associated type | LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add diff --git a/src/test/ui/associated-types/issue-63593.stderr b/src/test/ui/associated-types/issue-63593.stderr index 59637367604..70449b0c035 100644 --- a/src/test/ui/associated-types/issue-63593.stderr +++ b/src/test/ui/associated-types/issue-63593.stderr @@ -2,11 +2,13 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation --> $DIR/issue-63593.rs:9:5 | LL | type This = Self; - | ^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by this bound in `MyTrait::This` + | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | +note: required by a bound in `MyTrait::This` + --> $DIR/issue-63593.rs:9:5 + | +LL | type This = Self; + | ^^^^^^^^^^^^^^^^^ required by this bound in `MyTrait::This` help: consider further restricting `Self` | LL | trait MyTrait: Sized { diff --git a/src/test/ui/associated-types/issue-65774-1.stderr b/src/test/ui/associated-types/issue-65774-1.stderr index fc020e40b5a..abe1b76116e 100644 --- a/src/test/ui/associated-types/issue-65774-1.stderr +++ b/src/test/ui/associated-types/issue-65774-1.stderr @@ -2,10 +2,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:10:5 | LL | type MpuConfig: MyDisplay = T; - | ^^^^^^^^^^^^^^^^---------^^^^^ - | | | - | | required by this bound in `MPU::MpuConfig` - | the trait `MyDisplay` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyDisplay` is not implemented for `T` + | +note: required by a bound in `MPU::MpuConfig` + --> $DIR/issue-65774-1.rs:10:21 + | +LL | type MpuConfig: MyDisplay = T; + | ^^^^^^^^^ required by this bound in `MPU::MpuConfig` error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:44:76 diff --git a/src/test/ui/associated-types/issue-65774-2.stderr b/src/test/ui/associated-types/issue-65774-2.stderr index 572a9cf1909..9393cd4c0c3 100644 --- a/src/test/ui/associated-types/issue-65774-2.stderr +++ b/src/test/ui/associated-types/issue-65774-2.stderr @@ -2,10 +2,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-2.rs:10:5 | LL | type MpuConfig: MyDisplay = T; - | ^^^^^^^^^^^^^^^^---------^^^^^ - | | | - | | required by this bound in `MPU::MpuConfig` - | the trait `MyDisplay` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyDisplay` is not implemented for `T` + | +note: required by a bound in `MPU::MpuConfig` + --> $DIR/issue-65774-2.rs:10:21 + | +LL | type MpuConfig: MyDisplay = T; + | ^^^^^^^^^ required by this bound in `MPU::MpuConfig` error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-2.rs:39:25 diff --git a/src/test/ui/associated-types/issue-72806.stderr b/src/test/ui/associated-types/issue-72806.stderr index 23fabbee1c5..ea98e21d72f 100644 --- a/src/test/ui/associated-types/issue-72806.stderr +++ b/src/test/ui/associated-types/issue-72806.stderr @@ -1,11 +1,14 @@ error[E0271]: type mismatch resolving `<Foo2 as Bar2>::Ok == char` --> $DIR/issue-72806.rs:14:5 | -LL | type Sibling: Bar2<Ok=char>; - | ------- required by this bound in `Bar::Sibling` -... LL | type Sibling = Foo2; | ^^^^^^^^^^^^^^^^^^^^ expected `char`, found `u32` + | +note: required by a bound in `Bar::Sibling` + --> $DIR/issue-72806.rs:3:24 + | +LL | type Sibling: Bar2<Ok=char>; + | ^^^^^^^ required by this bound in `Bar::Sibling` error: aborting due to previous error diff --git a/src/test/ui/associated-types/issue-87261.stderr b/src/test/ui/associated-types/issue-87261.stderr index 780ef118d1c..b85d64b86ae 100644 --- a/src/test/ui/associated-types/issue-87261.stderr +++ b/src/test/ui/associated-types/issue-87261.stderr @@ -1,14 +1,16 @@ error[E0271]: type mismatch resolving `<A as Trait>::Associated == ()` --> $DIR/issue-87261.rs:56:5 | -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(a); | ^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<A as Trait>::Associated` +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` help: consider constraining the associated type `<A as Trait>::Associated` to `()` | LL | A: Trait<Associated = ()> + 'static, @@ -17,9 +19,6 @@ LL | A: Trait<Associated = ()> + 'static, error[E0271]: type mismatch resolving `<B as Trait>::Associated == ()` --> $DIR/issue-87261.rs:59:5 | -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(b); | ^^^^^^^^^^^^^ expected `()`, found associated type | @@ -27,18 +26,25 @@ LL | accepts_trait(b); found associated type `<B as Trait>::Associated` = help: consider constraining the associated type `<B as Trait>::Associated` to `()` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` error[E0271]: type mismatch resolving `<C as Trait>::Associated == ()` --> $DIR/issue-87261.rs:62:5 | -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(c); | ^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<C as Trait>::Associated` +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` help: consider constraining the associated type `<C as Trait>::Associated` to `()` | LL | C: Trait<Associated = ()> + Foo, @@ -47,9 +53,6 @@ LL | C: Trait<Associated = ()> + Foo, error[E0271]: type mismatch resolving `<D as Trait>::Associated == ()` --> $DIR/issue-87261.rs:65:5 | -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(d); | ^^^^^^^^^^^^^ expected `()`, found associated type | @@ -57,18 +60,25 @@ LL | accepts_trait(d); found associated type `<D as Trait>::Associated` = help: consider constraining the associated type `<D as Trait>::Associated` to `()` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` error[E0271]: type mismatch resolving `<E as GenericTrait<()>>::Associated == ()` --> $DIR/issue-87261.rs:68:5 | -LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_generic_trait` -... LL | accepts_generic_trait(e); | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<E as GenericTrait<()>>::Associated` +note: required by a bound in `accepts_generic_trait` + --> $DIR/issue-87261.rs:44:46 + | +LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` help: consider constraining the associated type `<E as GenericTrait<()>>::Associated` to `()` | LL | E: GenericTrait<(), Associated = ()> + 'static, @@ -77,14 +87,16 @@ LL | E: GenericTrait<(), Associated = ()> + 'static, error[E0271]: type mismatch resolving `<F as GenericTrait<()>>::Associated == ()` --> $DIR/issue-87261.rs:71:5 | -LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_generic_trait` -... LL | accepts_generic_trait(f); | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<F as GenericTrait<()>>::Associated` +note: required by a bound in `accepts_generic_trait` + --> $DIR/issue-87261.rs:44:46 + | +LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` help: consider constraining the associated type `<F as GenericTrait<()>>::Associated` to `()` | LL | F: GenericTrait<(), Associated = ()> + Foo, @@ -93,9 +105,6 @@ LL | F: GenericTrait<(), Associated = ()> + Foo, error[E0271]: type mismatch resolving `<G as GenericTrait<()>>::Associated == ()` --> $DIR/issue-87261.rs:74:5 | -LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_generic_trait` -... LL | accepts_generic_trait(g); | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type | @@ -103,6 +112,11 @@ LL | accepts_generic_trait(g); found associated type `<G as GenericTrait<()>>::Associated` = help: consider constraining the associated type `<G as GenericTrait<()>>::Associated` to `()` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `accepts_generic_trait` + --> $DIR/issue-87261.rs:44:46 + | +LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` error[E0271]: type mismatch resolving `<impl Trait as Trait>::Associated == ()` --> $DIR/issue-87261.rs:79:5 @@ -110,14 +124,16 @@ error[E0271]: type mismatch resolving `<impl Trait as Trait>::Associated == ()` LL | fn returns_opaque() -> impl Trait + 'static { | -------------------- the found opaque type ... -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(returns_opaque()); | ^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<impl Trait as Trait>::Associated` +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` help: consider constraining the associated type `<impl Trait as Trait>::Associated` to `()` | LL | fn returns_opaque() -> impl Trait<Associated = ()> + 'static { @@ -129,14 +145,16 @@ error[E0271]: type mismatch resolving `<impl DerivedTrait as Trait>::Associated LL | fn returns_opaque_derived() -> impl DerivedTrait + 'static { | --------------------------- the found opaque type ... -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(returns_opaque_derived()); | ^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<impl DerivedTrait as Trait>::Associated` +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` help: consider constraining the associated type `<impl DerivedTrait as Trait>::Associated` to `()` | LL | fn returns_opaque_derived() -> impl DerivedTrait<Associated = ()> + 'static { @@ -148,14 +166,16 @@ error[E0271]: type mismatch resolving `<impl Trait+Foo as Trait>::Associated == LL | fn returns_opaque_foo() -> impl Trait + Foo { | ---------------- the found opaque type ... -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(returns_opaque_foo()); | ^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<impl Trait+Foo as Trait>::Associated` +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` help: consider constraining the associated type `<impl Trait+Foo as Trait>::Associated` to `()` | LL | fn returns_opaque_foo() -> impl Trait<Associated = ()> + Foo { @@ -167,9 +187,6 @@ error[E0271]: type mismatch resolving `<impl DerivedTrait+Foo as Trait>::Associa LL | fn returns_opaque_derived_foo() -> impl DerivedTrait + Foo { | ----------------------- the found opaque type ... -LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_trait` -... LL | accepts_trait(returns_opaque_derived_foo()); | ^^^^^^^^^^^^^ expected `()`, found associated type | @@ -177,6 +194,11 @@ LL | accepts_trait(returns_opaque_derived_foo()); found associated type `<impl DerivedTrait+Foo as Trait>::Associated` = help: consider constraining the associated type `<impl DerivedTrait+Foo as Trait>::Associated` to `()` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `accepts_trait` + --> $DIR/issue-87261.rs:43:27 + | +LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` error[E0271]: type mismatch resolving `<impl GenericTrait<()> as GenericTrait<()>>::Associated == ()` --> $DIR/issue-87261.rs:91:5 @@ -184,14 +206,16 @@ error[E0271]: type mismatch resolving `<impl GenericTrait<()> as GenericTrait<() LL | fn returns_opaque_generic() -> impl GenericTrait<()> + 'static { | ------------------------------- the found opaque type ... -LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_generic_trait` -... LL | accepts_generic_trait(returns_opaque_generic()); | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<impl GenericTrait<()> as GenericTrait<()>>::Associated` +note: required by a bound in `accepts_generic_trait` + --> $DIR/issue-87261.rs:44:46 + | +LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` help: consider constraining the associated type `<impl GenericTrait<()> as GenericTrait<()>>::Associated` to `()` | LL | fn returns_opaque_generic() -> impl GenericTrait<(), Associated = ()> + 'static { @@ -203,14 +227,16 @@ error[E0271]: type mismatch resolving `<impl GenericTrait<()>+Foo as GenericTrai LL | fn returns_opaque_generic_foo() -> impl GenericTrait<()> + Foo { | --------------------------- the found opaque type ... -LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_generic_trait` -... LL | accepts_generic_trait(returns_opaque_generic_foo()); | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated` +note: required by a bound in `accepts_generic_trait` + --> $DIR/issue-87261.rs:44:46 + | +LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` help: consider constraining the associated type `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated` to `()` | LL | fn returns_opaque_generic_foo() -> impl GenericTrait<(), Associated = ()> + Foo { @@ -222,9 +248,6 @@ error[E0271]: type mismatch resolving `<impl GenericTrait<()>+GenericTrait<u8> a LL | fn returns_opaque_generic_duplicate() -> impl GenericTrait<()> + GenericTrait<u8> { | ---------------------------------------- the found opaque type ... -LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} - | --------------- required by this bound in `accepts_generic_trait` -... LL | accepts_generic_trait(returns_opaque_generic_duplicate()); | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type | @@ -232,6 +255,11 @@ LL | accepts_generic_trait(returns_opaque_generic_duplicate()); found associated type `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated` = help: consider constraining the associated type `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated` to `()` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `accepts_generic_trait` + --> $DIR/issue-87261.rs:44:46 + | +LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {} + | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` error: aborting due to 14 previous errors diff --git a/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr b/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr index b23030d7cb5..f9406834ad7 100644 --- a/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr +++ b/src/test/ui/associated-types/point-at-type-on-obligation-failure-2.stderr @@ -1,35 +1,44 @@ error[E0277]: the trait bound `bool: Bar` is not satisfied --> $DIR/point-at-type-on-obligation-failure-2.rs:8:5 | -LL | type Assoc: Bar; - | --- required by this bound in `Foo::Assoc` -... LL | type Assoc = bool; | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` + | +note: required by a bound in `Foo::Assoc` + --> $DIR/point-at-type-on-obligation-failure-2.rs:4:17 + | +LL | type Assoc: Bar; + | ^^^ required by this bound in `Foo::Assoc` error[E0277]: the trait bound `bool: Bar` is not satisfied --> $DIR/point-at-type-on-obligation-failure-2.rs:19:5 | +LL | type Assoc = bool; + | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` + | +note: required by a bound in `Baz::Assoc` + --> $DIR/point-at-type-on-obligation-failure-2.rs:13:18 + | LL | Self::Assoc: Bar, - | --- required by this bound in `Baz::Assoc` + | ^^^ required by this bound in `Baz::Assoc` LL | { LL | type Assoc; | ----- required by a bound in this -... -LL | type Assoc = bool; - | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` error[E0277]: the trait bound `bool: Bar` is not satisfied --> $DIR/point-at-type-on-obligation-failure-2.rs:30:5 | +LL | type Assoc = bool; + | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` + | +note: required by a bound in `Bat::Assoc` + --> $DIR/point-at-type-on-obligation-failure-2.rs:24:27 + | LL | <Self as Bat>::Assoc: Bar, - | --- required by this bound in `Bat::Assoc` + | ^^^ required by this bound in `Bat::Assoc` LL | { LL | type Assoc; | ----- required by a bound in this -... -LL | type Assoc = bool; - | ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool` error: aborting due to 3 previous errors diff --git a/src/test/ui/associated-types/point-at-type-on-obligation-failure.stderr b/src/test/ui/associated-types/point-at-type-on-obligation-failure.stderr index 7417a5aa3d4..85ecba68be9 100644 --- a/src/test/ui/associated-types/point-at-type-on-obligation-failure.stderr +++ b/src/test/ui/associated-types/point-at-type-on-obligation-failure.stderr @@ -1,11 +1,14 @@ error[E0271]: type mismatch resolving `<Foo2 as Bar2>::Ok == ()` --> $DIR/point-at-type-on-obligation-failure.rs:14:5 | -LL | type Sibling: Bar2<Ok=Self::Ok>; - | ----------- required by this bound in `Bar::Sibling` -... LL | type Sibling = Foo2; | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `u32` + | +note: required by a bound in `Bar::Sibling` + --> $DIR/point-at-type-on-obligation-failure.rs:3:24 + | +LL | type Sibling: Bar2<Ok=Self::Ok>; + | ^^^^^^^^^^^ required by this bound in `Bar::Sibling` error: aborting due to previous error diff --git a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr index 529b0f76c50..558b0f5c8a3 100644 --- a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr +++ b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr @@ -4,11 +4,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> {} | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL +note: required by a bound in `Add` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | LL | pub trait Add<Rhs = Self> { - | --- required by this bound in `Add` - | + | ^^^ required by this bound in `Add` help: consider further restricting `Self` | LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> + Sized {} diff --git a/src/test/ui/async-await/async-fn-nonsend.stderr b/src/test/ui/async-await/async-fn-nonsend.stderr index cd0db4cc01a..d509ff3598b 100644 --- a/src/test/ui/async-await/async-fn-nonsend.stderr +++ b/src/test/ui/async-await/async-fn-nonsend.stderr @@ -1,9 +1,6 @@ error: future cannot be sent between threads safely --> $DIR/async-fn-nonsend.rs:49:5 | -LL | fn assert_send(_: impl Send) {} - | ---- required by this bound in `assert_send` -... LL | assert_send(local_dropped_before_await()); | ^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send` | @@ -18,13 +15,15 @@ LL | fut().await; | ^^^^^^^^^^^ await occurs here, with `x` maybe used later LL | } | - `x` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:46:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` error: future cannot be sent between threads safely --> $DIR/async-fn-nonsend.rs:51:5 | -LL | fn assert_send(_: impl Send) {} - | ---- required by this bound in `assert_send` -... LL | assert_send(non_send_temporary_in_match()); | ^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` | @@ -39,13 +38,15 @@ LL | Some(_) => fut().await, ... LL | } | - `non_send()` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:46:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` error: future cannot be sent between threads safely --> $DIR/async-fn-nonsend.rs:53:5 | -LL | fn assert_send(_: impl Send) {} - | ---- required by this bound in `assert_send` -... LL | assert_send(non_sync_with_method_call()); | ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` | @@ -61,6 +62,11 @@ LL | fut().await; LL | } LL | } | - `f` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:46:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` error: aborting due to 3 previous errors diff --git a/src/test/ui/async-await/issue-64130-1-sync.stderr b/src/test/ui/async-await/issue-64130-1-sync.stderr index ab732368001..69c7ff47456 100644 --- a/src/test/ui/async-await/issue-64130-1-sync.stderr +++ b/src/test/ui/async-await/issue-64130-1-sync.stderr @@ -1,9 +1,6 @@ error: future cannot be shared between threads safely --> $DIR/issue-64130-1-sync.rs:21:5 | -LL | fn is_sync<T: Sync>(t: T) { } - | ---- required by this bound in `is_sync` -... LL | is_sync(bar()); | ^^^^^^^ future returned by `bar` is not `Sync` | @@ -17,6 +14,11 @@ LL | baz().await; | ^^^^^^^^^^^ await occurs here, with `x` maybe used later LL | } | - `x` is later dropped here +note: required by a bound in `is_sync` + --> $DIR/issue-64130-1-sync.rs:11:15 + | +LL | fn is_sync<T: Sync>(t: T) { } + | ^^^^ required by this bound in `is_sync` error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-64130-2-send.stderr b/src/test/ui/async-await/issue-64130-2-send.stderr index 5f7440a72d2..933e9296848 100644 --- a/src/test/ui/async-await/issue-64130-2-send.stderr +++ b/src/test/ui/async-await/issue-64130-2-send.stderr @@ -1,9 +1,6 @@ error: future cannot be sent between threads safely --> $DIR/issue-64130-2-send.rs:21:5 | -LL | fn is_send<T: Send>(t: T) { } - | ---- required by this bound in `is_send` -... LL | is_send(bar()); | ^^^^^^^ future returned by `bar` is not `Send` | @@ -17,6 +14,11 @@ LL | baz().await; | ^^^^^^^^^^^ await occurs here, with `x` maybe used later LL | } | - `x` is later dropped here +note: required by a bound in `is_send` + --> $DIR/issue-64130-2-send.rs:11:15 + | +LL | fn is_send<T: Send>(t: T) { } + | ^^^^ required by this bound in `is_send` error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-64130-3-other.stderr b/src/test/ui/async-await/issue-64130-3-other.stderr index 9ffdd0524c6..ec0fdd4a555 100644 --- a/src/test/ui/async-await/issue-64130-3-other.stderr +++ b/src/test/ui/async-await/issue-64130-3-other.stderr @@ -1,9 +1,6 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future` --> $DIR/issue-64130-3-other.rs:24:5 | -LL | fn is_qux<T: Qux>(t: T) { } - | --- required by this bound in `is_qux` -LL | LL | async fn bar() { | - within this `impl Future` ... @@ -19,6 +16,11 @@ LL | baz().await; | ^^^^^^^^^^^ await occurs here, with `x` maybe used later LL | } | - `x` is later dropped here +note: required by a bound in `is_qux` + --> $DIR/issue-64130-3-other.rs:14:14 + | +LL | fn is_qux<T: Qux>(t: T) { } + | ^^^ required by this bound in `is_qux` error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-64130-non-send-future-diags.stderr b/src/test/ui/async-await/issue-64130-non-send-future-diags.stderr index 2d6615cd5d3..472fffa61b7 100644 --- a/src/test/ui/async-await/issue-64130-non-send-future-diags.stderr +++ b/src/test/ui/async-await/issue-64130-non-send-future-diags.stderr @@ -1,9 +1,6 @@ error: future cannot be sent between threads safely --> $DIR/issue-64130-non-send-future-diags.rs:21:5 | -LL | fn is_send<T: Send>(t: T) { } - | ---- required by this bound in `is_send` -... LL | is_send(foo()); | ^^^^^^^ future returned by `foo` is not `Send` | @@ -17,6 +14,11 @@ LL | baz().await; | ^^^^^^^^^^^ await occurs here, with `g` maybe used later LL | } | - `g` is later dropped here +note: required by a bound in `is_send` + --> $DIR/issue-64130-non-send-future-diags.rs:7:15 + | +LL | fn is_send<T: Send>(t: T) { } + | ^^^^ required by this bound in `is_send` error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-67252-unnamed-future.stderr b/src/test/ui/async-await/issue-67252-unnamed-future.stderr index 741623040c6..d046e2a0561 100644 --- a/src/test/ui/async-await/issue-67252-unnamed-future.stderr +++ b/src/test/ui/async-await/issue-67252-unnamed-future.stderr @@ -1,9 +1,6 @@ error: future cannot be sent between threads safely --> $DIR/issue-67252-unnamed-future.rs:18:5 | -LL | fn spawn<T: Send>(_: T) {} - | ---- required by this bound in `spawn` -... LL | spawn(async { | ^^^^^ future created by async block is not `Send` | @@ -17,6 +14,11 @@ LL | AFuture.await; | ^^^^^^^^^^^^^ await occurs here, with `_a` maybe used later LL | }); | - `_a` is later dropped here +note: required by a bound in `spawn` + --> $DIR/issue-67252-unnamed-future.rs:6:13 + | +LL | fn spawn<T: Send>(_: T) {} + | ^^^^ required by this bound in `spawn` error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr index 62a1f451a1c..6b8e49a21a6 100644 --- a/src/test/ui/async-await/issue-68112.stderr +++ b/src/test/ui/async-await/issue-68112.stderr @@ -1,9 +1,6 @@ error: future cannot be sent between threads safely --> $DIR/issue-68112.rs:34:5 | -LL | fn require_send(_: impl Send) {} - | ---- required by this bound in `require_send` -... LL | require_send(send_fut); | ^^^^^^^^^^^^ future created by async block is not `Send` | @@ -13,13 +10,15 @@ note: future is not `Send` as it awaits another future which is not `Send` | LL | let _ = non_send_fut.await; | ^^^^^^^^^^^^ await occurs here on type `impl Future`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:11:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` error: future cannot be sent between threads safely --> $DIR/issue-68112.rs:43:5 | -LL | fn require_send(_: impl Send) {} - | ---- required by this bound in `require_send` -... LL | require_send(send_fut); | ^^^^^^^^^^^^ future created by async block is not `Send` | @@ -29,13 +28,15 @@ note: future is not `Send` as it awaits another future which is not `Send` | LL | let _ = make_non_send_future1().await; | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:11:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell<i32>` cannot be shared between threads safely --> $DIR/issue-68112.rs:60:5 | -LL | fn require_send(_: impl Send) {} - | ---- required by this bound in `require_send` -... LL | require_send(send_fut); | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | @@ -50,6 +51,11 @@ LL | require_send(send_fut); = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:55:26: 59:6]` = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:55:26: 59:6]>` = note: required because it appears within the type `impl Future` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:11:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` error: aborting due to 3 previous errors diff --git a/src/test/ui/async-await/issue-71137.stderr b/src/test/ui/async-await/issue-71137.stderr index 85cc7069b60..8903c09c17f 100644 --- a/src/test/ui/async-await/issue-71137.stderr +++ b/src/test/ui/async-await/issue-71137.stderr @@ -1,9 +1,6 @@ error: future cannot be sent between threads safely --> $DIR/issue-71137.rs:20:3 | -LL | fn fake_spawn<F: Future + Send + 'static>(f: F) { } - | ---- required by this bound in `fake_spawn` -... LL | fake_spawn(wrong_mutex()); | ^^^^^^^^^^ future returned by `wrong_mutex` is not `Send` | @@ -18,6 +15,11 @@ LL | (async { "right"; }).await; LL | *guard += 1; LL | } | - `mut guard` is later dropped here +note: required by a bound in `fake_spawn` + --> $DIR/issue-71137.rs:6:27 + | +LL | fn fake_spawn<F: Future + Send + 'static>(f: F) { } + | ^^^^ required by this bound in `fake_spawn` error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-72442.stderr b/src/test/ui/async-await/issue-72442.stderr index b586207a25f..b79b6bc4492 100644 --- a/src/test/ui/async-await/issue-72442.stderr +++ b/src/test/ui/async-await/issue-72442.stderr @@ -4,10 +4,11 @@ error[E0277]: the trait bound `Option<&str>: AsRef<Path>` is not satisfied LL | let mut f = File::open(path.to_str())?; | ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>` | - ::: $SRC_DIR/std/src/fs.rs:LL:COL +note: required by a bound in `File::open` + --> $SRC_DIR/std/src/fs.rs:LL:COL | LL | pub fn open<P: AsRef<Path>>(path: P) -> io::Result<File> { - | ----------- required by this bound in `File::open` + | ^^^^^^^^^^^ required by this bound in `File::open` error: aborting due to previous error diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr index 5568dab8655..666ef851ad6 100644 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr @@ -1,9 +1,6 @@ error: future cannot be sent between threads safely --> $DIR/issue-65436-raw-ptr-not-send.rs:12:5 | -LL | fn assert_send<T: Send>(_: T) {} - | ---- required by this bound in `assert_send` -... LL | assert_send(async { | ^^^^^^^^^^^ future created by async block is not `Send` | @@ -25,6 +22,11 @@ help: consider moving this into a `let` binding to create a shorter lived borrow | LL | bar(Foo(std::ptr::null())).await; | ^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `assert_send` + --> $DIR/issue-65436-raw-ptr-not-send.rs:9:19 + | +LL | fn assert_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `assert_send` error: aborting due to previous error diff --git a/src/test/ui/async-await/issues/issue-67893.stderr b/src/test/ui/async-await/issues/issue-67893.stderr index 39e50a106ac..c4b55e6ec20 100644 --- a/src/test/ui/async-await/issues/issue-67893.stderr +++ b/src/test/ui/async-await/issues/issue-67893.stderr @@ -1,9 +1,6 @@ error[E0277]: `MutexGuard<'_, ()>` cannot be sent between threads safely --> $DIR/issue-67893.rs:9:5 | -LL | fn g(_: impl Send) {} - | ---- required by this bound in `g` -... LL | g(issue_67893::run()) | ^ `MutexGuard<'_, ()>` cannot be sent between threads safely | @@ -18,6 +15,11 @@ LL | pub async fn run() { = note: required because it appears within the type `from_generator::GenFuture<[static generator@run::{closure#0}]>` = note: required because it appears within the type `impl Future` = note: required because it appears within the type `impl Future` +note: required by a bound in `g` + --> $DIR/issue-67893.rs:6:14 + | +LL | fn g(_: impl Send) {} + | ^^^^ required by this bound in `g` error: aborting due to previous error diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr index c2eab1a33b9..7d6bf58f516 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr @@ -1,13 +1,15 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)` --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:5 | -LL | fn is_mytrait<T: MyTrait>() {} - | ------- required by this bound in `is_mytrait` -... LL | is_mytrait::<(MyS2, MyS)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` | = note: required because it appears within the type `(MyS2, MyS)` +note: required by a bound in `is_mytrait` + --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:12:18 + | +LL | fn is_mytrait<T: MyTrait>() {} + | ^^^^^^^ required by this bound in `is_mytrait` error: aborting due to previous error diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr index efb6bde1799..c575c485a85 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied --> $DIR/typeck-default-trait-impl-constituent-types.rs:21:18 | -LL | fn is_mytrait<T: MyTrait>() {} - | ------- required by this bound in `is_mytrait` -... LL | is_mytrait::<MyS2>(); | ^^^^ the trait `MyTrait` is not implemented for `MyS2` + | +note: required by a bound in `is_mytrait` + --> $DIR/typeck-default-trait-impl-constituent-types.rs:16:18 + | +LL | fn is_mytrait<T: MyTrait>() {} + | ^^^^^^^ required by this bound in `is_mytrait` error: aborting due to previous error diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-negation.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-negation.stderr index dae87bc221a..fa8dd41da23 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-negation.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-negation.stderr @@ -1,20 +1,26 @@ error[E0277]: the trait bound `ThisImplsUnsafeTrait: MyTrait` is not satisfied --> $DIR/typeck-default-trait-impl-negation.rs:22:19 | -LL | fn is_my_trait<T: MyTrait>() {} - | ------- required by this bound in `is_my_trait` -... LL | is_my_trait::<ThisImplsUnsafeTrait>(); | ^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` + | +note: required by a bound in `is_my_trait` + --> $DIR/typeck-default-trait-impl-negation.rs:17:19 + | +LL | fn is_my_trait<T: MyTrait>() {} + | ^^^^^^^ required by this bound in `is_my_trait` error[E0277]: the trait bound `ThisImplsTrait: MyUnsafeTrait` is not satisfied --> $DIR/typeck-default-trait-impl-negation.rs:25:26 | -LL | fn is_my_unsafe_trait<T: MyUnsafeTrait>() {} - | ------------- required by this bound in `is_my_unsafe_trait` -... LL | is_my_unsafe_trait::<ThisImplsTrait>(); | ^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` + | +note: required by a bound in `is_my_unsafe_trait` + --> $DIR/typeck-default-trait-impl-negation.rs:18:26 + | +LL | fn is_my_unsafe_trait<T: MyUnsafeTrait>() {} + | ^^^^^^^^^^^^^ required by this bound in `is_my_unsafe_trait` error: aborting due to 2 previous errors diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr index 5962d191292..c98925a7b1d 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr @@ -1,13 +1,15 @@ error[E0277]: the trait bound `u32: Signed` is not satisfied --> $DIR/typeck-default-trait-impl-precedence.rs:19:5 | -LL | fn is_defaulted<T:Defaulted>() { } - | --------- required by this bound in `is_defaulted` -... LL | is_defaulted::<&'static u32>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32` | = note: required because of the requirements on the impl of `Defaulted` for `&'static u32` +note: required by a bound in `is_defaulted` + --> $DIR/typeck-default-trait-impl-precedence.rs:12:19 + | +LL | fn is_defaulted<T:Defaulted>() { } + | ^^^^^^^^^ required by this bound in `is_defaulted` error: aborting due to previous error diff --git a/src/test/ui/bound-suggestions.stderr b/src/test/ui/bound-suggestions.stderr index ebad4b02356..04f233a1e87 100644 --- a/src/test/ui/bound-suggestions.stderr +++ b/src/test/ui/bound-suggestions.stderr @@ -76,11 +76,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation LL | const SIZE: usize = core::mem::size_of::<Self>(); | ^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | + | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Foo<T>: Sized { @@ -92,11 +92,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation LL | const SIZE: usize = core::mem::size_of::<Self>(); | ^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | + | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Bar: std::fmt::Display + Sized { @@ -108,11 +108,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation LL | const SIZE: usize = core::mem::size_of::<Self>(); | ^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | + | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Baz: Sized where Self: std::fmt::Display { @@ -124,11 +124,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation LL | const SIZE: usize = core::mem::size_of::<Self>(); | ^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | + | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Qux<T>: Sized where Self: std::fmt::Display { @@ -140,11 +140,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation LL | const SIZE: usize = core::mem::size_of::<Self>(); | ^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | + | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Bat<T>: std::fmt::Display + Sized { diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index d0df241f747..492316f0027 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -1,13 +1,15 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/builtin-superkinds-double-superkind.rs:6:24 | -LL | trait Foo : Send+Sync { } - | ---- required by this bound in `Foo` -LL | LL | impl <T: Sync+'static> Foo for (T,) { } | ^^^ `T` cannot be sent between threads safely | = note: required because it appears within the type `(T,)` +note: required by a bound in `Foo` + --> $DIR/builtin-superkinds-double-superkind.rs:4:13 + | +LL | trait Foo : Send+Sync { } + | ^^^^ required by this bound in `Foo` help: consider further restricting this bound | LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { } @@ -16,13 +18,15 @@ LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { } error[E0277]: `T` cannot be shared between threads safely --> $DIR/builtin-superkinds-double-superkind.rs:9:16 | -LL | trait Foo : Send+Sync { } - | ---- required by this bound in `Foo` -... LL | impl <T: Send> Foo for (T,T) { } | ^^^ `T` cannot be shared between threads safely | = note: required because it appears within the type `(T, T)` +note: required by a bound in `Foo` + --> $DIR/builtin-superkinds-double-superkind.rs:4:18 + | +LL | trait Foo : Send+Sync { } + | ^^^^ required by this bound in `Foo` help: consider further restricting this bound | LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index 8233e781d69..a46e4b2337c 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -4,16 +4,16 @@ error[E0277]: `T` cannot be sent between threads safely LL | impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely | - ::: $DIR/auxiliary/trait_superkinds_in_metadata.rs:7:58 - | -LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } - | ---- required by this bound in `RequiresRequiresShareAndSend` - | note: required because it appears within the type `X<T>` --> $DIR/builtin-superkinds-in-metadata.rs:9:8 | LL | struct X<T>(T); | ^ +note: required by a bound in `RequiresRequiresShareAndSend` + --> $DIR/auxiliary/trait_superkinds_in_metadata.rs:7:58 + | +LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } + | ^^^^ required by this bound in `RequiresRequiresShareAndSend` help: consider further restricting this bound | LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr index 0abe2052b21..9db9cbfdb91 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr @@ -1,13 +1,15 @@ error[E0277]: `Rc<i8>` cannot be sent between threads safely --> $DIR/builtin-superkinds-simple.rs:6:6 | -LL | trait Foo : Send { } - | ---- required by this bound in `Foo` -LL | LL | impl Foo for std::rc::Rc<i8> { } | ^^^ `Rc<i8>` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Rc<i8>` +note: required by a bound in `Foo` + --> $DIR/builtin-superkinds-simple.rs:4:13 + | +LL | trait Foo : Send { } + | ^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 78121ad18ed..3ec0b907d0c 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -1,12 +1,14 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/builtin-superkinds-typaram-not-send.rs:5:24 | -LL | trait Foo : Send { } - | ---- required by this bound in `Foo` -LL | LL | impl <T: Sync+'static> Foo for T { } | ^^^ `T` cannot be sent between threads safely | +note: required by a bound in `Foo` + --> $DIR/builtin-superkinds-typaram-not-send.rs:3:13 + | +LL | trait Foo : Send { } + | ^^^^ required by this bound in `Foo` help: consider further restricting this bound | LL | impl <T: Sync+'static + std::marker::Send> Foo for T { } diff --git a/src/test/ui/chalkify/chalk_initial_program.stderr b/src/test/ui/chalkify/chalk_initial_program.stderr index f2e13a6a469..f8b792ae536 100644 --- a/src/test/ui/chalkify/chalk_initial_program.stderr +++ b/src/test/ui/chalkify/chalk_initial_program.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/chalk_initial_program.rs:15:13 | -LL | fn gimme<F: Foo>() { } - | --- required by this bound in `gimme` -... LL | gimme::<f32>(); | ^^^ the trait `Foo` is not implemented for `f32` + | +note: required by a bound in `gimme` + --> $DIR/chalk_initial_program.rs:9:13 + | +LL | fn gimme<F: Foo>() { } + | ^^^ required by this bound in `gimme` error: aborting due to previous error diff --git a/src/test/ui/chalkify/generic_impls.stderr b/src/test/ui/chalkify/generic_impls.stderr index a6f5d1a6085..0c7fcd04dfd 100644 --- a/src/test/ui/chalkify/generic_impls.stderr +++ b/src/test/ui/chalkify/generic_impls.stderr @@ -1,26 +1,30 @@ error[E0277]: the trait bound `(Option<T>, f32): Foo` is not satisfied --> $DIR/generic_impls.rs:12:13 | -LL | fn gimme<F: Foo>() { } - | --- required by this bound in `gimme` -... LL | gimme::<(Option<T>, f32)>(); | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(Option<T>, f32)` | = help: the following implementations were found: <(T, u32) as Foo> +note: required by a bound in `gimme` + --> $DIR/generic_impls.rs:7:13 + | +LL | fn gimme<F: Foo>() { } + | ^^^ required by this bound in `gimme` error[E0277]: the trait bound `(i32, f32): Foo` is not satisfied --> $DIR/generic_impls.rs:17:13 | -LL | fn gimme<F: Foo>() { } - | --- required by this bound in `gimme` -... LL | gimme::<(i32, f32)>(); | ^^^^^^^^^^ the trait `Foo` is not implemented for `(i32, f32)` | = help: the following implementations were found: <(T, u32) as Foo> +note: required by a bound in `gimme` + --> $DIR/generic_impls.rs:7:13 + | +LL | fn gimme<F: Foo>() { } + | ^^^ required by this bound in `gimme` error: aborting due to 2 previous errors diff --git a/src/test/ui/chalkify/impl_wf.stderr b/src/test/ui/chalkify/impl_wf.stderr index 24c7f0d82bd..95e320726aa 100644 --- a/src/test/ui/chalkify/impl_wf.stderr +++ b/src/test/ui/chalkify/impl_wf.stderr @@ -1,22 +1,27 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/impl_wf.rs:11:6 | -LL | trait Foo: Sized { } - | ----- required by this bound in `Foo` -... LL | impl Foo for str { } | ^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` +note: required by a bound in `Foo` + --> $DIR/impl_wf.rs:3:12 + | +LL | trait Foo: Sized { } + | ^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | -LL | trait Baz<U: ?Sized> where U: Foo { } - | --- required by this bound in `Baz` -... LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` + | +note: required by a bound in `Baz` + --> $DIR/impl_wf.rs:18:31 + | +LL | trait Baz<U: ?Sized> where U: Foo { } + | ^^^ required by this bound in `Baz` error: aborting due to 2 previous errors diff --git a/src/test/ui/chalkify/impl_wf_2.stderr b/src/test/ui/chalkify/impl_wf_2.stderr index 1da2144c0a5..0aac962fdba 100644 --- a/src/test/ui/chalkify/impl_wf_2.stderr +++ b/src/test/ui/chalkify/impl_wf_2.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf_2.rs:25:5 | -LL | type Item: Foo; - | --- required by this bound in `Bar::Item` -... LL | type Item = f32; | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `f32` + | +note: required by a bound in `Bar::Item` + --> $DIR/impl_wf_2.rs:8:16 + | +LL | type Item: Foo; + | ^^^ required by this bound in `Bar::Item` error: aborting due to previous error diff --git a/src/test/ui/chalkify/type_inference.stderr b/src/test/ui/chalkify/type_inference.stderr index 91c46b95315..a4a480ac64d 100644 --- a/src/test/ui/chalkify/type_inference.stderr +++ b/src/test/ui/chalkify/type_inference.stderr @@ -1,15 +1,17 @@ error[E0277]: the trait bound `{float}: Bar` is not satisfied --> $DIR/type_inference.rs:27:14 | -LL | fn only_bar<T: Bar>(_x: T) { } - | --- required by this bound in `only_bar` -... LL | only_bar(x); | ^ the trait `Bar` is not implemented for `{float}` | = help: the following implementations were found: <i32 as Bar> <u32 as Bar> +note: required by a bound in `only_bar` + --> $DIR/type_inference.rs:12:16 + | +LL | fn only_bar<T: Bar>(_x: T) { } + | ^^^ required by this bound in `only_bar` error: aborting due to previous error diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr index 64a0b52a1fa..768dc8e12db 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr @@ -21,23 +21,33 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | = help: consider replacing `'x` with `'static` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/expect-fn-supply-fn.rs:32:49 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - | ^ + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'r> fn(&'r u32)` + found fn pointer `fn(&u32)` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/expect-fn-supply-fn.rs:39:50 | LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - | ^ + | ^ one type is more general than the other + | + = note: expected fn pointer `fn(&'x u32)` + found fn pointer `for<'r> fn(&'r u32)` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/expect-fn-supply-fn.rs:48:50 | LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { - | ^ + | ^ one type is more general than the other + | + = note: expected fn pointer `fn(&u32)` + found fn pointer `for<'r> fn(&'r u32)` error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index 93b42a5a305..ba4c9b63381 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -1,15 +1,18 @@ error[E0631]: type mismatch in closure arguments --> $DIR/expect-infer-var-appearing-twice.rs:14:5 | -LL | fn with_closure<F, A>(_: F) - | ------------ required by a bound in this -LL | where F: FnOnce(A, A) - | ------------ required by this bound in `with_closure` -... LL | with_closure(|x: u32, y: i32| { | ^^^^^^^^^^^^ ---------------- found signature of `fn(u32, i32) -> _` | | | expected signature of `fn(_, _) -> _` + | +note: required by a bound in `with_closure` + --> $DIR/expect-infer-var-appearing-twice.rs:2:14 + | +LL | fn with_closure<F, A>(_: F) + | ------------ required by a bound in this +LL | where F: FnOnce(A, A) + | ^^^^^^^^^^^^ required by this bound in `with_closure` error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87987.rs b/src/test/ui/closures/2229_closure_analysis/issue-87987.rs new file mode 100644 index 00000000000..5dc2cb7e710 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/issue-87987.rs @@ -0,0 +1,30 @@ +// run-pass +// edition:2021 + +struct Props { + field_1: u32, //~ WARNING: field is never read: `field_1` + field_2: u32, //~ WARNING: field is never read: `field_2` +} + +fn main() { + // Test 1 + let props_2 = Props { //~ WARNING: unused variable: `props_2` + field_1: 1, + field_2: 1, + }; + + let _ = || { + let _: Props = props_2; + }; + + // Test 2 + let mut arr = [1, 3, 4, 5]; + + let mref = &mut arr; + + let _c = || match arr { + [_, _, _, _] => println!("A") + }; + + println!("{:#?}", mref); +} diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr b/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr new file mode 100644 index 00000000000..aa7012c3618 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr @@ -0,0 +1,24 @@ +warning: unused variable: `props_2` + --> $DIR/issue-87987.rs:11:9 + | +LL | let props_2 = Props { + | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_props_2` + | + = note: `#[warn(unused_variables)]` on by default + +warning: field is never read: `field_1` + --> $DIR/issue-87987.rs:5:5 + | +LL | field_1: u32, + | ^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` on by default + +warning: field is never read: `field_2` + --> $DIR/issue-87987.rs:6:5 + | +LL | field_2: u32, + | ^^^^^^^^^^^^ + +warning: 3 warnings emitted + diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87988.rs b/src/test/ui/closures/2229_closure_analysis/issue-87988.rs new file mode 100644 index 00000000000..27e7fabf11a --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/issue-87988.rs @@ -0,0 +1,19 @@ +// run-pass +// edition:2021 + +const LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED: i32 = 0x01; +const LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT: i32 = 0x02; + +pub fn hotplug_callback(event: i32) { + let _ = || { + match event { + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED => (), + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT => (), + _ => (), + }; + }; +} + +fn main() { + hotplug_callback(1); +} diff --git a/src/test/ui/closures/2229_closure_analysis/match-edge-cases.rs b/src/test/ui/closures/2229_closure_analysis/match-edge-cases.rs new file mode 100644 index 00000000000..914ebbe26a5 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/match-edge-cases.rs @@ -0,0 +1,44 @@ +// run-pass +// edition:2021 + +const PATTERN_REF: &str = "Hello World"; +const NUMBER: i32 = 30; +const NUMBER_POINTER: *const i32 = &NUMBER; + +pub fn edge_case_ref(event: &str) { + let _ = || { + match event { + PATTERN_REF => (), + _ => (), + }; + }; +} + +pub fn edge_case_str(event: String) { + let _ = || { + match event.as_str() { + "hello" => (), + _ => (), + }; + }; +} + +pub fn edge_case_raw_ptr(event: *const i32) { + let _ = || { + match event { + NUMBER_POINTER => (), + _ => (), + }; + }; +} + +pub fn edge_case_char(event: char) { + let _ = || { + match event { + 'a' => (), + _ => (), + }; + }; +} + +fn main() {} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr index e8dd81ede25..98396abb6ff 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr @@ -16,11 +16,11 @@ LL | #![deny(rust_2021_incompatible_closure_captures)] help: add a dummy let to cause `fptr` to be fully captured | LL ~ thread::spawn(move || { let _ = &fptr; unsafe { -LL + -LL + -LL + -LL + -LL + *fptr.0 = 20; +LL | +LL | +LL | +LL | +LL | *fptr.0 = 20; ... error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` trait implementation for closure @@ -36,11 +36,11 @@ LL | *fptr.0.0 = 20; help: add a dummy let to cause `fptr` to be fully captured | LL ~ thread::spawn(move || { let _ = &fptr; unsafe { -LL + -LL + -LL + -LL + -LL + *fptr.0.0 = 20; +LL | +LL | +LL | +LL | +LL | *fptr.0.0 = 20; ... error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order @@ -60,11 +60,7 @@ help: add a dummy let to cause `f` to be fully captured | LL ~ let c = || { LL + let _ = &f; -LL + -LL + -LL + -LL + - ... + | error: aborting due to 3 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr index b719b89f5fc..7989a8fa5cc 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr @@ -30,11 +30,7 @@ help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured | LL ~ let c = || { LL + let _ = (&t, &t1, &t2); -LL + -LL + -LL + -LL + - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/insignificant_drop.rs:41:13 @@ -59,11 +55,7 @@ help: add a dummy let to cause `t`, `t1` to be fully captured | LL ~ let c = || { LL + let _ = (&t, &t1); -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/insignificant_drop.rs:62:13 @@ -82,11 +74,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/insignificant_drop.rs:83:13 @@ -105,11 +93,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/insignificant_drop.rs:104:13 @@ -128,11 +112,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/insignificant_drop.rs:122:13 @@ -156,11 +136,7 @@ help: add a dummy let to cause `t1`, `t` to be fully captured | LL ~ let c = move || { LL + let _ = (&t1, &t); -LL + -LL + -LL + -LL + println!("{} {}", t1.1, t.1); - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/insignificant_drop.rs:142:13 @@ -179,11 +155,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: aborting due to 7 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr index 669614fee0a..961834aca19 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr @@ -20,11 +20,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/insignificant_drop_attr_migrations.rs:57:13 @@ -43,11 +39,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = move || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.1; - ... + | error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/macro.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/macro.stderr index 0614b78a743..d1f959dfc52 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/macro.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/macro.stderr @@ -18,7 +18,7 @@ LL | #![deny(rust_2021_incompatible_closure_captures)] help: add a dummy let to cause `a` to be fully captured | LL | let _ = || { let _ = &a; dbg!(a.0) }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++ + error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr index 8d4819fe2e2..3589a6150d0 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr @@ -20,11 +20,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/migrations_rustfix.rs:33:13 @@ -41,7 +37,7 @@ LL | } help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; t.0 }; - | ~~~~~~~~~~~~~~~~~~~ + | +++++++++++++ + error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr index b6ee5edb59e..10816b7bc3a 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr @@ -17,11 +17,7 @@ help: add a dummy let to cause `f` to be fully captured | LL ~ let result = panic::catch_unwind(move || { LL + let _ = &f; -LL + -LL + -LL + -LL + - ... + | error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr index b887b212e3d..8bee950c13e 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr @@ -23,11 +23,7 @@ help: add a dummy let to cause `f1`, `f2` to be fully captured | LL ~ let c = || { LL + let _ = (&f1, &f2); -LL + -LL + -LL + -LL + - ... + | error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure --> $DIR/multi_diagnostics.rs:42:13 @@ -43,11 +39,7 @@ help: add a dummy let to cause `f1` to be fully captured | LL ~ let c = || { LL + let _ = &f1; -LL + -LL + -LL + -LL + - ... + | error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure --> $DIR/multi_diagnostics.rs:67:13 @@ -69,11 +61,7 @@ help: add a dummy let to cause `f1` to be fully captured | LL ~ let c = || { LL + let _ = &f1; -LL + -LL + -LL + -LL + - ... + | error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order --> $DIR/multi_diagnostics.rs:86:13 @@ -98,11 +86,7 @@ help: add a dummy let to cause `f1` to be fully captured | LL ~ let c = || { LL + let _ = &f1; -LL + -LL + -LL + -LL + - ... + | error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` trait implementation for closure --> $DIR/multi_diagnostics.rs:119:19 @@ -123,11 +107,11 @@ LL | *fptr2.0 = 20; help: add a dummy let to cause `fptr1`, `fptr2` to be fully captured | LL ~ thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe { -LL + -LL + -LL + -LL + -LL + +LL | +LL | +LL | +LL | +LL | ... error: aborting due to 5 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr index 51b4e11819f..aa9b8672a0f 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/precise.stderr @@ -20,11 +20,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/precise.rs:45:13 @@ -53,11 +49,7 @@ help: add a dummy let to cause `u` to be fully captured | LL ~ let c = || { LL + let _ = &u; -LL + -LL + -LL + -LL + let _x = u.0.0; - ... + | error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr index 81700e32b5f..e9170eba3f1 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr @@ -30,11 +30,7 @@ help: add a dummy let to cause `t`, `t1`, `t2` to be fully captured | LL ~ let c = || { LL + let _ = (&t, &t1, &t2); -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:50:13 @@ -59,11 +55,7 @@ help: add a dummy let to cause `t`, `t1` to be fully captured | LL ~ let c = || { LL + let _ = (&t, &t1); -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:71:13 @@ -82,11 +74,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:91:13 @@ -105,11 +93,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:109:13 @@ -128,11 +112,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:125:13 @@ -151,11 +131,7 @@ help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { LL + let _ = &t; -LL + -LL + -LL + -LL + let _t = t.1; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:143:13 @@ -179,11 +155,7 @@ help: add a dummy let to cause `t1`, `t` to be fully captured | LL ~ let c = move || { LL + let _ = (&t1, &t); -LL + -LL + -LL + -LL + println!("{:?} {:?}", t1.1, t.1); - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:163:21 @@ -202,11 +174,7 @@ help: add a dummy let to cause `tuple` to be fully captured | LL ~ let c = || { LL + let _ = &tuple; -LL + -LL + -LL + -LL + tuple.0; - ... + | error: changes to closure capture in Rust 2021 will affect drop order --> $DIR/significant_drop.rs:181:17 @@ -225,11 +193,7 @@ help: add a dummy let to cause `tuple` to be fully captured | LL ~ let c = || { LL + let _ = &tuple; -LL + -LL + -LL + -LL + tuple.0; - ... + | error: aborting due to 9 previous errors diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index b7f0571316f..bf6ec5c36e4 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -1,12 +1,14 @@ error[E0277]: `F` cannot be sent between threads safely --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:22 | -LL | struct X<F> where F: FnOnce() + 'static + Send { - | ---- required by this bound in `X` -... LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static { | ^^^^ `F` cannot be sent between threads safely | +note: required by a bound in `X` + --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:1:43 + | +LL | struct X<F> where F: FnOnce() + 'static + Send { + | ^^^^ required by this bound in `X` help: consider further restricting this bound | LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send { diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index 16b168db681..bfea4979dec 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -1,12 +1,14 @@ error[E0277]: `F` cannot be shared between threads safely --> $DIR/closure-bounds-subtype.rs:13:22 | -LL | fn take_const_owned<F>(_: F) where F: FnOnce() + Sync + Send { - | ---- required by this bound in `take_const_owned` -... LL | take_const_owned(f); | ^ `F` cannot be shared between threads safely | +note: required by a bound in `take_const_owned` + --> $DIR/closure-bounds-subtype.rs:4:50 + | +LL | fn take_const_owned<F>(_: F) where F: FnOnce() + Sync + Send { + | ^^^^ required by this bound in `take_const_owned` help: consider further restricting this bound | LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync { diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.polonius.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.polonius.stderr index df60416709f..8846ccef34e 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.polonius.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.polonius.stderr @@ -1,25 +1,5 @@ -error[E0521]: borrowed data escapes outside of closure - --> $DIR/expect-region-supply-region.rs:18:9 - | -LL | let mut f: Option<&u32> = None; - | ----- `f` declared here, outside of the closure body -LL | closure_expecting_bound(|x| { - | - `x` is a reference that is only valid in the closure body -LL | f = Some(x); - | ^^^^^^^^^^^ `x` escapes the closure body here - -error[E0521]: borrowed data escapes outside of closure - --> $DIR/expect-region-supply-region.rs:28:9 - | -LL | let mut f: Option<&u32> = None; - | ----- `f` declared here, outside of the closure body -LL | closure_expecting_bound(|x: &u32| { - | - `x` is a reference that is only valid in the closure body -LL | f = Some(x); - | ^^^^^^^^^^^ `x` escapes the closure body here - error: lifetime may not live long enough - --> $DIR/expect-region-supply-region.rs:37:30 + --> $DIR/expect-region-supply-region-2.rs:14:30 | LL | fn expect_bound_supply_named<'x>() { | -- lifetime `'x` defined here @@ -30,7 +10,7 @@ LL | closure_expecting_bound(|x: &'x u32| { | requires that `'1` must outlive `'x` error[E0521]: borrowed data escapes outside of closure - --> $DIR/expect-region-supply-region.rs:42:9 + --> $DIR/expect-region-supply-region-2.rs:20:9 | LL | let mut f: Option<&u32> = None; | ----- `f` declared here, outside of the closure body @@ -42,7 +22,7 @@ LL | f = Some(x); | ^^^^^^^^^^^ `x` escapes the closure body here error: lifetime may not live long enough - --> $DIR/expect-region-supply-region.rs:37:30 + --> $DIR/expect-region-supply-region-2.rs:14:30 | LL | fn expect_bound_supply_named<'x>() { | -- lifetime `'x` defined here @@ -52,5 +32,6 @@ LL | closure_expecting_bound(|x: &'x u32| { | = help: consider replacing `'x` with `'static` -error: aborting due to 5 previous errors +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index b4e5db74e03..618c9a17247 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -4,14 +4,14 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads s LL | let t = thread::spawn(|| { | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely | - ::: $SRC_DIR/std/src/thread/mod.rs:LL:COL - | -LL | F: Send + 'static, - | ---- required by this bound in `spawn` - | = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = note: required because of the requirements on the impl of `Send` for `&std::sync::mpsc::Receiver<()>` = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:6:27: 9:6]` +note: required by a bound in `spawn` + --> $SRC_DIR/std/src/thread/mod.rs:LL:COL + | +LL | F: Send + 'static, + | ^^^^ required by this bound in `spawn` error[E0277]: `Sender<()>` cannot be shared between threads safely --> $DIR/closure-move-sync.rs:18:5 @@ -19,14 +19,14 @@ error[E0277]: `Sender<()>` cannot be shared between threads safely LL | thread::spawn(|| tx.send(()).unwrap()); | ^^^^^^^^^^^^^ `Sender<()>` cannot be shared between threads safely | - ::: $SRC_DIR/std/src/thread/mod.rs:LL:COL - | -LL | F: Send + 'static, - | ---- required by this bound in `spawn` - | = help: the trait `Sync` is not implemented for `Sender<()>` = note: required because of the requirements on the impl of `Send` for `&Sender<()>` = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:18:19: 18:42]` +note: required by a bound in `spawn` + --> $SRC_DIR/std/src/thread/mod.rs:LL:COL + | +LL | F: Send + 'static, + | ^^^^ required by this bound in `spawn` error: aborting due to 2 previous errors diff --git a/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs b/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs new file mode 100644 index 00000000000..38dfca347c8 --- /dev/null +++ b/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs @@ -0,0 +1,35 @@ +// build-pass +// compile-flags: -Copt-level=0 + +// Regression test for #88043: LLVM crash when the RemoveZsts mir-opt pass is enabled. +// We should not see the error: +// `Basic Block in function '_ZN4main10take_until17h0067b8a660429bc9E' does not have terminator!` + +fn bump() -> Option<usize> { + unreachable!() +} + +fn take_until(terminate: impl Fn() -> bool) { + loop { + if terminate() { + return; + } else { + bump(); + } + } +} + +// CHECK-LABEL: @main +fn main() { + take_until(|| true); + f(None); +} + +fn f(_a: Option<String>) -> Option<u32> { + loop { + g(); + () + } +} + +fn g() -> Option<u32> { None } diff --git a/src/test/ui/coherence/coherence-unsafe-trait-object-impl.stderr b/src/test/ui/coherence/coherence-unsafe-trait-object-impl.stderr index 93a06fccbf5..cf842b19085 100644 --- a/src/test/ui/coherence/coherence-unsafe-trait-object-impl.stderr +++ b/src/test/ui/coherence/coherence-unsafe-trait-object-impl.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `&dyn Trait: Trait` is not satisfied --> $DIR/coherence-unsafe-trait-object-impl.rs:15:13 | -LL | fn takes_t<S: Trait>(s: S) { - | ----- required by this bound in `takes_t` -... LL | takes_t(t); | ^ the trait `Trait` is not implemented for `&dyn Trait` + | +note: required by a bound in `takes_t` + --> $DIR/coherence-unsafe-trait-object-impl.rs:10:15 + | +LL | fn takes_t<S: Trait>(s: S) { + | ^^^^^ required by this bound in `takes_t` error: aborting due to previous error diff --git a/src/test/ui/const-generics/associated-type-bound-fail.full.stderr b/src/test/ui/const-generics/associated-type-bound-fail.full.stderr index 6644e74f97a..7ab430ba830 100644 --- a/src/test/ui/const-generics/associated-type-bound-fail.full.stderr +++ b/src/test/ui/const-generics/associated-type-bound-fail.full.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `u16: Bar<N>` is not satisfied --> $DIR/associated-type-bound-fail.rs:13:5 | -LL | type Assoc: Bar<N>; - | ------ required by this bound in `Foo::Assoc` -... LL | type Assoc = u16; | ^^^^^^^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `u16` | = help: the following implementations were found: <u16 as Bar<3_usize>> +note: required by a bound in `Foo::Assoc` + --> $DIR/associated-type-bound-fail.rs:8:17 + | +LL | type Assoc: Bar<N>; + | ^^^^^^ required by this bound in `Foo::Assoc` error: aborting due to previous error diff --git a/src/test/ui/const-generics/associated-type-bound-fail.min.stderr b/src/test/ui/const-generics/associated-type-bound-fail.min.stderr index 6644e74f97a..7ab430ba830 100644 --- a/src/test/ui/const-generics/associated-type-bound-fail.min.stderr +++ b/src/test/ui/const-generics/associated-type-bound-fail.min.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `u16: Bar<N>` is not satisfied --> $DIR/associated-type-bound-fail.rs:13:5 | -LL | type Assoc: Bar<N>; - | ------ required by this bound in `Foo::Assoc` -... LL | type Assoc = u16; | ^^^^^^^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `u16` | = help: the following implementations were found: <u16 as Bar<3_usize>> +note: required by a bound in `Foo::Assoc` + --> $DIR/associated-type-bound-fail.rs:8:17 + | +LL | type Assoc: Bar<N>; + | ^^^^^^ required by this bound in `Foo::Assoc` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-argument-if-length.full.stderr b/src/test/ui/const-generics/const-argument-if-length.full.stderr index 4eec2b21be6..8e62147eb7e 100644 --- a/src/test/ui/const-generics/const-argument-if-length.full.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.full.stderr @@ -6,11 +6,11 @@ LL | pub const fn is_zst<T: ?Sized>() -> usize { LL | if std::mem::size_of::<T>() == 0 { | ^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | + | ^ required by this bound in `std::mem::size_of` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - pub const fn is_zst<T: ?Sized>() -> usize { diff --git a/src/test/ui/const-generics/const_evaluatable_checked/abstract-const-as-cast-3.stderr b/src/test/ui/const-generics/const_evaluatable_checked/abstract-const-as-cast-3.stderr index c5237fc6f2b..f235eb443b8 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/abstract-const-as-cast-3.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/abstract-const-as-cast-3.stderr @@ -1,9 +1,6 @@ error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:17:5 | -LL | fn assert_impl<T: Trait>() {} - | ----- required by this bound in `use_trait_impl::assert_impl` -... LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -13,6 +10,11 @@ note: required because of the requirements on the impl of `Trait` for `HasCastIn | LL | impl<const O: usize> Trait for HasCastInTraitImpl<O, { O as u128 }> {} | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `use_trait_impl::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:14:23 + | +LL | fn assert_impl<T: Trait>() {} + | ^^^^^ required by this bound in `use_trait_impl::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -26,9 +28,6 @@ LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:20:5 | -LL | fn assert_impl<T: Trait>() {} - | ----- required by this bound in `use_trait_impl::assert_impl` -... LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -38,6 +37,11 @@ note: required because of the requirements on the impl of `Trait` for `HasCastIn | LL | impl<const O: usize> Trait for HasCastInTraitImpl<O, { O as u128 }> {} | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `use_trait_impl::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:14:23 + | +LL | fn assert_impl<T: Trait>() {} + | ^^^^^ required by this bound in `use_trait_impl::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -69,9 +73,6 @@ LL | assert_impl::<HasCastInTraitImpl<14, 13>>(); error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:35:5 | -LL | fn assert_impl<T: Trait>() {} - | ----- required by this bound in `use_trait_impl_2::assert_impl` -... LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -81,6 +82,11 @@ note: required because of the requirements on the impl of `Trait` for `HasCastIn | LL | impl<const O: usize> Trait for HasCastInTraitImpl<O, { O as u128 }> {} | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `use_trait_impl_2::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:32:23 + | +LL | fn assert_impl<T: Trait>() {} + | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -94,9 +100,6 @@ LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:38:5 | -LL | fn assert_impl<T: Trait>() {} - | ----- required by this bound in `use_trait_impl_2::assert_impl` -... LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -106,6 +109,11 @@ note: required because of the requirements on the impl of `Trait` for `HasCastIn | LL | impl<const O: usize> Trait for HasCastInTraitImpl<O, { O as u128 }> {} | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `use_trait_impl_2::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:32:23 + | +LL | fn assert_impl<T: Trait>() {} + | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr b/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr index ce7ec4d90b6..7b4d46b8209 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr @@ -4,12 +4,12 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::<T>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $DIR/auxiliary/const_evaluatable_lib.rs:6:10 + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` +note: required by a bound in `test1` + --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 | LL | [u8; std::mem::size_of::<T>() - 1]: Sized, - | ---------------------------- required by this bound in `test1` - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` error: unconstrained generic constant --> $DIR/cross_crate_predicate.rs:7:13 @@ -17,12 +17,12 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::<T>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $DIR/auxiliary/const_evaluatable_lib.rs:4:27 + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` +note: required by a bound in `test1` + --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 | LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1] - | ---------------------------- required by this bound in `test1` - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` error: unconstrained generic constant --> $DIR/cross_crate_predicate.rs:7:13 @@ -30,12 +30,12 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::<T>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $DIR/auxiliary/const_evaluatable_lib.rs:6:10 + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` +note: required by a bound in `test1` + --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 | LL | [u8; std::mem::size_of::<T>() - 1]: Sized, - | ---------------------------- required by this bound in `test1` - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` error: unconstrained generic constant --> $DIR/cross_crate_predicate.rs:7:13 @@ -43,12 +43,12 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::<T>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $DIR/auxiliary/const_evaluatable_lib.rs:4:27 + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` +note: required by a bound in `test1` + --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 | LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1] - | ---------------------------- required by this bound in `test1` - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<T>() - 1]:` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` error: aborting due to 4 previous errors diff --git a/src/test/ui/const-generics/const_evaluatable_checked/object-safety-ok-infer-err.stderr b/src/test/ui/const-generics/const_evaluatable_checked/object-safety-ok-infer-err.stderr index dd2c11e42c5..ce75314ada7 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/object-safety-ok-infer-err.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/object-safety-ok-infer-err.stderr @@ -1,11 +1,14 @@ error[E0284]: type annotations needed: cannot satisfy `the constant `use_dyn::<{_: usize}>::{constant#0}` can be evaluated` --> $DIR/object-safety-ok-infer-err.rs:20:5 | -LL | fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized { - | ----- required by this bound in `use_dyn` -... LL | use_dyn(&()); | ^^^^^^^ cannot satisfy `the constant `use_dyn::<{_: usize}>::{constant#0}` can be evaluated` + | +note: required by a bound in `use_dyn` + --> $DIR/object-safety-ok-infer-err.rs:14:55 + | +LL | fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized { + | ^^^^^ required by this bound in `use_dyn` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-67185-2.full.stderr b/src/test/ui/const-generics/issues/issue-67185-2.full.stderr index fa9c680d4b8..19f419c82fd 100644 --- a/src/test/ui/const-generics/issues/issue-67185-2.full.stderr +++ b/src/test/ui/const-generics/issues/issue-67185-2.full.stderr @@ -37,66 +37,74 @@ LL | | } error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied --> $DIR/issue-67185-2.rs:26:6 | -LL | trait Foo - | --- required by a bound in this -... -LL | <u8 as Baz>::Quaks: Bar, - | --- required by this bound in `Foo` -... LL | impl Foo for FooImpl {} | ^^^ the trait `Bar` is not implemented for `[u16; 3]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> - -error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:26:6 +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:20:29 | LL | trait Foo | --- required by a bound in this ... -LL | [<u8 as Baz>::Quaks; 2]: Bar, - | --- required by this bound in `Foo` -... +LL | <u8 as Baz>::Quaks: Bar, + | ^^^ required by this bound in `Foo` + +error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied + --> $DIR/issue-67185-2.rs:26:6 + | LL | impl Foo for FooImpl {} | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> - -error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:30:14 +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:19:34 | LL | trait Foo | --- required by a bound in this ... LL | [<u8 as Baz>::Quaks; 2]: Bar, - | --- required by this bound in `Foo` -... + | ^^^ required by this bound in `Foo` + +error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied + --> $DIR/issue-67185-2.rs:30:14 + | LL | fn f(_: impl Foo) {} | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> - -error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:30:14 +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:19:34 | LL | trait Foo | --- required by a bound in this ... -LL | <u8 as Baz>::Quaks: Bar, - | --- required by this bound in `Foo` -... +LL | [<u8 as Baz>::Quaks; 2]: Bar, + | ^^^ required by this bound in `Foo` + +error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied + --> $DIR/issue-67185-2.rs:30:14 + | LL | fn f(_: impl Foo) {} | ^^^ the trait `Bar` is not implemented for `[u16; 3]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:20:29 + | +LL | trait Foo + | --- required by a bound in this +... +LL | <u8 as Baz>::Quaks: Bar, + | ^^^ required by this bound in `Foo` error: aborting due to 6 previous errors diff --git a/src/test/ui/const-generics/issues/issue-67185-2.min.stderr b/src/test/ui/const-generics/issues/issue-67185-2.min.stderr index fa9c680d4b8..19f419c82fd 100644 --- a/src/test/ui/const-generics/issues/issue-67185-2.min.stderr +++ b/src/test/ui/const-generics/issues/issue-67185-2.min.stderr @@ -37,66 +37,74 @@ LL | | } error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied --> $DIR/issue-67185-2.rs:26:6 | -LL | trait Foo - | --- required by a bound in this -... -LL | <u8 as Baz>::Quaks: Bar, - | --- required by this bound in `Foo` -... LL | impl Foo for FooImpl {} | ^^^ the trait `Bar` is not implemented for `[u16; 3]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> - -error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:26:6 +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:20:29 | LL | trait Foo | --- required by a bound in this ... -LL | [<u8 as Baz>::Quaks; 2]: Bar, - | --- required by this bound in `Foo` -... +LL | <u8 as Baz>::Quaks: Bar, + | ^^^ required by this bound in `Foo` + +error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied + --> $DIR/issue-67185-2.rs:26:6 + | LL | impl Foo for FooImpl {} | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> - -error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:30:14 +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:19:34 | LL | trait Foo | --- required by a bound in this ... LL | [<u8 as Baz>::Quaks; 2]: Bar, - | --- required by this bound in `Foo` -... + | ^^^ required by this bound in `Foo` + +error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied + --> $DIR/issue-67185-2.rs:30:14 + | LL | fn f(_: impl Foo) {} | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> - -error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:30:14 +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:19:34 | LL | trait Foo | --- required by a bound in this ... -LL | <u8 as Baz>::Quaks: Bar, - | --- required by this bound in `Foo` -... +LL | [<u8 as Baz>::Quaks; 2]: Bar, + | ^^^ required by this bound in `Foo` + +error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied + --> $DIR/issue-67185-2.rs:30:14 + | LL | fn f(_: impl Foo) {} | ^^^ the trait `Bar` is not implemented for `[u16; 3]` | = help: the following implementations were found: <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> +note: required by a bound in `Foo` + --> $DIR/issue-67185-2.rs:20:29 + | +LL | trait Foo + | --- required by a bound in this +... +LL | <u8 as Baz>::Quaks: Bar, + | ^^^ required by this bound in `Foo` error: aborting due to 6 previous errors diff --git a/src/test/ui/const-generics/issues/issue-72787.min.stderr b/src/test/ui/const-generics/issues/issue-72787.min.stderr index aadf19ba6b6..86d1da052ae 100644 --- a/src/test/ui/const-generics/issues/issue-72787.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72787.min.stderr @@ -37,24 +37,28 @@ LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, error[E0283]: type annotations needed --> $DIR/issue-72787.rs:21:26 | -LL | pub trait True {} - | -------------- required by this bound in `True` -... LL | IsLessOrEqual<I, 8>: True, | ^^^^ cannot infer type for struct `IsLessOrEqual<I, 8_u32>` | = note: cannot satisfy `IsLessOrEqual<I, 8_u32>: True` +note: required by a bound in `True` + --> $DIR/issue-72787.rs:7:1 + | +LL | pub trait True {} + | ^^^^^^^^^^^^^^ required by this bound in `True` error[E0283]: type annotations needed --> $DIR/issue-72787.rs:21:26 | -LL | pub trait True {} - | -------------- required by this bound in `True` -... LL | IsLessOrEqual<I, 8>: True, | ^^^^ cannot infer type for struct `IsLessOrEqual<I, 8_u32>` | = note: cannot satisfy `IsLessOrEqual<I, 8_u32>: True` +note: required by a bound in `True` + --> $DIR/issue-72787.rs:7:1 + | +LL | pub trait True {} + | ^^^^^^^^^^^^^^ required by this bound in `True` error: aborting due to 6 previous errors diff --git a/src/test/ui/const-generics/issues/issue-85848.stderr b/src/test/ui/const-generics/issues/issue-85848.stderr index 5e65136a6bc..e51db35925e 100644 --- a/src/test/ui/const-generics/issues/issue-85848.stderr +++ b/src/test/ui/const-generics/issues/issue-85848.stderr @@ -3,9 +3,6 @@ error[E0277]: the trait bound `(): _Contains<&C>` is not satisfied | LL | writes_to_specific_path(&cap); | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `_Contains<&C>` is not implemented for `()` -... -LL | fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {} - | ------------- required by this bound in `writes_to_specific_path` | note: required because of the requirements on the impl of `Contains<(), true>` for `&C` --> $DIR/issue-85848.rs:21:12 @@ -17,15 +14,17 @@ note: required because of the requirements on the impl of `Delegates<()>` for `& | LL | impl<T, U> Delegates<U> for T where T: Contains<U, true> {} | ^^^^^^^^^^^^ ^ +note: required by a bound in `writes_to_specific_path` + --> $DIR/issue-85848.rs:29:31 + | +LL | fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {} + | ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path` error: unconstrained generic constant --> $DIR/issue-85848.rs:24:5 | LL | writes_to_specific_path(&cap); | ^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {} - | ------------- required by this bound in `writes_to_specific_path` | = help: try adding a `where` bound using this expression: `where [(); { contains::<T, U>() }]:` note: required because of the requirements on the impl of `Contains<(), true>` for `&C` @@ -38,6 +37,11 @@ note: required because of the requirements on the impl of `Delegates<()>` for `& | LL | impl<T, U> Delegates<U> for T where T: Contains<U, true> {} | ^^^^^^^^^^^^ ^ +note: required by a bound in `writes_to_specific_path` + --> $DIR/issue-85848.rs:29:31 + | +LL | fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {} + | ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/parent_generics_of_encoding_impl_trait.stderr b/src/test/ui/const-generics/parent_generics_of_encoding_impl_trait.stderr index 6c0d5c4f079..99085711513 100644 --- a/src/test/ui/const-generics/parent_generics_of_encoding_impl_trait.stderr +++ b/src/test/ui/const-generics/parent_generics_of_encoding_impl_trait.stderr @@ -4,10 +4,11 @@ error[E0284]: type annotations needed: cannot satisfy `the constant `foo::{opaqu LL | generics_of_parent_impl_trait::foo([()]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `foo::{opaque#0}::{constant#0}` can be evaluated` | - ::: $DIR/auxiliary/generics_of_parent_impl_trait.rs:6:48 +note: required by a bound in `foo` + --> $DIR/auxiliary/generics_of_parent_impl_trait.rs:6:48 | LL | pub fn foo<const N: usize>(foo: impl Into<[(); N + 1]>) { - | ----- required by this bound in `foo` + | ^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr index 6267fad4372..277454a1140 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr @@ -7,11 +7,11 @@ LL | #[derive(Eq,PartialEq)] LL | x: Error | ^^^^^^^^ the trait `Eq` is not implemented for `Error` | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | -- required by this bound in `AssertParamIsEq` - | + | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr index 5dc40734001..6a48ad24561 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum.stderr @@ -7,11 +7,11 @@ LL | #[derive(Eq,PartialEq)] LL | Error | ^^^^^ the trait `Eq` is not implemented for `Error` | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | -- required by this bound in `AssertParamIsEq` - | + | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr index 5fd21e2cd79..7bf83e8eae2 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-struct.stderr @@ -7,11 +7,11 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ the trait `Eq` is not implemented for `Error` | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | -- required by this bound in `AssertParamIsEq` - | + | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr index d96687f8bf2..13e2a55319e 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -7,11 +7,11 @@ LL | struct Struct( LL | Error | ^^^^^ the trait `Eq` is not implemented for `Error` | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | -- required by this bound in `AssertParamIsEq` - | + | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index 557431ab5bc..47c7f1c2c33 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -7,11 +7,11 @@ LL | #[derive(Hash)] LL | x: Error | ^^^^^^^^ the trait `Hash` is not implemented for `Error` | - ::: $SRC_DIR/core/src/hash/mod.rs:LL:COL +note: required by a bound in `std::hash::Hash::hash` + --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash<H: Hasher>(&self, state: &mut H); - | - required by this bound in `std::hash::Hash::hash` - | + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index 531ad59ca3b..92f084b58e3 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -7,11 +7,11 @@ LL | #[derive(Hash)] LL | Error | ^^^^^ the trait `Hash` is not implemented for `Error` | - ::: $SRC_DIR/core/src/hash/mod.rs:LL:COL +note: required by a bound in `std::hash::Hash::hash` + --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash<H: Hasher>(&self, state: &mut H); - | - required by this bound in `std::hash::Hash::hash` - | + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index 2852a448c43..c57cebe04eb 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -7,11 +7,11 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ the trait `Hash` is not implemented for `Error` | - ::: $SRC_DIR/core/src/hash/mod.rs:LL:COL +note: required by a bound in `std::hash::Hash::hash` + --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash<H: Hasher>(&self, state: &mut H); - | - required by this bound in `std::hash::Hash::hash` - | + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index 93ae1b29702..200937f0c9f 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -7,11 +7,11 @@ LL | struct Struct( LL | Error | ^^^^^ the trait `Hash` is not implemented for `Error` | - ::: $SRC_DIR/core/src/hash/mod.rs:LL:COL +note: required by a bound in `std::hash::Hash::hash` + --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash<H: Hasher>(&self, state: &mut H); - | - required by this bound in `std::hash::Hash::hash` - | + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr index 09611555fb9..ecdbbff4d97 100644 --- a/src/test/ui/derives/deriving-copyclone.stderr +++ b/src/test/ui/derives/deriving-copyclone.stderr @@ -1,9 +1,6 @@ error[E0277]: the trait bound `C: Copy` is not satisfied --> $DIR/deriving-copyclone.rs:31:13 | -LL | fn is_copy<T: Copy>(_: T) {} - | ---- required by this bound in `is_copy` -... LL | is_copy(B { a: 1, b: C }); | ^^^^^^^^^^^^^^^^ | | @@ -15,14 +12,16 @@ note: required because of the requirements on the impl of `Copy` for `B<C>` | LL | #[derive(Copy, Clone)] | ^^^^ +note: required by a bound in `is_copy` + --> $DIR/deriving-copyclone.rs:18:15 + | +LL | fn is_copy<T: Copy>(_: T) {} + | ^^^^ required by this bound in `is_copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `C: Clone` is not satisfied --> $DIR/deriving-copyclone.rs:32:14 | -LL | fn is_clone<T: Clone>(_: T) {} - | ----- required by this bound in `is_clone` -... LL | is_clone(B { a: 1, b: C }); | ^^^^^^^^^^^^^^^^ | | @@ -34,14 +33,16 @@ note: required because of the requirements on the impl of `Clone` for `B<C>` | LL | #[derive(Copy, Clone)] | ^^^^^ +note: required by a bound in `is_clone` + --> $DIR/deriving-copyclone.rs:19:16 + | +LL | fn is_clone<T: Clone>(_: T) {} + | ^^^^^ required by this bound in `is_clone` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `D: Copy` is not satisfied --> $DIR/deriving-copyclone.rs:35:13 | -LL | fn is_copy<T: Copy>(_: T) {} - | ---- required by this bound in `is_copy` -... LL | is_copy(B { a: 1, b: D }); | ^^^^^^^^^^^^^^^^ | | @@ -53,6 +54,11 @@ note: required because of the requirements on the impl of `Copy` for `B<D>` | LL | #[derive(Copy, Clone)] | ^^^^ +note: required by a bound in `is_copy` + --> $DIR/deriving-copyclone.rs:18:15 + | +LL | fn is_copy<T: Copy>(_: T) {} + | ^^^^ required by this bound in `is_copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/recursion_limit.stderr b/src/test/ui/did_you_mean/recursion_limit.stderr index 2d52172a6fa..fa8bee184a7 100644 --- a/src/test/ui/did_you_mean/recursion_limit.stderr +++ b/src/test/ui/did_you_mean/recursion_limit.stderr @@ -1,9 +1,6 @@ error[E0275]: overflow evaluating the requirement `K: Send` --> $DIR/recursion_limit.rs:34:5 | -LL | fn is_send<T:Send>() { } - | ---- required by this bound in `is_send` -... LL | is_send::<A>(); | ^^^^^^^^^^^^ | @@ -58,6 +55,11 @@ note: required because it appears within the type `A` | LL | link! { A, B } | ^ +note: required by a bound in `is_send` + --> $DIR/recursion_limit.rs:31:14 + | +LL | fn is_send<T:Send>() { } + | ^^^^ required by this bound in `is_send` error: aborting due to previous error diff --git a/src/test/ui/dst/dst-rvalue.rs b/src/test/ui/dst/dst-rvalue.rs index aa028396be4..b52a95a701f 100644 --- a/src/test/ui/dst/dst-rvalue.rs +++ b/src/test/ui/dst/dst-rvalue.rs @@ -4,11 +4,9 @@ pub fn main() { let _x: Box<str> = box *"hello world"; - //~^ ERROR E0161 - //~^^ ERROR cannot move out of a shared reference + //~^ ERROR E0277 let array: &[isize] = &[1, 2, 3]; let _x: Box<[isize]> = box *array; - //~^ ERROR E0161 - //~^^ ERROR cannot move out of type `[isize]`, a non-copy slice + //~^ ERROR E0277 } diff --git a/src/test/ui/dst/dst-rvalue.stderr b/src/test/ui/dst/dst-rvalue.stderr index 6a51c517558..15830636b51 100644 --- a/src/test/ui/dst/dst-rvalue.stderr +++ b/src/test/ui/dst/dst-rvalue.stderr @@ -1,31 +1,21 @@ -error[E0161]: cannot move a value of type str: the size of str cannot be statically determined +error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/dst-rvalue.rs:6:28 | LL | let _x: Box<str> = box *"hello world"; - | ^^^^^^^^^^^^^^ - -error[E0161]: cannot move a value of type [isize]: the size of [isize] cannot be statically determined - --> $DIR/dst-rvalue.rs:11:32 + | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time | -LL | let _x: Box<[isize]> = box *array; - | ^^^^^^ + = help: the trait `Sized` is not implemented for `str` + = note: the type of a box expression must have a statically known size -error[E0507]: cannot move out of a shared reference - --> $DIR/dst-rvalue.rs:6:28 - | -LL | let _x: Box<str> = box *"hello world"; - | ^^^^^^^^^^^^^^ move occurs because value has type `str`, which does not implement the `Copy` trait - -error[E0508]: cannot move out of type `[isize]`, a non-copy slice - --> $DIR/dst-rvalue.rs:11:32 +error[E0277]: the size for values of type `[isize]` cannot be known at compilation time + --> $DIR/dst-rvalue.rs:10:32 | LL | let _x: Box<[isize]> = box *array; - | ^^^^^^ - | | - | cannot move out of here - | move occurs because `*array` has type `[isize]`, which does not implement the `Copy` trait + | ^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[isize]` + = note: the type of a box expression must have a statically known size -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0161, E0507, E0508. -For more information about an error, try `rustc --explain E0161`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/dst/dst-sized-trait-param.stderr b/src/test/ui/dst/dst-sized-trait-param.stderr index 8b781a7b1f9..8ec94f5a3c0 100644 --- a/src/test/ui/dst/dst-sized-trait-param.stderr +++ b/src/test/ui/dst/dst-sized-trait-param.stderr @@ -1,13 +1,15 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilation time --> $DIR/dst-sized-trait-param.rs:7:6 | -LL | trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized - | - required by this bound in `Foo` -LL | LL | impl Foo<[isize]> for usize { } | ^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[isize]` +note: required by a bound in `Foo` + --> $DIR/dst-sized-trait-param.rs:5:11 + | +LL | trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized + | ^ required by this bound in `Foo` help: consider relaxing the implicit `Sized` restriction | LL | trait Foo<T: ?Sized> : Sized { fn take(self, x: &T) { } } // Note: T is sized @@ -16,13 +18,15 @@ LL | trait Foo<T: ?Sized> : Sized { fn take(self, x: &T) { } } // Note: T is siz error[E0277]: the size for values of type `[usize]` cannot be known at compilation time --> $DIR/dst-sized-trait-param.rs:10:6 | -LL | trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized - | ----- required by this bound in `Foo` -... LL | impl Foo<isize> for [usize] { } | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[usize]` +note: required by a bound in `Foo` + --> $DIR/dst-sized-trait-param.rs:5:16 + | +LL | trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized + | ^^^^^ required by this bound in `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs index 4da7b5ab24b..a6e5f70fdef 100644 --- a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs +++ b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs @@ -1,5 +1,4 @@ #![crate_type="lib"] -#![feature(arbitrary_enum_discriminant)] enum Enum { //~^ ERROR `#[repr(inttype)]` must be specified diff --git a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr index 2db5372da0c..7af063c591d 100644 --- a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr +++ b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr @@ -1,5 +1,5 @@ error[E0732]: `#[repr(inttype)]` must be specified - --> $DIR/arbitrary_enum_discriminant-no-repr.rs:4:1 + --> $DIR/arbitrary_enum_discriminant-no-repr.rs:3:1 | LL | / enum Enum { LL | | diff --git a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs index f2270602d87..360bddb7bd1 100644 --- a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs +++ b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs @@ -1,5 +1,5 @@ // run-pass -#![feature(arbitrary_enum_discriminant, const_raw_ptr_deref, test)] +#![feature(const_raw_ptr_deref, test)] extern crate test; diff --git a/src/test/ui/enum-discriminant/discriminant_value.rs b/src/test/ui/enum-discriminant/discriminant_value.rs index eb60aaf4b2d..7ed1d9660a6 100644 --- a/src/test/ui/enum-discriminant/discriminant_value.rs +++ b/src/test/ui/enum-discriminant/discriminant_value.rs @@ -1,6 +1,6 @@ // run-pass #![allow(stable_features)] -#![feature(arbitrary_enum_discriminant, core, core_intrinsics)] +#![feature(core, core_intrinsics)] extern crate core; use core::intrinsics::discriminant_value; diff --git a/src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.rs b/src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.rs deleted file mode 100644 index 3e90af4d36a..00000000000 --- a/src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type="lib"] - -enum Enum { - Unit = 1, - //~^ ERROR custom discriminant values are not allowed in enums with tuple or struct variants - Tuple() = 2, - //~^ ERROR discriminants on non-unit variants are experimental - Struct{} = 3, - //~^ ERROR discriminants on non-unit variants are experimental -} diff --git a/src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.stderr b/src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.stderr deleted file mode 100644 index b5f61e6e991..00000000000 --- a/src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error[E0658]: discriminants on non-unit variants are experimental - --> $DIR/feature-gate-arbitrary_enum_discriminant.rs:6:13 - | -LL | Tuple() = 2, - | ^ - | - = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information - = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable - -error[E0658]: discriminants on non-unit variants are experimental - --> $DIR/feature-gate-arbitrary_enum_discriminant.rs:8:14 - | -LL | Struct{} = 3, - | ^ - | - = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information - = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable - -error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants - --> $DIR/feature-gate-arbitrary_enum_discriminant.rs:4:10 - | -LL | Unit = 1, - | ^ disallowed custom discriminant -LL | -LL | Tuple() = 2, - | ----------- tuple variant defined here -LL | -LL | Struct{} = 3, - | ------------ struct variant defined here - | - = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information - = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs b/src/test/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs index f927dd18903..ad9fcc25b41 100644 --- a/src/test/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs +++ b/src/test/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs @@ -1,4 +1,4 @@ -#![feature(arbitrary_enum_discriminant, core_intrinsics)] +#![feature(core_intrinsics)] extern crate core; use core::intrinsics::discriminant_value; diff --git a/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs b/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs index e62582fb516..42a062239d3 100644 --- a/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs +++ b/src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs @@ -1,4 +1,4 @@ -#![feature(arbitrary_enum_discriminant, core_intrinsics)] +#![feature(core_intrinsics)] extern crate core; use core::intrinsics::discriminant_value; diff --git a/src/test/ui/enum-discriminant/issue-70509-partial_eq.rs b/src/test/ui/enum-discriminant/issue-70509-partial_eq.rs index ae389e11466..3adac7b7262 100644 --- a/src/test/ui/enum-discriminant/issue-70509-partial_eq.rs +++ b/src/test/ui/enum-discriminant/issue-70509-partial_eq.rs @@ -1,5 +1,5 @@ // run-pass -#![feature(repr128, arbitrary_enum_discriminant)] +#![feature(repr128)] //~^ WARN the feature `repr128` is incomplete #[derive(PartialEq, Debug)] diff --git a/src/test/ui/enum-discriminant/issue-70509-partial_eq.stderr b/src/test/ui/enum-discriminant/issue-70509-partial_eq.stderr index 5bf6ea56ebc..04fb13f37a0 100644 --- a/src/test/ui/enum-discriminant/issue-70509-partial_eq.stderr +++ b/src/test/ui/enum-discriminant/issue-70509-partial_eq.stderr @@ -1,7 +1,7 @@ warning: the feature `repr128` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/issue-70509-partial_eq.rs:2:12 | -LL | #![feature(repr128, arbitrary_enum_discriminant)] +LL | #![feature(repr128)] | ^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default diff --git a/src/test/ui/error-codes/E0106.stderr b/src/test/ui/error-codes/E0106.stderr index ee9a4733fd9..fbd77d96700 100644 --- a/src/test/ui/error-codes/E0106.stderr +++ b/src/test/ui/error-codes/E0106.stderr @@ -59,7 +59,7 @@ LL | type MyStr = &str; help: consider introducing a named lifetime parameter | LL | type MyStr<'a> = &'a str; - | ++++ ~~~ + | ++++ ++ error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0161.edition.stderr b/src/test/ui/error-codes/E0161.edition.stderr index 536a81a4bc6..6beb29c57d5 100644 --- a/src/test/ui/error-codes/E0161.edition.stderr +++ b/src/test/ui/error-codes/E0161.edition.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:9 +error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined + --> $DIR/E0161.rs:29:5 | -LL | box *x; - | ^^ +LL | x.f(); + | ^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.editionul.stderr b/src/test/ui/error-codes/E0161.editionul.stderr deleted file mode 100644 index 2baba998f12..00000000000 --- a/src/test/ui/error-codes/E0161.editionul.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:5 - | -LL | box *x; - | ^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0161`. diff --git a/src/test/ui/error-codes/E0161.migrate.stderr b/src/test/ui/error-codes/E0161.migrate.stderr index 536a81a4bc6..6beb29c57d5 100644 --- a/src/test/ui/error-codes/E0161.migrate.stderr +++ b/src/test/ui/error-codes/E0161.migrate.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:9 +error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined + --> $DIR/E0161.rs:29:5 | -LL | box *x; - | ^^ +LL | x.f(); + | ^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.migrateul.stderr b/src/test/ui/error-codes/E0161.migrateul.stderr deleted file mode 100644 index 2baba998f12..00000000000 --- a/src/test/ui/error-codes/E0161.migrateul.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:5 - | -LL | box *x; - | ^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0161`. diff --git a/src/test/ui/error-codes/E0161.nll.stderr b/src/test/ui/error-codes/E0161.nll.stderr index 536a81a4bc6..6beb29c57d5 100644 --- a/src/test/ui/error-codes/E0161.nll.stderr +++ b/src/test/ui/error-codes/E0161.nll.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:9 +error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined + --> $DIR/E0161.rs:29:5 | -LL | box *x; - | ^^ +LL | x.f(); + | ^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.nllul.stderr b/src/test/ui/error-codes/E0161.nllul.stderr deleted file mode 100644 index 2baba998f12..00000000000 --- a/src/test/ui/error-codes/E0161.nllul.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:5 - | -LL | box *x; - | ^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0161`. diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs index e0f5776424e..ba74529e4b6 100644 --- a/src/test/ui/error-codes/E0161.rs +++ b/src/test/ui/error-codes/E0161.rs @@ -8,6 +8,10 @@ //[edition]edition:2018 //[zflagsul]compile-flags: -Z borrowck=migrate //[editionul]edition:2018 +//[migrateul] check-pass +//[nllul] check-pass +//[zflagsul] check-pass +//[editionul] check-pass #![allow(incomplete_features)] #![cfg_attr(nll, feature(nll))] @@ -16,12 +20,14 @@ #![cfg_attr(zflagsul, feature(unsized_locals))] #![cfg_attr(nllul, feature(unsized_locals))] #![cfg_attr(editionul, feature(unsized_locals))] -#![feature(box_syntax)] -fn foo(x: Box<[i32]>) { - box *x; +trait Bar { + fn f(self); +} + +fn foo(x: Box<dyn Bar>) { + x.f(); //[migrate,nll,zflags,edition]~^ ERROR E0161 - //[migrateul,nllul,zflagsul,editionul]~^^ ERROR E0161 } fn main() {} diff --git a/src/test/ui/error-codes/E0161.zflags.stderr b/src/test/ui/error-codes/E0161.zflags.stderr index 536a81a4bc6..6beb29c57d5 100644 --- a/src/test/ui/error-codes/E0161.zflags.stderr +++ b/src/test/ui/error-codes/E0161.zflags.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:9 +error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined + --> $DIR/E0161.rs:29:5 | -LL | box *x; - | ^^ +LL | x.f(); + | ^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.zflagsul.stderr b/src/test/ui/error-codes/E0161.zflagsul.stderr deleted file mode 100644 index 2baba998f12..00000000000 --- a/src/test/ui/error-codes/E0161.zflagsul.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:22:5 - | -LL | box *x; - | ^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0161`. diff --git a/src/test/ui/error-codes/E0271.stderr b/src/test/ui/error-codes/E0271.stderr index 580b5aef07e..284eaafc6cc 100644 --- a/src/test/ui/error-codes/E0271.stderr +++ b/src/test/ui/error-codes/E0271.stderr @@ -1,11 +1,14 @@ error[E0271]: type mismatch resolving `<i8 as Trait>::AssociatedType == u32` --> $DIR/E0271.rs:10:5 | -LL | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> { - | ------------------ required by this bound in `foo` -... LL | foo(3_i8); | ^^^ expected `u32`, found `&str` + | +note: required by a bound in `foo` + --> $DIR/E0271.rs:3:32 + | +LL | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> { + | ^^^^^^^^^^^^^^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index 390c1e3e8ea..15d851aa934 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -1,9 +1,6 @@ error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/E0275.rs:5:33 | -LL | trait Foo {} - | --------- required by this bound in `Foo` -... LL | impl<T> Foo for T where Bar<T>: Foo {} | ^^^ | @@ -15,6 +12,11 @@ LL | impl<T> Foo for T where Bar<T>: Foo {} | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `Bar<T>` +note: required by a bound in `Foo` + --> $DIR/E0275.rs:1:1 + | +LL | trait Foo {} + | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0277-2.stderr b/src/test/ui/error-codes/E0277-2.stderr index afd0e032dc3..ca2cb884240 100644 --- a/src/test/ui/error-codes/E0277-2.stderr +++ b/src/test/ui/error-codes/E0277-2.stderr @@ -1,9 +1,6 @@ error[E0277]: `*const u8` cannot be sent between threads safely --> $DIR/E0277-2.rs:16:5 | -LL | fn is_send<T: Send>() { } - | ---- required by this bound in `is_send` -... LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ `*const u8` cannot be sent between threads safely | @@ -23,6 +20,11 @@ note: required because it appears within the type `Foo` | LL | struct Foo { | ^^^ +note: required by a bound in `is_send` + --> $DIR/E0277-2.rs:13:15 + | +LL | fn is_send<T: Send>() { } + | ^^^^ required by this bound in `is_send` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index 2c2dcbdd0dc..c82665aa580 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -15,11 +15,14 @@ LL | fn f(p: &Path) { } error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/E0277.rs:15:15 | -LL | fn some_func<T: Foo>(foo: T) { - | --- required by this bound in `some_func` -... LL | some_func(5i32); | ^^^^ the trait `Foo` is not implemented for `i32` + | +note: required by a bound in `some_func` + --> $DIR/E0277.rs:7:17 + | +LL | fn some_func<T: Foo>(foo: T) { + | ^^^ required by this bound in `some_func` error: aborting due to 2 previous errors diff --git a/src/test/ui/error-should-say-copy-not-pod.stderr b/src/test/ui/error-should-say-copy-not-pod.stderr index 346e882485e..8c6025e708e 100644 --- a/src/test/ui/error-should-say-copy-not-pod.stderr +++ b/src/test/ui/error-should-say-copy-not-pod.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/error-should-say-copy-not-pod.rs:6:17 | -LL | fn check_bound<T:Copy>(_: T) {} - | ---- required by this bound in `check_bound` -... LL | check_bound("nocopy".to_string()); | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `check_bound` + --> $DIR/error-should-say-copy-not-pod.rs:3:18 + | +LL | fn check_bound<T:Copy>(_: T) {} + | ^^^^ required by this bound in `check_bound` error: aborting due to previous error diff --git a/src/test/ui/extern/extern-types-not-sync-send.stderr b/src/test/ui/extern/extern-types-not-sync-send.stderr index 547116fbbab..7865ddeda34 100644 --- a/src/test/ui/extern/extern-types-not-sync-send.stderr +++ b/src/test/ui/extern/extern-types-not-sync-send.stderr @@ -1,24 +1,28 @@ error[E0277]: `A` cannot be shared between threads safely --> $DIR/extern-types-not-sync-send.rs:13:19 | -LL | fn assert_sync<T: ?Sized + Sync>() {} - | ---- required by this bound in `assert_sync` -... LL | assert_sync::<A>(); | ^ `A` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `A` +note: required by a bound in `assert_sync` + --> $DIR/extern-types-not-sync-send.rs:9:28 + | +LL | fn assert_sync<T: ?Sized + Sync>() {} + | ^^^^ required by this bound in `assert_sync` error[E0277]: `A` cannot be sent between threads safely --> $DIR/extern-types-not-sync-send.rs:16:19 | -LL | fn assert_send<T: ?Sized + Send>() {} - | ---- required by this bound in `assert_send` -... LL | assert_send::<A>(); | ^ `A` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `A` +note: required by a bound in `assert_send` + --> $DIR/extern-types-not-sync-send.rs:10:28 + | +LL | fn assert_send<T: ?Sized + Send>() {} + | ^^^^ required by this bound in `assert_send` error: aborting due to 2 previous errors diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr index 44c0ae49ea6..e21077159b2 100644 --- a/src/test/ui/extern/extern-types-unsized.stderr +++ b/src/test/ui/extern/extern-types-unsized.stderr @@ -1,13 +1,15 @@ error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/extern-types-unsized.rs:22:20 | -LL | fn assert_sized<T>() {} - | - required by this bound in `assert_sized` -... LL | assert_sized::<A>(); | ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `A` +note: required by a bound in `assert_sized` + --> $DIR/extern-types-unsized.rs:19:17 + | +LL | fn assert_sized<T>() {} + | ^ required by this bound in `assert_sized` help: consider relaxing the implicit `Sized` restriction | LL | fn assert_sized<T: ?Sized>() {} @@ -16,9 +18,6 @@ LL | fn assert_sized<T: ?Sized>() {} error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/extern-types-unsized.rs:25:5 | -LL | fn assert_sized<T>() {} - | - required by this bound in `assert_sized` -... LL | assert_sized::<Foo>(); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | @@ -28,6 +27,11 @@ note: required because it appears within the type `Foo` | LL | struct Foo { | ^^^ +note: required by a bound in `assert_sized` + --> $DIR/extern-types-unsized.rs:19:17 + | +LL | fn assert_sized<T>() {} + | ^ required by this bound in `assert_sized` help: consider relaxing the implicit `Sized` restriction | LL | fn assert_sized<T: ?Sized>() {} @@ -36,9 +40,6 @@ LL | fn assert_sized<T: ?Sized>() {} error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/extern-types-unsized.rs:28:5 | -LL | fn assert_sized<T>() {} - | - required by this bound in `assert_sized` -... LL | assert_sized::<Bar<A>>(); | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | @@ -48,6 +49,11 @@ note: required because it appears within the type `Bar<A>` | LL | struct Bar<T: ?Sized> { | ^^^ +note: required by a bound in `assert_sized` + --> $DIR/extern-types-unsized.rs:19:17 + | +LL | fn assert_sized<T>() {} + | ^ required by this bound in `assert_sized` help: consider relaxing the implicit `Sized` restriction | LL | fn assert_sized<T: ?Sized>() {} @@ -56,9 +62,6 @@ LL | fn assert_sized<T: ?Sized>() {} error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/extern-types-unsized.rs:31:5 | -LL | fn assert_sized<T>() {} - | - required by this bound in `assert_sized` -... LL | assert_sized::<Bar<Bar<A>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | @@ -73,6 +76,11 @@ note: required because it appears within the type `Bar<Bar<A>>` | LL | struct Bar<T: ?Sized> { | ^^^ +note: required by a bound in `assert_sized` + --> $DIR/extern-types-unsized.rs:19:17 + | +LL | fn assert_sized<T>() {} + | ^ required by this bound in `assert_sized` help: consider relaxing the implicit `Sized` restriction | LL | fn assert_sized<T: ?Sized>() {} diff --git a/src/test/ui/extern/extern-wrong-value-type.stderr b/src/test/ui/extern/extern-wrong-value-type.stderr index d92b5f43110..74981ebb76c 100644 --- a/src/test/ui/extern/extern-wrong-value-type.stderr +++ b/src/test/ui/extern/extern-wrong-value-type.stderr @@ -1,14 +1,16 @@ error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() {f}` --> $DIR/extern-wrong-value-type.rs:9:11 | -LL | fn is_fn<F>(_: F) where F: Fn() {} - | ---- required by this bound in `is_fn` -... LL | is_fn(f); | ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}` | = help: the trait `Fn<()>` is not implemented for `extern "C" fn() {f}` = note: wrap the `extern "C" fn() {f}` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `is_fn` + --> $DIR/extern-wrong-value-type.rs:4:28 + | +LL | fn is_fn<F>(_: F) where F: Fn() {} + | ^^^^ required by this bound in `is_fn` error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr index 8f5ba07bdaa..f24c3d69a26 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr @@ -139,11 +139,11 @@ error[E0277]: the trait bound `<<Self as _Tr3>::A as Iterator>::Item: Copy` is n LL | type A: Iterator<Item: Copy>; | ^^^^ the trait `Copy` is not implemented for `<<Self as _Tr3>::A as Iterator>::Item` | - ::: $SRC_DIR/core/src/marker.rs:LL:COL +note: required by a bound in `Copy` + --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub trait Copy: Clone { - | --------------------- required by this bound in `Copy` - | + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Copy` help: consider further restricting the associated type | LL | trait _Tr3 where <<Self as _Tr3>::A as Iterator>::Item: Copy { diff --git a/src/test/ui/fmt/send-sync.stderr b/src/test/ui/fmt/send-sync.stderr index 780c71128d4..7c7a3c8846b 100644 --- a/src/test/ui/fmt/send-sync.stderr +++ b/src/test/ui/fmt/send-sync.stderr @@ -1,9 +1,6 @@ error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely --> $DIR/send-sync.rs:8:5 | -LL | fn send<T: Send>(_: T) {} - | ---- required by this bound in `send` -... LL | send(format_args!("{:?}", c)); | ^^^^ `core::fmt::Opaque` cannot be shared between threads safely | @@ -13,13 +10,15 @@ LL | send(format_args!("{:?}", c)); = note: required because it appears within the type `[ArgumentV1<'_>]` = note: required because of the requirements on the impl of `Send` for `&[ArgumentV1<'_>]` = note: required because it appears within the type `Arguments<'_>` +note: required by a bound in `send` + --> $DIR/send-sync.rs:1:12 + | +LL | fn send<T: Send>(_: T) {} + | ^^^^ required by this bound in `send` error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely --> $DIR/send-sync.rs:9:5 | -LL | fn sync<T: Sync>(_: T) {} - | ---- required by this bound in `sync` -... LL | sync(format_args!("{:?}", c)); | ^^^^ `core::fmt::Opaque` cannot be shared between threads safely | @@ -29,6 +28,11 @@ LL | sync(format_args!("{:?}", c)); = note: required because it appears within the type `[ArgumentV1<'_>]` = note: required because it appears within the type `&[ArgumentV1<'_>]` = note: required because it appears within the type `Arguments<'_>` +note: required by a bound in `sync` + --> $DIR/send-sync.rs:2:12 + | +LL | fn sync<T: Sync>(_: T) {} + | ^^^^ required by this bound in `sync` error: aborting due to 2 previous errors diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index 5b63b8e2285..57a25b8e48b 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -34,13 +34,15 @@ LL | let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() - error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}` --> $DIR/fn-trait-formatting.rs:19:14 | -LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {} - | ------------------ required by this bound in `needs_fn` -... LL | needs_fn(1); | ^ expected an `Fn<(isize,)>` closure, found `{integer}` | = help: the trait `Fn<(isize,)>` is not implemented for `{integer}` +note: required by a bound in `needs_fn` + --> $DIR/fn-trait-formatting.rs:3:31 + | +LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `needs_fn` error: aborting due to 4 previous errors diff --git a/src/test/ui/generator/auto-trait-regions.nll.stderr b/src/test/ui/generator/auto-trait-regions.nll.stderr index 794369a8dc0..76970fb7872 100644 --- a/src/test/ui/generator/auto-trait-regions.nll.stderr +++ b/src/test/ui/generator/auto-trait-regions.nll.stderr @@ -24,17 +24,23 @@ LL | assert_foo(a); | = note: consider using a `let` binding to create a longer lived value -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/auto-trait-regions.rs:31:5 | LL | assert_foo(gen); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... + = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/auto-trait-regions.rs:50:5 | LL | assert_foo(gen); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... + = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` error: aborting due to 4 previous errors diff --git a/src/test/ui/generator/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator/generator-yielding-or-returning-itself.stderr index 5043a3be91d..62a7b37a5a3 100644 --- a/src/test/ui/generator/generator-yielding-or-returning-itself.stderr +++ b/src/test/ui/generator/generator-yielding-or-returning-itself.stderr @@ -1,11 +1,6 @@ error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6] as Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6]` --> $DIR/generator-yielding-or-returning-itself.rs:15:5 | -LL | pub fn want_cyclic_generator_return<T>(_: T) - | ---------------------------- required by a bound in this -LL | where T: Generator<Yield = (), Return = T> - | ---------- required by this bound in `want_cyclic_generator_return` -... LL | want_cyclic_generator_return(|| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size | @@ -13,15 +8,17 @@ LL | want_cyclic_generator_return(|| { this error may be the result of a recent compiler bug-fix, see issue #46062 <https://github.com/rust-lang/rust/issues/46062> for more information +note: required by a bound in `want_cyclic_generator_return` + --> $DIR/generator-yielding-or-returning-itself.rs:10:36 + | +LL | pub fn want_cyclic_generator_return<T>(_: T) + | ---------------------------- required by a bound in this +LL | where T: Generator<Yield = (), Return = T> + | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return` error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 32:6] as Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 32:6]` --> $DIR/generator-yielding-or-returning-itself.rs:28:5 | -LL | pub fn want_cyclic_generator_yield<T>(_: T) - | --------------------------- required by a bound in this -LL | where T: Generator<Yield = T, Return = ()> - | --------- required by this bound in `want_cyclic_generator_yield` -... LL | want_cyclic_generator_yield(|| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size | @@ -29,6 +26,13 @@ LL | want_cyclic_generator_yield(|| { this error may be the result of a recent compiler bug-fix, see issue #46062 <https://github.com/rust-lang/rust/issues/46062> for more information +note: required by a bound in `want_cyclic_generator_yield` + --> $DIR/generator-yielding-or-returning-itself.rs:23:24 + | +LL | pub fn want_cyclic_generator_yield<T>(_: T) + | --------------------------- required by a bound in this +LL | where T: Generator<Yield = T, Return = ()> + | ^^^^^^^^^ required by this bound in `want_cyclic_generator_yield` error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/issue-68112.stderr b/src/test/ui/generator/issue-68112.stderr index 46d27baa545..c3fc8dd8f92 100644 --- a/src/test/ui/generator/issue-68112.stderr +++ b/src/test/ui/generator/issue-68112.stderr @@ -1,9 +1,6 @@ error: generator cannot be sent between threads safely --> $DIR/issue-68112.rs:33:5 | -LL | fn require_send(_: impl Send) {} - | ---- required by this bound in `require_send` -... LL | require_send(send_gen); | ^^^^^^^^^^^^ generator is not `Send` | @@ -17,13 +14,15 @@ LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later LL | }; | - `_non_send_gen` is later dropped here +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:22:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell<i32>` cannot be shared between threads safely --> $DIR/issue-68112.rs:52:5 | -LL | fn require_send(_: impl Send) {} - | ---- required by this bound in `require_send` -... LL | require_send(send_gen); | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | @@ -34,6 +33,11 @@ LL | require_send(send_gen); = note: required because it appears within the type `impl Generator` = note: required because it appears within the type `{impl Generator, ()}` = note: required because it appears within the type `[generator@$DIR/issue-68112.rs:48:20: 51:6]` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:22:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/not-send-sync.stderr b/src/test/ui/generator/not-send-sync.stderr index 448cb2a043a..4d2faa198f1 100644 --- a/src/test/ui/generator/not-send-sync.stderr +++ b/src/test/ui/generator/not-send-sync.stderr @@ -1,22 +1,21 @@ error[E0277]: `Cell<i32>` cannot be shared between threads safely --> $DIR/not-send-sync.rs:16:5 | -LL | fn assert_send<T: Send>(_: T) {} - | ---- required by this bound in `assert_send` -... LL | assert_send(|| { | ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell<i32>` = note: required because of the requirements on the impl of `Send` for `&Cell<i32>` = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6]` +note: required by a bound in `assert_send` + --> $DIR/not-send-sync.rs:7:23 + | +LL | fn assert_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `assert_send` error: generator cannot be shared between threads safely --> $DIR/not-send-sync.rs:9:5 | -LL | fn assert_sync<T: Sync>(_: T) {} - | ---- required by this bound in `assert_sync` -... LL | assert_sync(|| { | ^^^^^^^^^^^ generator is not `Sync` | @@ -30,6 +29,11 @@ LL | yield; | ^^^^^ yield occurs here, with `a` maybe used later LL | }); | - `a` is later dropped here +note: required by a bound in `assert_sync` + --> $DIR/not-send-sync.rs:6:23 + | +LL | fn assert_sync<T: Sync>(_: T) {} + | ^^^^ required by this bound in `assert_sync` error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr index bd0d27ff3e9..53f0936632a 100644 --- a/src/test/ui/generator/print/generator-print-verbose-1.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr @@ -1,9 +1,6 @@ error: generator cannot be sent between threads safely --> $DIR/generator-print-verbose-1.rs:37:5 | -LL | fn require_send(_: impl Send) {} - | ---- required by this bound in `require_send` -... LL | require_send(send_gen); | ^^^^^^^^^^^^ generator is not `Send` | @@ -17,13 +14,15 @@ LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later LL | }; | - `_non_send_gen` is later dropped here +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:26:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell<i32>` cannot be shared between threads safely --> $DIR/generator-print-verbose-1.rs:56:5 | -LL | fn require_send(_: impl Send) {} - | ---- required by this bound in `require_send` -... LL | require_send(send_gen); | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | @@ -34,6 +33,11 @@ LL | require_send(send_gen); = note: required because it appears within the type `Opaque(DefId(0:42 ~ generator_print_verbose_1[70c9]::make_non_send_generator2::{opaque#0}), [])` = note: required because it appears within the type `{Opaque(DefId(0:42 ~ generator_print_verbose_1[70c9]::make_non_send_generator2::{opaque#0}), []), ()}` = note: required because it appears within the type `[test2::{closure#0} upvar_tys=() {Opaque(DefId(0:42 ~ generator_print_verbose_1[70c9]::make_non_send_generator2::{opaque#0}), []), ()}]` +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:26:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/print/generator-print-verbose-2.stderr b/src/test/ui/generator/print/generator-print-verbose-2.stderr index d590f876b8e..fb2a5754dd3 100644 --- a/src/test/ui/generator/print/generator-print-verbose-2.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-2.stderr @@ -1,22 +1,21 @@ error[E0277]: `Cell<i32>` cannot be shared between threads safely --> $DIR/generator-print-verbose-2.rs:19:5 | -LL | fn assert_send<T: Send>(_: T) {} - | ---- required by this bound in `assert_send` -... LL | assert_send(|| { | ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell<i32>` = note: required because of the requirements on the impl of `Send` for `&'_#4r Cell<i32>` = note: required because it appears within the type `[main::{closure#1} upvar_tys=(&'_#4r Cell<i32>) _#17t]` +note: required by a bound in `assert_send` + --> $DIR/generator-print-verbose-2.rs:10:23 + | +LL | fn assert_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `assert_send` error: generator cannot be shared between threads safely --> $DIR/generator-print-verbose-2.rs:12:5 | -LL | fn assert_sync<T: Sync>(_: T) {} - | ---- required by this bound in `assert_sync` -... LL | assert_sync(|| { | ^^^^^^^^^^^ generator is not `Sync` | @@ -30,6 +29,11 @@ LL | yield; | ^^^^^ yield occurs here, with `a` maybe used later LL | }); | - `a` is later dropped here +note: required by a bound in `assert_sync` + --> $DIR/generator-print-verbose-2.rs:9:23 + | +LL | fn assert_sync<T: Sync>(_: T) {} + | ^^^^ required by this bound in `assert_sync` error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/resume-arg-late-bound.nll.stderr b/src/test/ui/generator/resume-arg-late-bound.nll.stderr index 7d712191924..25bc6afc550 100644 --- a/src/test/ui/generator/resume-arg-late-bound.nll.stderr +++ b/src/test/ui/generator/resume-arg-late-bound.nll.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/resume-arg-late-bound.rs:15:5 | LL | test(gen); - | ^^^^^^^^^ + | ^^^^^^^^^ one type is more general than the other + | + = note: expected type `for<'a> Generator<&'a mut bool>` + found type `Generator<&mut bool>` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index 05cc6c01217..ea2a48d13ce 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -17,12 +17,12 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t LL | Pin::new(&mut gen).resume(()); | ^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/ops/generator.rs:LL:COL + = help: the trait `Sized` is not implemented for `str` +note: required by a bound in `GeneratorState` + --> $SRC_DIR/core/src/ops/generator.rs:LL:COL | LL | pub enum GeneratorState<Y, R> { - | - required by this bound in `GeneratorState` - | - = help: the trait `Sized` is not implemented for `str` + | ^ required by this bound in `GeneratorState` error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/static-not-unpin.stderr b/src/test/ui/generator/static-not-unpin.stderr index 74ac53a7f94..7ae128d072d 100644 --- a/src/test/ui/generator/static-not-unpin.stderr +++ b/src/test/ui/generator/static-not-unpin.stderr @@ -1,13 +1,15 @@ error[E0277]: `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]` cannot be unpinned --> $DIR/static-not-unpin.rs:14:18 | -LL | fn assert_unpin<T: Unpin>(_: T) { - | ----- required by this bound in `assert_unpin` -... LL | assert_unpin(generator); | ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]` | = note: consider using `Box::pin` +note: required by a bound in `assert_unpin` + --> $DIR/static-not-unpin.rs:7:20 + | +LL | fn assert_unpin<T: Unpin>(_: T) { + | ^^^^^ required by this bound in `assert_unpin` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr index 57ccadc7b8d..d6716cac06e 100644 --- a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr +++ b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr @@ -4,10 +4,11 @@ error[E0277]: the trait bound `(): AsRef<()>` is not satisfied LL | type Bar = (); | ^^^^^^^^^^^^^^ the trait `AsRef<()>` is not implemented for `()` | - ::: $DIR/auxiliary/foo_defn.rs:6:15 +note: required by a bound in `foo_defn::Foo::Bar` + --> $DIR/auxiliary/foo_defn.rs:6:15 | LL | type Bar: AsRef<()>; - | --------- required by this bound in `foo_defn::Foo::Bar` + | ^^^^^^^^^ required by this bound in `foo_defn::Foo::Bar` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr b/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr index 1594747e54c..e82cbf7e8e5 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr @@ -15,7 +15,7 @@ LL | type F<T1> = &[u8]; help: consider introducing a named lifetime parameter | LL | type F<'a, T1> = &'a [u8]; - | +++ ~~~ + | +++ ++ error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr index c341338390c..1d3aeaefca0 100644 --- a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr +++ b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/issue-68641-check-gat-bounds.rs:14:5 | -LL | type Item<'a>: Copy; - | ---- required by this bound in `UnsafeCopy::Item` -... LL | type Item<'a> = T; | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `UnsafeCopy::Item` + --> $DIR/issue-68641-check-gat-bounds.rs:6:20 + | +LL | type Item<'a>: Copy; + | ^^^^ required by this bound in `UnsafeCopy::Item` help: consider restricting type parameter `T` | LL | impl<T: std::marker::Copy> UnsafeCopy for T { diff --git a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr index 2861aee3aaf..574b81556e7 100644 --- a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr +++ b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr @@ -1,13 +1,15 @@ error[E0277]: expected a `Fn<()>` closure, found `T` --> $DIR/issue-68642-broken-llvm-ir.rs:14:5 | -LL | type F<'a>: Fn() -> u32; - | ----------- required by this bound in `Fun::F` -... LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `Fun::F` + --> $DIR/issue-68642-broken-llvm-ir.rs:6:17 + | +LL | type F<'a>: Fn() -> u32; + | ^^^^^^^^^^^ required by this bound in `Fun::F` help: consider restricting type parameter `T` | LL | impl<T: std::ops::Fn<()>> Fun for T { diff --git a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr index 2eaeffba089..9c4cbc5eb56 100644 --- a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr +++ b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr @@ -1,13 +1,15 @@ error[E0277]: expected a `Fn<()>` closure, found `T` --> $DIR/issue-68643-broken-mir.rs:14:5 | -LL | type F<'a>: Fn() -> u32; - | ----------- required by this bound in `Fun::F` -... LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `Fun::F` + --> $DIR/issue-68643-broken-mir.rs:6:17 + | +LL | type F<'a>: Fn() -> u32; + | ^^^^^^^^^^^ required by this bound in `Fun::F` help: consider restricting type parameter `T` | LL | impl<T: std::ops::Fn<()>> Fun for T { diff --git a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr index 7c56ded01bf..0df5c0f8c79 100644 --- a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr +++ b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr @@ -1,13 +1,15 @@ error[E0277]: expected a `Fn<()>` closure, found `T` --> $DIR/issue-68644-codegen-selection.rs:14:5 | -LL | type F<'a>: Fn() -> u32; - | ----------- required by this bound in `Fun::F` -... LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `Fun::F` + --> $DIR/issue-68644-codegen-selection.rs:6:17 + | +LL | type F<'a>: Fn() -> u32; + | ^^^^^^^^^^^ required by this bound in `Fun::F` help: consider restricting type parameter `T` | LL | impl<T: std::ops::Fn<()>> Fun for T { diff --git a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr index 6662a2b35da..35a4350804e 100644 --- a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr +++ b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr @@ -1,13 +1,15 @@ error[E0277]: expected a `Fn<()>` closure, found `T` --> $DIR/issue-68645-codegen-fulfillment.rs:14:5 | -LL | type F<'a>: Fn() -> u32; - | ----------- required by this bound in `Fun::F` -... LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `Fun::F` + --> $DIR/issue-68645-codegen-fulfillment.rs:6:17 + | +LL | type F<'a>: Fn() -> u32; + | ^^^^^^^^^^^ required by this bound in `Fun::F` help: consider restricting type parameter `T` | LL | impl<T: std::ops::Fn<()>> Fun for T { diff --git a/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr b/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr index 422805a0d0b..d69ac8e580a 100644 --- a/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr +++ b/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr @@ -1,9 +1,6 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T` --> $DIR/issue-68656-unsized-values.rs:15:5 | -LL | type Item<'a>: std::ops::Deref<Target = T>; - | ---------- required by this bound in `UnsafeCopy::Item` -... LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<T> for T { | - this type parameter LL | type Item<'a> = T; @@ -11,6 +8,11 @@ LL | type Item<'a> = T; | = note: expected type parameter `T` found associated type `<T as Deref>::Target` +note: required by a bound in `UnsafeCopy::Item` + --> $DIR/issue-68656-unsized-values.rs:6:36 + | +LL | type Item<'a>: std::ops::Deref<Target = T>; + | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item` help: consider further restricting this bound | LL | impl<T: Copy + std::ops::Deref + Deref<Target = T>> UnsafeCopy<T> for T { diff --git a/src/test/ui/generic-associated-types/issue-74684-2.stderr b/src/test/ui/generic-associated-types/issue-74684-2.stderr index 23fb4285fc9..86e9450904b 100644 --- a/src/test/ui/generic-associated-types/issue-74684-2.stderr +++ b/src/test/ui/generic-associated-types/issue-74684-2.stderr @@ -1,11 +1,14 @@ error[E0271]: type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]` --> $DIR/issue-74684-2.rs:23:5 | -LL | fn bug<'a, T: ?Sized + Fun<F<'a> = [u8]>>(t: Box<T>) -> &'static T::F<'a> { - | ------------ required by this bound in `bug` -... LL | bug(Box::new(x)); | ^^^ expected slice `[u8]`, found `i32` + | +note: required by a bound in `bug` + --> $DIR/issue-74684-2.rs:13:28 + | +LL | fn bug<'a, T: ?Sized + Fun<F<'a> = [u8]>>(t: Box<T>) -> &'static T::F<'a> { + | ^^^^^^^^^^^^ required by this bound in `bug` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-74816.stderr b/src/test/ui/generic-associated-types/issue-74816.stderr index c910261ca52..49ae87cbfe9 100644 --- a/src/test/ui/generic-associated-types/issue-74816.stderr +++ b/src/test/ui/generic-associated-types/issue-74816.stderr @@ -2,11 +2,13 @@ error[E0277]: the trait bound `Self: Trait1` is not satisfied --> $DIR/issue-74816.rs:9:5 | LL | type Associated: Trait1 = Self; - | ^^^^^^^^^^^^^^^^^------^^^^^^^^ - | | | - | | required by this bound in `Trait2::Associated` - | the trait `Trait1` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait1` is not implemented for `Self` | +note: required by a bound in `Trait2::Associated` + --> $DIR/issue-74816.rs:9:22 + | +LL | type Associated: Trait1 = Self; + | ^^^^^^ required by this bound in `Trait2::Associated` help: consider further restricting `Self` | LL | trait Trait2: Trait1 { @@ -16,11 +18,13 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation --> $DIR/issue-74816.rs:9:5 | LL | type Associated: Trait1 = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | doesn't have a size known at compile-time - | required by this bound in `Trait2::Associated` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | +note: required by a bound in `Trait2::Associated` + --> $DIR/issue-74816.rs:9:5 + | +LL | type Associated: Trait1 = Self; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated` help: consider further restricting `Self` | LL | trait Trait2: Sized { diff --git a/src/test/ui/generic-associated-types/issue-74824.stderr b/src/test/ui/generic-associated-types/issue-74824.stderr index aef44a164a9..bd51e5a447b 100644 --- a/src/test/ui/generic-associated-types/issue-74824.stderr +++ b/src/test/ui/generic-associated-types/issue-74824.stderr @@ -2,21 +2,26 @@ error[E0277]: the trait bound `Box<T>: Copy` is not satisfied --> $DIR/issue-74824.rs:7:5 | LL | type Copy<T>: Copy = Box<T>; - | ^^^^^^^^^^^^^^----^^^^^^^^^^ - | | | - | | required by this bound in `UnsafeCopy::Copy` - | the trait `Copy` is not implemented for `Box<T>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<T>` + | +note: required by a bound in `UnsafeCopy::Copy` + --> $DIR/issue-74824.rs:7:19 + | +LL | type Copy<T>: Copy = Box<T>; + | ^^^^ required by this bound in `UnsafeCopy::Copy` error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/issue-74824.rs:7:5 | LL | type Copy<T>: Copy = Box<T>; - | ^^^^^^^^^^^^^^----^^^^^^^^^^ - | | | - | | required by this bound in `UnsafeCopy::Copy` - | the trait `Clone` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `T` | = note: required because of the requirements on the impl of `Clone` for `Box<T>` +note: required by a bound in `UnsafeCopy::Copy` + --> $DIR/issue-74824.rs:7:19 + | +LL | type Copy<T>: Copy = Box<T>; + | ^^^^ required by this bound in `UnsafeCopy::Copy` help: consider restricting type parameter `T` | LL | type Copy<T: std::clone::Clone>: Copy = Box<T>; diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr index e7f801a7bd4..5e7e72ca562 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr +++ b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr @@ -1,11 +1,14 @@ error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized` --> $DIR/projection-bound-cycle-generic.rs:44:18 | -LL | type Item: Sized where <Self as Foo>::Item: Sized; - | ----- required by this bound in `Foo::Item` -... LL | type Assoc = OnlySized<<T as Foo>::Item>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: required by a bound in `Foo::Item` + --> $DIR/projection-bound-cycle-generic.rs:11:49 + | +LL | type Item: Sized where <Self as Foo>::Item: Sized; + | ^^^^^ required by this bound in `Foo::Item` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle.stderr b/src/test/ui/generic-associated-types/projection-bound-cycle.stderr index 67195c65d36..1153bf53ba4 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle.stderr +++ b/src/test/ui/generic-associated-types/projection-bound-cycle.stderr @@ -1,11 +1,14 @@ error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized` --> $DIR/projection-bound-cycle.rs:46:18 | -LL | type Item: Sized where <Self as Foo>::Item: Sized; - | ----- required by this bound in `Foo::Item` -... LL | type Assoc = OnlySized<<T as Foo>::Item>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: required by a bound in `Foo::Item` + --> $DIR/projection-bound-cycle.rs:13:49 + | +LL | type Item: Sized where <Self as Foo>::Item: Sized; + | ^^^^^ required by this bound in `Foo::Item` error: aborting due to previous error diff --git a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr index 2b88a6046fd..2c397d80b01 100644 --- a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr +++ b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr @@ -1,13 +1,15 @@ error[E0277]: the size for values of type `[()]` cannot be known at compilation time --> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:19:6 | -LL | trait Tsized<P: Sized = [Self]> {} - | - required by this bound in `Tsized` -LL | LL | impl Tsized for () {} | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[()]` +note: required by a bound in `Tsized` + --> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:17:14 + | +LL | trait Tsized<P: Sized = [Self]> {} + | ^ required by this bound in `Tsized` error: aborting due to previous error diff --git a/src/test/ui/higher-rank-trait-bounds/issue-59311.rs b/src/test/ui/higher-rank-trait-bounds/issue-59311.rs index 1e1241c7f83..d617571753c 100644 --- a/src/test/ui/higher-rank-trait-bounds/issue-59311.rs +++ b/src/test/ui/higher-rank-trait-bounds/issue-59311.rs @@ -14,7 +14,7 @@ pub fn crash<V>(v: &V) where for<'a> &'a V: T + 'static, { - v.t(|| {}); //~ ERROR: higher-ranked subtype error + v.t(|| {}); //~ ERROR: higher-ranked lifetime error } fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr b/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr index ca632629267..c16c8206153 100644 --- a/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr +++ b/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr @@ -1,8 +1,10 @@ -error: higher-ranked subtype error +error: higher-ranked lifetime error --> $DIR/issue-59311.rs:17:9 | LL | v.t(|| {}); | ^^^^^ + | + = note: could not prove for<'a> &'a V: 'static error: aborting due to previous error diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.nll.stderr index 4cca552d7d4..439a113ef38 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.nll.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.nll.stderr @@ -1,14 +1,17 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/hr-subtype.rs:45:13 | LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... LL | / check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &'a u32, LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) } | |_____________________________________________- in this macro invocation | + = note: expected enum `Option<for<'r, 's> fn(&'r u32, &'s u32) -> &'r u32>` + found enum `Option<for<'r> fn(&'r u32, &'r u32) -> &'r u32>` = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.nll.stderr index 2c1ac126fab..61b3f0ca284 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.nll.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.nll.stderr @@ -1,14 +1,17 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/hr-subtype.rs:45:13 | LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... LL | / check! { bound_a_vs_free_x: (for<'a> fn(&'a u32), LL | | fn(&'x u32)) } | |______________- in this macro invocation | + = note: expected enum `Option<for<'r> fn(&'r u32)>` + found enum `Option<fn(&u32)>` = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.nll.stderr index 816984654f7..75e2ba58f33 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.nll.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.nll.stderr @@ -1,26 +1,31 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/hr-subtype.rs:45:13 | LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... LL | / check! { bound_inv_a_b_vs_bound_inv_a: (for<'a,'b> fn(Inv<'a>, Inv<'b>), LL | | for<'a> fn(Inv<'a>, Inv<'a>)) } | |__________________________________- in this macro invocation | + = note: expected enum `Option<for<'r, 's> fn(Inv<'r>, Inv<'s>)>` + found enum `Option<for<'r> fn(Inv<'r>, Inv<'r>)>` = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/hr-subtype.rs:45:13 | LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... LL | / check! { bound_inv_a_b_vs_bound_inv_a: (for<'a,'b> fn(Inv<'a>, Inv<'b>), LL | | for<'a> fn(Inv<'a>, Inv<'a>)) } | |__________________________________- in this macro invocation | + = note: expected enum `Option<for<'r, 's> fn(Inv<'r>, Inv<'s>)>` + found enum `Option<for<'r> fn(Inv<'r>, Inv<'r>)>` = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr index f290a93326f..46f5308dd87 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr +++ b/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr @@ -1,14 +1,20 @@ -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/hrtb-conflate-regions.rs:27:10 | LL | fn b() { want_foo2::<SomeStruct>(); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/hrtb-conflate-regions.rs:27:10 | LL | fn b() { want_foo2::<SomeStruct>(); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` error: aborting due to 2 previous errors diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr index 11390d9e2d2..1ee3c674963 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/hrtb-exists-forall-fn.rs:17:12 | LL | let _: for<'b> fn(&'b u32) = foo(); - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'b> fn(&'b u32)` + found fn pointer `fn(&u32)` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr index a4c3ffd1f6c..364b613fc77 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr @@ -1,8 +1,11 @@ -error: higher-ranked subtype error +error: implementation of `Trait` is not general enough --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 | LL | foo::<()>(); - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ implementation of `Trait` is not general enough + | + = note: `()` must implement `Trait<for<'b> fn(&'b u32)>` + = note: ...but it actually implements `Trait<fn(&'0 u32)>`, for some specific lifetime `'0` error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr index e2a399b2faa..cb2ce8a4116 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr @@ -1,8 +1,11 @@ -error: higher-ranked subtype error +error: implementation of `Trait` is not general enough --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 | LL | foo::<()>(); - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ implementation of `Trait` is not general enough + | + = note: `()` must implement `Trait<for<'b> fn(Cell<&'b u32>)>` + = note: ...but it actually implements `Trait<fn(Cell<&'0 u32>)>`, for some specific lifetime `'0` error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr index 55eca034513..d8267712c2b 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:26 | -LL | fn want_bar_for_any_ccx<B>(b: &B) - | -------------------- required by a bound in this -LL | where B : for<'ccx> Bar<'ccx> - | ------------------- required by this bound in `want_bar_for_any_ccx` -... LL | want_bar_for_any_ccx(b); | ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | +note: required by a bound in `want_bar_for_any_ccx` + --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:32:15 + | +LL | fn want_bar_for_any_ccx<B>(b: &B) + | -------------------- required by a bound in this +LL | where B : for<'ccx> Bar<'ccx> + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` help: consider further restricting this bound | LL | where B : Qux + for<'ccx> Bar<'ccx> diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr index d7758ad9609..a510c05055c 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr @@ -3,12 +3,14 @@ error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied | LL | want_foo_for_any_tcx(f); | ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` -... + | +note: required by a bound in `want_foo_for_any_tcx` + --> $DIR/hrtb-higher-ranker-supertraits.rs:22:15 + | LL | fn want_foo_for_any_tcx<F>(f: &F) | -------------------- required by a bound in this LL | where F : for<'tcx> Foo<'tcx> - | ------------------- required by this bound in `want_foo_for_any_tcx` - | + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo_for_any_tcx` help: consider further restricting this bound | LL | where F : Foo<'x> + for<'tcx> Foo<'tcx> @@ -19,12 +21,14 @@ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied | LL | want_bar_for_any_ccx(b); | ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` -... + | +note: required by a bound in `want_bar_for_any_ccx` + --> $DIR/hrtb-higher-ranker-supertraits.rs:39:15 + | LL | fn want_bar_for_any_ccx<B>(b: &B) | -------------------- required by a bound in this LL | where B : for<'ccx> Bar<'ccx> - | ------------------- required by this bound in `want_bar_for_any_ccx` - | + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` help: consider further restricting this bound | LL | where B : Bar<'x> + for<'ccx> Bar<'ccx> diff --git a/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr b/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr index 8901a1b4681..a812282def9 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr @@ -1,8 +1,11 @@ -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/hrtb-just-for-static.rs:24:5 | LL | want_hrtb::<StaticInt>() - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... + = note: ...but it actually implements `Foo<&'static isize>` error: lifetime may not live long enough --> $DIR/hrtb-just-for-static.rs:30:5 diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr index c3dd7949575..aefe3cdfd64 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr @@ -57,11 +57,14 @@ LL | foo_hrtb_bar_not(&mut t); | = help: consider replacing `'b` with `'static` -error: higher-ranked subtype error +error: implementation of `Bar` is not general enough --> $DIR/hrtb-perfect-forwarding.rs:43:5 | LL | foo_hrtb_bar_not(&mut t); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough + | + = note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... + = note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` warning: function cannot return without recursing --> $DIR/hrtb-perfect-forwarding.rs:48:1 diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr index 676a934569c..a94c80eb30b 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr @@ -1,11 +1,11 @@ warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:22:1 + --> $DIR/hrtb-perfect-forwarding.rs:16:1 | -LL | / fn no_hrtb<'b,T>(mut t: T) -LL | | where T : Bar<&'b isize> +LL | / fn no_hrtb<'b, T>(mut t: T) +LL | | where +LL | | T: Bar<&'b isize>, LL | | { -LL | | // OK -- `T : Bar<&'b isize>`, and thus the impl above ensures that -LL | | // `&mut T : Bar<&'b isize>`. +... | LL | | no_hrtb(&mut t); | | --------------- recursive call site LL | | } @@ -15,12 +15,12 @@ LL | | } = help: a `loop` may express intention better if this is on purpose warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:30:1 + --> $DIR/hrtb-perfect-forwarding.rs:25:1 | LL | / fn bar_hrtb<T>(mut t: T) -LL | | where T : for<'b> Bar<&'b isize> +LL | | where +LL | | T: for<'b> Bar<&'b isize>, LL | | { -LL | | // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above ... | LL | | bar_hrtb(&mut t); | | ---------------- recursive call site @@ -30,34 +30,36 @@ LL | | } = help: a `loop` may express intention better if this is on purpose warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:39:1 + --> $DIR/hrtb-perfect-forwarding.rs:35:1 | -LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T) -LL | | where T : for<'a> Foo<&'a isize> + Bar<&'b isize> +LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T) +LL | | where +LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, LL | | { -LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also ... | LL | | foo_hrtb_bar_not(&mut t); | | ------------------------ recursive call site LL | | +LL | | LL | | } | |_^ cannot return without recursing | = help: a `loop` may express intention better if this is on purpose error: higher-ranked subtype error - --> $DIR/hrtb-perfect-forwarding.rs:46:5 + --> $DIR/hrtb-perfect-forwarding.rs:43:5 | LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:50:1 + --> $DIR/hrtb-perfect-forwarding.rs:48:1 | LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T) -LL | | where T : for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize> +LL | | where +LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, LL | | { -LL | | // OK -- now we have `T : for<'b> Bar&'b isize>`. +LL | | // OK -- now we have `T : for<'b> Bar<&'b isize>`. LL | | foo_hrtb_bar_hrtb(&mut t); | | ------------------------- recursive call site LL | | } @@ -65,5 +67,5 @@ LL | | } | = help: a `loop` may express intention better if this is on purpose -error: aborting due to previous error +error: aborting due to previous error; 4 warnings emitted diff --git a/src/test/ui/hrtb/issue-46989.nll.stderr b/src/test/ui/hrtb/issue-46989.nll.stderr index 6c127b92d97..309e1a676ed 100644 --- a/src/test/ui/hrtb/issue-46989.nll.stderr +++ b/src/test/ui/hrtb/issue-46989.nll.stderr @@ -1,8 +1,11 @@ -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/issue-46989.rs:38:5 | LL | assert_foo::<fn(&i32)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `for<'r> fn(&'r i32)` + = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` error: aborting due to previous error diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr index b752cde228d..44955c58889 100644 --- a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr +++ b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr @@ -7,7 +7,7 @@ LL | type Output = &i32; help: consider introducing a named lifetime parameter | LL | type Output<'a> = &'a i32; - | ++++ ~~~ + | ++++ ++ error[E0106]: missing lifetime specifier --> $DIR/assoc-type.rs:16:20 diff --git a/src/test/ui/impl-trait/auto-trait-leak2.stderr b/src/test/ui/impl-trait/auto-trait-leak2.stderr index 6b2b8248a4f..5a8e5036014 100644 --- a/src/test/ui/impl-trait/auto-trait-leak2.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak2.stderr @@ -4,22 +4,21 @@ error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely LL | fn before() -> impl Fn(i32) { | ------------ within this `impl Fn<(i32,)>` ... -LL | fn send<T: Send>(_: T) {} - | ---- required by this bound in `send` -... LL | send(before()); | ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely | = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>` = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22]` = note: required because it appears within the type `impl Fn<(i32,)>` +note: required by a bound in `send` + --> $DIR/auto-trait-leak2.rs:10:12 + | +LL | fn send<T: Send>(_: T) {} + | ^^^^ required by this bound in `send` error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely --> $DIR/auto-trait-leak2.rs:16:5 | -LL | fn send<T: Send>(_: T) {} - | ---- required by this bound in `send` -... LL | send(after()); | ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely ... @@ -29,6 +28,11 @@ LL | fn after() -> impl Fn(i32) { = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>` = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22]` = note: required because it appears within the type `impl Fn<(i32,)>` +note: required by a bound in `send` + --> $DIR/auto-trait-leak2.rs:10:12 + | +LL | fn send<T: Send>(_: T) {} + | ^^^^ required by this bound in `send` error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr index 6ce3aaf49eb..ccd0040030d 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/error-handling.rs:23:16 + --> $DIR/error-handling.rs:22:16 | LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/type-alias-impl-trait/private_unused.rs b/src/test/ui/impl-trait/private_unused.rs index 92268f1861d..92268f1861d 100644 --- a/src/test/ui/type-alias-impl-trait/private_unused.rs +++ b/src/test/ui/impl-trait/private_unused.rs diff --git a/src/test/ui/inference/issue-86162-1.stderr b/src/test/ui/inference/issue-86162-1.stderr index f4e2161d7b8..8d6f50748cb 100644 --- a/src/test/ui/inference/issue-86162-1.stderr +++ b/src/test/ui/inference/issue-86162-1.stderr @@ -1,13 +1,15 @@ error[E0283]: type annotations needed --> $DIR/issue-86162-1.rs:7:5 | -LL | fn foo(x: impl Clone) {} - | ----- required by this bound in `foo` -... LL | foo(gen()); //<- Do not suggest `foo::<impl Clone>()`! | ^^^ cannot infer type for type parameter `impl Clone` declared on the function `foo` | = note: cannot satisfy `_: Clone` +note: required by a bound in `foo` + --> $DIR/issue-86162-1.rs:3:16 + | +LL | fn foo(x: impl Clone) {} + | ^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/inference/issue-86162-2.stderr b/src/test/ui/inference/issue-86162-2.stderr index 19f741e1cf6..5f80c595628 100644 --- a/src/test/ui/inference/issue-86162-2.stderr +++ b/src/test/ui/inference/issue-86162-2.stderr @@ -1,13 +1,15 @@ error[E0283]: type annotations needed --> $DIR/issue-86162-2.rs:12:5 | -LL | fn bar(x: impl Clone) {} - | ----- required by this bound in `Foo::bar` -... LL | Foo::bar(gen()); //<- Do not suggest `Foo::bar::<impl Clone>()`! | ^^^^^^^^ cannot infer type for type parameter `impl Clone` declared on the associated function `bar` | = note: cannot satisfy `_: Clone` +note: required by a bound in `Foo::bar` + --> $DIR/issue-86162-2.rs:8:20 + | +LL | fn bar(x: impl Clone) {} + | ^^^^^ required by this bound in `Foo::bar` error: aborting due to previous error diff --git a/src/test/ui/infinite/infinite-instantiation.polonius.stderr b/src/test/ui/infinite/infinite-instantiation.polonius.stderr new file mode 100644 index 00000000000..29eb8c481cd --- /dev/null +++ b/src/test/ui/infinite/infinite-instantiation.polonius.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `function::<Option<Option<Option<...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/infinite-instantiation.rs:22:9 + | +LL | function(counter - 1, t.to_option()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `function` defined here + --> $DIR/infinite-instantiation.rs:20:1 + | +LL | fn function<T:ToOpt + Clone>(counter: usize, t: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/infinite/infinite-instantiation.polonius/infinite-instantiation.long-type.txt' + +error: aborting due to previous error + diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index af6e0053117..cb22d5adb71 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -4,15 +4,15 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a r LL | catch_unwind(|| { x.set(23); }); | ^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - ::: $SRC_DIR/std/src/panic.rs:LL:COL - | -LL | pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> { - | ---------- required by this bound in `catch_unwind` - | = help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `Cell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `&Cell<i32>` = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:5:18: 5:35]` +note: required by a bound in `catch_unwind` + --> $SRC_DIR/std/src/panic.rs:LL:COL + | +LL | pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> { + | ^^^^^^^^^^ required by this bound in `catch_unwind` error: aborting due to previous error diff --git a/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs b/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs index 72c0d7913e5..88ef8182f02 100644 --- a/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs +++ b/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs @@ -5,7 +5,7 @@ // This test checks panic emitted from `mem::{uninitialized,zeroed}`. -#![feature(never_type, arbitrary_enum_discriminant)] +#![feature(never_type)] #![allow(deprecated, invalid_value)] use std::{ diff --git a/src/test/ui/issues/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr index ee5b81391e9..053a93e6cd8 100644 --- a/src/test/ui/issues/issue-10412.stderr +++ b/src/test/ui/issues/issue-10412.stderr @@ -51,13 +51,15 @@ LL | impl<'self> Serializable<str> for &'self str { error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/issue-10412.rs:6:13 | -LL | trait Serializable<'self, T> { - | - required by this bound in `Serializable` -... LL | impl<'self> Serializable<str> for &'self str { | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` +note: required by a bound in `Serializable` + --> $DIR/issue-10412.rs:1:27 + | +LL | trait Serializable<'self, T> { + | ^ required by this bound in `Serializable` help: consider relaxing the implicit `Sized` restriction | LL | trait Serializable<'self, T: ?Sized> { diff --git a/src/test/ui/issues/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr index 0e942e80e25..b702196abdf 100644 --- a/src/test/ui/issues/issue-18611.stderr +++ b/src/test/ui/issues/issue-18611.stderr @@ -3,9 +3,12 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied | LL | fn add_state(op: <isize as HasState>::State) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` -... + | +note: required by a bound in `HasState` + --> $DIR/issue-18611.rs:5:1 + | LL | trait HasState { - | -------------- required by this bound in `HasState` + | ^^^^^^^^^^^^^^ required by this bound in `HasState` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18919.stderr b/src/test/ui/issues/issue-18919.stderr index d4b93eb074c..d7dbb8299b9 100644 --- a/src/test/ui/issues/issue-18919.stderr +++ b/src/test/ui/issues/issue-18919.stderr @@ -3,11 +3,13 @@ error[E0277]: the size for values of type `dyn for<'r> Fn(&'r isize) -> isize` c | LL | fn ho_func(f: Option<FuncType>) { | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | enum Option<T> { - | - required by this bound in `Option` | = help: the trait `Sized` is not implemented for `dyn for<'r> Fn(&'r isize) -> isize` +note: required by a bound in `Option` + --> $DIR/issue-18919.rs:7:13 + | +LL | enum Option<T> { + | ^ required by this bound in `Option` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` --> $DIR/issue-18919.rs:7:13 | diff --git a/src/test/ui/issues/issue-1920-1.stderr b/src/test/ui/issues/issue-1920-1.stderr index 0a2459c3a5d..a546924253c 100644 --- a/src/test/ui/issues/issue-1920-1.stderr +++ b/src/test/ui/issues/issue-1920-1.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `S: Clone` is not satisfied --> $DIR/issue-1920-1.rs:12:20 | -LL | fn assert_clone<T>() where T : Clone { } - | ----- required by this bound in `assert_clone` -... LL | assert_clone::<foo::issue_1920::S>(); | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-1.rs:9:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1920-2.stderr b/src/test/ui/issues/issue-1920-2.stderr index 06bc78a387f..1083b011252 100644 --- a/src/test/ui/issues/issue-1920-2.stderr +++ b/src/test/ui/issues/issue-1920-2.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `S: Clone` is not satisfied --> $DIR/issue-1920-2.rs:10:20 | -LL | fn assert_clone<T>() where T : Clone { } - | ----- required by this bound in `assert_clone` -... LL | assert_clone::<bar::S>(); | ^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-2.rs:7:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1920-3.stderr b/src/test/ui/issues/issue-1920-3.stderr index 48d3105bf9d..3f0787c8875 100644 --- a/src/test/ui/issues/issue-1920-3.stderr +++ b/src/test/ui/issues/issue-1920-3.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `S: Clone` is not satisfied --> $DIR/issue-1920-3.rs:14:20 | -LL | fn assert_clone<T>() where T : Clone { } - | ----- required by this bound in `assert_clone` -... LL | assert_clone::<foo::issue_1920::S>(); | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-3.rs:11:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19707.stderr b/src/test/ui/issues/issue-19707.stderr index c3e5fcdd63b..18f69bb5775 100644 --- a/src/test/ui/issues/issue-19707.stderr +++ b/src/test/ui/issues/issue-19707.stderr @@ -9,11 +9,11 @@ LL | type Foo = fn(&u8, &u8) -> &u8; help: consider making the type lifetime-generic with a new `'a` lifetime | LL | type Foo = for<'a> fn(&'a u8, &'a u8) -> &'a u8; - | +++++++ ~~~~~~ ~~~~~~ ~~~ + | +++++++ ++ ++ ++ help: consider introducing a named lifetime parameter | LL | type Foo<'a> = fn(&'a u8, &'a u8) -> &'a u8; - | ++++ ~~~~~~ ~~~~~~ ~~~ + | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/issue-19707.rs:5:27 @@ -26,11 +26,11 @@ LL | fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} help: consider making the bound lifetime-generic with a new `'a` lifetime | LL | fn bar<F: for<'a> Fn(&'a u8, &'a u8) -> &'a u8>(f: &F) {} - | +++++++ ~~~~~~ ~~~~~~ ~~~ + | +++++++ ++ ++ ++ help: consider introducing a named lifetime parameter | LL | fn bar<'a, F: Fn(&'a u8, &'a u8) -> &'a u8>(f: &F) {} - | +++ ~~~~~~ ~~~~~~ ~~~ + | +++ ++ ++ ++ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 28f87a75f0f..572c8ee33ce 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -10,9 +10,6 @@ LL | struct NoData<T>; error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/issue-20413.rs:8:36 | -LL | trait Foo { - | --------- required by this bound in `Foo` -... LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ | @@ -24,13 +21,15 @@ LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData<T>` +note: required by a bound in `Foo` + --> $DIR/issue-20413.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ required by this bound in `Foo` error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/issue-20413.rs:8:36 | -LL | trait Foo { - | --------- required by this bound in `Foo` -... LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ | @@ -42,13 +41,15 @@ LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData<T>` +note: required by a bound in `Foo` + --> $DIR/issue-20413.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ required by this bound in `Foo` error[E0275]: overflow evaluating the requirement `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:28:42 | -LL | trait Baz { - | --------- required by this bound in `Baz` -... LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ | @@ -65,13 +66,15 @@ LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Baz` for `EvenLessData<T>` +note: required by a bound in `Baz` + --> $DIR/issue-20413.rs:20:1 + | +LL | trait Baz { + | ^^^^^^^^^ required by this bound in `Baz` error[E0275]: overflow evaluating the requirement `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:28:42 | -LL | trait Baz { - | --------- required by this bound in `Baz` -... LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ | @@ -88,13 +91,15 @@ LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Baz` for `EvenLessData<T>` +note: required by a bound in `Baz` + --> $DIR/issue-20413.rs:20:1 + | +LL | trait Baz { + | ^^^^^^^^^ required by this bound in `Baz` error[E0275]: overflow evaluating the requirement `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` --> $DIR/issue-20413.rs:36:42 | -LL | trait Bar { - | --------- required by this bound in `Bar` -... LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ | @@ -111,13 +116,15 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData<T>` +note: required by a bound in `Bar` + --> $DIR/issue-20413.rs:16:1 + | +LL | trait Bar { + | ^^^^^^^^^ required by this bound in `Bar` error[E0275]: overflow evaluating the requirement `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` --> $DIR/issue-20413.rs:36:42 | -LL | trait Bar { - | --------- required by this bound in `Bar` -... LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ | @@ -134,6 +141,11 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData<T>` +note: required by a bound in `Bar` + --> $DIR/issue-20413.rs:16:1 + | +LL | trait Bar { + | ^^^^^^^^^ required by this bound in `Bar` error: aborting due to 7 previous errors diff --git a/src/test/ui/issues/issue-20433.stderr b/src/test/ui/issues/issue-20433.stderr index b9e9bfe1b8c..9d3bb8b924d 100644 --- a/src/test/ui/issues/issue-20433.stderr +++ b/src/test/ui/issues/issue-20433.stderr @@ -4,12 +4,12 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation LL | fn iceman(c: Vec<[i32]>) {} | ^^^^^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + = help: the trait `Sized` is not implemented for `[i32]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | - required by this bound in `Vec` - | - = help: the trait `Sized` is not implemented for `[i32]` + | ^ required by this bound in `Vec` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index e9aa8e27089..92742b50619 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -6,11 +6,11 @@ LL | #[derive(Hash)] LL | struct Foo(Bar); | ^^^ the trait `Hash` is not implemented for `Bar` | - ::: $SRC_DIR/core/src/hash/mod.rs:LL:COL +note: required by a bound in `std::hash::Hash::hash` + --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash<H: Hasher>(&self, state: &mut H); - | - required by this bound in `std::hash::Hash::hash` - | + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21763.stderr b/src/test/ui/issues/issue-21763.stderr index 4d27f507e26..b8b38c0a723 100644 --- a/src/test/ui/issues/issue-21763.stderr +++ b/src/test/ui/issues/issue-21763.stderr @@ -1,9 +1,6 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely --> $DIR/issue-21763.rs:9:5 | -LL | fn foo<T: Send>() {} - | ---- required by this bound in `foo` -... LL | foo::<HashMap<Rc<()>, Rc<()>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely | @@ -12,6 +9,11 @@ LL | foo::<HashMap<Rc<()>, Rc<()>>>(); = note: required because of the requirements on the impl of `Send` for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` = note: required because it appears within the type `hashbrown::map::HashMap<Rc<()>, Rc<()>, RandomState>` = note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>` +note: required by a bound in `foo` + --> $DIR/issue-21763.rs:6:11 + | +LL | fn foo<T: Send>() {} + | ^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21837.stderr b/src/test/ui/issues/issue-21837.stderr index 4b5768d1291..3d385266499 100644 --- a/src/test/ui/issues/issue-21837.stderr +++ b/src/test/ui/issues/issue-21837.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Bound` is not satisfied --> $DIR/issue-21837.rs:8:20 | -LL | pub struct Foo<T: Bound>(T); - | ----- required by this bound in `Foo` -... LL | impl<T> Trait2 for Foo<T> {} | ^^^^^^ the trait `Bound` is not implemented for `T` | +note: required by a bound in `Foo` + --> $DIR/issue-21837.rs:2:19 + | +LL | pub struct Foo<T: Bound>(T); + | ^^^^^ required by this bound in `Foo` help: consider restricting type parameter `T` | LL | impl<T: Bound> Trait2 for Foo<T> {} diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index fea2c7d5d26..3b6663513bb 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -1,13 +1,15 @@ error[E0283]: type annotations needed --> $DIR/issue-21974.rs:11:19 | -LL | trait Foo { - | --------- required by this bound in `Foo` -... LL | where &'a T : Foo, | ^^^ cannot infer type for reference `&'a T` | = note: cannot satisfy `&'a T: Foo` +note: required by a bound in `Foo` + --> $DIR/issue-21974.rs:6:1 + | +LL | trait Foo { + | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22638.polonius.stderr b/src/test/ui/issues/issue-22638.polonius.stderr new file mode 100644 index 00000000000..87a7c00e410 --- /dev/null +++ b/src/test/ui/issues/issue-22638.polonius.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `A::matches::$CLOSURE` + --> $DIR/issue-22638.rs:56:9 + | +LL | a.matches(f) + | ^^^^^^^^^^^^ + | +note: `A::matches` defined here + --> $DIR/issue-22638.rs:15:5 + | +LL | pub fn matches<F: Fn()>(&self, f: &F) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-22638.polonius/issue-22638.long-type.txt' + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-23281.stderr b/src/test/ui/issues/issue-23281.stderr index a3d25832925..804334c9b0d 100644 --- a/src/test/ui/issues/issue-23281.stderr +++ b/src/test/ui/issues/issue-23281.stderr @@ -3,11 +3,13 @@ error[E0277]: the size for values of type `(dyn Fn() + 'static)` cannot be known | LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {} | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | struct Vec<T> { - | - required by this bound in `Vec` | = help: the trait `Sized` is not implemented for `(dyn Fn() + 'static)` +note: required by a bound in `Vec` + --> $DIR/issue-23281.rs:8:12 + | +LL | struct Vec<T> { + | ^ required by this bound in `Vec` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` --> $DIR/issue-23281.rs:8:12 | diff --git a/src/test/ui/issues/issue-24424.stderr b/src/test/ui/issues/issue-24424.stderr index 9f5e934295b..4896006b645 100644 --- a/src/test/ui/issues/issue-24424.stderr +++ b/src/test/ui/issues/issue-24424.stderr @@ -1,13 +1,15 @@ error[E0283]: type annotations needed --> $DIR/issue-24424.rs:4:57 | -LL | trait Trait0<'l0> {} - | ----------------- required by this bound in `Trait0` -LL | LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} | ^^^^^^^^^^^ cannot infer type for type parameter `T0` | = note: cannot satisfy `T0: Trait0<'l0>` +note: required by a bound in `Trait0` + --> $DIR/issue-24424.rs:2:1 + | +LL | trait Trait0<'l0> {} + | ^^^^^^^^^^^^^^^^^ required by this bound in `Trait0` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25076.stderr b/src/test/ui/issues/issue-25076.stderr index 27c577a0d5f..ece99596e58 100644 --- a/src/test/ui/issues/issue-25076.stderr +++ b/src/test/ui/issues/issue-25076.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `(): InOut<_>` is not satisfied --> $DIR/issue-25076.rs:10:20 | -LL | fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {} - | --------------- required by this bound in `do_fold` -... LL | do_fold(bot(), ()); | ^^ the trait `InOut<_>` is not implemented for `()` + | +note: required by a bound in `do_fold` + --> $DIR/issue-25076.rs:5:18 + | +LL | fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {} + | ^^^^^^^^^^^^^^^ required by this bound in `do_fold` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26638.stderr b/src/test/ui/issues/issue-26638.stderr index 5784ca9d77f..bb7cdcbb100 100644 --- a/src/test/ui/issues/issue-26638.stderr +++ b/src/test/ui/issues/issue-26638.stderr @@ -8,7 +8,7 @@ LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.ne help: consider introducing a named lifetime parameter | LL | fn parse_type<'a>(iter: Box<dyn Iterator<Item=&str>+'static>) -> &'a str { iter.next() } - | ++++ ~~~ + | ++++ ++ error[E0106]: missing lifetime specifier --> $DIR/issue-26638.rs:4:40 diff --git a/src/test/ui/issues/issue-30255.stderr b/src/test/ui/issues/issue-30255.stderr index 390aa31487a..e5f492af5b3 100644 --- a/src/test/ui/issues/issue-30255.stderr +++ b/src/test/ui/issues/issue-30255.stderr @@ -8,7 +8,7 @@ LL | fn f(a: &S, b: i32) -> &i32 { help: consider introducing a named lifetime parameter | LL | fn f<'a>(a: &'a S, b: i32) -> &'a i32 { - | ++++ ~~~~~ ~~~ + | ++++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/issue-30255.rs:14:34 @@ -20,7 +20,7 @@ LL | fn g(a: &S, b: bool, c: &i32) -> &i32 { help: consider introducing a named lifetime parameter | LL | fn g<'a>(a: &'a S, b: bool, c: &'a i32) -> &'a i32 { - | ++++ ~~~~~ ~~~~~~~ ~~~ + | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/issue-30255.rs:19:44 @@ -32,7 +32,7 @@ LL | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { help: consider introducing a named lifetime parameter | LL | fn h<'a>(a: &'a bool, b: bool, c: &'a S, d: &'a i32) -> &'a i32 { - | ++++ ~~~~~~~~ ~~~~~ ~~~~~~~ ~~~ + | ++++ ++ ++ ++ ++ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-32963.stderr b/src/test/ui/issues/issue-32963.stderr index 76c62c1c6dd..b5aa7b1b94d 100644 --- a/src/test/ui/issues/issue-32963.stderr +++ b/src/test/ui/issues/issue-32963.stderr @@ -23,11 +23,14 @@ LL | size_of_copy::<dyn Misc + Copy>(); error[E0277]: the trait bound `dyn Misc: Copy` is not satisfied --> $DIR/issue-32963.rs:8:5 | -LL | fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() } - | ---- required by this bound in `size_of_copy` -... LL | size_of_copy::<dyn Misc + Copy>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `dyn Misc` + | +note: required by a bound in `size_of_copy` + --> $DIR/issue-32963.rs:5:20 + | +LL | fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() } + | ^^^^ required by this bound in `size_of_copy` error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.polonius.stderr b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.polonius.stderr new file mode 100644 index 00000000000..3a1c0b82c22 --- /dev/null +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.polonius.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(.....), ...), ...) as Foo>::recurse` + --> $DIR/issue-37311.rs:17:9 + | +LL | (self, self).recurse(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `<T as Foo>::recurse` defined here + --> $DIR/issue-37311.rs:16:5 + | +LL | fn recurse(&self) { + | ^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-37311-type-length-limit/issue-37311.polonius/issue-37311.long-type.txt' + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-40000.nll.stderr b/src/test/ui/issues/issue-40000.nll.stderr index 4e2bde06a52..e6f0b5fbfba 100644 --- a/src/test/ui/issues/issue-40000.nll.stderr +++ b/src/test/ui/issues/issue-40000.nll.stderr @@ -1,14 +1,21 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/issue-40000.rs:6:9 | LL | foo(bar); - | ^^^ + | ^^^ one type is more general than the other + | + = note: expected trait object `dyn for<'r> Fn(&'r i32)` + found trait object `dyn Fn(&i32)` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/issue-40000.rs:6:9 | LL | foo(bar); - | ^^^ + | ^^^ one type is more general than the other + | + = note: expected trait object `dyn for<'r> Fn(&'r i32)` + found trait object `dyn Fn(&i32)` error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-40827.stderr b/src/test/ui/issues/issue-40827.stderr index 38c3af935c5..3b2d232e61f 100644 --- a/src/test/ui/issues/issue-40827.stderr +++ b/src/test/ui/issues/issue-40827.stderr @@ -1,9 +1,6 @@ error[E0277]: `Rc<Foo>` cannot be shared between threads safely --> $DIR/issue-40827.rs:14:5 | -LL | fn f<T: Send>(_: T) {} - | ---- required by this bound in `f` -... LL | f(Foo(Arc::new(Bar::B(None)))); | ^ `Rc<Foo>` cannot be shared between threads safely | @@ -19,13 +16,15 @@ note: required because it appears within the type `Foo` | LL | struct Foo(Arc<Bar>); | ^^^ +note: required by a bound in `f` + --> $DIR/issue-40827.rs:11:9 + | +LL | fn f<T: Send>(_: T) {} + | ^^^^ required by this bound in `f` error[E0277]: `Rc<Foo>` cannot be sent between threads safely --> $DIR/issue-40827.rs:14:5 | -LL | fn f<T: Send>(_: T) {} - | ---- required by this bound in `f` -... LL | f(Foo(Arc::new(Bar::B(None)))); | ^ `Rc<Foo>` cannot be sent between threads safely | @@ -41,6 +40,11 @@ note: required because it appears within the type `Foo` | LL | struct Foo(Arc<Bar>); | ^^^ +note: required by a bound in `f` + --> $DIR/issue-40827.rs:11:9 + | +LL | fn f<T: Send>(_: T) {} + | ^^^^ required by this bound in `f` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-43623.stderr b/src/test/ui/issues/issue-43623.stderr index 4bc5eb03e92..b99f367d733 100644 --- a/src/test/ui/issues/issue-43623.stderr +++ b/src/test/ui/issues/issue-43623.stderr @@ -1,17 +1,20 @@ error[E0631]: type mismatch in function arguments --> $DIR/issue-43623.rs:16:5 | -LL | pub fn break_me<T, F>(f: F) - | -------- required by a bound in this -... -LL | F: for<'b> FnMut(<T as Trait<'b>>::Assoc), - | ------------------------------ required by this bound in `break_me` -LL | { LL | break_me::<Type, fn(_)>; | ^^^^^^^^^^^^^^^^^^^^^^^ | | | expected signature of `for<'b> fn(<Type as Trait<'b>>::Assoc) -> _` | found signature of `fn(()) -> _` + | +note: required by a bound in `break_me` + --> $DIR/issue-43623.rs:14:16 + | +LL | pub fn break_me<T, F>(f: F) + | -------- required by a bound in this +... +LL | F: for<'b> FnMut(<T as Trait<'b>>::Assoc), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `break_me` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 7fd1fd90ccc..bb890cb99ee 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/issue-43784-supertrait.rs:8:9 | -LL | pub trait Complete: Partial { - | ------- required by this bound in `Complete` -... LL | impl<T> Complete for T {} | ^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `Complete` + --> $DIR/issue-43784-supertrait.rs:4:21 + | +LL | pub trait Complete: Partial { + | ^^^^^^^ required by this bound in `Complete` help: consider restricting type parameter `T` | LL | impl<T: std::marker::Copy> Complete for T {} diff --git a/src/test/ui/issues/issue-47706.stderr b/src/test/ui/issues/issue-47706.stderr index c84d8ecb4c9..d9680a26e09 100644 --- a/src/test/ui/issues/issue-47706.stderr +++ b/src/test/ui/issues/issue-47706.stderr @@ -13,14 +13,17 @@ error[E0593]: function is expected to take 0 arguments, but it takes 1 argument LL | Bar(i32), | -------- takes 1 argument ... +LL | foo(Qux::Bar); + | ^^^^^^^^ expected function that takes 0 arguments + | +note: required by a bound in `foo` + --> $DIR/issue-47706.rs:22:8 + | LL | fn foo<F>(f: F) | --- required by a bound in this LL | where LL | F: Fn(), - | ---- required by this bound in `foo` -... -LL | foo(Qux::Bar); - | ^^^^^^^^ expected function that takes 0 arguments + | ^^^^ required by this bound in `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-54302-cases.nll.stderr b/src/test/ui/issues/issue-54302-cases.nll.stderr index 7463a3f286f..6e8b69c4bee 100644 --- a/src/test/ui/issues/issue-54302-cases.nll.stderr +++ b/src/test/ui/issues/issue-54302-cases.nll.stderr @@ -1,26 +1,38 @@ -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:63:5 | LL | <u32 as RefFoo<u32>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... + = note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:69:5 | LL | <i32 as RefFoo<i32>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`... + = note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:75:5 | LL | <u64 as RefFoo<u64>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`... + = note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` -error: higher-ranked subtype error +error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:81:5 | LL | <i64 as RefFoo<i64>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`... + = note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-54954.stderr b/src/test/ui/issues/issue-54954.stderr index 9de58d83c8b..df76a985559 100644 --- a/src/test/ui/issues/issue-54954.stderr +++ b/src/test/ui/issues/issue-54954.stderr @@ -9,11 +9,13 @@ error[E0283]: type annotations needed | LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type -... -LL | const fn const_val<T: Sized>() -> usize { - | - required by this bound in `Tt::const_val` | = note: cannot satisfy `_: Tt` +note: required by a bound in `Tt::const_val` + --> $DIR/issue-54954.rs:5:24 + | +LL | const fn const_val<T: Sized>() -> usize { + | ^ required by this bound in `Tt::const_val` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-55731.nll.stderr b/src/test/ui/issues/issue-55731.nll.stderr index dd38bb62912..97fd6678c99 100644 --- a/src/test/ui/issues/issue-55731.nll.stderr +++ b/src/test/ui/issues/issue-55731.nll.stderr @@ -1,11 +1,14 @@ -error: higher-ranked subtype error +error: implementation of `DistributedIteratorMulti` is not general enough --> $DIR/issue-55731.rs:48:5 | LL | / multi(Map { LL | | i: Cloned(PhantomData), LL | | f: X, LL | | }); - | |______^ + | |______^ implementation of `DistributedIteratorMulti` is not general enough + | + = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`... + = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-57843.nll.stderr b/src/test/ui/issues/issue-57843.nll.stderr index 70d16cc9a1d..2ab49ec61cf 100644 --- a/src/test/ui/issues/issue-57843.nll.stderr +++ b/src/test/ui/issues/issue-57843.nll.stderr @@ -1,8 +1,11 @@ -error: higher-ranked subtype error +error: implementation of `FnOnce` is not general enough --> $DIR/issue-57843.rs:25:9 | LL | Foo(Box::new(|_| ())); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | + = note: closure with signature `fn(&'2 bool)` must implement `FnOnce<(&'1 bool,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 bool,)>`, for some specific lifetime `'2` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-59494.stderr b/src/test/ui/issues/issue-59494.stderr index e2ac5d94da1..90af47dfa79 100644 --- a/src/test/ui/issues/issue-59494.stderr +++ b/src/test/ui/issues/issue-59494.stderr @@ -1,13 +1,15 @@ error[E0277]: expected a `Fn<(_,)>` closure, found `impl Fn<(((_, _), _),)>` --> $DIR/issue-59494.rs:21:22 | -LL | fn t8n<A, B, C>(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) - | ---------- required by this bound in `t8n` -... LL | let t8 = t8n(t7, t7p(f, g)); | ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn<(((_, _), _),)>` | = help: the trait `Fn<(_,)>` is not implemented for `impl Fn<(((_, _), _),)>` +note: required by a bound in `t8n` + --> $DIR/issue-59494.rs:5:45 + | +LL | fn t8n<A, B, C>(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) + | ^^^^^^^^^^ required by this bound in `t8n` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-60218.stderr b/src/test/ui/issues/issue-60218.stderr index a2b2fdd4fd2..a16363d7c87 100644 --- a/src/test/ui/issues/issue-60218.stderr +++ b/src/test/ui/issues/issue-60218.stderr @@ -1,14 +1,17 @@ error[E0277]: the trait bound `for<'t> <Map<<&'t _ as IntoIterator>::IntoIter, _> as Iterator>::Item: Foo` is not satisfied --> $DIR/issue-60218.rs:18:5 | +LL | trigger_error(vec![], |x: &u32| x) + | ^^^^^^^^^^^^^ the trait `for<'t> Foo` is not implemented for `<Map<<&'t _ as IntoIterator>::IntoIter, _> as Iterator>::Item` + | +note: required by a bound in `trigger_error` + --> $DIR/issue-60218.rs:13:72 + | LL | pub fn trigger_error<I, F>(iterable: I, functor: F) | ------------- required by a bound in this ... LL | for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo, - | --- required by this bound in `trigger_error` -... -LL | trigger_error(vec![], |x: &u32| x) - | ^^^^^^^^^^^^^ the trait `for<'t> Foo` is not implemented for `<Map<<&'t _ as IntoIterator>::IntoIter, _> as Iterator>::Item` + | ^^^ required by this bound in `trigger_error` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-60283.stderr b/src/test/ui/issues/issue-60283.stderr index 7241128d17a..2ee55105214 100644 --- a/src/test/ui/issues/issue-60283.stderr +++ b/src/test/ui/issues/issue-60283.stderr @@ -1,17 +1,20 @@ error[E0631]: type mismatch in function arguments --> $DIR/issue-60283.rs:17:13 | -LL | pub fn foo<T, F>(_: T, _: F) - | --- required by a bound in this -... -LL | F: for<'a> FnMut(<T as Trait<'a>>::Item), - | ----------------------------- required by this bound in `foo` -... LL | foo((), drop) | ^^^^ | | | expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _` | found signature of `fn(()) -> _` + | +note: required by a bound in `foo` + --> $DIR/issue-60283.rs:12:16 + | +LL | pub fn foo<T, F>(_: T, _: F) + | --- required by a bound in this +... +LL | F: for<'a> FnMut(<T as Trait<'a>>::Item), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` error[E0277]: the size for values of type `<() as Trait<'_>>::Item` cannot be known at compilation time --> $DIR/issue-60283.rs:17:13 @@ -19,12 +22,12 @@ error[E0277]: the size for values of type `<() as Trait<'_>>::Item` cannot be kn LL | foo((), drop) | ^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL + = help: the trait `Sized` is not implemented for `<() as Trait<'_>>::Item` +note: required by a bound in `std::mem::drop` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub fn drop<T>(_x: T) {} - | - required by this bound in `std::mem::drop` - | - = help: the trait `Sized` is not implemented for `<() as Trait<'_>>::Item` + | ^ required by this bound in `std::mem::drop` help: consider further restricting the associated type | LL | fn main() where <() as Trait<'_>>::Item: Sized { diff --git a/src/test/ui/issues/issue-67552.polonius.stderr b/src/test/ui/issues/issue-67552.polonius.stderr new file mode 100644 index 00000000000..9ab77d3444d --- /dev/null +++ b/src/test/ui/issues/issue-67552.polonius.stderr @@ -0,0 +1,17 @@ +error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &... &mut &mut &mut &mut &mut Empty>` + --> $DIR/issue-67552.rs:28:9 + | +LL | rec(identity(&mut it)) + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `rec` defined here + --> $DIR/issue-67552.rs:21:1 + | +LL | / fn rec<T>(mut it: T) +LL | | where +LL | | T: Iterator, + | |________________^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552.polonius/issue-67552.long-type.txt' + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-87199.stderr b/src/test/ui/issues/issue-87199.stderr index 87b284abf20..fc9418b36b6 100644 --- a/src/test/ui/issues/issue-87199.stderr +++ b/src/test/ui/issues/issue-87199.stderr @@ -19,13 +19,15 @@ LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } error[E0277]: the size for values of type `[i32]` cannot be known at compilation time --> $DIR/issue-87199.rs:18:22 | -LL | fn ref_arg<T: ?Send>(_: &T) {} - | - required by this bound in `ref_arg` -... LL | ref_arg::<[i32]>(&[5]); | ^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[i32]` +note: required by a bound in `ref_arg` + --> $DIR/issue-87199.rs:10:12 + | +LL | fn ref_arg<T: ?Send>(_: &T) {} + | ^ required by this bound in `ref_arg` help: consider relaxing the implicit `Sized` restriction | LL | fn ref_arg<T: ?Send + ?Sized>(_: &T) {} diff --git a/src/test/ui/issues/issue-8727.polonius.stderr b/src/test/ui/issues/issue-8727.polonius.stderr new file mode 100644 index 00000000000..283c01b6b62 --- /dev/null +++ b/src/test/ui/issues/issue-8727.polonius.stderr @@ -0,0 +1,26 @@ +warning: function cannot return without recursing + --> $DIR/issue-8727.rs:7:1 + | +LL | fn generic<T>() { + | ^^^^^^^^^^^^^^^ cannot return without recursing +LL | generic::<Option<T>>(); + | ---------------------- recursive call site + | + = note: `#[warn(unconditional_recursion)]` on by default + = help: a `loop` may express intention better if this is on purpose + +error: reached the recursion limit while instantiating `generic::<Option<Option<Option<O...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-8727.rs:8:5 + | +LL | generic::<Option<T>>(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `generic` defined here + --> $DIR/issue-8727.rs:7:1 + | +LL | fn generic<T>() { + | ^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-8727.polonius/issue-8727.long-type.txt' + +error: aborting due to previous error; 1 warning emitted + diff --git a/src/test/ui/iterators/bound.stderr b/src/test/ui/iterators/bound.stderr index eaf2e66d0f8..cc7ded498fc 100644 --- a/src/test/ui/iterators/bound.stderr +++ b/src/test/ui/iterators/bound.stderr @@ -1,13 +1,16 @@ error[E0277]: `u8` is not an iterator --> $DIR/bound.rs:2:10 | -LL | struct S<I: Iterator>(I); - | -------- required by this bound in `S` LL | struct T(S<u8>); | ^^^^^ `u8` is not an iterator | = help: the trait `Iterator` is not implemented for `u8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` +note: required by a bound in `S` + --> $DIR/bound.rs:1:13 + | +LL | struct S<I: Iterator>(I); + | ^^^^^^^^ required by this bound in `S` error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 11943045732..6977804708d 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -1,107 +1,138 @@ error[E0277]: the trait bound `&'static mut isize: Copy` is not satisfied --> $DIR/kindck-copy.rs:27:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<&'static mut isize>(); | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'static mut isize` | = help: the following implementations were found: <isize as Copy> +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `&'a mut isize: Copy` is not satisfied --> $DIR/kindck-copy.rs:28:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<&'a mut isize>(); | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut isize` | = help: the following implementations were found: <isize as Copy> +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `Box<isize>: Copy` is not satisfied --> $DIR/kindck-copy.rs:31:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<Box<isize>>(); | ^^^^^^^^^^ the trait `Copy` is not implemented for `Box<isize>` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/kindck-copy.rs:32:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<String>(); | ^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `Vec<isize>: Copy` is not satisfied --> $DIR/kindck-copy.rs:33:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<Vec<isize> >(); | ^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<isize>` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `Box<&'a mut isize>: Copy` is not satisfied --> $DIR/kindck-copy.rs:34:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<Box<&'a mut isize>>(); | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<&'a mut isize>` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `Box<dyn Dummy>: Copy` is not satisfied --> $DIR/kindck-copy.rs:42:5 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<Box<dyn Dummy>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<dyn Dummy>` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `Box<dyn Dummy + Send>: Copy` is not satisfied --> $DIR/kindck-copy.rs:43:5 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<Box<dyn Dummy + Send>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<dyn Dummy + Send>` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `&'a mut (dyn Dummy + Send + 'a): Copy` is not satisfied --> $DIR/kindck-copy.rs:46:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<&'a mut (dyn Dummy + Send)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut (dyn Dummy + Send + 'a)` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `MyNoncopyStruct: Copy` is not satisfied --> $DIR/kindck-copy.rs:64:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<MyNoncopyStruct>(); | ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `MyNoncopyStruct` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error[E0277]: the trait bound `Rc<isize>: Copy` is not satisfied --> $DIR/kindck-copy.rs:67:19 | -LL | fn assert_copy<T:Copy>() { } - | ---- required by this bound in `assert_copy` -... LL | assert_copy::<Rc<isize>>(); | ^^^^^^^^^ the trait `Copy` is not implemented for `Rc<isize>` + | +note: required by a bound in `assert_copy` + --> $DIR/kindck-copy.rs:5:18 + | +LL | fn assert_copy<T:Copy>() { } + | ^^^^ required by this bound in `assert_copy` error: aborting due to 11 previous errors diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.stderr b/src/test/ui/kindck/kindck-impl-type-params-2.stderr index c635ebdbb7f..60ad68cec41 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params-2.stderr @@ -1,9 +1,6 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-impl-type-params-2.rs:13:16 | -LL | fn take_param<T:Foo>(foo: &T) { } - | --- required by this bound in `take_param` -... LL | take_param(&x); | ^^ the trait `Copy` is not implemented for `Box<{integer}>` | @@ -12,6 +9,11 @@ note: required because of the requirements on the impl of `Foo` for `Box<{intege | LL | impl<T:Copy> Foo for T { | ^^^ ^ +note: required by a bound in `take_param` + --> $DIR/kindck-impl-type-params-2.rs:9:17 + | +LL | fn take_param<T:Foo>(foo: &T) { } + | ^^^ required by this bound in `take_param` error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr index 86eaca83f20..ac43c549d8d 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr @@ -1,9 +1,6 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | -LL | fn take_param<T:Foo>(foo: &T) { } - | --- required by this bound in `take_param` -... LL | take_param(&x); | ^^ the trait `Copy` is not implemented for `Box<{integer}>` | @@ -12,6 +9,11 @@ note: required because of the requirements on the impl of `Foo` for `Box<{intege | LL | impl<T:Copy> Foo for T { | ^^^ ^ +note: required by a bound in `take_param` + --> $DIR/kindck-inherited-copy-bound.rs:17:17 + | +LL | fn take_param<T:Foo>(foo: &T) { } + | ^^^ required by this bound in `take_param` error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/kindck-inherited-copy-bound.rs:28:19 diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr index 49c5cd40b58..a486ab17c88 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr @@ -1,9 +1,6 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | -LL | fn take_param<T:Foo>(foo: &T) { } - | --- required by this bound in `take_param` -... LL | take_param(&x); | ^^ the trait `Copy` is not implemented for `Box<{integer}>` | @@ -12,6 +9,11 @@ note: required because of the requirements on the impl of `Foo` for `Box<{intege | LL | impl<T:Copy> Foo for T { | ^^^ ^ +note: required by a bound in `take_param` + --> $DIR/kindck-inherited-copy-bound.rs:17:17 + | +LL | fn take_param<T:Foo>(foo: &T) { } + | ^^^ required by this bound in `take_param` error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/kindck-inherited-copy-bound.rs:28:13 diff --git a/src/test/ui/kindck/kindck-nonsendable-1.stderr b/src/test/ui/kindck/kindck-nonsendable-1.stderr index c7d67a991bf..b3ebe7f5c7d 100644 --- a/src/test/ui/kindck/kindck-nonsendable-1.stderr +++ b/src/test/ui/kindck/kindck-nonsendable-1.stderr @@ -1,9 +1,6 @@ error[E0277]: `Rc<usize>` cannot be sent between threads safely --> $DIR/kindck-nonsendable-1.rs:9:5 | -LL | fn bar<F:FnOnce() + Send>(_: F) { } - | ---- required by this bound in `bar` -... LL | bar(move|| foo(x)); | ^^^ ------------- within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]` | | @@ -11,6 +8,11 @@ LL | bar(move|| foo(x)); | = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`, the trait `Send` is not implemented for `Rc<usize>` = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]` +note: required by a bound in `bar` + --> $DIR/kindck-nonsendable-1.rs:5:21 + | +LL | fn bar<F:FnOnce() + Send>(_: F) { } + | ^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-send-object.stderr b/src/test/ui/kindck/kindck-send-object.stderr index 0df7df85371..f14983a5189 100644 --- a/src/test/ui/kindck/kindck-send-object.stderr +++ b/src/test/ui/kindck/kindck-send-object.stderr @@ -1,27 +1,31 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely --> $DIR/kindck-send-object.rs:12:5 | -LL | fn assert_send<T:Send>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<&'static (dyn Dummy + 'static)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `Send` for `&'static (dyn Dummy + 'static)` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object.rs:5:18 + | +LL | fn assert_send<T:Send>() { } + | ^^^^ required by this bound in `assert_send` error[E0277]: `dyn Dummy` cannot be sent between threads safely --> $DIR/kindck-send-object.rs:17:5 | -LL | fn assert_send<T:Send>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<Box<dyn Dummy>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` = note: required because of the requirements on the impl of `Send` for `Unique<dyn Dummy>` = note: required because it appears within the type `Box<dyn Dummy>` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object.rs:5:18 + | +LL | fn assert_send<T:Send>() { } + | ^^^^ required by this bound in `assert_send` error: aborting due to 2 previous errors diff --git a/src/test/ui/kindck/kindck-send-object1.nll.stderr b/src/test/ui/kindck/kindck-send-object1.nll.stderr index 4792914d95e..fa190449b64 100644 --- a/src/test/ui/kindck/kindck-send-object1.nll.stderr +++ b/src/test/ui/kindck/kindck-send-object1.nll.stderr @@ -1,27 +1,31 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely --> $DIR/kindck-send-object1.rs:10:5 | -LL | fn assert_send<T:Send+'static>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<&'a dyn Dummy>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `Send` for `&'a (dyn Dummy + 'a)` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object1.rs:5:18 + | +LL | fn assert_send<T:Send+'static>() { } + | ^^^^ required by this bound in `assert_send` error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely --> $DIR/kindck-send-object1.rs:29:5 | -LL | fn assert_send<T:Send+'static>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<Box<dyn Dummy + 'a>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `Send` for `Unique<(dyn Dummy + 'a)>` = note: required because it appears within the type `Box<(dyn Dummy + 'a)>` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object1.rs:5:18 + | +LL | fn assert_send<T:Send+'static>() { } + | ^^^^ required by this bound in `assert_send` error: aborting due to 2 previous errors diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr index b2b70976080..58397b7f597 100644 --- a/src/test/ui/kindck/kindck-send-object1.stderr +++ b/src/test/ui/kindck/kindck-send-object1.stderr @@ -1,14 +1,16 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely --> $DIR/kindck-send-object1.rs:10:5 | -LL | fn assert_send<T:Send+'static>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<&'a dyn Dummy>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `Send` for `&'a (dyn Dummy + 'a)` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object1.rs:5:18 + | +LL | fn assert_send<T:Send+'static>() { } + | ^^^^ required by this bound in `assert_send` error[E0477]: the type `&'a (dyn Dummy + Sync + 'a)` does not fulfill the required lifetime --> $DIR/kindck-send-object1.rs:14:5 @@ -25,15 +27,17 @@ LL | fn assert_send<T:Send+'static>() { } error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely --> $DIR/kindck-send-object1.rs:29:5 | -LL | fn assert_send<T:Send+'static>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<Box<dyn Dummy + 'a>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `Send` for `Unique<(dyn Dummy + 'a)>` = note: required because it appears within the type `Box<(dyn Dummy + 'a)>` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object1.rs:5:18 + | +LL | fn assert_send<T:Send+'static>() { } + | ^^^^ required by this bound in `assert_send` error: aborting due to 3 previous errors diff --git a/src/test/ui/kindck/kindck-send-object2.stderr b/src/test/ui/kindck/kindck-send-object2.stderr index f7fb32ac04c..527127e95a2 100644 --- a/src/test/ui/kindck/kindck-send-object2.stderr +++ b/src/test/ui/kindck/kindck-send-object2.stderr @@ -1,27 +1,31 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely --> $DIR/kindck-send-object2.rs:7:5 | -LL | fn assert_send<T:Send>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<&'static dyn Dummy>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `Send` for `&'static (dyn Dummy + 'static)` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object2.rs:3:18 + | +LL | fn assert_send<T:Send>() { } + | ^^^^ required by this bound in `assert_send` error[E0277]: `dyn Dummy` cannot be sent between threads safely --> $DIR/kindck-send-object2.rs:12:5 | -LL | fn assert_send<T:Send>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<Box<dyn Dummy>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` = note: required because of the requirements on the impl of `Send` for `Unique<dyn Dummy>` = note: required because it appears within the type `Box<dyn Dummy>` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-object2.rs:3:18 + | +LL | fn assert_send<T:Send>() { } + | ^^^^ required by this bound in `assert_send` error: aborting due to 2 previous errors diff --git a/src/test/ui/kindck/kindck-send-owned.stderr b/src/test/ui/kindck/kindck-send-owned.stderr index d6664ec24f9..454291aa95b 100644 --- a/src/test/ui/kindck/kindck-send-owned.stderr +++ b/src/test/ui/kindck/kindck-send-owned.stderr @@ -1,15 +1,17 @@ error[E0277]: `*mut u8` cannot be sent between threads safely --> $DIR/kindck-send-owned.rs:12:5 | -LL | fn assert_send<T:Send>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<Box<*mut u8>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut u8` = note: required because of the requirements on the impl of `Send` for `Unique<*mut u8>` = note: required because it appears within the type `Box<*mut u8>` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-owned.rs:3:18 + | +LL | fn assert_send<T:Send>() { } + | ^^^^ required by this bound in `assert_send` error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-send-unsafe.stderr b/src/test/ui/kindck/kindck-send-unsafe.stderr index 069e8dc67f6..ceed0053caa 100644 --- a/src/test/ui/kindck/kindck-send-unsafe.stderr +++ b/src/test/ui/kindck/kindck-send-unsafe.stderr @@ -1,13 +1,15 @@ error[E0277]: `*mut &'a isize` cannot be sent between threads safely --> $DIR/kindck-send-unsafe.rs:6:19 | -LL | fn assert_send<T:Send>() { } - | ---- required by this bound in `assert_send` -... LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^ `*mut &'a isize` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut &'a isize` +note: required by a bound in `assert_send` + --> $DIR/kindck-send-unsafe.rs:3:18 + | +LL | fn assert_send<T:Send>() { } + | ^^^^ required by this bound in `assert_send` error: aborting due to previous error diff --git a/src/test/ui/lifetimes/issue-34979.stderr b/src/test/ui/lifetimes/issue-34979.stderr index 04ad0d12766..b76d71a3d43 100644 --- a/src/test/ui/lifetimes/issue-34979.stderr +++ b/src/test/ui/lifetimes/issue-34979.stderr @@ -1,13 +1,15 @@ error[E0283]: type annotations needed --> $DIR/issue-34979.rs:6:13 | -LL | trait Foo {} - | --------- required by this bound in `Foo` -... LL | &'a (): Foo, | ^^^ cannot infer type for reference `&'a ()` | = note: cannot satisfy `&'a (): Foo` +note: required by a bound in `Foo` + --> $DIR/issue-34979.rs:1:1 + | +LL | trait Foo {} + | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/lifetimes/issue-79187-2.nll.stderr b/src/test/ui/lifetimes/issue-79187-2.nll.stderr index 4970c579e7b..907b43d6762 100644 --- a/src/test/ui/lifetimes/issue-79187-2.nll.stderr +++ b/src/test/ui/lifetimes/issue-79187-2.nll.stderr @@ -16,29 +16,47 @@ LL | take_foo(|a: &i32| -> &i32 { a }); | | let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'1` -error: higher-ranked subtype error +error: implementation of `FnOnce` is not general enough --> $DIR/issue-79187-2.rs:8:5 | LL | take_foo(|a| a); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | + = note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/issue-79187-2.rs:8:5 | LL | take_foo(|a| a); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected type `for<'r> Fn<(&'r i32,)>` + found type `Fn<(&i32,)>` +note: this closure does not fulfill the lifetime requirements + --> $DIR/issue-79187-2.rs:8:14 + | +LL | take_foo(|a| a); + | ^^^^^ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/issue-79187-2.rs:9:5 | LL | take_foo(|a: &i32| a); - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected reference `&i32` + found reference `&i32` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/issue-79187-2.rs:10:5 | LL | take_foo(|a: &i32| -> &i32 { a }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected reference `&i32` + found reference `&i32` error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lifetimes/issue-79187.nll.stderr b/src/test/ui/lifetimes/issue-79187.nll.stderr index aa8809dbc95..725b132e83a 100644 --- a/src/test/ui/lifetimes/issue-79187.nll.stderr +++ b/src/test/ui/lifetimes/issue-79187.nll.stderr @@ -1,14 +1,26 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/issue-79187.rs:5:5 | LL | thing(f); - | ^^^^^^^^ + | ^^^^^^^^ one type is more general than the other + | + = note: expected type `for<'r> FnOnce<(&'r u32,)>` + found type `FnOnce<(&u32,)>` +note: this closure does not fulfill the lifetime requirements + --> $DIR/issue-79187.rs:4:13 + | +LL | let f = |_| (); + | ^^^^^^ -error: higher-ranked subtype error +error: implementation of `FnOnce` is not general enough --> $DIR/issue-79187.rs:5:5 | LL | thing(f); - | ^^^^^^^^ + | ^^^^^^^^ implementation of `FnOnce` is not general enough + | + = note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index d0dc3601202..0e69cd50f6a 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -20,7 +20,7 @@ LL | fn g(_x: &isize, _y: &isize) -> &isize { help: consider introducing a named lifetime parameter | LL | fn g<'a>(_x: &'a isize, _y: &'a isize) -> &'a isize { - | ++++ ~~~~~~~~~ ~~~~~~~~~ ~~~ + | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:19 @@ -32,7 +32,7 @@ LL | fn h(_x: &Foo) -> &isize { help: consider introducing a named lifetime parameter | LL | fn h<'a>(_x: &'a Foo) -> &'a isize { - | ++++ ~~~~~~~ ~~~ + | ++++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr index cf365af9904..bcc3e9510ac 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr @@ -8,7 +8,7 @@ LL | fn foo(x: &i32, y: &i32) -> &i32 { help: consider introducing a named lifetime parameter | LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { - | ++++ ~~~~~~~ ~~~~~~~ ~~~ + | ++++ ++ ++ ++ error: aborting due to previous error diff --git a/src/test/ui/lint/dead-code/anon-const-in-pat.rs b/src/test/ui/lint/dead-code/anon-const-in-pat.rs new file mode 100644 index 00000000000..4c6211a279a --- /dev/null +++ b/src/test/ui/lint/dead-code/anon-const-in-pat.rs @@ -0,0 +1,45 @@ +// check-pass +#![feature(inline_const)] +#![allow(incomplete_features)] +#![deny(dead_code)] + +const fn one() -> i32 { + 1 +} + +const fn two() -> i32 { + 2 +} + +const fn three() -> i32 { + 3 +} + +fn inline_const() { + // rust-lang/rust#78171: dead_code lint triggers even though function is used in const pattern + match 1 { + const { one() } => {} + _ => {} + } +} + +fn inline_const_range() { + match 1 { + 1 ..= const { two() } => {} + _ => {} + } +} + +struct S<const C: i32>; + +fn const_generic_arg() { + match S::<3> { + S::<{three()}> => {} + } +} + +fn main() { + inline_const(); + inline_const_range(); + const_generic_arg(); +} diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nll.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nll.stderr index b95e247d2a8..3fdc2da9f1e 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nll.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nll.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/old-lub-glb-hr-noteq1.rs:11:14 | LL | _ => y, - | ^ + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's> fn(&'r u8, &'s u8) -> &'r u8` + found fn pointer `for<'r> fn(&'r u8, &'r u8) -> &'r u8` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs index 4bdd05b4f92..2aabc0dab1e 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs @@ -10,6 +10,7 @@ // relationship, and that holds. // // ignore-compare-mode-nll +// ignore-compare-mode-polonius fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8) -> &'a u8) { // The two types above are not equivalent. With the older LUB/GLB diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.stderr index 252e13aada0..eacbbb87640 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.stderr @@ -1,5 +1,5 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/old-lub-glb-hr-noteq2.rs:20:14 + --> $DIR/old-lub-glb-hr-noteq2.rs:21:14 | LL | let z = match 22 { | _____________- diff --git a/src/test/ui/lub-glb/old-lub-glb-object.nll.stderr b/src/test/ui/lub-glb/old-lub-glb-object.nll.stderr index 51bf96f3233..ad14d6b7521 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.nll.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-object.nll.stderr @@ -1,14 +1,21 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/old-lub-glb-object.rs:10:14 | LL | _ => y, - | ^ + | ^ one type is more general than the other + | + = note: expected trait object `dyn for<'r, 's> Foo<&'r u8, &'s u8>` + found trait object `dyn for<'r> Foo<&'r u8, &'r u8>` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/old-lub-glb-object.rs:10:14 | LL | _ => y, - | ^ + | ^ one type is more general than the other + | + = note: expected trait object `dyn for<'r, 's> Foo<&'r u8, &'s u8>` + found trait object `dyn for<'r> Foo<&'r u8, &'r u8>` error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr index 0eafb2d7587..0ddce1be476 100644 --- a/src/test/ui/malformed/malformed-derive-entry.stderr +++ b/src/test/ui/malformed/malformed-derive-entry.stderr @@ -22,11 +22,11 @@ error[E0277]: the trait bound `Test1: Clone` is not satisfied LL | #[derive(Copy(Bad))] | ^^^^ the trait `Clone` is not implemented for `Test1` | - ::: $SRC_DIR/core/src/marker.rs:LL:COL +note: required by a bound in `Copy` + --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub trait Copy: Clone { - | ----- required by this bound in `Copy` - | + | ^^^^^ required by this bound in `Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Test2: Clone` is not satisfied @@ -35,11 +35,11 @@ error[E0277]: the trait bound `Test2: Clone` is not satisfied LL | #[derive(Copy="bad")] | ^^^^ the trait `Clone` is not implemented for `Test2` | - ::: $SRC_DIR/core/src/marker.rs:LL:COL +note: required by a bound in `Copy` + --> $SRC_DIR/core/src/marker.rs:LL:COL | LL | pub trait Copy: Clone { - | ----- required by this bound in `Copy` - | + | ^^^^^ required by this bound in `Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 5 previous errors diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr index 0fc266454ee..1f341059794 100644 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr +++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied --> $DIR/overlap-marker-trait.rs:27:17 | -LL | fn is_marker<T: Marker>() { } - | ------ required by this bound in `is_marker` -... LL | is_marker::<NotDebugOrDisplay>(); | ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` + | +note: required by a bound in `is_marker` + --> $DIR/overlap-marker-trait.rs:15:17 + | +LL | fn is_marker<T: Marker>() { } + | ^^^^^^ required by this bound in `is_marker` error: aborting due to previous error diff --git a/src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr b/src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr index aa7dd32f4d3..7985357d0ae 100644 --- a/src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr +++ b/src/test/ui/meta/meta-expected-error-wrong-rev.a.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/meta-expected-error-wrong-rev.rs:13:18 + --> $DIR/meta-expected-error-wrong-rev.rs:14:18 | LL | let x: u32 = 22_usize; | --- ^^^^^^^^ expected `u32`, found `usize` diff --git a/src/test/ui/meta/meta-expected-error-wrong-rev.rs b/src/test/ui/meta/meta-expected-error-wrong-rev.rs index 7e49434142b..80af527a697 100644 --- a/src/test/ui/meta/meta-expected-error-wrong-rev.rs +++ b/src/test/ui/meta/meta-expected-error-wrong-rev.rs @@ -1,4 +1,5 @@ // ignore-compare-mode-nll +// ignore-compare-mode-polonius // revisions: a // should-fail diff --git a/src/test/ui/mir/issue-80742.stderr b/src/test/ui/mir/issue-80742.stderr index d3983f9aae8..b2b40bea708 100644 --- a/src/test/ui/mir/issue-80742.stderr +++ b/src/test/ui/mir/issue-80742.stderr @@ -52,13 +52,15 @@ LL | [u8; size_of::<T>() + 1]: , error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time --> $DIR/issue-80742.rs:31:15 | -LL | struct Inline<T> - | - required by this bound in `Inline` -... LL | let dst = Inline::<dyn Debug>::new(0); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Debug` +note: required by a bound in `Inline` + --> $DIR/issue-80742.rs:13:15 + | +LL | struct Inline<T> + | ^ required by this bound in `Inline` help: consider relaxing the implicit `Sized` restriction | LL | struct Inline<T: ?Sized> diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 1b10325564a..c8e81c93e2c 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -1,48 +1,60 @@ error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:7:5 | -LL | fn foo<F: Fn(usize)>(_: F) {} - | --------- required by this bound in `foo` -... LL | foo(|_: isize| {}); | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` + | +note: required by a bound in `foo` + --> $DIR/E0631.rs:3:11 + | +LL | fn foo<F: Fn(usize)>(_: F) {} + | ^^^^^^^^^ required by this bound in `foo` error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:8:5 | -LL | fn bar<F: Fn<usize>>(_: F) {} - | --------- required by this bound in `bar` -... LL | bar(|_: isize| {}); | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` + | +note: required by a bound in `bar` + --> $DIR/E0631.rs:4:11 + | +LL | fn bar<F: Fn<usize>>(_: F) {} + | ^^^^^^^^^ required by this bound in `bar` error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:9:9 | -LL | fn foo<F: Fn(usize)>(_: F) {} - | --------- required by this bound in `foo` -... LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... LL | foo(f); | ^ expected signature of `fn(usize) -> _` + | +note: required by a bound in `foo` + --> $DIR/E0631.rs:3:11 + | +LL | fn foo<F: Fn(usize)>(_: F) {} + | ^^^^^^^^^ required by this bound in `foo` error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:10:9 | -LL | fn bar<F: Fn<usize>>(_: F) {} - | --------- required by this bound in `bar` -LL | fn main() { LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... LL | bar(f); | ^ expected signature of `fn(usize) -> _` + | +note: required by a bound in `bar` + --> $DIR/E0631.rs:4:11 + | +LL | fn bar<F: Fn<usize>>(_: F) {} + | ^^^^^^^^^ required by this bound in `bar` error: aborting due to 4 previous errors diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index 2bea9572b70..67900172464 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -48,14 +48,16 @@ LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:13:5 | -LL | fn f<F: Fn<usize>>(_: F) {} - | --------- required by this bound in `f` -... LL | f(|| panic!()); | ^ -- takes 0 arguments | | | expected closure that takes 1 argument | +note: required by a bound in `f` + --> $DIR/closure-arg-count.rs:3:9 + | +LL | fn f<F: Fn<usize>>(_: F) {} + | ^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | LL | f(|_| panic!()); @@ -64,14 +66,16 @@ LL | f(|_| panic!()); error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:15:5 | -LL | fn f<F: Fn<usize>>(_: F) {} - | --------- required by this bound in `f` -... LL | f( move || panic!()); | ^ ---------- takes 0 arguments | | | expected closure that takes 1 argument | +note: required by a bound in `f` + --> $DIR/closure-arg-count.rs:3:9 + | +LL | fn f<F: Fn<usize>>(_: F) {} + | ^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | LL | f( move |_| panic!()); @@ -149,10 +153,14 @@ error[E0593]: function is expected to take 0 arguments, but it takes 1 argument LL | call(Foo); | ^^^ expected function that takes 0 arguments ... -LL | fn call<F, R>(_: F) where F: FnOnce() -> R {} - | ------------- required by this bound in `call` LL | struct Foo(u8); | --------------- takes 1 argument + | +note: required by a bound in `call` + --> $DIR/closure-arg-count.rs:42:30 + | +LL | fn call<F, R>(_: F) where F: FnOnce() -> R {} + | ^^^^^^^^^^^^^ required by this bound in `call` error: aborting due to 14 previous errors diff --git a/src/test/ui/mismatched_types/closure-mismatch.nll.stderr b/src/test/ui/mismatched_types/closure-mismatch.nll.stderr index 745a61b866e..f29126e6afc 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.nll.stderr +++ b/src/test/ui/mismatched_types/closure-mismatch.nll.stderr @@ -1,14 +1,26 @@ -error: higher-ranked subtype error +error: implementation of `FnOnce` is not general enough --> $DIR/closure-mismatch.rs:8:5 | LL | baz(|_| ()); - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | + = note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/closure-mismatch.rs:8:5 | LL | baz(|_| ()); - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ one type is more general than the other + | + = note: expected type `for<'r> Fn<(&'r (),)>` + found type `Fn<(&(),)>` +note: this closure does not fulfill the lifetime requirements + --> $DIR/closure-mismatch.rs:8:9 + | +LL | baz(|_| ()); + | ^^^^^^ error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index dbb281bbf41..afde894b304 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -3,12 +3,15 @@ error[E0631]: type mismatch in function arguments | LL | fn takes_mut(x: &mut isize) { } | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` -LL | -LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { - | --------- required by this bound in `apply` ... LL | apply(&3, takes_mut); | ^^^^^^^^^ expected signature of `fn(&{integer}) -> _` + | +note: required by a bound in `apply` + --> $DIR/fn-variance-1.rs:5:37 + | +LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { + | ^^^^^^^^^ required by this bound in `apply` error[E0631]: type mismatch in function arguments --> $DIR/fn-variance-1.rs:15:19 @@ -16,11 +19,14 @@ error[E0631]: type mismatch in function arguments LL | fn takes_imm(x: &isize) { } | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` ... -LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { - | --------- required by this bound in `apply` -... LL | apply(&mut 3, takes_imm); | ^^^^^^^^^ expected signature of `fn(&mut {integer}) -> _` + | +note: required by a bound in `apply` + --> $DIR/fn-variance-1.rs:5:37 + | +LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { + | ^^^^^^^^^ required by this bound in `apply` error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs index ab36b8536bf..ad59462e9bd 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs @@ -6,6 +6,7 @@ fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f } fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize { //~^ NOTE required by this bound in `call_it` +//~| NOTE required by a bound in `call_it` f(2, y) } diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 111ff4a0c32..4406f8a9e58 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -1,14 +1,17 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/unboxed-closures-vtable-mismatch.rs:15:24 + --> $DIR/unboxed-closures-vtable-mismatch.rs:16:24 | -LL | fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize { - | ------------------------- required by this bound in `call_it` -... LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); | ----------------------------- found signature of `fn(usize, isize) -> _` LL | LL | let z = call_it(3, f); | ^ expected signature of `fn(isize, isize) -> _` + | +note: required by a bound in `call_it` + --> $DIR/unboxed-closures-vtable-mismatch.rs:7:14 + | +LL | fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` error: aborting due to previous error diff --git a/src/test/ui/mut/mutable-enum-indirect.stderr b/src/test/ui/mut/mutable-enum-indirect.stderr index 5b26f94115a..8ec478cd63f 100644 --- a/src/test/ui/mut/mutable-enum-indirect.stderr +++ b/src/test/ui/mut/mutable-enum-indirect.stderr @@ -1,9 +1,6 @@ error[E0277]: `NoSync` cannot be shared between threads safely --> $DIR/mutable-enum-indirect.rs:17:5 | -LL | fn bar<T: Sync>(_: T) {} - | ---- required by this bound in `bar` -... LL | bar(&x); | ^^^ `NoSync` cannot be shared between threads safely | @@ -14,6 +11,11 @@ note: required because it appears within the type `Foo` LL | enum Foo { A(NoSync) } | ^^^ = note: required because it appears within the type `&Foo` +note: required by a bound in `bar` + --> $DIR/mutable-enum-indirect.rs:13:11 + | +LL | fn bar<T: Sync>(_: T) {} + | ^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/mutexguard-sync.stderr b/src/test/ui/mutexguard-sync.stderr index 588c32a755e..172e257ebf0 100644 --- a/src/test/ui/mutexguard-sync.stderr +++ b/src/test/ui/mutexguard-sync.stderr @@ -1,14 +1,16 @@ error[E0277]: `Cell<i32>` cannot be shared between threads safely --> $DIR/mutexguard-sync.rs:11:15 | -LL | fn test_sync<T: Sync>(_t: T) {} - | ---- required by this bound in `test_sync` -... LL | test_sync(guard); | ^^^^^ `Cell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell<i32>` = note: required because of the requirements on the impl of `Sync` for `MutexGuard<'_, Cell<i32>>` +note: required by a bound in `test_sync` + --> $DIR/mutexguard-sync.rs:5:17 + | +LL | fn test_sync<T: Sync>(_t: T) {} + | ^^^^ required by this bound in `test_sync` error: aborting due to previous error diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index 6c792c3314c..e4e10716388 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -99,398 +99,530 @@ LL | use xm8::V; error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:33:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m1::S{}); | ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::S: Impossible` is not satisfied --> $DIR/namespace-mix.rs:35:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m2::S{}); | ^^^^^^^ the trait `Impossible` is not implemented for `c::S` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:36:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m2::S); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:39:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm1::S{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::S: Impossible` is not satisfied --> $DIR/namespace-mix.rs:41:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm2::S{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:42:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm2::S); | ^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:55:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m3::TS{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `fn() -> c::TS {c::TS}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:56:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m3::TS); | ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::TS: Impossible` is not satisfied --> $DIR/namespace-mix.rs:57:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m4::TS{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::TS` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:58:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m4::TS); | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:61:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm3::TS{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:62:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm3::TS); | ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::TS: Impossible` is not satisfied --> $DIR/namespace-mix.rs:63:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm4::TS{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:64:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm4::TS); | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:77:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m5::US{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:78:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m5::US); | ^^^^^^ the trait `Impossible` is not implemented for `c::US` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:79:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m6::US{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::US` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:80:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m6::US); | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:83:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm5::US{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:84:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm5::US); | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:85:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm6::US{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:86:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm6::US); | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:99:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m7::V{}); | ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:101:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m8::V{}); | ^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:102:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m8::V); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:105:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm7::V{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:107:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm8::V{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:108:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm8::V); | ^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:121:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m9::TV{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:122:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(m9::TV); | ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:123:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(mA::TV{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:124:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(mA::TV); | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:127:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm9::TV{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:128:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xm9::TV); | ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:129:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xmA::TV{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:130:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xmA::TV); | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:143:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(mB::UV{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:144:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(mB::UV); | ^^^^^^ the trait `Impossible` is not implemented for `c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:145:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(mC::UV{}); | ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:146:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(mC::UV); | ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:149:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xmB::UV{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:150:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xmB::UV); | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:151:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xmC::UV{}); | ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:152:11 | -LL | fn check<T: Impossible>(_: T) {} - | ---------- required by this bound in `check` -... LL | check(xmC::UV); | ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` error: aborting due to 48 previous errors diff --git a/src/test/ui/never_type/defaulted-never-note.rs b/src/test/ui/never_type/defaulted-never-note.rs index 6979c3ec443..70333c5f324 100644 --- a/src/test/ui/never_type/defaulted-never-note.rs +++ b/src/test/ui/never_type/defaulted-never-note.rs @@ -20,7 +20,7 @@ impl ImplementedForUnitButNotNever for () {} fn foo<T: ImplementedForUnitButNotNever>(_t: T) {} //~^ NOTE required by this bound in `foo` - +//~| NOTE required by a bound in `foo` fn smeg() { let _x = return; foo(_x); diff --git a/src/test/ui/never_type/defaulted-never-note.stderr b/src/test/ui/never_type/defaulted-never-note.stderr index 99738375022..109a81a5ca0 100644 --- a/src/test/ui/never_type/defaulted-never-note.stderr +++ b/src/test/ui/never_type/defaulted-never-note.stderr @@ -1,15 +1,17 @@ error[E0277]: the trait bound `!: ImplementedForUnitButNotNever` is not satisfied --> $DIR/defaulted-never-note.rs:26:5 | -LL | fn foo<T: ImplementedForUnitButNotNever>(_t: T) {} - | ----------------------------- required by this bound in `foo` -... LL | foo(_x); | ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!` | = note: this trait is implemented for `()`. = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information). = help: did you intend to use the type `()` here instead? +note: required by a bound in `foo` + --> $DIR/defaulted-never-note.rs:21:11 + | +LL | fn foo<T: ImplementedForUnitButNotNever>(_t: T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/never_type/issue-51506.stderr b/src/test/ui/never_type/issue-51506.stderr index 16d93c18900..38f299d11c1 100644 --- a/src/test/ui/never_type/issue-51506.stderr +++ b/src/test/ui/never_type/issue-51506.stderr @@ -1,13 +1,15 @@ error[E0277]: `!` is not an iterator --> $DIR/issue-51506.rs:13:5 | -LL | type Out: Iterator<Item = u32>; - | -------------------- required by this bound in `Trait::Out` -... LL | default type Out = !; | ^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator | = help: the trait `Iterator` is not implemented for `!` +note: required by a bound in `Trait::Out` + --> $DIR/issue-51506.rs:7:15 + | +LL | type Out: Iterator<Item = u32>; + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait::Out` error: aborting due to previous error diff --git a/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr b/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr index dbbda62d208..c00288f2e3c 100644 --- a/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr +++ b/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr @@ -121,3 +121,4 @@ LL | Bar2::new(&self) error: aborting due to 10 previous errors +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/nll/relate_tys/fn-subtype.rs b/src/test/ui/nll/relate_tys/fn-subtype.rs index ac00627ad00..0730dcc9e49 100644 --- a/src/test/ui/nll/relate_tys/fn-subtype.rs +++ b/src/test/ui/nll/relate_tys/fn-subtype.rs @@ -6,5 +6,5 @@ fn main() { let x: fn(&'static ()) = |_| {}; - let y: for<'a> fn(&'a ()) = x; //~ ERROR higher-ranked subtype error + let y: for<'a> fn(&'a ()) = x; //~ ERROR mismatched types [E0308] } diff --git a/src/test/ui/nll/relate_tys/fn-subtype.stderr b/src/test/ui/nll/relate_tys/fn-subtype.stderr index b089b5aaa25..94def690086 100644 --- a/src/test/ui/nll/relate_tys/fn-subtype.stderr +++ b/src/test/ui/nll/relate_tys/fn-subtype.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/fn-subtype.rs:9:33 | LL | let y: for<'a> fn(&'a ()) = x; - | ^ + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'r> fn(&'r ())` + found fn pointer `fn(&())` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs index fca69b83efe..a6d6ffa0ce3 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs +++ b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs @@ -12,7 +12,7 @@ fn make_it() -> for<'a> fn(&'a u32, &'a u32) -> &'a u32 { fn foo() { let a: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); - //~^ ERROR higher-ranked subtype error + //~^ ERROR mismatched types [E0308] drop(a); } @@ -20,7 +20,7 @@ fn bar() { // The code path for patterns is mildly different, so go ahead and // test that too: let _: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); - //~^ ERROR higher-ranked subtype error + //~^ ERROR mismatched types [E0308] } -fn main() { } +fn main() {} diff --git a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr index 7906dbd37ef..8c1eaeb6aa7 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr +++ b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr @@ -1,14 +1,21 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/hr-fn-aaa-as-aba.rs:14:58 | LL | let a: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); - | ^^^^^^^^^ + | ^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's> fn(&'r u32, &'s u32) -> &'r u32` + found fn pointer `for<'a> fn(&'a u32, &'a u32) -> &'a u32` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/hr-fn-aaa-as-aba.rs:22:12 | LL | let _: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32` + found fn pointer `for<'r> fn(&'r u32, &'r u32) -> &'r u32` error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs index 44dcd191d1b..37a01f28946 100644 --- a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs +++ b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs @@ -30,6 +30,6 @@ impl<T> Y for fn(T) { fn main() { let _x = <fn(&())>::make_f(); - //~^ higher-ranked subtype error - //~| higher-ranked subtype error + //~^ ERROR implementation of `Y` is not general enough + //~| ERROR implementation of `Y` is not general enough } diff --git a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index 190b520c678..ed79c7df25e 100644 --- a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -1,14 +1,20 @@ -error: higher-ranked subtype error +error: implementation of `Y` is not general enough --> $DIR/impl-fn-ignore-binder-via-bottom.rs:32:14 | LL | let _x = <fn(&())>::make_f(); - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Y` would have to be implemented for the type `for<'r> fn(&'r ())` + = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` -error: higher-ranked subtype error +error: implementation of `Y` is not general enough --> $DIR/impl-fn-ignore-binder-via-bottom.rs:32:14 | LL | let _x = <fn(&())>::make_f(); - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Y` would have to be implemented for the type `for<'r> fn(&'r ())` + = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/relate_tys/trait-hrtb.rs b/src/test/ui/nll/relate_tys/trait-hrtb.rs index 80f31ca6b47..2e94fc5c12d 100644 --- a/src/test/ui/nll/relate_tys/trait-hrtb.rs +++ b/src/test/ui/nll/relate_tys/trait-hrtb.rs @@ -12,5 +12,5 @@ fn make_foo<'a>() -> Box<dyn Foo<'a>> { fn main() { let x: Box<dyn Foo<'static>> = make_foo(); - let y: Box<dyn for<'a> Foo<'a>> = x; //~ ERROR higher-ranked subtype error + let y: Box<dyn for<'a> Foo<'a>> = x; //~ ERROR mismatched types [E0308] } diff --git a/src/test/ui/nll/relate_tys/trait-hrtb.stderr b/src/test/ui/nll/relate_tys/trait-hrtb.stderr index 4df2f352522..60a7f204446 100644 --- a/src/test/ui/nll/relate_tys/trait-hrtb.stderr +++ b/src/test/ui/nll/relate_tys/trait-hrtb.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/trait-hrtb.rs:15:39 | LL | let y: Box<dyn for<'a> Foo<'a>> = x; - | ^ + | ^ one type is more general than the other + | + = note: expected trait object `dyn for<'r> Foo<'r>` + found trait object `dyn Foo<'_>` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/nll/relate_tys/universe-violation.rs b/src/test/ui/nll/relate_tys/universe-violation.rs index d29f8f8af20..8389c8e8377 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.rs +++ b/src/test/ui/nll/relate_tys/universe-violation.rs @@ -12,6 +12,6 @@ fn make_it() -> fn(&'static u32) -> &'static u32 { fn main() { let a: fn(_) -> _ = make_it(); - let b: fn(&u32) -> &u32 = a; //~ ERROR higher-ranked subtype error + let b: fn(&u32) -> &u32 = a; //~ ERROR mismatched types [E0308] drop(a); } diff --git a/src/test/ui/nll/relate_tys/universe-violation.stderr b/src/test/ui/nll/relate_tys/universe-violation.stderr index 6dc78789564..ff4c7abc250 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.stderr +++ b/src/test/ui/nll/relate_tys/universe-violation.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/universe-violation.rs:15:31 | LL | let b: fn(&u32) -> &u32 = a; - | ^ + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'r> fn(&'r u32) -> &'r u32` + found fn pointer `fn(&u32) -> &u32` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr b/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr index 46b6c04dcbc..af159a6cd1b 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr +++ b/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr @@ -21,7 +21,7 @@ error: lifetime may not live long enough --> $DIR/closure-substs.rs:15:16 | LL | |x: &i32| -> &'static i32 { - | - ------------ return type of closure is &'2 i32 + | - - let's call the lifetime of this reference `'2` | | | let's call the lifetime of this reference `'1` LL | return x; @@ -58,3 +58,4 @@ LL | b(x); error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index c35692d6eab..80708c989fc 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -11,11 +11,6 @@ LL | | println!("{:?}", y); LL | | }); | |_____- within this `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]` | - ::: $SRC_DIR/std/src/thread/mod.rs:LL:COL - | -LL | F: Send + 'static, - | ---- required by this bound in `spawn` - | = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]`, the trait `Send` is not implemented for `Rc<()>` note: required because it appears within the type `Port<()>` --> $DIR/no-send-res-ports.rs:5:8 @@ -28,6 +23,11 @@ note: required because it appears within the type `Foo` LL | struct Foo { | ^^^ = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]` +note: required by a bound in `spawn` + --> $SRC_DIR/std/src/thread/mod.rs:LL:COL + | +LL | F: Send + 'static, + | ^^^^ required by this bound in `spawn` error: aborting due to previous error diff --git a/src/test/ui/no_send-enum.stderr b/src/test/ui/no_send-enum.stderr index 9d755839d37..814f3473828 100644 --- a/src/test/ui/no_send-enum.stderr +++ b/src/test/ui/no_send-enum.stderr @@ -1,9 +1,6 @@ error[E0277]: `NoSend` cannot be sent between threads safely --> $DIR/no_send-enum.rs:16:5 | -LL | fn bar<T: Send>(_: T) {} - | ---- required by this bound in `bar` -... LL | bar(x); | ^^^ `NoSend` cannot be sent between threads safely | @@ -13,6 +10,11 @@ note: required because it appears within the type `Foo` | LL | enum Foo { | ^^^ +note: required by a bound in `bar` + --> $DIR/no_send-enum.rs:12:11 + | +LL | fn bar<T: Send>(_: T) {} + | ^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/no_send-rc.stderr b/src/test/ui/no_send-rc.stderr index 713dd753663..f8be5e76f7a 100644 --- a/src/test/ui/no_send-rc.stderr +++ b/src/test/ui/no_send-rc.stderr @@ -1,13 +1,15 @@ error[E0277]: `Rc<{integer}>` cannot be sent between threads safely --> $DIR/no_send-rc.rs:7:9 | -LL | fn bar<T: Send>(_: T) {} - | ---- required by this bound in `bar` -... LL | bar(x); | ^ `Rc<{integer}>` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Rc<{integer}>` +note: required by a bound in `bar` + --> $DIR/no_send-rc.rs:3:11 + | +LL | fn bar<T: Send>(_: T) {} + | ^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/no_send-struct.stderr b/src/test/ui/no_send-struct.stderr index a28a5e6d3d5..2f8cf3569ae 100644 --- a/src/test/ui/no_send-struct.stderr +++ b/src/test/ui/no_send-struct.stderr @@ -1,13 +1,15 @@ error[E0277]: `Foo` cannot be sent between threads safely --> $DIR/no_send-struct.rs:15:9 | -LL | fn bar<T: Send>(_: T) {} - | ---- required by this bound in `bar` -... LL | bar(x); | ^ `Foo` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Foo` +note: required by a bound in `bar` + --> $DIR/no_send-struct.rs:11:11 + | +LL | fn bar<T: Send>(_: T) {} + | ^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/no_share-enum.stderr b/src/test/ui/no_share-enum.stderr index a8ab69200ec..ad837863be9 100644 --- a/src/test/ui/no_share-enum.stderr +++ b/src/test/ui/no_share-enum.stderr @@ -1,9 +1,6 @@ error[E0277]: `NoSync` cannot be shared between threads safely --> $DIR/no_share-enum.rs:14:5 | -LL | fn bar<T: Sync>(_: T) {} - | ---- required by this bound in `bar` -... LL | bar(x); | ^^^ `NoSync` cannot be shared between threads safely | @@ -13,6 +10,11 @@ note: required because it appears within the type `Foo` | LL | enum Foo { A(NoSync) } | ^^^ +note: required by a bound in `bar` + --> $DIR/no_share-enum.rs:10:11 + | +LL | fn bar<T: Sync>(_: T) {} + | ^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/no_share-struct.stderr b/src/test/ui/no_share-struct.stderr index a35271a8b78..8983b086789 100644 --- a/src/test/ui/no_share-struct.stderr +++ b/src/test/ui/no_share-struct.stderr @@ -1,13 +1,15 @@ error[E0277]: `Foo` cannot be shared between threads safely --> $DIR/no_share-struct.rs:12:9 | -LL | fn bar<T: Sync>(_: T) {} - | ---- required by this bound in `bar` -... LL | bar(x); | ^ `Foo` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Foo` +note: required by a bound in `bar` + --> $DIR/no_share-struct.rs:8:11 + | +LL | fn bar<T: Sync>(_: T) {} + | ^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/non-fmt-panic.fixed b/src/test/ui/non-fmt-panic.fixed index c85e1887d96..d226f4129aa 100644 --- a/src/test/ui/non-fmt-panic.fixed +++ b/src/test/ui/non-fmt-panic.fixed @@ -17,11 +17,16 @@ fn main() { //~^ WARN panic message contains unused formatting placeholders assert!(false, "{}", S); //~^ WARN panic message is not a string literal + assert!(false, "{}", 123); + //~^ WARN panic message is not a string literal + assert!(false, "{:?}", Some(123)); + //~^ WARN panic message is not a string literal debug_assert!(false, "{}", "{{}} bla"); //~ WARN panic message contains braces panic!("{}", C); //~ WARN panic message is not a string literal panic!("{}", S); //~ WARN panic message is not a string literal std::panic::panic_any(123); //~ WARN panic message is not a string literal core::panic!("{}", &*"abc"); //~ WARN panic message is not a string literal + std::panic::panic_any(Some(123)); //~ WARN panic message is not a string literal panic!("{}", concat!("{", "}")); //~ WARN panic message contains an unused formatting placeholder panic!("{}", concat!("{", "{")); //~ WARN panic message contains braces @@ -51,4 +56,29 @@ fn main() { } panic!("{}"); // OK panic!(S); // OK + + a(1); + b(1); + c(1); + d(1); +} + +fn a<T: Send + 'static>(v: T) { + std::panic::panic_any(v); //~ WARN panic message is not a string literal + assert!(false, v); //~ WARN panic message is not a string literal +} + +fn b<T: std::fmt::Debug + Send + 'static>(v: T) { + std::panic::panic_any(v); //~ WARN panic message is not a string literal + assert!(false, "{:?}", v); //~ WARN panic message is not a string literal +} + +fn c<T: std::fmt::Display + Send + 'static>(v: T) { + std::panic::panic_any(v); //~ WARN panic message is not a string literal + assert!(false, "{}", v); //~ WARN panic message is not a string literal +} + +fn d<T: std::fmt::Display + std::fmt::Debug + Send + 'static>(v: T) { + std::panic::panic_any(v); //~ WARN panic message is not a string literal + assert!(false, "{}", v); //~ WARN panic message is not a string literal } diff --git a/src/test/ui/non-fmt-panic.rs b/src/test/ui/non-fmt-panic.rs index 020bcf00a01..2ffd7638ae0 100644 --- a/src/test/ui/non-fmt-panic.rs +++ b/src/test/ui/non-fmt-panic.rs @@ -17,11 +17,16 @@ fn main() { //~^ WARN panic message contains unused formatting placeholders assert!(false, S); //~^ WARN panic message is not a string literal + assert!(false, 123); + //~^ WARN panic message is not a string literal + assert!(false, Some(123)); + //~^ WARN panic message is not a string literal debug_assert!(false, "{{}} bla"); //~ WARN panic message contains braces panic!(C); //~ WARN panic message is not a string literal panic!(S); //~ WARN panic message is not a string literal std::panic!(123); //~ WARN panic message is not a string literal core::panic!(&*"abc"); //~ WARN panic message is not a string literal + panic!(Some(123)); //~ WARN panic message is not a string literal panic!(concat!("{", "}")); //~ WARN panic message contains an unused formatting placeholder panic!(concat!("{", "{")); //~ WARN panic message contains braces @@ -51,4 +56,29 @@ fn main() { } panic!("{}"); // OK panic!(S); // OK + + a(1); + b(1); + c(1); + d(1); +} + +fn a<T: Send + 'static>(v: T) { + panic!(v); //~ WARN panic message is not a string literal + assert!(false, v); //~ WARN panic message is not a string literal +} + +fn b<T: std::fmt::Debug + Send + 'static>(v: T) { + panic!(v); //~ WARN panic message is not a string literal + assert!(false, v); //~ WARN panic message is not a string literal +} + +fn c<T: std::fmt::Display + Send + 'static>(v: T) { + panic!(v); //~ WARN panic message is not a string literal + assert!(false, v); //~ WARN panic message is not a string literal +} + +fn d<T: std::fmt::Display + std::fmt::Debug + Send + 'static>(v: T) { + panic!(v); //~ WARN panic message is not a string literal + assert!(false, v); //~ WARN panic message is not a string literal } diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr index 513ffd37dc3..b62cc378aa5 100644 --- a/src/test/ui/non-fmt-panic.stderr +++ b/src/test/ui/non-fmt-panic.stderr @@ -61,15 +61,41 @@ warning: panic message is not a string literal LL | assert!(false, S); | ^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> help: add a "{}" format string to Display the message | LL | assert!(false, "{}", S); | +++++ +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:20:20 + | +LL | assert!(false, 123); + | ^^^ + | + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | assert!(false, "{}", 123); + | +++++ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:22:20 + | +LL | assert!(false, Some(123)); + | ^^^^^^^^^ + | + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{:?}" format string to use the Debug implementation of `Option<i32>` + | +LL | assert!(false, "{:?}", Some(123)); + | +++++++ + warning: panic message contains braces - --> $DIR/non-fmt-panic.rs:20:27 + --> $DIR/non-fmt-panic.rs:24:27 | LL | debug_assert!(false, "{{}} bla"); | ^^^^ @@ -81,7 +107,7 @@ LL | debug_assert!(false, "{}", "{{}} bla"); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:21:12 + --> $DIR/non-fmt-panic.rs:25:12 | LL | panic!(C); | ^ @@ -94,7 +120,7 @@ LL | panic!("{}", C); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:22:12 + --> $DIR/non-fmt-panic.rs:26:12 | LL | panic!(S); | ^ @@ -107,12 +133,12 @@ LL | panic!("{}", S); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:23:17 + --> $DIR/non-fmt-panic.rs:27:17 | LL | std::panic!(123); | ^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of std::panic!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> help: add a "{}" format string to Display the message | @@ -124,20 +150,37 @@ LL | std::panic::panic_any(123); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:24:18 + --> $DIR/non-fmt-panic.rs:28:18 | LL | core::panic!(&*"abc"); | ^^^^^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of core::panic!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> help: add a "{}" format string to Display the message | LL | core::panic!("{}", &*"abc"); | +++++ +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:29:12 + | +LL | panic!(Some(123)); + | ^^^^^^^^^ + | + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{:?}" format string to use the Debug implementation of `Option<i32>` + | +LL | panic!("{:?}", Some(123)); + | +++++++ +help: or use std::panic::panic_any instead + | +LL | std::panic::panic_any(Some(123)); + | ~~~~~~~~~~~~~~~~~~~~~ + warning: panic message contains an unused formatting placeholder - --> $DIR/non-fmt-panic.rs:25:12 + --> $DIR/non-fmt-panic.rs:30:12 | LL | panic!(concat!("{", "}")); | ^^^^^^^^^^^^^^^^^ @@ -153,7 +196,7 @@ LL | panic!("{}", concat!("{", "}")); | +++++ warning: panic message contains braces - --> $DIR/non-fmt-panic.rs:26:5 + --> $DIR/non-fmt-panic.rs:31:5 | LL | panic!(concat!("{", "{")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -165,7 +208,7 @@ LL | panic!("{}", concat!("{", "{")); | +++++ warning: panic message contains an unused formatting placeholder - --> $DIR/non-fmt-panic.rs:28:37 + --> $DIR/non-fmt-panic.rs:33:37 | LL | fancy_panic::fancy_panic!("test {} 123"); | ^^ @@ -173,7 +216,7 @@ LL | fancy_panic::fancy_panic!("test {} 123"); = note: this message is not used as a format string when given without arguments, but will be in Rust 2021 warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:38:12 + --> $DIR/non-fmt-panic.rs:43:12 | LL | panic!(a!()); | ^^^^ @@ -190,7 +233,7 @@ LL | std::panic::panic_any(a!()); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:40:12 + --> $DIR/non-fmt-panic.rs:45:12 | LL | panic!(format!("{}", 1)); | ^^^^^^^^^^^^^^^^ @@ -205,12 +248,12 @@ LL + panic!("{}", 1); | warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:41:20 + --> $DIR/non-fmt-panic.rs:46:20 | LL | assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> = note: the assert!() macro supports formatting, so there's no need for the format!() macro here help: remove the `format!(..)` macro call @@ -220,12 +263,12 @@ LL + assert!(false, "{}", 1); | warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:42:26 + --> $DIR/non-fmt-panic.rs:47:26 | LL | debug_assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of debug_assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> = note: the debug_assert!() macro supports formatting, so there's no need for the format!() macro here help: remove the `format!(..)` macro call @@ -235,7 +278,7 @@ LL + debug_assert!(false, "{}", 1); | warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:44:12 + --> $DIR/non-fmt-panic.rs:49:12 | LL | panic![123]; | ^^^ @@ -252,7 +295,7 @@ LL | std::panic::panic_any(123); | ~~~~~~~~~~~~~~~~~~~~~~ ~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:45:12 + --> $DIR/non-fmt-panic.rs:50:12 | LL | panic!{123}; | ^^^ @@ -268,5 +311,115 @@ help: or use std::panic::panic_any instead LL | std::panic::panic_any(123); | ~~~~~~~~~~~~~~~~~~~~~~ ~ -warning: 19 warnings emitted +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:67:12 + | +LL | panic!(v); + | ------ ^ + | | + | help: use std::panic::panic_any instead: `std::panic::panic_any` + | + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:68:20 + | +LL | assert!(false, v); + | ^ + | + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:72:12 + | +LL | panic!(v); + | ^ + | + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{:?}" format string to use the Debug implementation of `T` + | +LL | panic!("{:?}", v); + | +++++++ +help: or use std::panic::panic_any instead + | +LL | std::panic::panic_any(v); + | ~~~~~~~~~~~~~~~~~~~~~ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:73:20 + | +LL | assert!(false, v); + | ^ + | + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{:?}" format string to use the Debug implementation of `T` + | +LL | assert!(false, "{:?}", v); + | +++++++ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:77:12 + | +LL | panic!(v); + | ^ + | + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | panic!("{}", v); + | +++++ +help: or use std::panic::panic_any instead + | +LL | std::panic::panic_any(v); + | ~~~~~~~~~~~~~~~~~~~~~ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:78:20 + | +LL | assert!(false, v); + | ^ + | + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | assert!(false, "{}", v); + | +++++ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:82:12 + | +LL | panic!(v); + | ^ + | + = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | panic!("{}", v); + | +++++ +help: or use std::panic::panic_any instead + | +LL | std::panic::panic_any(v); + | ~~~~~~~~~~~~~~~~~~~~~ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:83:20 + | +LL | assert!(false, v); + | ^ + | + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | assert!(false, "{}", v); + | +++++ + +warning: 30 warnings emitted diff --git a/src/test/ui/not-panic/not-panic-safe-2.stderr b/src/test/ui/not-panic/not-panic-safe-2.stderr index 6deb1e7d6fe..65594702bc4 100644 --- a/src/test/ui/not-panic/not-panic-safe-2.stderr +++ b/src/test/ui/not-panic/not-panic-safe-2.stderr @@ -1,22 +1,21 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-2.rs:10:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<Rc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `Rc<RefCell<i32>>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-2.rs:7:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-2.rs:10:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<Rc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | @@ -24,6 +23,11 @@ LL | assert::<Rc<RefCell<i32>>>(); = note: required because it appears within the type `Cell<isize>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `Rc<RefCell<i32>>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-2.rs:7:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error: aborting due to 2 previous errors diff --git a/src/test/ui/not-panic/not-panic-safe-3.stderr b/src/test/ui/not-panic/not-panic-safe-3.stderr index ef1cf548df0..db3fdb25345 100644 --- a/src/test/ui/not-panic/not-panic-safe-3.stderr +++ b/src/test/ui/not-panic/not-panic-safe-3.stderr @@ -1,22 +1,21 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-3.rs:10:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<Arc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `Arc<RefCell<i32>>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-3.rs:7:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-3.rs:10:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<Arc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | @@ -24,6 +23,11 @@ LL | assert::<Arc<RefCell<i32>>>(); = note: required because it appears within the type `Cell<isize>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `Arc<RefCell<i32>>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-3.rs:7:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error: aborting due to 2 previous errors diff --git a/src/test/ui/not-panic/not-panic-safe-4.stderr b/src/test/ui/not-panic/not-panic-safe-4.stderr index 2f86b96540c..079601b39c0 100644 --- a/src/test/ui/not-panic/not-panic-safe-4.stderr +++ b/src/test/ui/not-panic/not-panic-safe-4.stderr @@ -1,22 +1,21 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-4.rs:9:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<&RefCell<i32>>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `&RefCell<i32>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-4.rs:6:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-4.rs:9:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<&RefCell<i32>>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | @@ -24,6 +23,11 @@ LL | assert::<&RefCell<i32>>(); = note: required because it appears within the type `Cell<isize>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `&RefCell<i32>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-4.rs:6:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error: aborting due to 2 previous errors diff --git a/src/test/ui/not-panic/not-panic-safe-5.stderr b/src/test/ui/not-panic/not-panic-safe-5.stderr index c9f407a7f77..edd0f72dd3b 100644 --- a/src/test/ui/not-panic/not-panic-safe-5.stderr +++ b/src/test/ui/not-panic/not-panic-safe-5.stderr @@ -1,14 +1,16 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-5.rs:9:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<*const UnsafeCell<i32>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `*const UnsafeCell<i32>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-5.rs:6:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error: aborting due to previous error diff --git a/src/test/ui/not-panic/not-panic-safe-6.stderr b/src/test/ui/not-panic/not-panic-safe-6.stderr index cf75c89f27e..f3b784a2956 100644 --- a/src/test/ui/not-panic/not-panic-safe-6.stderr +++ b/src/test/ui/not-panic/not-panic-safe-6.stderr @@ -1,22 +1,21 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-6.rs:9:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<*mut RefCell<i32>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `*mut RefCell<i32>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-6.rs:6:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-6.rs:9:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<*mut RefCell<i32>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | @@ -24,6 +23,11 @@ LL | assert::<*mut RefCell<i32>>(); = note: required because it appears within the type `Cell<isize>` = note: required because it appears within the type `RefCell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `*mut RefCell<i32>` +note: required by a bound in `assert` + --> $DIR/not-panic-safe-6.rs:6:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error: aborting due to 2 previous errors diff --git a/src/test/ui/not-panic/not-panic-safe.stderr b/src/test/ui/not-panic/not-panic-safe.stderr index 1aaf17b1cd8..b95cd9173e3 100644 --- a/src/test/ui/not-panic/not-panic-safe.stderr +++ b/src/test/ui/not-panic/not-panic-safe.stderr @@ -1,14 +1,16 @@ error[E0277]: the type `&mut i32` may not be safely transferred across an unwind boundary --> $DIR/not-panic-safe.rs:9:5 | -LL | fn assert<T: UnwindSafe + ?Sized>() {} - | ---------- required by this bound in `assert` -... LL | assert::<&mut i32>(); | ^^^^^^^^^^^^^^^^^^ `&mut i32` may not be safely transferred across an unwind boundary | = help: the trait `UnwindSafe` is not implemented for `&mut i32` = note: `UnwindSafe` is implemented for `&i32`, but not for `&mut i32` +note: required by a bound in `assert` + --> $DIR/not-panic-safe.rs:6:14 + | +LL | fn assert<T: UnwindSafe + ?Sized>() {} + | ^^^^^^^^^^ required by this bound in `assert` error: aborting due to previous error diff --git a/src/test/ui/not-sync.stderr b/src/test/ui/not-sync.stderr index 85d3599da05..1ee358ba836 100644 --- a/src/test/ui/not-sync.stderr +++ b/src/test/ui/not-sync.stderr @@ -1,68 +1,80 @@ error[E0277]: `Cell<i32>` cannot be shared between threads safely --> $DIR/not-sync.rs:8:12 | -LL | fn test<T: Sync>() {} - | ---- required by this bound in `test` -... LL | test::<Cell<i32>>(); | ^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell<i32>` +note: required by a bound in `test` + --> $DIR/not-sync.rs:5:12 + | +LL | fn test<T: Sync>() {} + | ^^^^ required by this bound in `test` error[E0277]: `RefCell<i32>` cannot be shared between threads safely --> $DIR/not-sync.rs:10:12 | -LL | fn test<T: Sync>() {} - | ---- required by this bound in `test` -... LL | test::<RefCell<i32>>(); | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `RefCell<i32>` +note: required by a bound in `test` + --> $DIR/not-sync.rs:5:12 + | +LL | fn test<T: Sync>() {} + | ^^^^ required by this bound in `test` error[E0277]: `Rc<i32>` cannot be shared between threads safely --> $DIR/not-sync.rs:13:12 | -LL | fn test<T: Sync>() {} - | ---- required by this bound in `test` -... LL | test::<Rc<i32>>(); | ^^^^^^^ `Rc<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Rc<i32>` +note: required by a bound in `test` + --> $DIR/not-sync.rs:5:12 + | +LL | fn test<T: Sync>() {} + | ^^^^ required by this bound in `test` error[E0277]: `std::rc::Weak<i32>` cannot be shared between threads safely --> $DIR/not-sync.rs:15:12 | -LL | fn test<T: Sync>() {} - | ---- required by this bound in `test` -... LL | test::<Weak<i32>>(); | ^^^^^^^^^ `std::rc::Weak<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `std::rc::Weak<i32>` +note: required by a bound in `test` + --> $DIR/not-sync.rs:5:12 + | +LL | fn test<T: Sync>() {} + | ^^^^ required by this bound in `test` error[E0277]: `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely --> $DIR/not-sync.rs:18:12 | -LL | fn test<T: Sync>() {} - | ---- required by this bound in `test` -... LL | test::<Receiver<i32>>(); | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<i32>` +note: required by a bound in `test` + --> $DIR/not-sync.rs:5:12 + | +LL | fn test<T: Sync>() {} + | ^^^^ required by this bound in `test` error[E0277]: `Sender<i32>` cannot be shared between threads safely --> $DIR/not-sync.rs:20:12 | -LL | fn test<T: Sync>() {} - | ---- required by this bound in `test` -... LL | test::<Sender<i32>>(); | ^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Sender<i32>` +note: required by a bound in `test` + --> $DIR/not-sync.rs:5:12 + | +LL | fn test<T: Sync>() {} + | ^^^^ required by this bound in `test` error: aborting due to 6 previous errors diff --git a/src/test/ui/object-does-not-impl-trait.stderr b/src/test/ui/object-does-not-impl-trait.stderr index 44424bc4ae7..bf1641167cf 100644 --- a/src/test/ui/object-does-not-impl-trait.stderr +++ b/src/test/ui/object-does-not-impl-trait.stderr @@ -1,10 +1,14 @@ error[E0277]: the trait bound `Box<dyn Foo>: Foo` is not satisfied --> $DIR/object-does-not-impl-trait.rs:6:44 | -LL | fn take_foo<F:Foo>(f: F) {} - | --- required by this bound in `take_foo` LL | fn take_object(f: Box<dyn Foo>) { take_foo(f); } | ^ the trait `Foo` is not implemented for `Box<dyn Foo>` + | +note: required by a bound in `take_foo` + --> $DIR/object-does-not-impl-trait.rs:5:15 + | +LL | fn take_foo<F:Foo>(f: F) {} + | ^^^ required by this bound in `take_foo` error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/enclosing-scope.stderr b/src/test/ui/on-unimplemented/enclosing-scope.stderr index 4c1aaf39c7b..abd156dd5ac 100644 --- a/src/test/ui/on-unimplemented/enclosing-scope.stderr +++ b/src/test/ui/on-unimplemented/enclosing-scope.stderr @@ -1,9 +1,6 @@ error[E0277]: the trait bound `Foo: Trait` is not satisfied --> $DIR/enclosing-scope.rs:14:11 | -LL | fn f<T: Trait>(x: T) {} - | ----- required by this bound in `f` -... LL | let x = || { | _____________- LL | | f(Foo{}); @@ -13,26 +10,32 @@ LL | | f(Foo{}); LL | | }; LL | | }; | |_____- in this scope + | +note: required by a bound in `f` + --> $DIR/enclosing-scope.rs:10:9 + | +LL | fn f<T: Trait>(x: T) {} + | ^^^^^ required by this bound in `f` error[E0277]: the trait bound `Foo: Trait` is not satisfied --> $DIR/enclosing-scope.rs:16:15 | -LL | fn f<T: Trait>(x: T) {} - | ----- required by this bound in `f` -... LL | let y = || { | _________________- LL | | f(Foo{}); | | ^^^^^ the trait `Trait` is not implemented for `Foo` LL | | }; | |_________- in this scope + | +note: required by a bound in `f` + --> $DIR/enclosing-scope.rs:10:9 + | +LL | fn f<T: Trait>(x: T) {} + | ^^^^^ required by this bound in `f` error[E0277]: the trait bound `Foo: Trait` is not satisfied --> $DIR/enclosing-scope.rs:22:15 | -LL | fn f<T: Trait>(x: T) {} - | ----- required by this bound in `f` -LL | LL | / fn main() { LL | | let x = || { LL | | f(Foo{}); @@ -44,13 +47,16 @@ LL | | f(Foo{}); LL | | f(Foo{}); LL | | } | |_- in this scope + | +note: required by a bound in `f` + --> $DIR/enclosing-scope.rs:10:9 + | +LL | fn f<T: Trait>(x: T) {} + | ^^^^^ required by this bound in `f` error[E0277]: the trait bound `Foo: Trait` is not satisfied --> $DIR/enclosing-scope.rs:26:7 | -LL | fn f<T: Trait>(x: T) {} - | ----- required by this bound in `f` -LL | LL | / fn main() { LL | | let x = || { LL | | f(Foo{}); @@ -60,6 +66,12 @@ LL | | f(Foo{}); | | ^^^^^ the trait `Trait` is not implemented for `Foo` LL | | } | |_- in this scope + | +note: required by a bound in `f` + --> $DIR/enclosing-scope.rs:10:9 + | +LL | fn f<T: Trait>(x: T) {} + | ^^^^^ required by this bound in `f` error: aborting due to 4 previous errors diff --git a/src/test/ui/on-unimplemented/on-trait.stderr b/src/test/ui/on-unimplemented/on-trait.stderr index 00c8492abc6..4b040f1ac5a 100644 --- a/src/test/ui/on-unimplemented/on-trait.stderr +++ b/src/test/ui/on-unimplemented/on-trait.stderr @@ -1,24 +1,28 @@ error[E0277]: the trait bound `Option<Vec<u8>>: MyFromIterator<&u8>` is not satisfied --> $DIR/on-trait.rs:28:30 | -LL | fn collect<A, I: Iterator<Item=A>, B: MyFromIterator<A>>(it: I) -> B { - | ----------------- required by this bound in `collect` -... LL | let y: Option<Vec<u8>> = collect(x.iter()); // this should give approximately the same error for x.iter().collect() | ^^^^^^^ a collection of type `Option<Vec<u8>>` cannot be built from an iterator over elements of type `&u8` | = help: the trait `MyFromIterator<&u8>` is not implemented for `Option<Vec<u8>>` +note: required by a bound in `collect` + --> $DIR/on-trait.rs:22:39 + | +LL | fn collect<A, I: Iterator<Item=A>, B: MyFromIterator<A>>(it: I) -> B { + | ^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: the trait bound `String: Foo<u8, _, u32>` is not satisfied --> $DIR/on-trait.rs:31:21 | -LL | fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T { - | --------------- required by this bound in `foobar` -... LL | let x: String = foobar(); | ^^^^^^ test error `String` with `u8` `_` `u32` in `Foo` | = help: the trait `Foo<u8, _, u32>` is not implemented for `String` +note: required by a bound in `foobar` + --> $DIR/on-trait.rs:12:24 + | +LL | fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T { + | ^^^^^^^^^^^^^^^ required by this bound in `foobar` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issue-17383.rs b/src/test/ui/parser/issue-17383.rs deleted file mode 100644 index 7bf0e64f2c0..00000000000 --- a/src/test/ui/parser/issue-17383.rs +++ /dev/null @@ -1,7 +0,0 @@ -enum X { - A = 3, - //~^ ERROR custom discriminant values are not allowed in enums with tuple or struct variants - B(usize) -} - -fn main() {} diff --git a/src/test/ui/parser/issue-17383.stderr b/src/test/ui/parser/issue-17383.stderr deleted file mode 100644 index 265d6e14866..00000000000 --- a/src/test/ui/parser/issue-17383.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants - --> $DIR/issue-17383.rs:2:9 - | -LL | A = 3, - | ^ disallowed custom discriminant -LL | -LL | B(usize) - | -------- tuple variant defined here - | - = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information - = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.rs b/src/test/ui/parser/tag-variant-disr-non-nullary.rs deleted file mode 100644 index a9cfdd549c7..00000000000 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.rs +++ /dev/null @@ -1,12 +0,0 @@ -enum Color { - Red = 0xff0000, - //~^ ERROR custom discriminant values are not allowed in enums with tuple or struct variants - Green = 0x00ff00, - Blue = 0x0000ff, - Black = 0x000000, - White = 0xffffff, - Other(usize), - Other2(usize, usize), -} - -fn main() {} diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr deleted file mode 100644 index 79f044a0675..00000000000 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants - --> $DIR/tag-variant-disr-non-nullary.rs:2:11 - | -LL | Red = 0xff0000, - | ^^^^^^^^ disallowed custom discriminant -LL | -LL | Green = 0x00ff00, - | ^^^^^^^^ disallowed custom discriminant -LL | Blue = 0x0000ff, - | ^^^^^^^^ disallowed custom discriminant -LL | Black = 0x000000, - | ^^^^^^^^ disallowed custom discriminant -LL | White = 0xffffff, - | ^^^^^^^^ disallowed custom discriminant -LL | Other(usize), - | ------------ tuple variant defined here -LL | Other2(usize, usize), - | -------------------- tuple variant defined here - | - = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information - = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/phantom-auto-trait.stderr b/src/test/ui/phantom-auto-trait.stderr index acd33e0a416..e7b5528daee 100644 --- a/src/test/ui/phantom-auto-trait.stderr +++ b/src/test/ui/phantom-auto-trait.stderr @@ -1,9 +1,6 @@ error[E0277]: `T` cannot be shared between threads safely --> $DIR/phantom-auto-trait.rs:21:12 | -LL | fn is_zen<T: Zen>(_: T) {} - | --- required by this bound in `is_zen` -... LL | is_zen(x) | ^ `T` cannot be shared between threads safely | @@ -18,6 +15,11 @@ note: required because it appears within the type `Guard<'_, T>` | LL | struct Guard<'a, T: 'a> { | ^^^^^ +note: required by a bound in `is_zen` + --> $DIR/phantom-auto-trait.rs:18:14 + | +LL | fn is_zen<T: Zen>(_: T) {} + | ^^^ required by this bound in `is_zen` help: consider restricting type parameter `T` | LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) { @@ -26,9 +28,6 @@ LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) { error[E0277]: `T` cannot be shared between threads safely --> $DIR/phantom-auto-trait.rs:26:12 | -LL | fn is_zen<T: Zen>(_: T) {} - | --- required by this bound in `is_zen` -... LL | is_zen(x) | ^ `T` cannot be shared between threads safely | @@ -48,6 +47,11 @@ note: required because it appears within the type `Nested<Guard<'_, T>>` | LL | struct Nested<T>(T); | ^^^^^^ +note: required by a bound in `is_zen` + --> $DIR/phantom-auto-trait.rs:18:14 + | +LL | fn is_zen<T: Zen>(_: T) {} + | ^^^ required by this bound in `is_zen` help: consider restricting type parameter `T` | LL | fn nested_not_sync<T: std::marker::Sync>(x: Nested<Guard<T>>) { diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr index 53453ea04dd..ff494d7d4b8 100644 --- a/src/test/ui/range/range-1.stderr +++ b/src/test/ui/range/range-1.stderr @@ -24,12 +24,12 @@ error[E0277]: the size for values of type `[{integer}]` cannot be known at compi LL | let range = *arr..; | ^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/ops/range.rs:LL:COL + = help: the trait `Sized` is not implemented for `[{integer}]` +note: required by a bound in `RangeFrom` + --> $SRC_DIR/core/src/ops/range.rs:LL:COL | LL | pub struct RangeFrom<Idx> { - | --- required by this bound in `RangeFrom` - | - = help: the trait `Sized` is not implemented for `[{integer}]` + | ^^^ required by this bound in `RangeFrom` error: aborting due to 3 previous errors diff --git a/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.polonius.stderr b/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.polonius.stderr new file mode 100644 index 00000000000..4b4fc4fb7d1 --- /dev/null +++ b/src/test/ui/recursion/issue-38591-non-regular-dropck-recursion.polonius.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `std::ptr::drop_in_place::<S<fn(f...)))))))))))))))))))))))))))))>))` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | +LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `std::ptr::drop_in_place` defined here + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | +LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-38591-non-regular-dropck-recursion.polonius/issue-38591-non-regular-dropck-recursion.long-type.txt' + +error: aborting due to previous error + diff --git a/src/test/ui/recursion/recursion.polonius.stderr b/src/test/ui/recursion/recursion.polonius.stderr new file mode 100644 index 00000000000..c727fe551e3 --- /dev/null +++ b/src/test/ui/recursion/recursion.polonius.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/recursion.rs:18:11 + | +LL | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `test` defined here + --> $DIR/recursion.rs:16:1 + | +LL | fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/recursion.polonius/recursion.long-type.txt' + +error: aborting due to previous error + diff --git a/src/test/ui/recursion/recursive-requirements.stderr b/src/test/ui/recursion/recursive-requirements.stderr index 0518cc507b5..8ee154ce57b 100644 --- a/src/test/ui/recursion/recursive-requirements.stderr +++ b/src/test/ui/recursion/recursive-requirements.stderr @@ -1,9 +1,6 @@ error[E0277]: `*const Bar` cannot be shared between threads safely --> $DIR/recursive-requirements.rs:16:12 | -LL | struct AssertSync<T: Sync>(PhantomData<T>); - | ---- required by this bound in `AssertSync` -... LL | let _: AssertSync<Foo> = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Bar` cannot be shared between threads safely | @@ -13,13 +10,15 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ +note: required by a bound in `AssertSync` + --> $DIR/recursive-requirements.rs:3:22 + | +LL | struct AssertSync<T: Sync>(PhantomData<T>); + | ^^^^ required by this bound in `AssertSync` error[E0277]: `*const Foo` cannot be shared between threads safely --> $DIR/recursive-requirements.rs:16:12 | -LL | struct AssertSync<T: Sync>(PhantomData<T>); - | ---- required by this bound in `AssertSync` -... LL | let _: AssertSync<Foo> = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely | @@ -35,6 +34,11 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ +note: required by a bound in `AssertSync` + --> $DIR/recursive-requirements.rs:3:22 + | +LL | struct AssertSync<T: Sync>(PhantomData<T>); + | ^^^^ required by this bound in `AssertSync` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/issue-78262.default.stderr b/src/test/ui/regions/issue-78262.default.stderr index e97b8eca948..5250848a65c 100644 --- a/src/test/ui/regions/issue-78262.default.stderr +++ b/src/test/ui/regions/issue-78262.default.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types - --> $DIR/issue-78262.rs:12:28 + --> $DIR/issue-78262.rs:14:28 | LL | let f = |x: &dyn TT| x.func(); | ^^^^ lifetime mismatch | = note: expected reference `&(dyn TT + 'static)` found reference `&dyn TT` -note: the anonymous lifetime #1 defined on the body at 12:13... - --> $DIR/issue-78262.rs:12:13 +note: the anonymous lifetime #1 defined on the body at 14:13... + --> $DIR/issue-78262.rs:14:13 | LL | let f = |x: &dyn TT| x.func(); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/issue-78262.nll.stderr b/src/test/ui/regions/issue-78262.nll.stderr index fafff35e415..a35d6fd9bf8 100644 --- a/src/test/ui/regions/issue-78262.nll.stderr +++ b/src/test/ui/regions/issue-78262.nll.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of closure - --> $DIR/issue-78262.rs:12:26 + --> $DIR/issue-78262.rs:14:26 | LL | let f = |x: &dyn TT| x.func(); | - ^^^^^^^^ `x` escapes the closure body here diff --git a/src/test/ui/regions/issue-78262.polonius.stderr b/src/test/ui/regions/issue-78262.polonius.stderr new file mode 100644 index 00000000000..a35d6fd9bf8 --- /dev/null +++ b/src/test/ui/regions/issue-78262.polonius.stderr @@ -0,0 +1,11 @@ +error[E0521]: borrowed data escapes outside of closure + --> $DIR/issue-78262.rs:14:26 + | +LL | let f = |x: &dyn TT| x.func(); + | - ^^^^^^^^ `x` escapes the closure body here + | | + | `x` is a reference that is only valid in the closure body + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/regions/issue-78262.rs b/src/test/ui/regions/issue-78262.rs index 0bdb0abac30..b88ad678ee6 100644 --- a/src/test/ui/regions/issue-78262.rs +++ b/src/test/ui/regions/issue-78262.rs @@ -1,6 +1,8 @@ -// revisions: nll default +// revisions: default nll polonius // ignore-compare-mode-nll -//[nll]compile-flags: -Z borrowck=mir +// ignore-compare-mode-polonius +// [nll] compile-flags: -Z borrowck=mir +// [polonius] compile-flags: -Z borrowck=mir -Z polonius trait TT {} @@ -11,4 +13,5 @@ impl dyn TT { fn main() { let f = |x: &dyn TT| x.func(); //[default]~ ERROR: mismatched types //[nll]~^ ERROR: borrowed data escapes outside of closure + //[polonius]~^^ ERROR: borrowed data escapes outside of closure } diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr index 4ddea2c27b2..a64ad46ef46 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -27,17 +27,24 @@ LL | a(x, y); = note: mutable references are invariant over their type parameter = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` + found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` + found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr index a9cf128bb62..ce5e7d01723 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -27,23 +27,33 @@ LL | a(x, y, z); = note: mutable references are invariant over their type parameter = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` + found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` + found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` + found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr new file mode 100644 index 00000000000..13741664ef2 --- /dev/null +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr @@ -0,0 +1,82 @@ +error: lifetime may not live long enough + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5 + | +LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // Illegal now because there is no `'b:'a` declaration. +LL | *x = *y; + | ^^^^^^^ assignment requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` + +error: lifetime may not live long enough + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:5 + | +LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here +... +LL | *z = *y; + | ^^^^^^^ assignment requires that `'b` must outlive `'c` + | + = help: consider adding the following bound: `'b: 'c` + +help: add bound `'b: 'a + 'c` + +error: lifetime may not live long enough + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 + | +LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | a(x, y, z); + | ^^^^^^^^^^ argument requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` + = note: requirement occurs because of a mutable reference to &isize + = note: mutable references are invariant over their type parameter + = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance + +error: lifetime may not live long enough + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 + | +LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here +... +LL | a(x, y, z); + | ^^^^^^^^^^ argument requires that `'b` must outlive `'c` + | + = help: consider adding the following bound: `'b: 'c` + = note: requirement occurs because of a mutable reference to &isize + = note: mutable references are invariant over their type parameter + = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance + +help: add bound `'b: 'a + 'c` + +error: higher-ranked subtype error + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + | +LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + | +LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + | +LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr index d762f55f9d5..c2956cd8958 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr +++ b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr @@ -1,8 +1,12 @@ -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:5 | LL | want_G(baz); - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'cx> fn(&'cx S) -> &'static S` + found fn pointer `for<'r> fn(&'r S) -> &'r S` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr index db86572f1cf..cae692ad2f6 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr @@ -27,17 +27,24 @@ LL | a(x, y); = note: mutable references are invariant over their type parameter = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/regions-lifetime-bounds-on-fns.rs:20:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` + found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/regions-lifetime-bounds-on-fns.rs:20:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` + found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index e32d89fe6be..f8eaf61d7d7 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -8,12 +8,12 @@ LL | | "0".parse() LL | | } | |_^ `main` can only return types that implement `Termination` | - ::: $SRC_DIR/test/src/lib.rs:LL:COL - | -LL | pub fn assert_test_result<T: Termination>(result: T) { - | ----------- required by this bound in `assert_test_result` - | = help: the trait `Termination` is not implemented for `Result<f32, ParseFloatError>` +note: required by a bound in `assert_test_result` + --> $SRC_DIR/test/src/lib.rs:LL:COL + | +LL | pub fn assert_test_result<T: Termination>(result: T) { + | ^^^^^^^^^^^ required by this bound in `assert_test_result` = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr index f690d95cc58..ada29ba3f8b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr @@ -1,13 +1,15 @@ error[E0277]: cannot add `NonConstAdd` to `NonConstAdd` --> $DIR/assoc-type.rs:21:5 | -LL | type Bar: std::ops::Add; - | ------------- required by this bound in `Foo::Bar` -... LL | type Bar = NonConstAdd; | ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `NonConstAdd + NonConstAdd` | = help: the trait `Add` is not implemented for `NonConstAdd` +note: required by a bound in `Foo::Bar` + --> $DIR/assoc-type.rs:17:15 + | +LL | type Bar: std::ops::Add; + | ^^^^^^^^^^^^^ required by this bound in `Foo::Bar` help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement | LL | impl const Foo for NonConstAdd where NonConstAdd: Add { diff --git a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr index 75c7cab3621..7cc54e0129a 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr @@ -1,13 +1,15 @@ error[E0277]: can't compare `S` with `S` --> $DIR/call-generic-method-nonconst.rs:19:34 | -LL | const fn equals_self<T: PartialEq>(t: &T) -> bool { - | --------- required by this bound in `equals_self` -... LL | pub const EQ: bool = equals_self(&S); | ^^ no implementation for `S == S` | = help: the trait `PartialEq` is not implemented for `S` +note: required by a bound in `equals_self` + --> $DIR/call-generic-method-nonconst.rs:12:25 + | +LL | const fn equals_self<T: PartialEq>(t: &T) -> bool { + | ^^^^^^^^^ required by this bound in `equals_self` error: aborting due to previous error diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs new file mode 100644 index 00000000000..d5b1a9073ac --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs @@ -0,0 +1,18 @@ +// check-pass + +// This was an ICE, because the compiler ensures the +// function to be const when performing const checking, +// but functions marked with the attribute are not const +// *and* subject to const checking. + +#![feature(staged_api)] +#![feature(const_trait_impl)] +#![feature(const_fn_trait_bound)] +#![stable(since = "1", feature = "foo")] + +trait Tr { + #[default_method_body_is_const] + fn a() {} +} + +fn main() {} diff --git a/src/test/ui/rfc-2632-const-trait-impl/std-impl-gate.rs b/src/test/ui/rfc-2632-const-trait-impl/std-impl-gate.rs new file mode 100644 index 00000000000..c6975da7121 --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/std-impl-gate.rs @@ -0,0 +1,21 @@ +// This tests feature gates for const impls in the standard library. + +// revisions: stock gated +//[gated] run-pass + +#![cfg_attr(gated, feature(const_trait_impl, const_default_impls))] + +fn non_const_context() -> Vec<usize> { + Default::default() +} + +const fn const_context() -> Vec<usize> { + Default::default() + //[stock]~^ ERROR calls in constant functions are limited +} + +fn main() { + const VAL: Vec<usize> = const_context(); + + assert_eq!(VAL, non_const_context()); +} diff --git a/src/test/ui/rfc-2632-const-trait-impl/std-impl-gate.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/std-impl-gate.stock.stderr new file mode 100644 index 00000000000..55a0daaaec7 --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/std-impl-gate.stock.stderr @@ -0,0 +1,9 @@ +error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants + --> $DIR/std-impl-gate.rs:13:5 + | +LL | Default::default() + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/rfc1623-2.stderr b/src/test/ui/rfc1623-2.stderr index 8ed606cf905..65b9f68817a 100644 --- a/src/test/ui/rfc1623-2.stderr +++ b/src/test/ui/rfc1623-2.stderr @@ -9,7 +9,7 @@ LL | static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 = help: consider making the type lifetime-generic with a new `'a` lifetime | LL | static NON_ELIDABLE_FN: &for<'a> fn(&'a u8, &'a u8) -> &'a u8 = - | +++++++ ~~~~~~ ~~~~~~ ~~~ + | +++++++ ++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/rfc1623-2.rs:10:39 @@ -22,7 +22,7 @@ LL | &(non_elidable as fn(&u8, &u8) -> &u8); help: consider making the type lifetime-generic with a new `'a` lifetime | LL | &(non_elidable as for<'a> fn(&'a u8, &'a u8) -> &'a u8); - | +++++++ ~~~~~~ ~~~~~~ ~~~ + | +++++++ ++ ++ ++ error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc1623.nll.stderr b/src/test/ui/rfc1623.nll.stderr index a3d94679434..cc247bbcb11 100644 --- a/src/test/ui/rfc1623.nll.stderr +++ b/src/test/ui/rfc1623.nll.stderr @@ -19,7 +19,7 @@ LL | struct SomeStruct<'x, 'y, 'z: 'x> { = note: required because it appears within the type `&SomeStruct` = note: shared static variables must have a type that implements `Sync` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/rfc1623.rs:21:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { @@ -29,9 +29,12 @@ LL | | bar: &Bar { bools: &[true, true] }, LL | | f: &id, LL | | LL | | }; - | |_^ + | |_^ one type is more general than the other + | + = note: expected type `for<'r, 's> Fn<(&'r Foo<'s>,)>` + found type `Fn<(&Foo<'_>,)>` -error: higher-ranked subtype error +error[E0308]: mismatched types --> $DIR/rfc1623.rs:21:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { @@ -41,9 +44,12 @@ LL | | bar: &Bar { bools: &[true, true] }, LL | | f: &id, LL | | LL | | }; - | |_^ + | |_^ one type is more general than the other + | + = note: expected type `for<'r, 's> Fn<(&'r Foo<'s>,)>` + found type `Fn<(&Foo<'_>,)>` -error: higher-ranked subtype error +error: implementation of `FnOnce` is not general enough --> $DIR/rfc1623.rs:21:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { @@ -53,9 +59,12 @@ LL | | bar: &Bar { bools: &[true, true] }, LL | | f: &id, LL | | LL | | }; - | |_^ + | |_^ implementation of `FnOnce` is not general enough + | + = note: `fn(&'2 Foo<'_>) -> &'2 Foo<'_> {id::<&'2 Foo<'_>>}` must implement `FnOnce<(&'1 Foo<'_>,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 Foo<'_>,)>`, for some specific lifetime `'2` -error: higher-ranked subtype error +error: implementation of `FnOnce` is not general enough --> $DIR/rfc1623.rs:21:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { @@ -65,8 +74,12 @@ LL | | bar: &Bar { bools: &[true, true] }, LL | | f: &id, LL | | LL | | }; - | |_^ + | |_^ implementation of `FnOnce` is not general enough + | + = note: `fn(&Foo<'2>) -> &Foo<'2> {id::<&Foo<'2>>}` must implement `FnOnce<(&Foo<'1>,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&Foo<'2>,)>`, for some specific lifetime `'2` error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr b/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr index 4ed86b34a34..81c0c4a7875 100644 --- a/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr +++ b/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr @@ -1,80 +1,92 @@ error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:24:10 | -LL | fn call(f: impl Fn()) { - | ---- required by this bound in `call` -... LL | call(foo); | ^^^ expected an `Fn<()>` closure, found `fn() {foo}` | = help: the trait `Fn<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits +note: required by a bound in `call` + --> $DIR/fn-traits.rs:11:17 + | +LL | fn call(f: impl Fn()) { + | ^^^^ required by this bound in `call` error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:25:14 | -LL | fn call_mut(f: impl FnMut()) { - | ------- required by this bound in `call_mut` -... LL | call_mut(foo); | ^^^ expected an `FnMut<()>` closure, found `fn() {foo}` | = help: the trait `FnMut<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits +note: required by a bound in `call_mut` + --> $DIR/fn-traits.rs:15:21 + | +LL | fn call_mut(f: impl FnMut()) { + | ^^^^^^^ required by this bound in `call_mut` error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}` --> $DIR/fn-traits.rs:26:15 | -LL | fn call_once(f: impl FnOnce()) { - | -------- required by this bound in `call_once` -... LL | call_once(foo); | ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}` | = help: the trait `FnOnce<()>` is not implemented for `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits +note: required by a bound in `call_once` + --> $DIR/fn-traits.rs:19:22 + | +LL | fn call_once(f: impl FnOnce()) { + | ^^^^^^^^ required by this bound in `call_once` error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:28:10 | -LL | fn call(f: impl Fn()) { - | ---- required by this bound in `call` -... LL | call(foo_unsafe); | ^^^^^^^^^^ expected an `Fn<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits +note: required by a bound in `call` + --> $DIR/fn-traits.rs:11:17 + | +LL | fn call(f: impl Fn()) { + | ^^^^ required by this bound in `call` error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:30:14 | -LL | fn call_mut(f: impl FnMut()) { - | ------- required by this bound in `call_mut` -... LL | call_mut(foo_unsafe); | ^^^^^^^^^^ expected an `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits +note: required by a bound in `call_mut` + --> $DIR/fn-traits.rs:15:21 + | +LL | fn call_mut(f: impl FnMut()) { + | ^^^^^^^ required by this bound in `call_mut` error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` --> $DIR/fn-traits.rs:32:15 | -LL | fn call_once(f: impl FnOnce()) { - | -------- required by this bound in `call_once` -... LL | call_once(foo_unsafe); | ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}` | = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits +note: required by a bound in `call_once` + --> $DIR/fn-traits.rs:19:22 + | +LL | fn call_once(f: impl FnOnce()) { + | ^^^^^^^^ required by this bound in `call_once` error: aborting due to 6 previous errors diff --git a/src/test/ui/rustdoc/doc-test-attr-pass.rs b/src/test/ui/rustdoc/doc-test-attr-pass.rs new file mode 100644 index 00000000000..7884addd15f --- /dev/null +++ b/src/test/ui/rustdoc/doc-test-attr-pass.rs @@ -0,0 +1,9 @@ +// check-pass + +#![crate_type = "lib"] +#![deny(invalid_doc_attributes)] +#![doc(test(no_crate_inject))] +#![doc(test(attr(deny(warnings))))] +#![doc(test())] + +pub fn foo() {} diff --git a/src/test/ui/rustdoc/doc-test-attr.rs b/src/test/ui/rustdoc/doc-test-attr.rs new file mode 100644 index 00000000000..46178ad865a --- /dev/null +++ b/src/test/ui/rustdoc/doc-test-attr.rs @@ -0,0 +1,14 @@ +#![crate_type = "lib"] +#![deny(invalid_doc_attributes)] + +#![doc(test)] +//~^ ERROR `#[doc(test(...)]` takes a list of attributes +//~^^ WARN this was previously accepted by the compiler +#![doc(test = "hello")] +//~^ ERROR `#[doc(test(...)]` takes a list of attributes +//~^^ WARN this was previously accepted by the compiler +#![doc(test(a))] +//~^ ERROR unknown `doc(test)` attribute `a` +//~^^ WARN this was previously accepted by the compiler + +pub fn foo() {} diff --git a/src/test/ui/rustdoc/doc-test-attr.stderr b/src/test/ui/rustdoc/doc-test-attr.stderr new file mode 100644 index 00000000000..7f5e2d6bc70 --- /dev/null +++ b/src/test/ui/rustdoc/doc-test-attr.stderr @@ -0,0 +1,34 @@ +error: `#[doc(test(...)]` takes a list of attributes + --> $DIR/doc-test-attr.rs:4:8 + | +LL | #![doc(test)] + | ^^^^ + | +note: the lint level is defined here + --> $DIR/doc-test-attr.rs:2:9 + | +LL | #![deny(invalid_doc_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + +error: `#[doc(test(...)]` takes a list of attributes + --> $DIR/doc-test-attr.rs:7:8 + | +LL | #![doc(test = "hello")] + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + +error: unknown `doc(test)` attribute `a` + --> $DIR/doc-test-attr.rs:10:13 + | +LL | #![doc(test(a))] + | ^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/rustdoc/feature-gate-doc_primitive.rs b/src/test/ui/rustdoc/feature-gate-doc_primitive.rs new file mode 100644 index 00000000000..18e99e72f8b --- /dev/null +++ b/src/test/ui/rustdoc/feature-gate-doc_primitive.rs @@ -0,0 +1,8 @@ +// check-pass +#[doc(primitive = "usize")] +//~^ WARNING `doc(primitive)` should never have been stable +//~| WARNING hard error in a future release +/// Some docs +mod usize {} + +fn main() {} diff --git a/src/test/ui/rustdoc/feature-gate-doc_primitive.stderr b/src/test/ui/rustdoc/feature-gate-doc_primitive.stderr new file mode 100644 index 00000000000..736bf29c580 --- /dev/null +++ b/src/test/ui/rustdoc/feature-gate-doc_primitive.stderr @@ -0,0 +1,12 @@ +warning: `doc(primitive)` should never have been stable + --> $DIR/feature-gate-doc_primitive.rs:2:7 + | +LL | #[doc(primitive = "usize")] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(invalid_doc_attributes)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> + +warning: 1 warning emitted + diff --git a/src/test/ui/specialization/deafult-associated-type-bound-1.stderr b/src/test/ui/specialization/deafult-associated-type-bound-1.stderr index 4ca3d831198..b3dba0d552a 100644 --- a/src/test/ui/specialization/deafult-associated-type-bound-1.stderr +++ b/src/test/ui/specialization/deafult-associated-type-bound-1.stderr @@ -11,11 +11,14 @@ LL | #![feature(specialization)] error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/deafult-associated-type-bound-1.rs:19:5 | -LL | type U: Clone; - | ----- required by this bound in `X::U` -... LL | default type U = str; | ^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | +note: required by a bound in `X::U` + --> $DIR/deafult-associated-type-bound-1.rs:9:13 + | +LL | type U: Clone; + | ^^^^^ required by this bound in `X::U` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/specialization/deafult-associated-type-bound-2.stderr b/src/test/ui/specialization/deafult-associated-type-bound-2.stderr index 8d110d50e28..d425fae6dc3 100644 --- a/src/test/ui/specialization/deafult-associated-type-bound-2.stderr +++ b/src/test/ui/specialization/deafult-associated-type-bound-2.stderr @@ -11,13 +11,15 @@ LL | #![feature(specialization)] error[E0277]: can't compare `&'static B` with `B` --> $DIR/deafult-associated-type-bound-2.rs:16:5 | -LL | type U: PartialEq<T>; - | ------------ required by this bound in `X::U` -... LL | default type U = &'static B; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `&'static B == B` | = help: the trait `PartialEq<B>` is not implemented for `&'static B` +note: required by a bound in `X::U` + --> $DIR/deafult-associated-type-bound-2.rs:6:13 + | +LL | type U: PartialEq<T>; + | ^^^^^^^^^^^^ required by this bound in `X::U` help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement | LL | impl<B: 'static, T> X<B> for T where &'static B: PartialEq<B> { diff --git a/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr b/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr index ff56c77c8f8..8cfce7feffc 100644 --- a/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr +++ b/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr @@ -11,13 +11,15 @@ LL | #![feature(specialization)] error[E0277]: can't compare `T` with `T` --> $DIR/deafult-generic-associated-type-bound.rs:18:5 | -LL | type U<'a>: PartialEq<&'a Self> where Self: 'a; - | ------------------- required by this bound in `X::U` -... LL | default type U<'a> = &'a T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T == T` | = note: required because of the requirements on the impl of `PartialEq` for `&'a T` +note: required by a bound in `X::U` + --> $DIR/deafult-generic-associated-type-bound.rs:8:17 + | +LL | type U<'a>: PartialEq<&'a Self> where Self: 'a; + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `X::U` help: consider further restricting this bound | LL | impl<T: 'static + std::cmp::PartialEq> X for T { diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr index a8f6cf68399..a8fdbc52884 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -11,12 +11,14 @@ LL | #![feature(specialization)] error[E0277]: the trait bound `U: Eq` is not satisfied --> $DIR/specialization-wfcheck.rs:7:17 | -LL | trait Foo<'a, T: Eq + 'a> { } - | -- required by this bound in `Foo` -LL | LL | default impl<U> Foo<'static, U> for () {} | ^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `U` | +note: required by a bound in `Foo` + --> $DIR/specialization-wfcheck.rs:5:18 + | +LL | trait Foo<'a, T: Eq + 'a> { } + | ^^ required by this bound in `Foo` help: consider restricting type parameter `U` | LL | default impl<U: std::cmp::Eq> Foo<'static, U> for () {} diff --git a/src/test/ui/specialization/issue-33017.stderr b/src/test/ui/specialization/issue-33017.stderr index 0d4976c665d..44e7581f5ca 100644 --- a/src/test/ui/specialization/issue-33017.stderr +++ b/src/test/ui/specialization/issue-33017.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/issue-33017.rs:12:5 | -LL | type Output: From<Self> + Copy + Into<Self>; - | ---- required by this bound in `UncheckedCopy::Output` -... LL | default type Output = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/issue-33017.rs:8:31 + | +LL | type Output: From<Self> + Copy + Into<Self>; + | ^^^^ required by this bound in `UncheckedCopy::Output` help: consider restricting type parameter `T` | LL | impl<T: std::marker::Copy> UncheckedCopy for T { diff --git a/src/test/ui/specialization/issue-38091.stderr b/src/test/ui/specialization/issue-38091.stderr index 97e5775ab54..d5452e1d513 100644 --- a/src/test/ui/specialization/issue-38091.stderr +++ b/src/test/ui/specialization/issue-38091.stderr @@ -11,11 +11,14 @@ LL | #![feature(specialization)] error[E0277]: the trait bound `(): Valid` is not satisfied --> $DIR/issue-38091.rs:12:5 | -LL | type Ty: Valid; - | ----- required by this bound in `Iterate::Ty` -... LL | default type Ty = (); | ^^^^^^^^^^^^^^^^^^^^^ the trait `Valid` is not implemented for `()` + | +note: required by a bound in `Iterate::Ty` + --> $DIR/issue-38091.rs:5:14 + | +LL | type Ty: Valid; + | ^^^^^ required by this bound in `Iterate::Ty` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/specialization/issue-44861.stderr b/src/test/ui/specialization/issue-44861.stderr index 3935a4a5f99..114504b0439 100644 --- a/src/test/ui/specialization/issue-44861.stderr +++ b/src/test/ui/specialization/issue-44861.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `(): CoerceUnsized<*const [u8]>` is not satisfied --> $DIR/issue-44861.rs:21:5 | -LL | type Data2: CoerceUnsized<*const [u8]>; - | -------------------------- required by this bound in `Smartass::Data2` -... LL | default type Data2 = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `CoerceUnsized<*const [u8]>` is not implemented for `()` + | +note: required by a bound in `Smartass::Data2` + --> $DIR/issue-44861.rs:12:17 + | +LL | type Data2: CoerceUnsized<*const [u8]>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Smartass::Data2` error: aborting due to previous error diff --git a/src/test/ui/specialization/issue-59435.stderr b/src/test/ui/specialization/issue-59435.stderr index f3f8b022b01..606d22ed07b 100644 --- a/src/test/ui/specialization/issue-59435.stderr +++ b/src/test/ui/specialization/issue-59435.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `MyStruct: Default` is not satisfied --> $DIR/issue-59435.rs:11:5 | -LL | type MyType: Default; - | ------- required by this bound in `MyTrait::MyType` -... LL | default type MyType = MyStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `MyStruct` + | +note: required by a bound in `MyTrait::MyType` + --> $DIR/issue-59435.rs:7:18 + | +LL | type MyType: Default; + | ^^^^^^^ required by this bound in `MyTrait::MyType` error: aborting due to previous error diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index 567f5d8e1e7..3e49c8394ab 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -1,13 +1,15 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/str-mut-idx.rs:4:15 | -LL | fn bot<T>() -> T { loop {} } - | - required by this bound in `bot` -... LL | s[1..2] = bot(); | ^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` +note: required by a bound in `bot` + --> $DIR/str-mut-idx.rs:1:8 + | +LL | fn bot<T>() -> T { loop {} } + | ^ required by this bound in `bot` help: consider relaxing the implicit `Sized` restriction | LL | fn bot<T: ?Sized>() -> T { loop {} } diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr index 10abdfc333a..97caa833d2f 100644 --- a/src/test/ui/substs-ppaux.normal.stderr +++ b/src/test/ui/substs-ppaux.normal.stderr @@ -73,9 +73,6 @@ LL | let x: () = foo::<'static>(); error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/substs-ppaux.rs:49:5 | -LL | fn bar<'a, T>() where T: 'a {} - | -- required by this bound in `Foo::bar` -... LL | <str as Foo<u8>>::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | @@ -85,6 +82,11 @@ note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ +note: required by a bound in `Foo::bar` + --> $DIR/substs-ppaux.rs:7:30 + | +LL | fn bar<'a, T>() where T: 'a {} + | ^^ required by this bound in `Foo::bar` error: aborting due to 5 previous errors diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr index 136e269b210..5829073c265 100644 --- a/src/test/ui/substs-ppaux.verbose.stderr +++ b/src/test/ui/substs-ppaux.verbose.stderr @@ -73,9 +73,6 @@ LL | let x: () = foo::<'static>(); error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/substs-ppaux.rs:49:5 | -LL | fn bar<'a, T>() where T: 'a {} - | -- required by this bound in `Foo::bar` -... LL | <str as Foo<u8>>::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | @@ -85,6 +82,11 @@ note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8> | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ +note: required by a bound in `Foo::bar` + --> $DIR/substs-ppaux.rs:7:30 + | +LL | fn bar<'a, T>() where T: 'a {} + | ^^ required by this bound in `Foo::bar` error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index c64205411bb..fb40c260e2d 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -3,10 +3,12 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation | LL | fn func1() -> Struct1<Self>; | ^^^^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | struct Struct1<T>{ - | - required by this bound in `Struct1` | +note: required by a bound in `Struct1` + --> $DIR/adt-param-with-implicit-sized-bound.rs:8:16 + | +LL | struct Struct1<T>{ + | ^ required by this bound in `Struct1` help: consider further restricting `Self` | LL | fn func1() -> Struct1<Self> where Self: Sized; @@ -21,10 +23,12 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation | LL | fn func2<'a>() -> Struct2<'a, Self>; | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | struct Struct2<'a, T>{ - | - required by this bound in `Struct2` | +note: required by a bound in `Struct2` + --> $DIR/adt-param-with-implicit-sized-bound.rs:11:20 + | +LL | struct Struct2<'a, T>{ + | ^ required by this bound in `Struct2` help: consider further restricting `Self` | LL | fn func2<'a>() -> Struct2<'a, Self> where Self: Sized; @@ -39,10 +43,12 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation | LL | fn func3() -> Struct3<Self>; | ^^^^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | struct Struct3<T>{ - | - required by this bound in `Struct3` | +note: required by a bound in `Struct3` + --> $DIR/adt-param-with-implicit-sized-bound.rs:14:16 + | +LL | struct Struct3<T>{ + | ^ required by this bound in `Struct3` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` --> $DIR/adt-param-with-implicit-sized-bound.rs:14:16 | @@ -60,10 +66,12 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation | LL | fn func4() -> Struct4<Self>; | ^^^^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | struct Struct4<T>{ - | - required by this bound in `Struct4` | +note: required by a bound in `Struct4` + --> $DIR/adt-param-with-implicit-sized-bound.rs:20:16 + | +LL | struct Struct4<T>{ + | ^ required by this bound in `Struct4` help: consider further restricting `Self` | LL | fn func4() -> Struct4<Self> where Self: Sized; @@ -76,14 +84,16 @@ LL | struct Struct4<T: ?Sized>{ error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/adt-param-with-implicit-sized-bound.rs:25:9 | -LL | struct X<T>(T); - | - required by this bound in `X` -... LL | struct Struct5<T: ?Sized>{ | - this type parameter needs to be `std::marker::Sized` LL | _t: X<T>, | ^^^^ doesn't have a size known at compile-time | +note: required by a bound in `X` + --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 + | +LL | struct X<T>(T); + | ^ required by this bound in `X` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 | diff --git a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index 81c9b0378e7..300c2a66c29 100644 --- a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -3,14 +3,16 @@ error[E0277]: `fn() -> impl Future {foo}` is not a future | LL | async fn foo() {} | --- consider calling this function -LL | -LL | fn bar(f: impl Future<Output=()>) {} - | ----------------- required by this bound in `bar` ... LL | bar(foo); | ^^^ `fn() -> impl Future {foo}` is not a future | = help: the trait `Future` is not implemented for `fn() -> impl Future {foo}` +note: required by a bound in `bar` + --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 + | +LL | fn bar(f: impl Future<Output=()>) {} + | ^^^^^^^^^^^^^^^^^ required by this bound in `bar` help: use parentheses to call the function | LL | bar(foo()); @@ -19,15 +21,17 @@ LL | bar(foo()); error[E0277]: `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` is not a future --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9 | -LL | fn bar(f: impl Future<Output=()>) {} - | ----------------- required by this bound in `bar` -... LL | let async_closure = async || (); | -------- consider calling this closure LL | bar(async_closure); | ^^^^^^^^^^^^^ `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` is not a future | = help: the trait `Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` +note: required by a bound in `bar` + --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 + | +LL | fn bar(f: impl Future<Output=()>) {} + | ^^^^^^^^^^^^^^^^^ required by this bound in `bar` help: use parentheses to call the closure | LL | bar(async_closure()); diff --git a/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index 1916fe54cc5..93048107e59 100644 --- a/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -3,13 +3,15 @@ error[E0277]: the trait bound `fn() -> impl T {foo}: T` is not satisfied | LL | fn foo() -> impl T<O=()> { S } | --- consider calling this function -LL | -LL | fn bar(f: impl T<O=()>) {} - | ------- required by this bound in `bar` ... LL | bar(foo); | ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}` | +note: required by a bound in `bar` + --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16 + | +LL | fn bar(f: impl T<O=()>) {} + | ^^^^^^^ required by this bound in `bar` help: use parentheses to call the function | LL | bar(foo()); @@ -18,14 +20,16 @@ LL | bar(foo()); error[E0277]: the trait bound `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:23]: T` is not satisfied --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9 | -LL | fn bar(f: impl T<O=()>) {} - | ------- required by this bound in `bar` -... LL | let closure = || S; | -- consider calling this closure LL | bar(closure); | ^^^^^^^ the trait `T` is not implemented for `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:23]` | +note: required by a bound in `bar` + --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16 + | +LL | fn bar(f: impl T<O=()>) {} + | ^^^^^^^ required by this bound in `bar` help: use parentheses to call the closure | LL | bar(closure()); diff --git a/src/test/ui/suggestions/fn-missing-lifetime-in-item.stderr b/src/test/ui/suggestions/fn-missing-lifetime-in-item.stderr index 20468cef20b..7c0f8d199a9 100644 --- a/src/test/ui/suggestions/fn-missing-lifetime-in-item.stderr +++ b/src/test/ui/suggestions/fn-missing-lifetime-in-item.stderr @@ -25,11 +25,11 @@ LL | struct S2<F: Fn(&i32, &i32) -> &i32>(F); help: consider making the bound lifetime-generic with a new `'a` lifetime | LL | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F); - | +++++++ ~~~~~~~ ~~~~~~~ ~~~ + | +++++++ ++ ++ ++ help: consider introducing a named lifetime parameter | LL | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F); - | +++ ~~~~~~~ ~~~~~~~ ~~~ + | +++ ++ ++ ++ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types --> $DIR/fn-missing-lifetime-in-item.rs:3:40 diff --git a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr index 83de3c4cfe0..64a62524653 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr +++ b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -1,17 +1,19 @@ error[E0277]: the trait bound `for<'b> &'b S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:17:5 | -LL | fn foo<X>(_: X) - | --- required by a bound in this -LL | where -LL | for<'b> &'b X: Trait, - | ----- required by this bound in `foo` -... LL | foo::<S>(s); | ^^^^^^^^ the trait `for<'b> Trait` is not implemented for `&'b S` | = help: the following implementations were found: <&'a mut S as Trait> +note: required by a bound in `foo` + --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:11:20 + | +LL | fn foo<X>(_: X) + | --- required by a bound in this +LL | where +LL | for<'b> &'b X: Trait, + | ^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr b/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr index a12b6bd2128..39bde52c55a 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `&S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:12:7 | -LL | fn foo<X: Trait>(_: X) {} - | ----- required by this bound in `foo` -... LL | foo(&s); | ^^ the trait `Trait` is not implemented for `&S` | = help: the following implementations were found: <&'a mut S as Trait> +note: required by a bound in `foo` + --> $DIR/imm-ref-trait-object-literal.rs:7:11 + | +LL | fn foo<X: Trait>(_: X) {} + | ^^^^^ required by this bound in `foo` help: consider changing this borrow's mutability | LL | foo(&mut s); @@ -17,14 +19,17 @@ LL | foo(&mut s); error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 | -LL | fn foo<X: Trait>(_: X) {} - | ----- required by this bound in `foo` -... LL | foo(s); | ^ | | | expected an implementor of trait `Trait` | help: consider mutably borrowing here: `&mut s` + | +note: required by a bound in `foo` + --> $DIR/imm-ref-trait-object-literal.rs:7:11 + | +LL | fn foo<X: Trait>(_: X) {} + | ^^^^^ required by this bound in `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr b/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr index 7d8a34ed018..1cde42ff2cb 100644 --- a/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr +++ b/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr @@ -3,11 +3,13 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` | LL | qux(constraint); | ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` -... -LL | fn qux(_: impl std::fmt::Debug) {} - | --------------- required by this bound in `qux` | = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` +note: required by a bound in `qux` + --> $DIR/impl-trait-with-missing-bounds.rs:50:16 + | +LL | fn qux(_: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | fn foo<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { @@ -18,11 +20,13 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` | LL | qux(constraint); | ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` -... -LL | fn qux(_: impl std::fmt::Debug) {} - | --------------- required by this bound in `qux` | = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` +note: required by a bound in `qux` + --> $DIR/impl-trait-with-missing-bounds.rs:50:16 + | +LL | fn qux(_: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | fn bar<T, I: Iterator>(t: T, constraints: I) where T: std::fmt::Debug, <I as Iterator>::Item: Debug { @@ -33,11 +37,13 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` | LL | qux(constraint); | ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` -... -LL | fn qux(_: impl std::fmt::Debug) {} - | --------------- required by this bound in `qux` | = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` +note: required by a bound in `qux` + --> $DIR/impl-trait-with-missing-bounds.rs:50:16 + | +LL | fn qux(_: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | fn baz<I: Iterator>(t: impl std::fmt::Debug, constraints: I) where <I as Iterator>::Item: Debug { @@ -48,11 +54,13 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` | LL | qux(constraint); | ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` -... -LL | fn qux(_: impl std::fmt::Debug) {} - | --------------- required by this bound in `qux` | = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` +note: required by a bound in `qux` + --> $DIR/impl-trait-with-missing-bounds.rs:50:16 + | +LL | fn qux(_: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | fn bat<I, T: std::fmt::Debug, U: Iterator>(t: T, constraints: U, _: I) where <U as Iterator>::Item: Debug { @@ -63,11 +71,13 @@ error[E0277]: `<impl Iterator + std::fmt::Debug as Iterator>::Item` doesn't impl | LL | qux(constraint); | ^^^^^^^^^^ `<impl Iterator + std::fmt::Debug as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` -... -LL | fn qux(_: impl std::fmt::Debug) {} - | --------------- required by this bound in `qux` | = help: the trait `Debug` is not implemented for `<impl Iterator + std::fmt::Debug as Iterator>::Item` +note: required by a bound in `qux` + --> $DIR/impl-trait-with-missing-bounds.rs:50:16 + | +LL | fn qux(_: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | fn bak<I: Iterator + std::fmt::Debug>(constraints: I) where <I as Iterator>::Item: Debug { @@ -78,11 +88,13 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` | LL | qux(constraint); | ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` -... -LL | fn qux(_: impl std::fmt::Debug) {} - | --------------- required by this bound in `qux` | = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` +note: required by a bound in `qux` + --> $DIR/impl-trait-with-missing-bounds.rs:50:16 + | +LL | fn qux(_: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | fn baw<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { diff --git a/src/test/ui/suggestions/into-str.stderr b/src/test/ui/suggestions/into-str.stderr index 26efd50bb8f..263d509075a 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `&str: From<String>` is not satisfied --> $DIR/into-str.rs:4:5 | -LL | fn foo<'a, T>(_t: T) where T: Into<&'a str> {} - | ------------- required by this bound in `foo` -... LL | foo(String::new()); | ^^^ the trait `From<String>` is not implemented for `&str` | = note: to coerce a `String` into a `&str`, use `&*` as a prefix = note: required because of the requirements on the impl of `Into<&str>` for `String` +note: required by a bound in `foo` + --> $DIR/into-str.rs:1:31 + | +LL | fn foo<'a, T>(_t: T) where T: Into<&'a str> {} + | ^^^^^^^^^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr b/src/test/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr index be91eb876d0..cd1a8c4be8e 100644 --- a/src/test/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr +++ b/src/test/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr @@ -3,11 +3,13 @@ error[E0277]: `<impl Foo as Foo>::Bar` cannot be sent between threads safely | LL | assert_is_send(&bar); | ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely -... -LL | fn assert_is_send<T: Send>(_: &T) {} - | ---- required by this bound in `assert_is_send` | = help: the trait `Send` is not implemented for `<impl Foo as Foo>::Bar` +note: required by a bound in `assert_is_send` + --> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:30:22 + | +LL | fn assert_is_send<T: Send>(_: &T) {} + | ^^^^ required by this bound in `assert_is_send` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | async fn run<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { @@ -18,11 +20,13 @@ error[E0277]: `<impl Foo as Foo>::Bar` cannot be sent between threads safely | LL | assert_is_send(&bar); | ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely -... -LL | fn assert_is_send<T: Send>(_: &T) {} - | ---- required by this bound in `assert_is_send` | = help: the trait `Send` is not implemented for `<impl Foo as Foo>::Bar` +note: required by a bound in `assert_is_send` + --> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:30:22 + | +LL | fn assert_is_send<T: Send>(_: &T) {} + | ^^^^ required by this bound in `assert_is_send` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | async fn run2<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { diff --git a/src/test/ui/suggestions/issue-84592.stderr b/src/test/ui/suggestions/issue-84592.stderr index fe301e41277..70c96feb1de 100644 --- a/src/test/ui/suggestions/issue-84592.stderr +++ b/src/test/ui/suggestions/issue-84592.stderr @@ -10,7 +10,7 @@ LL | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> { help: consider introducing a named lifetime parameter | LL | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> { - | ++++ ~~~~~~ ~~~~~~ ~~ ~~ + | ++++ ++ ++ ~~ ~~ error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-84973-2.stderr b/src/test/ui/suggestions/issue-84973-2.stderr index b6ed437b5ee..df1eeb7a2b8 100644 --- a/src/test/ui/suggestions/issue-84973-2.stderr +++ b/src/test/ui/suggestions/issue-84973-2.stderr @@ -1,14 +1,17 @@ error[E0277]: the trait bound `i32: Tr` is not satisfied --> $DIR/issue-84973-2.rs:11:9 | -LL | fn foo<T: Tr>(i: T) {} - | -- required by this bound in `foo` -... LL | foo(a); | ^ | | | expected an implementor of trait `Tr` | help: consider mutably borrowing here: `&mut a` + | +note: required by a bound in `foo` + --> $DIR/issue-84973-2.rs:7:11 + | +LL | fn foo<T: Tr>(i: T) {} + | ^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-84973-blacklist.stderr b/src/test/ui/suggestions/issue-84973-blacklist.stderr index f1e6ef883ae..2ffe2f5a2b6 100644 --- a/src/test/ui/suggestions/issue-84973-blacklist.stderr +++ b/src/test/ui/suggestions/issue-84973-blacklist.stderr @@ -1,53 +1,65 @@ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/issue-84973-blacklist.rs:15:12 | -LL | fn f_copy<T: Copy>(t: T) {} - | ---- required by this bound in `f_copy` -... LL | f_copy("".to_string()); | ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `f_copy` + --> $DIR/issue-84973-blacklist.rs:6:14 + | +LL | fn f_copy<T: Copy>(t: T) {} + | ^^^^ required by this bound in `f_copy` error[E0277]: the trait bound `S: Clone` is not satisfied --> $DIR/issue-84973-blacklist.rs:16:13 | -LL | fn f_clone<T: Clone>(t: T) {} - | ----- required by this bound in `f_clone` -... LL | f_clone(S); | ^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `f_clone` + --> $DIR/issue-84973-blacklist.rs:7:15 + | +LL | fn f_clone<T: Clone>(t: T) {} + | ^^^^^ required by this bound in `f_clone` error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:33]` cannot be unpinned --> $DIR/issue-84973-blacklist.rs:17:5 | -LL | fn f_unpin<T: Unpin>(t: T) {} - | ----- required by this bound in `f_unpin` -... LL | f_unpin(static || { yield; }); | ^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:33]` | = note: consider using `Box::pin` +note: required by a bound in `f_unpin` + --> $DIR/issue-84973-blacklist.rs:8: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 | -LL | fn f_sized<T: Sized>(t: T) {} - | - required by this bound in `f_sized` -... LL | f_sized(*ref_cl); | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Fn()` +note: required by a bound in `f_sized` + --> $DIR/issue-84973-blacklist.rs:9:12 + | +LL | fn f_sized<T: Sized>(t: T) {} + | ^ required by this bound in `f_sized` error[E0277]: `Rc<{integer}>` cannot be sent between threads safely --> $DIR/issue-84973-blacklist.rs:28:12 | -LL | fn f_send<T: Send>(t: T) {} - | ---- required by this bound in `f_send` -... LL | f_send(rc); | ^^ `Rc<{integer}>` cannot be sent between threads safely | = 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 + | +LL | fn f_send<T: Send>(t: T) {} + | ^^^^ required by this bound in `f_send` error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilation time --> $DIR/issue-84973-blacklist.rs:22:5 diff --git a/src/test/ui/suggestions/issue-84973-negative.stderr b/src/test/ui/suggestions/issue-84973-negative.stderr index 94513eca0bf..bd1cf6ba614 100644 --- a/src/test/ui/suggestions/issue-84973-negative.stderr +++ b/src/test/ui/suggestions/issue-84973-negative.stderr @@ -1,23 +1,29 @@ error[E0277]: the trait bound `i32: Tr` is not satisfied --> $DIR/issue-84973-negative.rs:10:9 | -LL | fn bar<T: Tr>(t: T) {} - | -- required by this bound in `bar` -... LL | bar(a); | ^ the trait `Tr` is not implemented for `i32` + | +note: required by a bound in `bar` + --> $DIR/issue-84973-negative.rs:5:11 + | +LL | fn bar<T: Tr>(t: T) {} + | ^^ required by this bound in `bar` error[E0277]: the trait bound `f32: Tr` is not satisfied --> $DIR/issue-84973-negative.rs:11:9 | -LL | fn bar<T: Tr>(t: T) {} - | -- required by this bound in `bar` -... LL | bar(b); | ^ | | | expected an implementor of trait `Tr` | help: consider borrowing here: `&b` + | +note: required by a bound in `bar` + --> $DIR/issue-84973-negative.rs:5:11 + | +LL | fn bar<T: Tr>(t: T) {} + | ^^ required by this bound in `bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.stderr b/src/test/ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.stderr index 735aeb0e0e7..752533cdc12 100644 --- a/src/test/ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.stderr +++ b/src/test/ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.stderr @@ -1,12 +1,15 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs:5:10 | -LL | struct A<T>(T) where T: Send; - | - required by this bound in `A` LL | struct B(A<[u8]>); | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `A` + --> $DIR/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs:4:10 + | +LL | struct A<T>(T) where T: Send; + | ^ required by this bound in `A` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` --> $DIR/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs:4:10 | diff --git a/src/test/ui/suggestions/issue-86667.stderr b/src/test/ui/suggestions/issue-86667.stderr index c1319165a70..14dbbfffb0e 100644 --- a/src/test/ui/suggestions/issue-86667.stderr +++ b/src/test/ui/suggestions/issue-86667.stderr @@ -8,7 +8,7 @@ LL | async fn a(s1: &str, s2: &str) -> &str { help: consider introducing a named lifetime parameter | LL | async fn a<'a>(s1: &'a str, s2: &'a str) -> &'a str { - | ++++ ~~~~~~~ ~~~~~~~ ~~~ + | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/issue-86667.rs:11:29 @@ -20,7 +20,7 @@ LL | fn b(s1: &str, s2: &str) -> &str { help: consider introducing a named lifetime parameter | LL | fn b<'a>(s1: &'a str, s2: &'a str) -> &'a str { - | ++++ ~~~~~~~ ~~~~~~~ ~~~ + | ++++ ++ ++ ++ error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/missing-lt-for-hrtb.stderr b/src/test/ui/suggestions/missing-lt-for-hrtb.stderr index b1caaea9aed..33f9d092e6e 100644 --- a/src/test/ui/suggestions/missing-lt-for-hrtb.stderr +++ b/src/test/ui/suggestions/missing-lt-for-hrtb.stderr @@ -47,7 +47,7 @@ LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &X); help: consider using one of the available lifetimes here | LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &'lifetime X); - | ~~~~~~~~~~ + | +++++++++ error[E0106]: missing lifetime specifier --> $DIR/missing-lt-for-hrtb.rs:5:41 diff --git a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr index 07fdffd8bed..3b71d5cee93 100644 --- a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr +++ b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr @@ -17,12 +17,12 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis LL | let fp = BufWriter::new(fp); | ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write` | - ::: $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL + = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` +note: required by a bound in `BufWriter` + --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL | LL | pub struct BufWriter<W: Write> { - | ----- required by this bound in `BufWriter` - | - = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` + | ^^^^^ required by this bound in `BufWriter` error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn std::io::Write>`, but its trait bounds were not satisfied --> $DIR/mut-borrow-needed-by-trait.rs:21:5 diff --git a/src/test/ui/suggestions/restrict-type-argument.stderr b/src/test/ui/suggestions/restrict-type-argument.stderr index 95a0cb192f3..b62502fb6a2 100644 --- a/src/test/ui/suggestions/restrict-type-argument.stderr +++ b/src/test/ui/suggestions/restrict-type-argument.stderr @@ -1,12 +1,14 @@ error[E0277]: `impl Sync` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:4:13 | -LL | fn is_send<T: Send>(val: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(val); | ^^^ `impl Sync` cannot be sent between threads safely | +note: required by a bound in `is_send` + --> $DIR/restrict-type-argument.rs:1:15 + | +LL | fn is_send<T: Send>(val: T) {} + | ^^^^ required by this bound in `is_send` help: consider further restricting this bound | LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { @@ -15,12 +17,14 @@ LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:8:13 | -LL | fn is_send<T: Send>(val: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | +note: required by a bound in `is_send` + --> $DIR/restrict-type-argument.rs:1:15 + | +LL | fn is_send<T: Send>(val: T) {} + | ^^^^ required by this bound in `is_send` help: consider further restricting this bound | LL | fn use_where<S>(val: S) where S: Sync + std::marker::Send { @@ -29,12 +33,14 @@ LL | fn use_where<S>(val: S) where S: Sync + std::marker::Send { error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:12:13 | -LL | fn is_send<T: Send>(val: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | +note: required by a bound in `is_send` + --> $DIR/restrict-type-argument.rs:1:15 + | +LL | fn is_send<T: Send>(val: T) {} + | ^^^^ required by this bound in `is_send` help: consider further restricting this bound | LL | fn use_bound<S: Sync + std::marker::Send>(val: S) { @@ -43,12 +49,14 @@ LL | fn use_bound<S: Sync + std::marker::Send>(val: S) { error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:20:13 | -LL | fn is_send<T: Send>(val: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | +note: required by a bound in `is_send` + --> $DIR/restrict-type-argument.rs:1:15 + | +LL | fn is_send<T: Send>(val: T) {} + | ^^^^ required by this bound in `is_send` help: consider further restricting this bound | LL | Sync + std::marker::Send @@ -57,12 +65,14 @@ LL | Sync + std::marker::Send error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:24:13 | -LL | fn is_send<T: Send>(val: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | +note: required by a bound in `is_send` + --> $DIR/restrict-type-argument.rs:1:15 + | +LL | fn is_send<T: Send>(val: T) {} + | ^^^^ required by this bound in `is_send` help: consider further restricting this bound | LL | fn use_bound_and_where<S: Sync>(val: S) where S: std::fmt::Debug + std::marker::Send { @@ -71,12 +81,14 @@ LL | fn use_bound_and_where<S: Sync>(val: S) where S: std::fmt::Debug + std::mar error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:28:13 | -LL | fn is_send<T: Send>(val: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | +note: required by a bound in `is_send` + --> $DIR/restrict-type-argument.rs:1:15 + | +LL | fn is_send<T: Send>(val: T) {} + | ^^^^ required by this bound in `is_send` help: consider restricting type parameter `S` | LL | fn use_unbound<S: std::marker::Send>(val: S) { diff --git a/src/test/ui/suggestions/return-elided-lifetime.stderr b/src/test/ui/suggestions/return-elided-lifetime.stderr index cdc3f5e85d1..f147b4463e2 100644 --- a/src/test/ui/suggestions/return-elided-lifetime.stderr +++ b/src/test/ui/suggestions/return-elided-lifetime.stderr @@ -80,7 +80,7 @@ LL | fn f3(s: &S) -> &i32 { loop {} } help: consider introducing a named lifetime parameter | LL | fn f3<'a>(s: &'a S) -> &'a i32 { loop {} } - | ++++ ~~~~~ ~~~ + | ++++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/return-elided-lifetime.rs:21:26 @@ -92,7 +92,7 @@ LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} } help: consider introducing a named lifetime parameter | LL | fn f3_<'a>(s: &'a S, t: &'a S) -> (&'a i32, &i32) { loop {} } - | ++++ ~~~~~ ~~~~~ ~~~ + | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/return-elided-lifetime.rs:21:32 @@ -104,7 +104,7 @@ LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} } help: consider introducing a named lifetime parameter | LL | fn f3_<'a>(s: &'a S, t: &'a S) -> (&i32, &'a i32) { loop {} } - | ++++ ~~~~~ ~~~~~ ~~~ + | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier --> $DIR/return-elided-lifetime.rs:25:42 @@ -121,7 +121,7 @@ LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} } help: consider using one of the available lifetimes here | LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &'lifetime i32 { loop {} } - | ~~~~~~~~~~ + | +++++++++ error[E0106]: missing lifetime specifier --> $DIR/return-elided-lifetime.rs:27:44 @@ -138,7 +138,7 @@ LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } help: consider using one of the available lifetimes here | LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&'lifetime i32, &i32) { loop {} } - | ~~~~~~~~~~ + | +++++++++ error[E0106]: missing lifetime specifier --> $DIR/return-elided-lifetime.rs:27:50 @@ -155,7 +155,7 @@ LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } help: consider using one of the available lifetimes here | LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &'lifetime i32) { loop {} } - | ~~~~~~~~~~ + | +++++++++ error[E0106]: missing lifetime specifier --> $DIR/return-elided-lifetime.rs:31:35 diff --git a/src/test/ui/trait-bounds/unsized-bound.stderr b/src/test/ui/trait-bounds/unsized-bound.stderr index c2f176c4b46..0c758c9ba26 100644 --- a/src/test/ui/trait-bounds/unsized-bound.stderr +++ b/src/test/ui/trait-bounds/unsized-bound.stderr @@ -1,14 +1,17 @@ error[E0277]: the size for values of type `B` cannot be known at compilation time --> $DIR/unsized-bound.rs:2:12 | -LL | trait Trait<A> {} - | - required by this bound in `Trait` LL | impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} | - ^^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | = note: required because it appears within the type `(A, B)` +note: required by a bound in `Trait` + --> $DIR/unsized-bound.rs:1:13 + | +LL | trait Trait<A> {} + | ^ required by this bound in `Trait` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} @@ -37,15 +40,17 @@ LL + impl<A, B> Trait<(A, B)> for (A, B) where B: ?Sized, {} error[E0277]: the size for values of type `C` cannot be known at compilation time --> $DIR/unsized-bound.rs:5:31 | -LL | trait Trait<A> {} - | - required by this bound in `Trait` -... LL | impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} | - ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | = note: required because it appears within the type `(A, B, C)` +note: required by a bound in `Trait` + --> $DIR/unsized-bound.rs:1:13 + | +LL | trait Trait<A> {} + | ^ required by this bound in `Trait` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} @@ -89,14 +94,17 @@ LL + impl<A, B, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} error[E0277]: the size for values of type `B` cannot be known at compilation time --> $DIR/unsized-bound.rs:10:28 | -LL | trait Trait2<A> {} - | - required by this bound in `Trait2` LL | impl<A: ?Sized, B: ?Sized> Trait2<(A, B)> for (A, B) {} | - ^^^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | = note: required because it appears within the type `(A, B)` +note: required by a bound in `Trait2` + --> $DIR/unsized-bound.rs:9:14 + | +LL | trait Trait2<A> {} + | ^ required by this bound in `Trait2` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A: ?Sized, B: ?Sized> Trait2<(A, B)> for (A, B) {} @@ -125,13 +133,16 @@ LL + impl<A, B: ?Sized> Trait2<(A, B)> for (A, B) {} error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/unsized-bound.rs:14:9 | -LL | trait Trait3<A> {} - | - required by this bound in `Trait3` LL | impl<A> Trait3<A> for A where A: ?Sized {} | - ^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Trait3` + --> $DIR/unsized-bound.rs:13:14 + | +LL | trait Trait3<A> {} + | ^ required by this bound in `Trait3` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A> Trait3<A> for A where A: ?Sized {} @@ -145,13 +156,16 @@ LL | trait Trait3<A: ?Sized> {} error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/unsized-bound.rs:17:17 | -LL | trait Trait4<A> {} - | - required by this bound in `Trait4` LL | impl<A: ?Sized> Trait4<A> for A {} | - ^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Trait4` + --> $DIR/unsized-bound.rs:16:14 + | +LL | trait Trait4<A> {} + | ^ required by this bound in `Trait4` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<A: ?Sized> Trait4<A> for A {} @@ -165,13 +179,16 @@ LL | trait Trait4<A: ?Sized> {} error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized-bound.rs:20:12 | -LL | trait Trait5<A, B> {} - | - required by this bound in `Trait5` LL | impl<X, Y> Trait5<X, Y> for X where X: ?Sized {} | - ^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Trait5` + --> $DIR/unsized-bound.rs:19:14 + | +LL | trait Trait5<A, B> {} + | ^ required by this bound in `Trait5` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X, Y> Trait5<X, Y> for X where X: ?Sized {} @@ -185,13 +202,16 @@ LL | trait Trait5<A: ?Sized, B> {} error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized-bound.rs:23:20 | -LL | trait Trait6<A, B> {} - | - required by this bound in `Trait6` LL | impl<X: ?Sized, Y> Trait6<X, Y> for X {} | - ^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Trait6` + --> $DIR/unsized-bound.rs:22:14 + | +LL | trait Trait6<A, B> {} + | ^ required by this bound in `Trait6` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized, Y> Trait6<X, Y> for X {} @@ -205,13 +225,16 @@ LL | trait Trait6<A: ?Sized, B> {} error[E0277]: the size for values of type `Y` cannot be known at compilation time --> $DIR/unsized-bound.rs:26:12 | -LL | trait Trait7<A, B> {} - | - required by this bound in `Trait7` LL | impl<X, Y> Trait7<X, Y> for X where Y: ?Sized {} | - ^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Trait7` + --> $DIR/unsized-bound.rs:25:17 + | +LL | trait Trait7<A, B> {} + | ^ required by this bound in `Trait7` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X, Y> Trait7<X, Y> for X where Y: ?Sized {} @@ -225,13 +248,16 @@ LL | trait Trait7<A, B: ?Sized> {} error[E0277]: the size for values of type `Y` cannot be known at compilation time --> $DIR/unsized-bound.rs:29:20 | -LL | trait Trait8<A, B> {} - | - required by this bound in `Trait8` LL | impl<X, Y: ?Sized> Trait8<X, Y> for X {} | - ^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Trait8` + --> $DIR/unsized-bound.rs:28:17 + | +LL | trait Trait8<A, B> {} + | ^ required by this bound in `Trait8` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X, Y: ?Sized> Trait8<X, Y> for X {} diff --git a/src/test/ui/trait-impl-bound-suggestions.stderr b/src/test/ui/trait-impl-bound-suggestions.stderr index c9dad2ef896..38679679cf9 100644 --- a/src/test/ui/trait-impl-bound-suggestions.stderr +++ b/src/test/ui/trait-impl-bound-suggestions.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `X: Copy` is not satisfied --> $DIR/trait-impl-bound-suggestions.rs:14:52 | -LL | struct ConstrainedStruct<X: Copy> { - | ---- required by this bound in `ConstrainedStruct` -... LL | fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> { | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `X` | +note: required by a bound in `ConstrainedStruct` + --> $DIR/trait-impl-bound-suggestions.rs:8:29 + | +LL | struct ConstrainedStruct<X: Copy> { + | ^^^^ required by this bound in `ConstrainedStruct` help: consider further restricting type parameter `X` | LL | trait InsufficientlyConstrainedGeneric<X=()> where X: std::marker::Copy { diff --git a/src/test/ui/traits/alias/cross-crate.stderr b/src/test/ui/traits/alias/cross-crate.stderr index 3b8fee8e8df..3c3b6e56690 100644 --- a/src/test/ui/traits/alias/cross-crate.stderr +++ b/src/test/ui/traits/alias/cross-crate.stderr @@ -1,24 +1,28 @@ error[E0277]: `Rc<u32>` cannot be sent between threads safely --> $DIR/cross-crate.rs:14:17 | -LL | fn use_alias<T: SendSync>() {} - | -------- required by this bound in `use_alias` -... LL | use_alias::<Rc<u32>>(); | ^^^^^^^ `Rc<u32>` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Rc<u32>` +note: required by a bound in `use_alias` + --> $DIR/cross-crate.rs:10:17 + | +LL | fn use_alias<T: SendSync>() {} + | ^^^^^^^^ required by this bound in `use_alias` error[E0277]: `Rc<u32>` cannot be shared between threads safely --> $DIR/cross-crate.rs:14:17 | -LL | fn use_alias<T: SendSync>() {} - | -------- required by this bound in `use_alias` -... LL | use_alias::<Rc<u32>>(); | ^^^^^^^ `Rc<u32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Rc<u32>` +note: required by a bound in `use_alias` + --> $DIR/cross-crate.rs:10:17 + | +LL | fn use_alias<T: SendSync>() {} + | ^^^^^^^^ required by this bound in `use_alias` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/alias/wf.stderr b/src/test/ui/traits/alias/wf.stderr index 44b194cea40..7172008d3ee 100644 --- a/src/test/ui/traits/alias/wf.stderr +++ b/src/test/ui/traits/alias/wf.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `T: Foo` is not satisfied --> $DIR/wf.rs:5:14 | -LL | trait A<T: Foo> {} - | --- required by this bound in `A` LL | trait B<T> = A<T>; | ^^^^ the trait `Foo` is not implemented for `T` | +note: required by a bound in `A` + --> $DIR/wf.rs:4:12 + | +LL | trait A<T: Foo> {} + | ^^^ required by this bound in `A` help: consider restricting type parameter `T` | LL | trait B<T: Foo> = A<T>; diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr index 170ed6eacfd..6333b4eb08c 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/check-trait-object-bounds-1.rs:12:5 | -LL | fn f<T: X + ?Sized>() { - | - required by this bound in `f` -... LL | f::<dyn X<Y = str>>(); | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | +note: required by a bound in `f` + --> $DIR/check-trait-object-bounds-1.rs:7:9 + | +LL | fn f<T: X + ?Sized>() { + | ^ required by this bound in `f` error: aborting due to previous error diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr index 04e2348634e..46e8ce78874 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr @@ -1,13 +1,15 @@ error[E0277]: expected a `FnOnce<(&i32,)>` closure, found `i32` --> $DIR/check-trait-object-bounds-2.rs:13:5 | -LL | fn f<T: for<'r> X<'r> + ?Sized>() { - | ------------- required by this bound in `f` -... LL | f::<dyn for<'x> X<'x, F = i32>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32` | = help: the trait `for<'r> FnOnce<(&'r i32,)>` is not implemented for `i32` +note: required by a bound in `f` + --> $DIR/check-trait-object-bounds-2.rs:8:9 + | +LL | fn f<T: for<'r> X<'r> + ?Sized>() { + | ^^^^^^^^^^^^^ required by this bound in `f` error: aborting due to previous error diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr index fc9f31c5ebc..9afae9a9638 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/check-trait-object-bounds-4.rs:15:5 | -LL | fn f<T: X + ?Sized>() { - | - required by this bound in `f` -... LL | f::<dyn X<Y = str>>(); | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | +note: required by a bound in `f` + --> $DIR/check-trait-object-bounds-4.rs:10:9 + | +LL | fn f<T: X + ?Sized>() { + | ^ required by this bound in `f` error: aborting due to previous error diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr index bd2b789cd99..c97408ff91e 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr @@ -1,11 +1,14 @@ error[E0271]: type mismatch resolving `<i32 as Is>::T == i64` --> $DIR/check-trait-object-bounds-5.rs:23:5 | -LL | fn is_obj<T: ?Sized + Obj>(_: &T) {} - | --- required by this bound in `is_obj` -... LL | is_obj(x) | ^^^^^^ expected `i64`, found `i32` + | +note: required by a bound in `is_obj` + --> $DIR/check-trait-object-bounds-5.rs:20:23 + | +LL | fn is_obj<T: ?Sized + Obj>(_: &T) {} + | ^^^ required by this bound in `is_obj` error: aborting due to previous error diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr index ea1fdaf46f6..89356449437 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr @@ -1,11 +1,14 @@ error[E0271]: type mismatch resolving `<i32 as Is>::T == i64` --> $DIR/check-trait-object-bounds-6.rs:20:5 | -LL | fn is_obj<T: ?Sized + Obj>(_: &T) {} - | --- required by this bound in `is_obj` -... LL | is_obj(x) | ^^^^^^ expected `i64`, found `i32` + | +note: required by a bound in `is_obj` + --> $DIR/check-trait-object-bounds-6.rs:17:23 + | +LL | fn is_obj<T: ?Sized + Obj>(_: &T) {} + | ^^^ required by this bound in `is_obj` error: aborting due to previous error diff --git a/src/test/ui/traits/bad-sized.stderr b/src/test/ui/traits/bad-sized.stderr index 58e34cfe15c..1322b660035 100644 --- a/src/test/ui/traits/bad-sized.stderr +++ b/src/test/ui/traits/bad-sized.stderr @@ -15,12 +15,12 @@ error[E0277]: the size for values of type `dyn Trait` cannot be known at compila LL | let x: Vec<dyn Trait + Sized> = Vec::new(); | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + = help: the trait `Sized` is not implemented for `dyn Trait` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | - required by this bound in `Vec` - | - = help: the trait `Sized` is not implemented for `dyn Trait` + | ^ required by this bound in `Vec` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:37 @@ -41,12 +41,12 @@ error[E0277]: the size for values of type `dyn Trait` cannot be known at compila LL | let x: Vec<dyn Trait + Sized> = Vec::new(); | ^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + = help: the trait `Sized` is not implemented for `dyn Trait` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | - required by this bound in `Vec` - | - = help: the trait `Sized` is not implemented for `dyn Trait` + | ^ required by this bound in `Vec` error: aborting due to 4 previous errors diff --git a/src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr b/src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr index 346b690d441..61237a63e32 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr @@ -1,20 +1,26 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied --> $DIR/on-structs-and-enums-in-fns.rs:13:15 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | fn explode(x: Foo<u32>) {} | ^^^^^^^^ the trait `Trait` is not implemented for `u32` + | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums-in-fns.rs:3:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `f32: Trait` is not satisfied --> $DIR/on-structs-and-enums-in-fns.rs:16:14 | -LL | enum Bar<T:Trait> { - | ----- required by this bound in `Bar` -... LL | fn kaboom(y: Bar<f32>) {} | ^^^^^^^^ the trait `Trait` is not implemented for `f32` + | +note: required by a bound in `Bar` + --> $DIR/on-structs-and-enums-in-fns.rs:7:12 + | +LL | enum Bar<T:Trait> { + | ^^^^^ required by this bound in `Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr b/src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr index 47bab6c375f..8a43742260b 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `u16: Trait` is not satisfied --> $DIR/on-structs-and-enums-in-impls.rs:20:6 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | impl PolyTrait<Foo<u16>> for Struct { | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16` + | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums-in-impls.rs:3:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr index 7480d243f4e..cd33e18cfb6 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied --> $DIR/on-structs-and-enums-locals.rs:15:14 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | let baz: Foo<usize> = loop { }; | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` + | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums-locals.rs:5:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `{integer}: Trait` is not satisfied --> $DIR/on-structs-and-enums-locals.rs:10:15 diff --git a/src/test/ui/traits/bound/on-structs-and-enums-static.stderr b/src/test/ui/traits/bound/on-structs-and-enums-static.stderr index 2cf8a623b3f..fda734e8571 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-static.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-static.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied --> $DIR/on-structs-and-enums-static.rs:9:11 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | static X: Foo<usize> = Foo { | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` + | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums-static.rs:5:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc.stderr b/src/test/ui/traits/bound/on-structs-and-enums-xc.stderr index 91552d4ea07..5064b60bfd5 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-xc.stderr @@ -4,10 +4,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied LL | fn explode(x: Foo<usize>) {} | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | - ::: $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18 +note: required by a bound in `Foo` + --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18 | LL | pub struct Foo<T:Trait> { - | ----- required by this bound in `Foo` + | ^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `f32: Trait` is not satisfied --> $DIR/on-structs-and-enums-xc.rs:10:14 @@ -15,10 +16,11 @@ error[E0277]: the trait bound `f32: Trait` is not satisfied LL | fn kaboom(y: Bar<f32>) {} | ^^^^^^^^ the trait `Trait` is not implemented for `f32` | - ::: $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16 +note: required by a bound in `Bar` + --> $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16 | LL | pub enum Bar<T:Trait> { - | ----- required by this bound in `Bar` + | ^^^^^ required by this bound in `Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr index 7d54a559e8b..0f25c885688 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr @@ -4,10 +4,11 @@ error[E0277]: the trait bound `f64: Trait` is not satisfied LL | let bar: Bar<f64> = return; | ^^^^^^^^ the trait `Trait` is not implemented for `f64` | - ::: $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16 +note: required by a bound in `Bar` + --> $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16 | LL | pub enum Bar<T:Trait> { - | ----- required by this bound in `Bar` + | ^^^^^ required by this bound in `Bar` error[E0277]: the trait bound `{integer}: Trait` is not satisfied --> $DIR/on-structs-and-enums-xc1.rs:8:15 diff --git a/src/test/ui/traits/bound/on-structs-and-enums.stderr b/src/test/ui/traits/bound/on-structs-and-enums.stderr index cc09b80898c..fe05b86344b 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Trait` is not satisfied --> $DIR/on-structs-and-enums.rs:13:9 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | impl<T> Foo<T> { | ^^^^^^ the trait `Trait` is not implemented for `T` | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums.rs:3:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` help: consider restricting type parameter `T` | LL | impl<T: Trait> Foo<T> { @@ -15,30 +17,38 @@ LL | impl<T: Trait> Foo<T> { error[E0277]: the trait bound `isize: Trait` is not satisfied --> $DIR/on-structs-and-enums.rs:19:8 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | a: Foo<isize>, | ^^^^^^^^^^ the trait `Trait` is not implemented for `isize` + | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums.rs:3:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `usize: Trait` is not satisfied --> $DIR/on-structs-and-enums.rs:23:10 | -LL | enum Bar<T:Trait> { - | ----- required by this bound in `Bar` -... LL | Quux(Bar<usize>), | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` + | +note: required by a bound in `Bar` + --> $DIR/on-structs-and-enums.rs:7:12 + | +LL | enum Bar<T:Trait> { + | ^^^^^ required by this bound in `Bar` error[E0277]: the trait bound `U: Trait` is not satisfied --> $DIR/on-structs-and-enums.rs:27:8 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | b: Foo<U>, | ^^^^^^ the trait `Trait` is not implemented for `U` | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums.rs:3:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` help: consider restricting type parameter `U` | LL | struct Badness<U: Trait> { @@ -47,12 +57,14 @@ LL | struct Badness<U: Trait> { error[E0277]: the trait bound `V: Trait` is not satisfied --> $DIR/on-structs-and-enums.rs:31:21 | -LL | enum Bar<T:Trait> { - | ----- required by this bound in `Bar` -... LL | EvenMoreBadness(Bar<V>), | ^^^^^^ the trait `Trait` is not implemented for `V` | +note: required by a bound in `Bar` + --> $DIR/on-structs-and-enums.rs:7:12 + | +LL | enum Bar<T:Trait> { + | ^^^^^ required by this bound in `Bar` help: consider restricting type parameter `V` | LL | enum MoreBadness<V: Trait> { @@ -61,20 +73,26 @@ LL | enum MoreBadness<V: Trait> { error[E0277]: the trait bound `i32: Trait` is not satisfied --> $DIR/on-structs-and-enums.rs:35:5 | -LL | struct Foo<T:Trait> { - | ----- required by this bound in `Foo` -... LL | Foo<i32>, | ^^^^^^^^ the trait `Trait` is not implemented for `i32` + | +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums.rs:3:14 + | +LL | struct Foo<T:Trait> { + | ^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `u8: Trait` is not satisfied --> $DIR/on-structs-and-enums.rs:39:29 | -LL | enum Bar<T:Trait> { - | ----- required by this bound in `Bar` -... LL | DictionaryLike { field: Bar<u8> }, | ^^^^^^^ the trait `Trait` is not implemented for `u8` + | +note: required by a bound in `Bar` + --> $DIR/on-structs-and-enums.rs:7:12 + | +LL | enum Bar<T:Trait> { + | ^^^^^ required by this bound in `Bar` error: aborting due to 7 previous errors diff --git a/src/test/ui/traits/bound/same-crate-name.stderr b/src/test/ui/traits/bound/same-crate-name.stderr index ce163b501b7..15f5fe16bc7 100644 --- a/src/test/ui/traits/bound/same-crate-name.stderr +++ b/src/test/ui/traits/bound/same-crate-name.stderr @@ -4,17 +4,17 @@ error[E0277]: the trait bound `Foo: main::a::Bar` is not satisfied LL | a::try_foo(foo); | ^^^ the trait `main::a::Bar` is not implemented for `Foo` | - ::: $DIR/auxiliary/crate_a1.rs:3:24 - | -LL | pub fn try_foo(x: impl Bar) {} - | --- required by this bound in `try_foo` - | help: trait impl with same name found --> $DIR/auxiliary/crate_a2.rs:5:1 | LL | impl Bar for Foo {} | ^^^^^^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `crate_a2` are being used? +note: required by a bound in `try_foo` + --> $DIR/auxiliary/crate_a1.rs:3:24 + | +LL | pub fn try_foo(x: impl Bar) {} + | ^^^ required by this bound in `try_foo` error[E0277]: the trait bound `DoesNotImplementTrait: main::a::Bar` is not satisfied --> $DIR/same-crate-name.rs:38:20 @@ -22,10 +22,11 @@ error[E0277]: the trait bound `DoesNotImplementTrait: main::a::Bar` is not satis LL | a::try_foo(implements_no_traits); | ^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `DoesNotImplementTrait` | - ::: $DIR/auxiliary/crate_a1.rs:3:24 +note: required by a bound in `try_foo` + --> $DIR/auxiliary/crate_a1.rs:3:24 | LL | pub fn try_foo(x: impl Bar) {} - | --- required by this bound in `try_foo` + | ^^^ required by this bound in `try_foo` error[E0277]: the trait bound `ImplementsWrongTraitConditionally<isize>: main::a::Bar` is not satisfied --> $DIR/same-crate-name.rs:45:20 @@ -33,17 +34,17 @@ error[E0277]: the trait bound `ImplementsWrongTraitConditionally<isize>: main::a LL | a::try_foo(other_variant_implements_mismatched_trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsWrongTraitConditionally<isize>` | - ::: $DIR/auxiliary/crate_a1.rs:3:24 - | -LL | pub fn try_foo(x: impl Bar) {} - | --- required by this bound in `try_foo` - | help: trait impl with same name found --> $DIR/auxiliary/crate_a2.rs:13:1 | LL | impl Bar for ImplementsWrongTraitConditionally<isize> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `crate_a2` are being used? +note: required by a bound in `try_foo` + --> $DIR/auxiliary/crate_a1.rs:3:24 + | +LL | pub fn try_foo(x: impl Bar) {} + | ^^^ required by this bound in `try_foo` error[E0277]: the trait bound `ImplementsTraitForUsize<isize>: main::a::Bar` is not satisfied --> $DIR/same-crate-name.rs:51:20 @@ -51,13 +52,13 @@ error[E0277]: the trait bound `ImplementsTraitForUsize<isize>: main::a::Bar` is LL | a::try_foo(other_variant_implements_correct_trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsTraitForUsize<isize>` | - ::: $DIR/auxiliary/crate_a1.rs:3:24 - | -LL | pub fn try_foo(x: impl Bar) {} - | --- required by this bound in `try_foo` - | = help: the following implementations were found: <ImplementsTraitForUsize<usize> as main::a::Bar> +note: required by a bound in `try_foo` + --> $DIR/auxiliary/crate_a1.rs:3:24 + | +LL | pub fn try_foo(x: impl Bar) {} + | ^^^ required by this bound in `try_foo` error: aborting due to 4 previous errors diff --git a/src/test/ui/traits/impl-bounds-checking.stderr b/src/test/ui/traits/impl-bounds-checking.stderr index 8698ed6e875..b01bacdb87d 100644 --- a/src/test/ui/traits/impl-bounds-checking.stderr +++ b/src/test/ui/traits/impl-bounds-checking.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied --> $DIR/impl-bounds-checking.rs:10:6 | -LL | trait Getter<T: Clone2> { - | ------ required by this bound in `Getter` -... LL | impl Getter<isize> for isize { | ^^^^^^^^^^^^^ the trait `Clone2` is not implemented for `isize` + | +note: required by a bound in `Getter` + --> $DIR/impl-bounds-checking.rs:6:17 + | +LL | trait Getter<T: Clone2> { + | ^^^^^^ required by this bound in `Getter` error: aborting due to previous error diff --git a/src/test/ui/traits/inductive-overflow/lifetime.rs b/src/test/ui/traits/inductive-overflow/lifetime.rs index b75da1b512d..072c46bc21e 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.rs +++ b/src/test/ui/traits/inductive-overflow/lifetime.rs @@ -21,7 +21,7 @@ impl<'a> NotAuto for C<'a> {} fn is_send<S: NotAuto>() {} //~^ NOTE: required - +//~| NOTE: required fn main() { // Should only be a few notes. is_send::<X<C<'static>>>(); diff --git a/src/test/ui/traits/inductive-overflow/lifetime.stderr b/src/test/ui/traits/inductive-overflow/lifetime.stderr index cc913930395..2905deb940f 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.stderr +++ b/src/test/ui/traits/inductive-overflow/lifetime.stderr @@ -1,9 +1,6 @@ error[E0275]: overflow evaluating the requirement `Box<X<C<'_>>>: NotAuto` --> $DIR/lifetime.rs:27:5 | -LL | fn is_send<S: NotAuto>() {} - | ------- required by this bound in `is_send` -... LL | is_send::<X<C<'static>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -14,6 +11,11 @@ LL | impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} | ^^^^^^^ ^^^^ = note: 2 redundant requirements hidden = note: required because of the requirements on the impl of `NotAuto` for `X<C<'static>>` +note: required by a bound in `is_send` + --> $DIR/lifetime.rs:22:15 + | +LL | fn is_send<S: NotAuto>() {} + | ^^^^^^^ required by this bound in `is_send` error: aborting due to previous error diff --git a/src/test/ui/traits/inductive-overflow/simultaneous.stderr b/src/test/ui/traits/inductive-overflow/simultaneous.stderr index 94a255fcb84..7eb1c9ffb3b 100644 --- a/src/test/ui/traits/inductive-overflow/simultaneous.stderr +++ b/src/test/ui/traits/inductive-overflow/simultaneous.stderr @@ -1,9 +1,6 @@ error[E0275]: overflow evaluating the requirement `{integer}: Tweedledee` --> $DIR/simultaneous.rs:18:5 | -LL | fn is_ee<T: Combo>(t: T) { - | ----- required by this bound in `is_ee` -... LL | is_ee(4); | ^^^^^ | @@ -12,6 +9,11 @@ note: required because of the requirements on the impl of `Combo` for `{integer} | LL | impl<T: Tweedledee + Tweedledum> Combo for T {} | ^^^^^ ^ +note: required by a bound in `is_ee` + --> $DIR/simultaneous.rs:13:13 + | +LL | fn is_ee<T: Combo>(t: T) { + | ^^^^^ required by this bound in `is_ee` error: aborting due to previous error diff --git a/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr index 6a0f7398cf1..5206b572106 100644 --- a/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr +++ b/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr @@ -9,13 +9,15 @@ LL | auto trait Magic: Copy {} error[E0277]: the trait bound `NoClone: Copy` is not satisfied --> $DIR/supertrait-auto-trait.rs:16:23 | -LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) } - | ----- required by this bound in `copy` -... LL | let (a, b) = copy(NoClone); | ^^^^^^^ the trait `Copy` is not implemented for `NoClone` | = note: required because of the requirements on the impl of `Magic` for `NoClone` +note: required by a bound in `copy` + --> $DIR/supertrait-auto-trait.rs:10:12 + | +LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) } + | ^^^^^ required by this bound in `copy` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/inductive-overflow/supertrait.stderr b/src/test/ui/traits/inductive-overflow/supertrait.stderr index 5ed1c2cc2da..95325a534f5 100644 --- a/src/test/ui/traits/inductive-overflow/supertrait.stderr +++ b/src/test/ui/traits/inductive-overflow/supertrait.stderr @@ -1,9 +1,6 @@ error[E0275]: overflow evaluating the requirement `NoClone: Magic` --> $DIR/supertrait.rs:13:18 | -LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) } - | ----- required by this bound in `copy` -... LL | let (a, b) = copy(NoClone); | ^^^^ | @@ -12,6 +9,11 @@ note: required because of the requirements on the impl of `Magic` for `NoClone` | LL | impl<T: Magic> Magic for T {} | ^^^^^ ^ +note: required by a bound in `copy` + --> $DIR/supertrait.rs:7:12 + | +LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) } + | ^^^^^ required by this bound in `copy` error: aborting due to previous error diff --git a/src/test/ui/traits/inductive-overflow/two-traits.stderr b/src/test/ui/traits/inductive-overflow/two-traits.stderr index bf2acd350ae..28610c94181 100644 --- a/src/test/ui/traits/inductive-overflow/two-traits.stderr +++ b/src/test/ui/traits/inductive-overflow/two-traits.stderr @@ -1,12 +1,14 @@ error[E0277]: `T` cannot be shared between threads safely --> $DIR/two-traits.rs:11:5 | -LL | type X: Trait; - | ----- required by this bound in `Magic::X` -... LL | type X = Self; | ^^^^^^^^^^^^^^ `T` cannot be shared between threads safely | +note: required by a bound in `Magic::X` + --> $DIR/two-traits.rs:8:13 + | +LL | type X: Trait; + | ^^^^^ required by this bound in `Magic::X` help: consider further restricting this bound | LL | impl<T: Magic + std::marker::Sync> Magic for T { @@ -15,11 +17,14 @@ LL | impl<T: Magic + std::marker::Sync> Magic for T { error[E0275]: overflow evaluating the requirement `*mut (): Magic` --> $DIR/two-traits.rs:20:5 | -LL | fn wizard<T: Magic>() { check::<<T as Magic>::X>(); } - | ----- required by this bound in `wizard` -... LL | wizard::<*mut ()>(); | ^^^^^^^^^^^^^^^^^ + | +note: required by a bound in `wizard` + --> $DIR/two-traits.rs:17:14 + | +LL | fn wizard<T: Magic>() { check::<<T as Magic>::X>(); } + | ^^^^^ required by this bound in `wizard` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/issue-65673.stderr b/src/test/ui/traits/issue-65673.stderr index 64cc0bab3f3..fba24d683a6 100644 --- a/src/test/ui/traits/issue-65673.stderr +++ b/src/test/ui/traits/issue-65673.stderr @@ -1,13 +1,15 @@ error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time --> $DIR/issue-65673.rs:9:5 | -LL | type Ctx; - | --------- required by this bound in `WithType::Ctx` -... LL | type Ctx = dyn Alias<T>; | ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Trait + 'static)` +note: required by a bound in `WithType::Ctx` + --> $DIR/issue-65673.rs:4:5 + | +LL | type Ctx; + | ^^^^^^^^^ required by this bound in `WithType::Ctx` error: aborting due to previous error diff --git a/src/test/ui/traits/issue-85735.stderr b/src/test/ui/traits/issue-85735.stderr index 7b3d7f868cd..7d7f6ea30ae 100644 --- a/src/test/ui/traits/issue-85735.stderr +++ b/src/test/ui/traits/issue-85735.stderr @@ -4,12 +4,12 @@ error[E0283]: type annotations needed LL | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL + = note: cannot satisfy `T: FnMut<(&'a (),)>` +note: required by a bound in `FnMut` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | LL | pub trait FnMut<Args>: FnOnce<Args> { - | ----------------------------------- required by this bound in `FnMut` - | - = note: cannot satisfy `T: FnMut<(&'a (),)>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `FnMut` error: aborting due to previous error diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.stderr b/src/test/ui/traits/mutual-recursion-issue-75860.stderr index 91c4136a752..d2ac3a836f6 100644 --- a/src/test/ui/traits/mutual-recursion-issue-75860.stderr +++ b/src/test/ui/traits/mutual-recursion-issue-75860.stderr @@ -4,12 +4,12 @@ error[E0275]: overflow evaluating the requirement `Option<_>: Sized` LL | iso(left, right) | ^^^ | - ::: $SRC_DIR/core/src/option.rs:LL:COL + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`mutual_recursion_issue_75860`) +note: required by a bound in `Option` + --> $SRC_DIR/core/src/option.rs:LL:COL | LL | pub enum Option<T> { - | - required by this bound in `Option` - | - = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`mutual_recursion_issue_75860`) + | ^ required by this bound in `Option` error: aborting due to previous error diff --git a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr index cad298cf247..ad95e06eb4e 100644 --- a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -14,43 +14,46 @@ LL | struct Outer<T: Send>(T); error[E0277]: `dummy::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:23:5 | -LL | struct Outer<T: Send>(T); - | ---- required by this bound in `Outer` -... LL | Outer(TestType); | ^^^^^^^^^^^^^^^ `dummy::TestType` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dummy::TestType` +note: required by a bound in `Outer` + --> $DIR/negated-auto-traits-error.rs:10:17 + | +LL | struct Outer<T: Send>(T); + | ^^^^ required by this bound in `Outer` error[E0277]: `dummy1b::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:32:13 | -LL | fn is_send<T: Send>(_: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(TestType); | ^^^^^^^^ `dummy1b::TestType` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dummy1b::TestType` +note: required by a bound in `is_send` + --> $DIR/negated-auto-traits-error.rs:16:15 + | +LL | fn is_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `is_send` error[E0277]: `dummy1c::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:40:13 | -LL | fn is_send<T: Send>(_: T) {} - | ---- required by this bound in `is_send` -... LL | is_send((8, TestType)); | ^^^^^^^^^^^^^ `dummy1c::TestType` cannot be sent between threads safely | = help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType` = note: required because it appears within the type `({integer}, dummy1c::TestType)` +note: required by a bound in `is_send` + --> $DIR/negated-auto-traits-error.rs:16:15 + | +LL | fn is_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `is_send` error[E0277]: `dummy2::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:48:13 | -LL | fn is_send<T: Send>(_: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(Box::new(TestType)); | ^^^^^^^^^^^^^^^^^^ | | @@ -60,13 +63,15 @@ LL | is_send(Box::new(TestType)); = note: the trait bound `dummy2::TestType: Send` is not satisfied = note: required because of the requirements on the impl of `Send` for `Unique<dummy2::TestType>` = note: required because it appears within the type `Box<dummy2::TestType>` +note: required by a bound in `is_send` + --> $DIR/negated-auto-traits-error.rs:16:15 + | +LL | fn is_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `is_send` error[E0277]: `dummy3::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:56:13 | -LL | fn is_send<T: Send>(_: T) {} - | ---- required by this bound in `is_send` -... LL | is_send(Box::new(Outer2(TestType))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `dummy3::TestType` cannot be sent between threads safely | @@ -78,13 +83,15 @@ LL | struct Outer2<T>(T); | ^^^^^^ = note: required because of the requirements on the impl of `Send` for `Unique<Outer2<dummy3::TestType>>` = note: required because it appears within the type `Box<Outer2<dummy3::TestType>>` +note: required by a bound in `is_send` + --> $DIR/negated-auto-traits-error.rs:16:15 + | +LL | fn is_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `is_send` error[E0277]: `main::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:66:13 | -LL | fn is_sync<T: Sync>(_: T) {} - | ---- required by this bound in `is_sync` -... LL | is_sync(Outer2(TestType)); | ^^^^^^^^^^^^^^^^ | | @@ -97,6 +104,11 @@ note: required because of the requirements on the impl of `Sync` for `Outer2<mai | LL | unsafe impl<T: Send> Sync for Outer2<T> {} | ^^^^ ^^^^^^^^^ +note: required by a bound in `is_sync` + --> $DIR/negated-auto-traits-error.rs:17:15 + | +LL | fn is_sync<T: Sync>(_: T) {} + | ^^^^ required by this bound in `is_sync` error: aborting due to 7 previous errors diff --git a/src/test/ui/traits/suggest-deferences/issue-39029.stderr b/src/test/ui/traits/suggest-deferences/issue-39029.stderr index d1778a284da..10eeec20d98 100644 --- a/src/test/ui/traits/suggest-deferences/issue-39029.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-39029.stderr @@ -7,12 +7,12 @@ LL | let _errors = TcpListener::bind(&bad); | the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` | help: consider adding dereference here: `&*bad` | - ::: $SRC_DIR/std/src/net/tcp.rs:LL:COL + = note: required because of the requirements on the impl of `ToSocketAddrs` for `&NoToSocketAddrs` +note: required by a bound in `TcpListener::bind` + --> $SRC_DIR/std/src/net/tcp.rs:LL:COL | LL | pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<TcpListener> { - | ------------- required by this bound in `TcpListener::bind` - | - = note: required because of the requirements on the impl of `ToSocketAddrs` for `&NoToSocketAddrs` + | ^^^^^^^^^^^^^ required by this bound in `TcpListener::bind` error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-deferences/issue-62530.stderr b/src/test/ui/traits/suggest-deferences/issue-62530.stderr index 4f1165b17c5..750c8a86c56 100644 --- a/src/test/ui/traits/suggest-deferences/issue-62530.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-62530.stderr @@ -1,14 +1,17 @@ error[E0277]: the trait bound `&String: SomeTrait` is not satisfied --> $DIR/issue-62530.rs:13:26 | -LL | fn takes_type_parameter<T>(_x: T) where T: SomeTrait {} - | --------- required by this bound in `takes_type_parameter` -... LL | takes_type_parameter(&string); // Error | ^^^^^^^ | | | the trait `SomeTrait` is not implemented for `&String` | help: consider adding dereference here: `&*string` + | +note: required by a bound in `takes_type_parameter` + --> $DIR/issue-62530.rs:4:44 + | +LL | fn takes_type_parameter<T>(_x: T) where T: SomeTrait {} + | ^^^^^^^^^ required by this bound in `takes_type_parameter` error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-deferences/multiple-0.stderr b/src/test/ui/traits/suggest-deferences/multiple-0.stderr index f76c73cbb63..6fcf8780d6e 100644 --- a/src/test/ui/traits/suggest-deferences/multiple-0.stderr +++ b/src/test/ui/traits/suggest-deferences/multiple-0.stderr @@ -1,14 +1,17 @@ error[E0277]: the trait bound `&Baz: Happy` is not satisfied --> $DIR/multiple-0.rs:34:9 | -LL | fn foo<T>(_: T) where T: Happy {} - | ----- required by this bound in `foo` -... LL | foo(&baz); | ^^^^ | | | the trait `Happy` is not implemented for `&Baz` | help: consider adding dereference here: `&***baz` + | +note: required by a bound in `foo` + --> $DIR/multiple-0.rs:30:26 + | +LL | fn foo<T>(_: T) where T: Happy {} + | ^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-deferences/multiple-1.stderr b/src/test/ui/traits/suggest-deferences/multiple-1.stderr index f98cc54227f..268f375050a 100644 --- a/src/test/ui/traits/suggest-deferences/multiple-1.stderr +++ b/src/test/ui/traits/suggest-deferences/multiple-1.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `&mut Baz: Happy` is not satisfied --> $DIR/multiple-1.rs:52:9 | -LL | fn foo<T>(_: T) where T: Happy {} - | ----- required by this bound in `foo` -... LL | foo(&mut baz); | ^^^^^^^^ the trait `Happy` is not implemented for `&mut Baz` + | +note: required by a bound in `foo` + --> $DIR/multiple-1.rs:45:26 + | +LL | fn foo<T>(_: T) where T: Happy {} + | ^^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index a6b0837e7d4..d955cb06a1d 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -7,11 +7,11 @@ LL | // suggest a where-clause, if needed LL | mem::size_of::<U>(); | ^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | + | ^ required by this bound in `std::mem::size_of` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check<T: Iterator, U: ?Sized>() { @@ -27,16 +27,16 @@ LL | fn check<T: Iterator, U: ?Sized>() { LL | mem::size_of::<Misc<U>>(); | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | note: required because it appears within the type `Misc<U>` --> $DIR/suggest-where-clause.rs:3:8 | LL | struct Misc<T:?Sized>(T); | ^^^^ +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + | +LL | pub const fn size_of<T>() -> usize { + | ^ required by this bound in `std::mem::size_of` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check<T: Iterator, U: ?Sized>() { @@ -93,12 +93,12 @@ error[E0277]: the size for values of type `[T]` cannot be known at compilation t LL | mem::size_of::<[T]>(); | ^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL + = help: the trait `Sized` is not implemented for `[T]` +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | - = help: the trait `Sized` is not implemented for `[T]` + | ^ required by this bound in `std::mem::size_of` error[E0277]: the size for values of type `[&U]` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:31:5 @@ -106,12 +106,12 @@ error[E0277]: the size for values of type `[&U]` cannot be known at compilation LL | mem::size_of::<[&U]>(); | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL + = help: the trait `Sized` is not implemented for `[&U]` +note: required by a bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of<T>() -> usize { - | - required by this bound in `std::mem::size_of` - | - = help: the trait `Sized` is not implemented for `[&U]` + | ^ required by this bound in `std::mem::size_of` error: aborting due to 7 previous errors diff --git a/src/test/ui/traits/trait-upcasting/type-checking-test-3.polonius.stderr b/src/test/ui/traits/trait-upcasting/type-checking-test-3.polonius.stderr new file mode 100644 index 00000000000..e48ba709af1 --- /dev/null +++ b/src/test/ui/traits/trait-upcasting/type-checking-test-3.polonius.stderr @@ -0,0 +1,22 @@ +error: lifetime may not live long enough + --> $DIR/type-checking-test-3.rs:13:13 + | +LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { + | -- lifetime `'a` defined here +LL | let _ = x as &dyn Bar<'a>; // Error + | ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` + +error: lifetime may not live long enough + --> $DIR/type-checking-test-3.rs:18:13 + | +LL | fn test_wrong2<'a>(x: &dyn Foo<'a>) { + | -- lifetime `'a` defined here +LL | let _ = x as &dyn Bar<'static>; // Error + | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/traits/trait-upcasting/type-checking-test-4.polonius.stderr b/src/test/ui/traits/trait-upcasting/type-checking-test-4.polonius.stderr new file mode 100644 index 00000000000..a3411f40ad0 --- /dev/null +++ b/src/test/ui/traits/trait-upcasting/type-checking-test-4.polonius.stderr @@ -0,0 +1,33 @@ +error: lifetime may not live long enough + --> $DIR/type-checking-test-4.rs:17:13 + | +LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { + | -- lifetime `'a` defined here +LL | let _ = x as &dyn Bar<'static, 'a>; // Error + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` + +error: lifetime may not live long enough + --> $DIR/type-checking-test-4.rs:22:13 + | +LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) { + | -- lifetime `'a` defined here +LL | let _ = x as &dyn Bar<'a, 'static>; // Error + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` + +error: lifetime may not live long enough + --> $DIR/type-checking-test-4.rs:29:5 + | +LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { + | -- lifetime `'a` defined here +... +LL | y.get_b() // ERROR + | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index 41a19bff870..97ef2dd37f7 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -37,9 +37,12 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied | LL | generic_function(5i32); | ^^^^ the trait `Foo` is not implemented for `i32` -... + | +note: required by a bound in `generic_function` + --> $DIR/trivial-bounds-leak.rs:29:24 + | LL | fn generic_function<T: Foo>(t: T) {} - | --- required by this bound in `generic_function` + | ^^^ required by this bound in `generic_function` error: aborting due to 4 previous errors diff --git a/src/test/ui/try-trait/try-operator-on-main.stderr b/src/test/ui/try-trait/try-operator-on-main.stderr index dd893cadff7..d669124e9f1 100644 --- a/src/test/ui/try-trait/try-operator-on-main.stderr +++ b/src/test/ui/try-trait/try-operator-on-main.stderr @@ -58,9 +58,12 @@ error[E0277]: the trait bound `(): Try` is not satisfied | LL | try_trait_generic::<()>(); | ^^ the trait `Try` is not implemented for `()` -... + | +note: required by a bound in `try_trait_generic` + --> $DIR/try-operator-on-main.rs:17:25 + | LL | fn try_trait_generic<T: Try>() -> T { - | --- required by this bound in `try_trait_generic` + | ^^^ required by this bound in `try_trait_generic` error[E0277]: the `?` operator can only be applied to values that implement `Try` --> $DIR/try-operator-on-main.rs:19:5 diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr index c2671f7ae60..99eb884a0e8 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr @@ -7,12 +7,14 @@ LL | type Underconstrained<T: Trait> = impl 'static; error[E0277]: the trait bound `T: Trait` is not satisfied --> $DIR/generic_underconstrained.rs:10:31 | -LL | type Underconstrained<T: Trait> = impl 'static; - | ----- required by this bound in `Underconstrained` -... LL | fn underconstrain<T>(_: T) -> Underconstrained<T> { | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | +note: required by a bound in `Underconstrained` + --> $DIR/generic_underconstrained.rs:6:26 + | +LL | type Underconstrained<T: Trait> = impl 'static; + | ^^^^^ required by this bound in `Underconstrained` help: consider restricting type parameter `T` | LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> { diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr index 3213b26456d..1c1193705f9 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr @@ -13,12 +13,14 @@ LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static; error[E0277]: `U` doesn't implement `Debug` --> $DIR/generic_underconstrained2.rs:9:33 | -LL | type Underconstrained<T: std::fmt::Debug> = impl 'static; - | --------------- required by this bound in `Underconstrained` -... LL | fn underconstrained<U>(_: U) -> Underconstrained<U> { | ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | +note: required by a bound in `Underconstrained` + --> $DIR/generic_underconstrained2.rs:5:26 + | +LL | type Underconstrained<T: std::fmt::Debug> = impl 'static; + | ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained` help: consider restricting type parameter `U` | LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> { @@ -27,12 +29,14 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> { error[E0277]: `V` doesn't implement `Debug` --> $DIR/generic_underconstrained2.rs:18:43 | -LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static; - | --------------- required by this bound in `Underconstrained2` -... LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> { | ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug` | +note: required by a bound in `Underconstrained2` + --> $DIR/generic_underconstrained2.rs:14:27 + | +LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static; + | ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained2` help: consider restricting type parameter `V` | LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> { diff --git a/src/test/ui/type-alias-impl-trait/unused_generic_param.rs b/src/test/ui/type-alias-impl-trait/unused_generic_param.rs index 04a5c58cd36..ad5e4918cca 100644 --- a/src/test/ui/type-alias-impl-trait/unused_generic_param.rs +++ b/src/test/ui/type-alias-impl-trait/unused_generic_param.rs @@ -1,16 +1,17 @@ +// check-pass + #![feature(type_alias_impl_trait)] +#![allow(dead_code)] fn main() {} -type PartiallyDefined<T> = impl 'static; -//~^ ERROR: at least one trait must be specified +type PartiallyDefined<T> = impl Sized; fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> { 4u32 } -type PartiallyDefined2<T> = impl 'static; -//~^ ERROR: at least one trait must be specified +type PartiallyDefined2<T> = impl Sized; fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> { 4u32 diff --git a/src/test/ui/type-alias-impl-trait/unused_generic_param.stderr b/src/test/ui/type-alias-impl-trait/unused_generic_param.stderr deleted file mode 100644 index 4e11854b071..00000000000 --- a/src/test/ui/type-alias-impl-trait/unused_generic_param.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: at least one trait must be specified - --> $DIR/unused_generic_param.rs:5:28 - | -LL | type PartiallyDefined<T> = impl 'static; - | ^^^^^^^^^^^^ - -error: at least one trait must be specified - --> $DIR/unused_generic_param.rs:12:29 - | -LL | type PartiallyDefined2<T> = impl 'static; - | ^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/type/type-annotation-needed.rs b/src/test/ui/type/type-annotation-needed.rs index 553318ecac6..999486018a3 100644 --- a/src/test/ui/type/type-annotation-needed.rs +++ b/src/test/ui/type/type-annotation-needed.rs @@ -1,6 +1,6 @@ fn foo<T: Into<String>>(x: i32) {} //~^ NOTE required by - +//~| NOTE required by fn main() { foo(42); //~^ ERROR type annotations needed diff --git a/src/test/ui/type/type-annotation-needed.stderr b/src/test/ui/type/type-annotation-needed.stderr index 3052ff5490a..20cae3eb24c 100644 --- a/src/test/ui/type/type-annotation-needed.stderr +++ b/src/test/ui/type/type-annotation-needed.stderr @@ -1,13 +1,15 @@ error[E0283]: type annotations needed --> $DIR/type-annotation-needed.rs:5:5 | -LL | fn foo<T: Into<String>>(x: i32) {} - | ------------ required by this bound in `foo` -... LL | foo(42); | ^^^ cannot infer type for type parameter `T` declared on the function `foo` | = note: cannot satisfy `_: Into<String>` +note: required by a bound in `foo` + --> $DIR/type-annotation-needed.rs:1:11 + | +LL | fn foo<T: Into<String>>(x: i32) {} + | ^^^^^^^^^^^^ required by this bound in `foo` help: consider specifying the type argument in the function call | LL | foo::<T>(42); diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 6a2f4beb98a..f8dbd66c1c7 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -1,23 +1,28 @@ error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:6:19 | -LL | struct Foo<T, U: FromIterator<T>>(T, U); - | --------------- required by this bound in `Foo` LL | struct WellFormed<Z = Foo<i32, i32>>(Z); | ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `FromIterator<i32>` is not implemented for `i32` +note: required by a bound in `Foo` + --> $DIR/type-check-defaults.rs:5:18 + | +LL | struct Foo<T, U: FromIterator<T>>(T, U); + | ^^^^^^^^^^^^^^^ required by this bound in `Foo` error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:8:27 | -LL | struct Foo<T, U: FromIterator<T>>(T, U); - | --------------- required by this bound in `Foo` -... LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z); | ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `FromIterator<i32>` is not implemented for `i32` +note: required by a bound in `Foo` + --> $DIR/type-check-defaults.rs:5:18 + | +LL | struct Foo<T, U: FromIterator<T>>(T, U); + | ^^^^^^^^^^^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/type-check-defaults.rs:11:17 @@ -58,11 +63,14 @@ LL | trait TraitBound<T:Copy=String> {} error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/type-check-defaults.rs:21:25 | -LL | trait Super<T: Copy> { } - | ---- required by this bound in `Super` LL | trait Base<T = String>: Super<T> { } | ^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `Super` + --> $DIR/type-check-defaults.rs:20:16 + | +LL | trait Super<T: Copy> { } + | ^^^^ required by this bound in `Super` help: consider further restricting type parameter `T` | LL | trait Base<T = String>: Super<T> where T: std::marker::Copy { } diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index ea7771a9c22..9ca07eaba83 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -1,13 +1,15 @@ error[E0283]: type annotations needed --> $DIR/issue-40294.rs:6:19 | -LL | trait Foo: Sized { - | ---------------- required by this bound in `Foo` -... LL | where &'a T : Foo, | ^^^ cannot infer type for reference `&'a T` | = note: cannot satisfy `&'a T: Foo` +note: required by a bound in `Foo` + --> $DIR/issue-40294.rs:1:1 + | +LL | trait Foo: Sized { + | ^^^^^^^^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/type_length_limit.polonius.stderr b/src/test/ui/type_length_limit.polonius.stderr new file mode 100644 index 00000000000..82d066b2a2f --- /dev/null +++ b/src/test/ui/type_length_limit.polonius.stderr @@ -0,0 +1,11 @@ +error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((...,....., ...), ..., ...), ..., ...)>>` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + | +LL | pub fn drop<T>(_x: T) {} + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit.polonius/type_length_limit.long-type.txt' + = help: consider adding a `#![type_length_limit="8"]` attribute to your crate + +error: aborting due to previous error + diff --git a/src/test/ui/typeck/issue-87935-unsized-box-expr.rs b/src/test/ui/typeck/issue-87935-unsized-box-expr.rs new file mode 100644 index 00000000000..cd2a82074ed --- /dev/null +++ b/src/test/ui/typeck/issue-87935-unsized-box-expr.rs @@ -0,0 +1,10 @@ +#![feature(box_syntax)] +// Box expression needs to be movable, and hence has to be of a Sized type. +fn main() { + let _x: Box<[u32]> = box { loop {} }; + //~^ ERROR: the size for values of type `[u32]` cannot be known at compilation time + + // Check that a deduced size does not cause issues. + let _y: Box<[u32]> = box []; + let _z: Box<[u32; 0]> = box { loop {} }; +} diff --git a/src/test/ui/typeck/issue-87935-unsized-box-expr.stderr b/src/test/ui/typeck/issue-87935-unsized-box-expr.stderr new file mode 100644 index 00000000000..9ff822352a1 --- /dev/null +++ b/src/test/ui/typeck/issue-87935-unsized-box-expr.stderr @@ -0,0 +1,12 @@ +error[E0277]: the size for values of type `[u32]` cannot be known at compilation time + --> $DIR/issue-87935-unsized-box-expr.rs:4:30 + | +LL | let _x: Box<[u32]> = box { loop {} }; + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u32]` + = note: the type of a box expression must have a statically known size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr index 11c2fbbcda2..7aefa064611 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr @@ -3,11 +3,13 @@ error[E0277]: `<T as Trait>::AssocType` cannot be sent between threads safely | LL | is_send::<T::AssocType>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `<T as Trait>::AssocType` cannot be sent between threads safely -... -LL | fn is_send<T:Send>() { - | ---- required by this bound in `is_send` | = help: the trait `Send` is not implemented for `<T as Trait>::AssocType` +note: required by a bound in `is_send` + --> $DIR/typeck-default-trait-impl-assoc-type.rs:14:14 + | +LL | fn is_send<T:Send>() { + | ^^^^ required by this bound in `is_send` help: consider further restricting the associated type | LL | fn bar<T:Trait+Send>() where <T as Trait>::AssocType: Send { diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr index e164bb01f70..2ce32990e55 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr @@ -1,13 +1,15 @@ error[E0277]: `MyNotSendable` cannot be sent between threads safely --> $DIR/typeck-default-trait-impl-negation-send.rs:19:15 | -LL | fn is_send<T: Send>() {} - | ---- required by this bound in `is_send` -... LL | is_send::<MyNotSendable>(); | ^^^^^^^^^^^^^ `MyNotSendable` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `MyNotSendable` +note: required by a bound in `is_send` + --> $DIR/typeck-default-trait-impl-negation-send.rs:15:15 + | +LL | fn is_send<T: Send>() {} + | ^^^^ required by this bound in `is_send` error: aborting due to previous error diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index a9b49ee3263..6bb5e1f5427 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -1,20 +1,19 @@ error[E0277]: `MyNotSync` cannot be shared between threads safely --> $DIR/typeck-default-trait-impl-negation-sync.rs:33:15 | -LL | fn is_sync<T: Sync>() {} - | ---- required by this bound in `is_sync` -... LL | is_sync::<MyNotSync>(); | ^^^^^^^^^ `MyNotSync` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `MyNotSync` +note: required by a bound in `is_sync` + --> $DIR/typeck-default-trait-impl-negation-sync.rs:29:15 + | +LL | fn is_sync<T: Sync>() {} + | ^^^^ required by this bound in `is_sync` error[E0277]: `UnsafeCell<u8>` cannot be shared between threads safely --> $DIR/typeck-default-trait-impl-negation-sync.rs:36:5 | -LL | fn is_sync<T: Sync>() {} - | ---- required by this bound in `is_sync` -... LL | is_sync::<MyTypeWUnsafe>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<u8>` cannot be shared between threads safely | @@ -24,13 +23,15 @@ note: required because it appears within the type `MyTypeWUnsafe` | LL | struct MyTypeWUnsafe { | ^^^^^^^^^^^^^ +note: required by a bound in `is_sync` + --> $DIR/typeck-default-trait-impl-negation-sync.rs:29:15 + | +LL | fn is_sync<T: Sync>() {} + | ^^^^ required by this bound in `is_sync` error[E0277]: `Managed` cannot be shared between threads safely --> $DIR/typeck-default-trait-impl-negation-sync.rs:39:5 | -LL | fn is_sync<T: Sync>() {} - | ---- required by this bound in `is_sync` -... LL | is_sync::<MyTypeManaged>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely | @@ -40,6 +41,11 @@ note: required because it appears within the type `MyTypeManaged` | LL | struct MyTypeManaged { | ^^^^^^^^^^^^^ +note: required by a bound in `is_sync` + --> $DIR/typeck-default-trait-impl-negation-sync.rs:29:15 + | +LL | fn is_sync<T: Sync>() {} + | ^^^^ required by this bound in `is_sync` error: aborting due to 3 previous errors diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index b73ed49ce65..887a1ddbb69 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -3,10 +3,12 @@ error[E0277]: `T` cannot be sent between threads safely | LL | is_send::<T>() | ^ `T` cannot be sent between threads safely -... -LL | fn is_send<T:Send>() { - | ---- required by this bound in `is_send` | +note: required by a bound in `is_send` + --> $DIR/typeck-default-trait-impl-send-param.rs:8:14 + | +LL | fn is_send<T:Send>() { + | ^^^^ required by this bound in `is_send` help: consider restricting type parameter `T` | LL | fn foo<T: std::marker::Send>() { diff --git a/src/test/ui/typeck/typeck-unsafe-always-share.stderr b/src/test/ui/typeck/typeck-unsafe-always-share.stderr index 91585e78d4b..c0f388bd15b 100644 --- a/src/test/ui/typeck/typeck-unsafe-always-share.stderr +++ b/src/test/ui/typeck/typeck-unsafe-always-share.stderr @@ -1,31 +1,32 @@ error[E0277]: `UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely --> $DIR/typeck-unsafe-always-share.rs:19:10 | -LL | fn test<T: Sync>(s: T) {} - | ---- required by this bound in `test` -... LL | test(us); | ^^ `UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `UnsafeCell<MySync<{integer}>>` +note: required by a bound in `test` + --> $DIR/typeck-unsafe-always-share.rs:15:12 + | +LL | fn test<T: Sync>(s: T) {} + | ^^^^ required by this bound in `test` error[E0277]: `UnsafeCell<NoSync>` cannot be shared between threads safely --> $DIR/typeck-unsafe-always-share.rs:23:10 | -LL | fn test<T: Sync>(s: T) {} - | ---- required by this bound in `test` -... LL | test(uns); | ^^^ `UnsafeCell<NoSync>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `UnsafeCell<NoSync>` +note: required by a bound in `test` + --> $DIR/typeck-unsafe-always-share.rs:15:12 + | +LL | fn test<T: Sync>(s: T) {} + | ^^^^ required by this bound in `test` error[E0277]: `UnsafeCell<NoSync>` cannot be shared between threads safely --> $DIR/typeck-unsafe-always-share.rs:27:5 | -LL | fn test<T: Sync>(s: T) {} - | ---- required by this bound in `test` -... LL | test(ms); | ^^^^ `UnsafeCell<NoSync>` cannot be shared between threads safely | @@ -35,17 +36,24 @@ note: required because it appears within the type `MySync<NoSync>` | LL | struct MySync<T> { | ^^^^^^ +note: required by a bound in `test` + --> $DIR/typeck-unsafe-always-share.rs:15:12 + | +LL | fn test<T: Sync>(s: T) {} + | ^^^^ required by this bound in `test` error[E0277]: `NoSync` cannot be shared between threads safely --> $DIR/typeck-unsafe-always-share.rs:30:10 | -LL | fn test<T: Sync>(s: T) {} - | ---- required by this bound in `test` -... LL | test(NoSync); | ^^^^^^ `NoSync` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `NoSync` +note: required by a bound in `test` + --> $DIR/typeck-unsafe-always-share.rs:15:12 + | +LL | fn test<T: Sync>(s: T) {} + | ^^^^ required by this bound in `test` error: aborting due to 4 previous errors diff --git a/src/test/ui/unboxed-closures/issue-30906.nll.stderr b/src/test/ui/unboxed-closures/issue-30906.nll.stderr index 2db392e8b8b..147a2097473 100644 --- a/src/test/ui/unboxed-closures/issue-30906.nll.stderr +++ b/src/test/ui/unboxed-closures/issue-30906.nll.stderr @@ -1,8 +1,11 @@ -error: higher-ranked subtype error +error: implementation of `FnOnce` is not general enough --> $DIR/issue-30906.rs:18:5 | LL | test(Compose(f, |_| {})); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | + = note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr index 908d8543851..09d3eec6b21 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `dyn Foo<(isize,), isize, Output = ()>: Eq<dyn Foo<(isize,), Output = ()>>` is not satisfied --> $DIR/unboxed-closure-sugar-default.rs:21:5 | -LL | fn eq<A: ?Sized,B: ?Sized>() where A : Eq<B> { } - | ----- required by this bound in `eq` -... LL | eq::<dyn Foo<(isize,), isize, Output=()>, dyn Foo(isize)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq<dyn Foo<(isize,), Output = ()>>` is not implemented for `dyn Foo<(isize,), isize, Output = ()>` + | +note: required by a bound in `eq` + --> $DIR/unboxed-closure-sugar-default.rs:14:40 + | +LL | fn eq<A: ?Sized,B: ?Sized>() where A : Eq<B> { } + | ^^^^^ required by this bound in `eq` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr index 8ce7e825a1c..a1cbf842a68 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr @@ -1,12 +1,15 @@ error[E0277]: the trait bound `dyn Foo<(char,), Output = ()>: Eq<dyn Foo<(), Output = ()>>` is not satisfied --> $DIR/unboxed-closure-sugar-equiv.rs:43:5 | -LL | fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { } - | ----- required by this bound in `eq` -... LL | / eq::< dyn Foo<(),Output=()>, LL | | dyn Foo(char) >(); | |_______________________________________________________________________^ the trait `Eq<dyn Foo<(), Output = ()>>` is not implemented for `dyn Foo<(char,), Output = ()>` + | +note: required by a bound in `eq` + --> $DIR/unboxed-closure-sugar-equiv.rs:16:28 + | +LL | fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { } + | ^^^^^ required by this bound in `eq` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr index df3563455b6..f30bf40983e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr @@ -1,13 +1,15 @@ error[E0277]: expected a `Fn<(isize,)>` closure, found `S` --> $DIR/unboxed-closures-fnmut-as-fn.rs:28:21 | -LL | fn call_it<F:Fn(isize)->isize>(f: &F, x: isize) -> isize { - | ---------------- required by this bound in `call_it` -... LL | let x = call_it(&S, 22); | ^^ expected an `Fn<(isize,)>` closure, found `S` | = help: the trait `Fn<(isize,)>` is not implemented for `S` +note: required by a bound in `call_it` + --> $DIR/unboxed-closures-fnmut-as-fn.rs:23:14 + | +LL | fn call_it<F:Fn(isize)->isize>(f: &F, x: isize) -> isize { + | ^^^^^^^^^^^^^^^^ required by this bound in `call_it` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr index d1f433e92d7..6b21b9246f7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr @@ -1,35 +1,41 @@ error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` --> $DIR/unboxed-closures-unsafe-extern-fn.rs:20:21 | -LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize { - | ------------------- required by this bound in `call_it` -... LL | let x = call_it(&square, 22); | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` +note: required by a bound in `call_it` + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:9:15 + | +LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` --> $DIR/unboxed-closures-unsafe-extern-fn.rs:25:25 | -LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize { - | ---------------------- required by this bound in `call_it_mut` -... LL | let y = call_it_mut(&mut square, 22); | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` +note: required by a bound in `call_it_mut` + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:19 + | +LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut` error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` --> $DIR/unboxed-closures-unsafe-extern-fn.rs:30:26 | -LL | fn call_it_once<F: FnOnce(&isize) -> isize>(_: F, _: isize) -> isize { - | ----------------------- required by this bound in `call_it_once` -... LL | let z = call_it_once(square, 22); | ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` +note: required by a bound in `call_it_once` + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:15:20 + | +LL | fn call_it_once<F: FnOnce(&isize) -> isize>(_: F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_once` error: aborting due to 3 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr index 05b532e983a..936cb27759a 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr @@ -1,35 +1,41 @@ error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` --> $DIR/unboxed-closures-wrong-abi.rs:20:21 | -LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize { - | ------------------- required by this bound in `call_it` -... LL | let x = call_it(&square, 22); | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` +note: required by a bound in `call_it` + --> $DIR/unboxed-closures-wrong-abi.rs:9:15 + | +LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` --> $DIR/unboxed-closures-wrong-abi.rs:25:25 | -LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize { - | ---------------------- required by this bound in `call_it_mut` -... LL | let y = call_it_mut(&mut square, 22); | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` +note: required by a bound in `call_it_mut` + --> $DIR/unboxed-closures-wrong-abi.rs:12:19 + | +LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut` error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` --> $DIR/unboxed-closures-wrong-abi.rs:30:26 | -LL | fn call_it_once<F: FnOnce(&isize) -> isize>(_: F, _: isize) -> isize { - | ----------------------- required by this bound in `call_it_once` -... LL | let z = call_it_once(square, 22); | ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` +note: required by a bound in `call_it_once` + --> $DIR/unboxed-closures-wrong-abi.rs:15:20 + | +LL | fn call_it_once<F: FnOnce(&isize) -> isize>(_: F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_once` error: aborting due to 3 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr index 3b88b35d4ba..f9f1182e309 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr @@ -1,35 +1,41 @@ error[E0277]: expected a `Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:21:21 | -LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize { - | ------------------- required by this bound in `call_it` -... LL | let x = call_it(&square, 22); | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` +note: required by a bound in `call_it` + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:10:15 + | +LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` error[E0277]: expected a `FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:26:25 | -LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize { - | ---------------------- required by this bound in `call_it_mut` -... LL | let y = call_it_mut(&mut square, 22); | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` +note: required by a bound in `call_it_mut` + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:13:19 + | +LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut` error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:31:26 | -LL | fn call_it_once<F: FnOnce(&isize) -> isize>(_: F, _: isize) -> isize { - | ----------------------- required by this bound in `call_it_once` -... LL | let z = call_it_once(square, 22); | ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` +note: required by a bound in `call_it_once` + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:16:20 + | +LL | fn call_it_once<F: FnOnce(&isize) -> isize>(_: F, _: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_once` error: aborting due to 3 previous errors diff --git a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr index 89d36bfc926..6a104e8f94b 100644 --- a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr +++ b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr @@ -8,7 +8,7 @@ LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } help: consider introducing a named lifetime parameter | LL | fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } } - | ++++ ~~~~~~~ ~~~~~~~ ~~ + | ++++ ++ ++ ~~ error: aborting due to previous error diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index 4c207bd3e68..22bf1fdba32 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -43,7 +43,7 @@ LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } help: consider introducing a named lifetime parameter | LL | fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y } - | ++++ ~~~~~~ ~~~~~~ ~~ + | ++++ ~~ ~~ ~~ error: aborting due to 5 previous errors diff --git a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr index 9c4ee28a2ad..414d2759a47 100644 --- a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `U1: Copy` is not satisfied LL | #[derive(Clone)] | ^^^^^ the trait `Copy` is not implemented for `U1` | - ::: $SRC_DIR/core/src/clone.rs:LL:COL +note: required by a bound in `AssertParamIsCopy` + --> $SRC_DIR/core/src/clone.rs:LL:COL | LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { - | ---- required by this bound in `AssertParamIsCopy` - | + | ^^^^ required by this bound in `AssertParamIsCopy` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its trait bounds were not satisfied diff --git a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr index 9c4ee28a2ad..414d2759a47 100644 --- a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `U1: Copy` is not satisfied LL | #[derive(Clone)] | ^^^^^ the trait `Copy` is not implemented for `U1` | - ::: $SRC_DIR/core/src/clone.rs:LL:COL +note: required by a bound in `AssertParamIsCopy` + --> $SRC_DIR/core/src/clone.rs:LL:COL | LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { - | ---- required by this bound in `AssertParamIsCopy` - | + | ^^^^ required by this bound in `AssertParamIsCopy` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its trait bounds were not satisfied diff --git a/src/test/ui/union/union-derive-eq.mirunsafeck.stderr b/src/test/ui/union/union-derive-eq.mirunsafeck.stderr index 1d768315d9f..ff4dfcd2917 100644 --- a/src/test/ui/union/union-derive-eq.mirunsafeck.stderr +++ b/src/test/ui/union/union-derive-eq.mirunsafeck.stderr @@ -7,11 +7,11 @@ LL | union U2 { LL | a: PartialEqNotEq, | ^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `PartialEqNotEq` | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | -- required by this bound in `AssertParamIsEq` - | + | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/union/union-derive-eq.thirunsafeck.stderr b/src/test/ui/union/union-derive-eq.thirunsafeck.stderr index 1d768315d9f..ff4dfcd2917 100644 --- a/src/test/ui/union/union-derive-eq.thirunsafeck.stderr +++ b/src/test/ui/union/union-derive-eq.thirunsafeck.stderr @@ -7,11 +7,11 @@ LL | union U2 { LL | a: PartialEqNotEq, | ^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `PartialEqNotEq` | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | -- required by this bound in `AssertParamIsEq` - | + | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/unsized/issue-75707.stderr b/src/test/ui/unsized/issue-75707.stderr index 6e557a25f95..7d0a2cb85b6 100644 --- a/src/test/ui/unsized/issue-75707.stderr +++ b/src/test/ui/unsized/issue-75707.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `MyCall: Callback` is not satisfied --> $DIR/issue-75707.rs:15:5 | -LL | fn f<P: Processing + ?Sized>() { - | ---------- required by this bound in `f` -... LL | f::<dyn Processing<Call = MyCall>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall` + | +note: required by a bound in `f` + --> $DIR/issue-75707.rs:9:9 + | +LL | fn f<P: Processing + ?Sized>() { + | ^^^^^^^^^^ required by this bound in `f` error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 9af9cd24481..531e9b4c9c9 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -1,13 +1,16 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/unsized-bare-typaram.rs:2:29 | -LL | fn bar<T: Sized>() { } - | - required by this bound in `bar` LL | fn foo<T: ?Sized>() { bar::<T>() } | - ^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `bar` + --> $DIR/unsized-bare-typaram.rs:1:8 + | +LL | fn bar<T: Sized>() { } + | ^ required by this bound in `bar` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo<T: ?Sized>() { bar::<T>() } diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr index 88678307de2..980dee87e58 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -1,14 +1,16 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/unsized-enum.rs:6:36 | -LL | enum Foo<U> { FooSome(U), FooNone } - | - required by this bound in `Foo` -LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory. LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() } | - ^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Foo` + --> $DIR/unsized-enum.rs:4:10 + | +LL | enum Foo<U> { FooSome(U), FooNone } + | ^ required by this bound in `Foo` help: you could relax the implicit `Sized` bound on `U` if it were used through indirection like `&U` or `Box<U>` --> $DIR/unsized-enum.rs:4:10 | diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr index 7cd8383c52c..1a3c7d788f0 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -1,14 +1,16 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized-inherent-impl-self-type.rs:7:17 | -LL | struct S5<Y>(Y); - | - required by this bound in `S5` -LL | LL | impl<X: ?Sized> S5<X> { | - ^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `S5` + --> $DIR/unsized-inherent-impl-self-type.rs:5:11 + | +LL | struct S5<Y>(Y); + | ^ required by this bound in `S5` help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box<Y>` --> $DIR/unsized-inherent-impl-self-type.rs:5:11 | diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index fc2df2977ce..1c70a840c77 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -1,14 +1,16 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/unsized-struct.rs:6:36 | -LL | struct Foo<T> { data: T } - | - required by this bound in `Foo` -LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory. LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() } | - ^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `Foo` + --> $DIR/unsized-struct.rs:4:12 + | +LL | struct Foo<T> { data: T } + | ^ required by this bound in `Foo` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` --> $DIR/unsized-struct.rs:4:12 | @@ -25,9 +27,6 @@ LL + fn foo2<T>() { not_sized::<Foo<T>>() } error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/unsized-struct.rs:13:24 | -LL | fn is_sized<T:Sized>() { } - | - required by this bound in `is_sized` -... LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() } | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | | @@ -38,6 +37,11 @@ note: required because it appears within the type `Bar<T>` | LL | struct Bar<T: ?Sized> { data: T } | ^^^ +note: required by a bound in `is_sized` + --> $DIR/unsized-struct.rs:1:13 + | +LL | fn is_sized<T:Sized>() { } + | ^ required by this bound in `is_sized` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() } diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr index 55cdffec8c3..da251d4078b 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -1,14 +1,16 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized-trait-impl-self-type.rs:10:27 | -LL | struct S5<Y>(Y); - | - required by this bound in `S5` -LL | LL | impl<X: ?Sized> T3<X> for S5<X> { | - ^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `S5` + --> $DIR/unsized-trait-impl-self-type.rs:8:11 + | +LL | struct S5<Y>(Y); + | ^ required by this bound in `S5` help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box<Y>` --> $DIR/unsized-trait-impl-self-type.rs:8:11 | diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr index 7dfd0e43974..e91419070f5 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -1,14 +1,16 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized-trait-impl-trait-arg.rs:8:17 | -LL | trait T2<Z> { - | - required by this bound in `T2` -... LL | impl<X: ?Sized> T2<X> for S4<X> { | - ^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `T2` + --> $DIR/unsized-trait-impl-trait-arg.rs:4:10 + | +LL | trait T2<Z> { + | ^ required by this bound in `T2` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized> T2<X> for S4<X> { diff --git a/src/test/ui/unsized/unsized3.stderr b/src/test/ui/unsized/unsized3.stderr index e2331774ebe..f7bb6c9c78c 100644 --- a/src/test/ui/unsized/unsized3.stderr +++ b/src/test/ui/unsized/unsized3.stderr @@ -5,10 +5,12 @@ LL | fn f1<X: ?Sized>(x: &X) { | - this type parameter needs to be `std::marker::Sized` LL | f2::<X>(x); | ^ doesn't have a size known at compile-time -... -LL | fn f2<X>(x: &X) { - | - required by this bound in `f2` | +note: required by a bound in `f2` + --> $DIR/unsized3.rs:10:7 + | +LL | fn f2<X>(x: &X) { + | ^ required by this bound in `f2` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1<X: ?Sized>(x: &X) { @@ -26,10 +28,12 @@ LL | fn f3<X: ?Sized + T>(x: &X) { | - this type parameter needs to be `std::marker::Sized` LL | f4::<X>(x); | ^ doesn't have a size known at compile-time -... -LL | fn f4<X: T>(x: &X) { - | - required by this bound in `f4` | +note: required by a bound in `f4` + --> $DIR/unsized3.rs:21:7 + | +LL | fn f4<X: T>(x: &X) { + | ^ required by this bound in `f4` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3<X: ?Sized + T>(x: &X) { @@ -43,9 +47,6 @@ LL | fn f4<X: T + ?Sized>(x: &X) { error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized3.rs:33:8 | -LL | fn f5<Y>(x: &Y) {} - | - required by this bound in `f5` -... LL | fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) { | - this type parameter needs to be `std::marker::Sized` LL | f5(x1); @@ -56,6 +57,11 @@ note: required because it appears within the type `S<X>` | LL | struct S<X: ?Sized> { | ^ +note: required by a bound in `f5` + --> $DIR/unsized3.rs:24:7 + | +LL | fn f5<Y>(x: &Y) {} + | ^ required by this bound in `f5` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) { @@ -110,9 +116,6 @@ LL + fn f10<X>(x1: Box<S<X>>) { error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized3.rs:45:8 | -LL | fn f5<Y>(x: &Y) {} - | - required by this bound in `f5` -... LL | fn f10<X: ?Sized>(x1: Box<S<X>>) { | - this type parameter needs to be `std::marker::Sized` LL | f5(&(32, *x1)); @@ -124,6 +127,11 @@ note: required because it appears within the type `S<X>` LL | struct S<X: ?Sized> { | ^ = note: required because it appears within the type `({integer}, S<X>)` +note: required by a bound in `f5` + --> $DIR/unsized3.rs:24:7 + | +LL | fn f5<Y>(x: &Y) {} + | ^ required by this bound in `f5` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f10<X: ?Sized>(x1: Box<S<X>>) { diff --git a/src/test/ui/unsized/unsized7.stderr b/src/test/ui/unsized/unsized7.stderr index f176b8863f8..3246e26e6eb 100644 --- a/src/test/ui/unsized/unsized7.stderr +++ b/src/test/ui/unsized/unsized7.stderr @@ -1,14 +1,16 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized7.rs:12:21 | -LL | trait T1<Z: T> { - | - required by this bound in `T1` -... LL | impl<X: ?Sized + T> T1<X> for S3<X> { | - ^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | +note: required by a bound in `T1` + --> $DIR/unsized7.rs:7:10 + | +LL | trait T1<Z: T> { + | ^ required by this bound in `T1` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl<X: ?Sized + T> T1<X> for S3<X> { diff --git a/src/test/ui/wf/hir-wf-check-erase-regions.stderr b/src/test/ui/wf/hir-wf-check-erase-regions.stderr index 272a87535d2..0d9b9627562 100644 --- a/src/test/ui/wf/hir-wf-check-erase-regions.stderr +++ b/src/test/ui/wf/hir-wf-check-erase-regions.stderr @@ -4,13 +4,13 @@ error[E0277]: `&T` is not an iterator LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator | - ::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL - | -LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { - | ------------ required by this bound in `Flatten` - | = help: the trait `Iterator` is not implemented for `&T` = note: required because of the requirements on the impl of `IntoIterator` for `&T` +note: required by a bound in `Flatten` + --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL + | +LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { + | ^^^^^^^^^^^^ required by this bound in `Flatten` error[E0277]: `&T` is not an iterator --> $DIR/hir-wf-check-erase-regions.rs:10:27 @@ -18,13 +18,13 @@ error[E0277]: `&T` is not an iterator LL | fn into_iter(self) -> Self::IntoIter { | ^^^^^^^^^^^^^^ `&T` is not an iterator | - ::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL - | -LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { - | ------------ required by this bound in `Flatten` - | = help: the trait `Iterator` is not implemented for `&T` = note: required because of the requirements on the impl of `IntoIterator` for `&T` +note: required by a bound in `Flatten` + --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL + | +LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { + | ^^^^^^^^^^^^ required by this bound in `Flatten` error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-complex-assoc-type.stderr b/src/test/ui/wf/wf-complex-assoc-type.stderr index c366519a8d7..ef613e3132d 100644 --- a/src/test/ui/wf/wf-complex-assoc-type.stderr +++ b/src/test/ui/wf/wf-complex-assoc-type.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `bool: MyTrait` is not satisfied --> $DIR/wf-complex-assoc-type.rs:9:28 | -LL | struct AssertMyTrait<T: MyTrait>(T); - | ------- required by this bound in `AssertMyTrait` -... LL | type MyItem = Option<((AssertMyTrait<bool>, u8))>; | ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `bool` + | +note: required by a bound in `AssertMyTrait` + --> $DIR/wf-complex-assoc-type.rs:2:25 + | +LL | struct AssertMyTrait<T: MyTrait>(T); + | ^^^^^^^ required by this bound in `AssertMyTrait` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-const-type.stderr b/src/test/ui/wf/wf-const-type.stderr index d2e68548805..5a6d66ee7fa 100644 --- a/src/test/ui/wf/wf-const-type.stderr +++ b/src/test/ui/wf/wf-const-type.stderr @@ -1,13 +1,15 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-const-type.rs:10:12 | -LL | struct IsCopy<T:Copy> { t: T } - | ---- required by this bound in `IsCopy` -... LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required because of the requirements on the impl of `Copy` for `Option<NotCopy>` +note: required by a bound in `IsCopy` + --> $DIR/wf-const-type.rs:7:17 + | +LL | struct IsCopy<T:Copy> { t: T } + | ^^^^ required by this bound in `IsCopy` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index d62a6828ca3..d39fc0c6a45 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `U: Copy` is not satisfied --> $DIR/wf-enum-bound.rs:10:14 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -... LL | where T: ExtraCopy<U> | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `U` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-enum-bound.rs:7:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider further restricting type parameter `U` | LL | where T: ExtraCopy<U>, U: std::marker::Copy diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index 295037efb54..c12d62521f7 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `A: Copy` is not satisfied --> $DIR/wf-enum-fields-struct-variant.rs:13:12 | -LL | struct IsCopy<T:Copy> { - | ---- required by this bound in `IsCopy` -... LL | f: IsCopy<A> | ^^^^^^^^^ the trait `Copy` is not implemented for `A` | +note: required by a bound in `IsCopy` + --> $DIR/wf-enum-fields-struct-variant.rs:7:17 + | +LL | struct IsCopy<T:Copy> { + | ^^^^ required by this bound in `IsCopy` help: consider restricting type parameter `A` | LL | enum AnotherEnum<A: std::marker::Copy> { diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr index 496216a7fa8..ac3301a965a 100644 --- a/src/test/ui/wf/wf-enum-fields.stderr +++ b/src/test/ui/wf/wf-enum-fields.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `A: Copy` is not satisfied --> $DIR/wf-enum-fields.rs:12:17 | -LL | struct IsCopy<T:Copy> { - | ---- required by this bound in `IsCopy` -... LL | SomeVariant(IsCopy<A>) | ^^^^^^^^^ the trait `Copy` is not implemented for `A` | +note: required by a bound in `IsCopy` + --> $DIR/wf-enum-fields.rs:7:17 + | +LL | struct IsCopy<T:Copy> { + | ^^^^ required by this bound in `IsCopy` help: consider restricting type parameter `A` | LL | enum SomeEnum<A: std::marker::Copy> { diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 1302d0e1761..2aec641e71e 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `U: Copy` is not satisfied --> $DIR/wf-fn-where-clause.rs:8:24 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -LL | LL | fn foo<T,U>() where T: ExtraCopy<U> | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `U` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-fn-where-clause.rs:6:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider further restricting type parameter `U` | LL | fn foo<T,U>() where T: ExtraCopy<U>, U: std::marker::Copy @@ -17,11 +19,13 @@ error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known | LL | fn bar() where Vec<dyn Copy>:, {} | ^^^^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | struct Vec<T> { - | - required by this bound in `Vec` | = help: the trait `Sized` is not implemented for `(dyn Copy + 'static)` +note: required by a bound in `Vec` + --> $DIR/wf-fn-where-clause.rs:16:12 + | +LL | struct Vec<T> { + | ^ required by this bound in `Vec` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` --> $DIR/wf-fn-where-clause.rs:16:12 | diff --git a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr index f6b48938f9b..66bfdbc5962 100644 --- a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr +++ b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr @@ -1,20 +1,26 @@ error[E0277]: the trait bound `(): Foo` is not satisfied --> $DIR/wf-foreign-fn-decl-ret.rs:11:25 | -LL | pub trait Foo { - | ------------- required by this bound in `Foo` -... LL | pub fn lint_me() -> <() as Foo>::Assoc; | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` + | +note: required by a bound in `Foo` + --> $DIR/wf-foreign-fn-decl-ret.rs:6:1 + | +LL | pub trait Foo { + | ^^^^^^^^^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied --> $DIR/wf-foreign-fn-decl-ret.rs:14:32 | -LL | pub struct Bar<T: Unsatisfied>(T); - | ----------- required by this bound in `Bar` -... LL | pub fn lint_me_aswell() -> Bar<u32>; | ^^^^^^^^ the trait `Unsatisfied` is not implemented for `u32` + | +note: required by a bound in `Bar` + --> $DIR/wf-foreign-fn-decl-ret.rs:4:19 + | +LL | pub struct Bar<T: Unsatisfied>(T); + | ^^^^^^^^^^^ required by this bound in `Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-impl-associated-type-trait.stderr b/src/test/ui/wf/wf-impl-associated-type-trait.stderr index 50b4e5d8e7e..bdf8bba5ee0 100644 --- a/src/test/ui/wf/wf-impl-associated-type-trait.stderr +++ b/src/test/ui/wf/wf-impl-associated-type-trait.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: MyHash` is not satisfied --> $DIR/wf-impl-associated-type-trait.rs:17:16 | -LL | pub struct MySet<T:MyHash> { - | ------ required by this bound in `MySet` -... LL | type Bar = MySet<T>; | ^^^^^^^^ the trait `MyHash` is not implemented for `T` | +note: required by a bound in `MySet` + --> $DIR/wf-impl-associated-type-trait.rs:8:20 + | +LL | pub struct MySet<T:MyHash> { + | ^^^^^^ required by this bound in `MySet` help: consider restricting type parameter `T` | LL | impl<T: MyHash> Foo for T { diff --git a/src/test/ui/wf/wf-impl-self-type.stderr b/src/test/ui/wf/wf-impl-self-type.stderr index 918e5feb286..371321793ad 100644 --- a/src/test/ui/wf/wf-impl-self-type.stderr +++ b/src/test/ui/wf/wf-impl-self-type.stderr @@ -4,12 +4,12 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | impl Foo for Option<[u8]> {} | ^^^^^^^^^^^^ doesn't have a size known at compile-time | - ::: $SRC_DIR/core/src/option.rs:LL:COL + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Option` + --> $SRC_DIR/core/src/option.rs:LL:COL | LL | pub enum Option<T> { - | - required by this bound in `Option` - | - = help: the trait `Sized` is not implemented for `[u8]` + | ^ required by this bound in `Option` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr index 94899e21876..83a4a592ad3 100644 --- a/src/test/ui/wf/wf-in-fn-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-arg.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/wf-in-fn-arg.rs:10:15 | -LL | struct MustBeCopy<T:Copy> { - | ---- required by this bound in `MustBeCopy` -... LL | fn bar<T>(_: &MustBeCopy<T>) | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `MustBeCopy` + --> $DIR/wf-in-fn-arg.rs:6:21 + | +LL | struct MustBeCopy<T:Copy> { + | ^^^^ required by this bound in `MustBeCopy` help: consider restricting type parameter `T` | LL | fn bar<T: std::marker::Copy>(_: &MustBeCopy<T>) diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr index 731331c894a..7eeb9747283 100644 --- a/src/test/ui/wf/wf-in-fn-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-ret.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/wf-in-fn-ret.rs:10:16 | -LL | struct MustBeCopy<T:Copy> { - | ---- required by this bound in `MustBeCopy` -... LL | fn bar<T>() -> MustBeCopy<T> | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `MustBeCopy` + --> $DIR/wf-in-fn-ret.rs:6:21 + | +LL | struct MustBeCopy<T:Copy> { + | ^^^^ required by this bound in `MustBeCopy` help: consider restricting type parameter `T` | LL | fn bar<T: std::marker::Copy>() -> MustBeCopy<T> diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index e41fe321142..be5e9d4182b 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/wf-in-fn-type-arg.rs:9:11 | -LL | struct MustBeCopy<T:Copy> { - | ---- required by this bound in `MustBeCopy` -... LL | x: fn(MustBeCopy<T>) | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `MustBeCopy` + --> $DIR/wf-in-fn-type-arg.rs:3:21 + | +LL | struct MustBeCopy<T:Copy> { + | ^^^^ required by this bound in `MustBeCopy` help: consider restricting type parameter `T` | LL | struct Bar<T: std::marker::Copy> { diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 36ee740de31..8fcfcb0b21a 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/wf-in-fn-type-ret.rs:9:16 | -LL | struct MustBeCopy<T:Copy> { - | ---- required by this bound in `MustBeCopy` -... LL | x: fn() -> MustBeCopy<T> | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `MustBeCopy` + --> $DIR/wf-in-fn-type-ret.rs:3:21 + | +LL | struct MustBeCopy<T:Copy> { + | ^^^^ required by this bound in `MustBeCopy` help: consider restricting type parameter `T` | LL | struct Foo<T: std::marker::Copy> { diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index 5d9501bac85..160a738409b 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `U: Copy` is not satisfied --> $DIR/wf-in-fn-where-clause.rs:10:14 | -LL | trait MustBeCopy<T:Copy> { - | ---- required by this bound in `MustBeCopy` -... LL | where T: MustBeCopy<U> | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `U` | +note: required by a bound in `MustBeCopy` + --> $DIR/wf-in-fn-where-clause.rs:6:20 + | +LL | trait MustBeCopy<T:Copy> { + | ^^^^ required by this bound in `MustBeCopy` help: consider further restricting type parameter `U` | LL | where T: MustBeCopy<U>, U: std::marker::Copy diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index abf53010a60..f556b678e0e 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/wf-in-obj-type-trait.rs:11:19 | -LL | struct MustBeCopy<T:Copy> { - | ---- required by this bound in `MustBeCopy` -... LL | x: dyn Object<MustBeCopy<T>> | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `MustBeCopy` + --> $DIR/wf-in-obj-type-trait.rs:5:21 + | +LL | struct MustBeCopy<T:Copy> { + | ^^^^ required by this bound in `MustBeCopy` help: consider restricting type parameter `T` | LL | struct Bar<T: std::marker::Copy> { diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index 097d23ddc5f..e723d1ba76b 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `U: Copy` is not satisfied --> $DIR/wf-inherent-impl-method-where-clause.rs:12:27 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -... LL | fn foo(self) where T: ExtraCopy<U> | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `U` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-inherent-impl-method-where-clause.rs:7:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider restricting type parameter `U` | LL | impl<T,U: std::marker::Copy> Foo<T,U> { diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index 5767cae5bc9..39e0d348ea5 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `U: Copy` is not satisfied --> $DIR/wf-inherent-impl-where-clause.rs:11:29 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -... LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U> | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `U` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-inherent-impl-where-clause.rs:7:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider further restricting type parameter `U` | LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U>, U: std::marker::Copy diff --git a/src/test/ui/wf/wf-static-type.stderr b/src/test/ui/wf/wf-static-type.stderr index a98184633b5..c45bd577762 100644 --- a/src/test/ui/wf/wf-static-type.stderr +++ b/src/test/ui/wf/wf-static-type.stderr @@ -1,13 +1,15 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | -LL | struct IsCopy<T:Copy> { t: T } - | ---- required by this bound in `IsCopy` -... LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required because of the requirements on the impl of `Copy` for `Option<NotCopy>` +note: required by a bound in `IsCopy` + --> $DIR/wf-static-type.rs:7:17 + | +LL | struct IsCopy<T:Copy> { t: T } + | ^^^^ required by this bound in `IsCopy` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 6d72ef70355..6248e3e4e43 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `U: Copy` is not satisfied --> $DIR/wf-struct-bound.rs:10:14 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -... LL | where T: ExtraCopy<U> | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `U` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-struct-bound.rs:7:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider further restricting type parameter `U` | LL | where T: ExtraCopy<U>, U: std::marker::Copy diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index e4c322163d7..78a8da8602a 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `A: Copy` is not satisfied --> $DIR/wf-struct-field.rs:12:11 | -LL | struct IsCopy<T:Copy> { - | ---- required by this bound in `IsCopy` -... LL | data: IsCopy<A> | ^^^^^^^^^ the trait `Copy` is not implemented for `A` | +note: required by a bound in `IsCopy` + --> $DIR/wf-struct-field.rs:7:17 + | +LL | struct IsCopy<T:Copy> { + | ^^^^ required by this bound in `IsCopy` help: consider restricting type parameter `A` | LL | struct SomeStruct<A: std::marker::Copy> { diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index 404f3400a48..8297700171f 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/wf-trait-associated-type-bound.rs:10:17 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -... LL | type Type1: ExtraCopy<T>; | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-trait-associated-type-bound.rs:7:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider restricting type parameter `T` | LL | trait SomeTrait<T: std::marker::Copy> { diff --git a/src/test/ui/wf/wf-trait-associated-type-trait.stderr b/src/test/ui/wf/wf-trait-associated-type-trait.stderr index dc1cd3d17c3..a73c3a2aed6 100644 --- a/src/test/ui/wf/wf-trait-associated-type-trait.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-trait.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `<Self as SomeTrait>::Type1: Copy` is not satisfied --> $DIR/wf-trait-associated-type-trait.rs:11:19 | -LL | struct IsCopy<T:Copy> { x: T } - | ---- required by this bound in `IsCopy` -... LL | type Type2 = (IsCopy<Self::Type1>, bool); | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `<Self as SomeTrait>::Type1` | +note: required by a bound in `IsCopy` + --> $DIR/wf-trait-associated-type-trait.rs:7:17 + | +LL | struct IsCopy<T:Copy> { x: T } + | ^^^^ required by this bound in `IsCopy` help: consider further restricting the associated type | LL | trait SomeTrait where <Self as SomeTrait>::Type1: Copy { diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index 4b77d48e87c..bace3e3ef00 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `U: Copy` is not satisfied --> $DIR/wf-trait-bound.rs:10:14 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -... LL | where T: ExtraCopy<U> | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `U` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-trait-bound.rs:7:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider further restricting type parameter `U` | LL | where T: ExtraCopy<U>, U: std::marker::Copy diff --git a/src/test/ui/wf/wf-trait-default-fn-arg.stderr b/src/test/ui/wf/wf-trait-default-fn-arg.stderr index 81b0dd04d29..8c3d0568fdf 100644 --- a/src/test/ui/wf/wf-trait-default-fn-arg.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-arg.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied --> $DIR/wf-trait-default-fn-arg.rs:11:23 | -LL | struct Bar<T:Eq+?Sized> { value: Box<T> } - | -- required by this bound in `Bar` -... LL | fn bar(&self, x: &Bar<Self>) { | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-default-fn-arg.rs:8:14 + | +LL | struct Bar<T:Eq+?Sized> { value: Box<T> } + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar(&self, x: &Bar<Self>) where Self: Eq { diff --git a/src/test/ui/wf/wf-trait-default-fn-ret.stderr b/src/test/ui/wf/wf-trait-default-fn-ret.stderr index d0da0ee5860..6422e862d28 100644 --- a/src/test/ui/wf/wf-trait-default-fn-ret.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-ret.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied --> $DIR/wf-trait-default-fn-ret.rs:11:22 | -LL | struct Bar<T:Eq+?Sized> { value: Box<T> } - | -- required by this bound in `Bar` -... LL | fn bar(&self) -> Bar<Self> { | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-default-fn-ret.rs:8:14 + | +LL | struct Bar<T:Eq+?Sized> { value: Box<T> } + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar(&self) -> Bar<Self> where Self: Eq { diff --git a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr index 1572d069325..f260d5750c5 100644 --- a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied --> $DIR/wf-trait-default-fn-where-clause.rs:11:31 | -LL | trait Bar<T:Eq+?Sized> { } - | -- required by this bound in `Bar` -... LL | fn bar<A>(&self) where A: Bar<Self> { | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-default-fn-where-clause.rs:8:13 + | +LL | trait Bar<T:Eq+?Sized> { } + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar<A>(&self) where A: Bar<Self>, Self: Eq { diff --git a/src/test/ui/wf/wf-trait-fn-arg.stderr b/src/test/ui/wf/wf-trait-fn-arg.stderr index 3b366605b75..3bd1f48928d 100644 --- a/src/test/ui/wf/wf-trait-fn-arg.stderr +++ b/src/test/ui/wf/wf-trait-fn-arg.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied --> $DIR/wf-trait-fn-arg.rs:10:23 | -LL | struct Bar<T:Eq+?Sized> { value: Box<T> } - | -- required by this bound in `Bar` -... LL | fn bar(&self, x: &Bar<Self>); | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-fn-arg.rs:7:14 + | +LL | struct Bar<T:Eq+?Sized> { value: Box<T> } + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar(&self, x: &Bar<Self>) where Self: Eq; diff --git a/src/test/ui/wf/wf-trait-fn-ret.stderr b/src/test/ui/wf/wf-trait-fn-ret.stderr index d289501d163..a59ba3400a4 100644 --- a/src/test/ui/wf/wf-trait-fn-ret.stderr +++ b/src/test/ui/wf/wf-trait-fn-ret.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied --> $DIR/wf-trait-fn-ret.rs:10:22 | -LL | struct Bar<T:Eq+?Sized> { value: Box<T> } - | -- required by this bound in `Bar` -... LL | fn bar(&self) -> &Bar<Self>; | ^^^^^^^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-fn-ret.rs:7:14 + | +LL | struct Bar<T:Eq+?Sized> { value: Box<T> } + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar(&self) -> &Bar<Self> where Self: Eq; diff --git a/src/test/ui/wf/wf-trait-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-fn-where-clause.stderr index ad517511a63..d064f7fc56e 100644 --- a/src/test/ui/wf/wf-trait-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-fn-where-clause.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied --> $DIR/wf-trait-fn-where-clause.rs:10:49 | -LL | struct Bar<T:Eq+?Sized> { value: Box<T> } - | -- required by this bound in `Bar` -... LL | fn bar(&self) where Self: Sized, Bar<Self>: Copy; | ^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-fn-where-clause.rs:7:14 + | +LL | struct Bar<T:Eq+?Sized> { value: Box<T> } + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar(&self) where Self: Sized, Bar<Self>: Copy, Self: Eq; diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index c3016cff0f5..cd49243a4bf 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/wf-trait-superbound.rs:9:21 | -LL | trait ExtraCopy<T:Copy> { } - | ---- required by this bound in `ExtraCopy` -LL | LL | trait SomeTrait<T>: ExtraCopy<T> { | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `ExtraCopy` + --> $DIR/wf-trait-superbound.rs:7:19 + | +LL | trait ExtraCopy<T:Copy> { } + | ^^^^ required by this bound in `ExtraCopy` help: consider restricting type parameter `T` | LL | trait SomeTrait<T: std::marker::Copy>: ExtraCopy<T> { diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index 08945c5fdc1..0df5f91c8f3 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:13:22 | -LL | fn require_copy<T: Copy>(x: T) {} - | ---- required by this bound in `require_copy` -... LL | require_copy(self.x); | ^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `require_copy` + --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:1:20 + | +LL | fn require_copy<T: Copy>(x: T) {} + | ^^^^ required by this bound in `require_copy` help: consider restricting type parameter `T` | LL | impl<T: std::marker::Copy> Foo<T> { diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 1a54ec25291..97d651e0bec 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:18:22 | -LL | fn require_copy<T: Copy>(x: T) {} - | ---- required by this bound in `require_copy` -... LL | require_copy(self.x); | ^^^^^^ the trait `Copy` is not implemented for `T` | +note: required by a bound in `require_copy` + --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:1:20 + | +LL | fn require_copy<T: Copy>(x: T) {} + | ^^^^ required by this bound in `require_copy` help: consider restricting type parameter `T` | LL | impl<T: std::marker::Copy> Foo<T> for Bar<T> { diff --git a/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr index 9e19b9a3b11..ba18119ff1b 100644 --- a/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr @@ -1,11 +1,14 @@ error[E0277]: the trait bound `Struct: Eq` is not satisfied --> $DIR/where-clauses-unsatisfied.rs:6:10 | -LL | fn equal<T>(a: &T, b: &T) -> bool where T : Eq { a == b } - | -- required by this bound in `equal` -... LL | drop(equal(&Struct, &Struct)) | ^^^^^ the trait `Eq` is not implemented for `Struct` + | +note: required by a bound in `equal` + --> $DIR/where-clauses-unsatisfied.rs:1:45 + | +LL | fn equal<T>(a: &T, b: &T) -> bool where T : Eq { a == b } + | ^^ required by this bound in `equal` error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-for-self-2.nll.stderr b/src/test/ui/where-clauses/where-for-self-2.nll.stderr index d0c476dc6ec..f65db78fc89 100644 --- a/src/test/ui/where-clauses/where-for-self-2.nll.stderr +++ b/src/test/ui/where-clauses/where-for-self-2.nll.stderr @@ -1,8 +1,11 @@ -error: higher-ranked subtype error +error: implementation of `Bar` is not general enough --> $DIR/where-for-self-2.rs:23:5 | LL | foo(&X); - | ^^^^^^^ + | ^^^^^^^ implementation of `Bar` is not general enough + | + = note: `&'0 u32` must implement `Bar`, for any lifetime `'0`... + = note: ...but `Bar` is actually implemented for the type `&'static u32` error: aborting due to previous error |
