diff options
Diffstat (limited to 'src/test')
167 files changed, 1417 insertions, 1568 deletions
diff --git a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff b/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff index 4fdd4b2b4bb..84d72202d52 100644 --- a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff @@ -21,7 +21,7 @@ // + span: $DIR/const_prop_fails_gracefully.rs:7:13: 7:16 // + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) } _2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16 - _1 = move _2 as usize (PointerAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:39 + _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:39 StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:38: 7:39 StorageDead(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:39: 7:40 StorageLive(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:8:5: 8:12 diff --git a/src/test/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff b/src/test/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff index 7eb34ed5469..037febdf3a5 100644 --- a/src/test/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff @@ -17,9 +17,9 @@ // mir::Constant // + span: $DIR/reify_fn_ptr.rs:4:13: 4:17 // + literal: Const { ty: fn() {main}, val: Value(Scalar(<ZST>)) } - _2 = move _3 as usize (PointerAddress); // scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:26 + _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:26 StorageDead(_3); // scope 0 at $DIR/reify_fn_ptr.rs:4:25: 4:26 - _1 = move _2 as *const fn() (Misc); // scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:41 + _1 = move _2 as *const fn() (PointerFromExposedAddress); // scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:41 StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:4:40: 4:41 StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:4:41: 4:42 nop; // scope 0 at $DIR/reify_fn_ptr.rs:3:11: 5:2 diff --git a/src/test/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff b/src/test/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff index bf32245e300..2331f63ecdd 100644 --- a/src/test/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff +++ b/src/test/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff @@ -19,12 +19,12 @@ StorageLive(_2); // scope 0 at $DIR/provenance_soundness.rs:8:9: 8:11 StorageLive(_3); // scope 0 at $DIR/provenance_soundness.rs:8:14: 8:15 _3 = _1; // scope 0 at $DIR/provenance_soundness.rs:8:14: 8:15 - _2 = move _3 as usize (PointerAddress); // scope 0 at $DIR/provenance_soundness.rs:8:14: 8:24 + _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/provenance_soundness.rs:8:14: 8:24 StorageDead(_3); // scope 0 at $DIR/provenance_soundness.rs:8:23: 8:24 StorageLive(_4); // scope 1 at $DIR/provenance_soundness.rs:9:9: 9:11 StorageLive(_5); // scope 1 at $DIR/provenance_soundness.rs:9:14: 9:15 _5 = _1; // scope 1 at $DIR/provenance_soundness.rs:9:14: 9:15 - _4 = move _5 as isize (PointerAddress); // scope 1 at $DIR/provenance_soundness.rs:9:14: 9:24 + _4 = move _5 as isize (PointerExposeAddress); // scope 1 at $DIR/provenance_soundness.rs:9:14: 9:24 StorageDead(_5); // scope 1 at $DIR/provenance_soundness.rs:9:23: 9:24 _0 = const (); // scope 0 at $DIR/provenance_soundness.rs:7:32: 10:2 StorageDead(_4); // scope 1 at $DIR/provenance_soundness.rs:10:1: 10:2 diff --git a/src/test/rustdoc-js/impl-trait.js b/src/test/rustdoc-js/impl-trait.js new file mode 100644 index 00000000000..8d594bf8aea --- /dev/null +++ b/src/test/rustdoc-js/impl-trait.js @@ -0,0 +1,51 @@ +// ignore-order + +const QUERY = [ + 'Aaaaaaa -> i32', + 'Aaaaaaa -> Aaaaaaa', + 'Aaaaaaa -> usize', + '-> Aaaaaaa', + 'Aaaaaaa', +]; + +const EXPECTED = [ + { + // Aaaaaaa -> i32 + 'others': [ + { 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' }, + ], + }, + { + // Aaaaaaa -> Aaaaaaa + 'others': [ + { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, + ], + }, + { + // Aaaaaaa -> usize + 'others': [], + }, + { + // -> Aaaaaaa + 'others': [ + { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' }, + { 'path': 'impl_trait', 'name': 'bbbbbbb' }, + ], + }, + { + // Aaaaaaa + 'others': [ + { 'path': 'impl_trait', 'name': 'Aaaaaaa' }, + ], + 'in_args': [ + { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' }, + ], + 'returned': [ + { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, + { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' }, + { 'path': 'impl_trait', 'name': 'bbbbbbb' }, + ], + }, +]; diff --git a/src/test/rustdoc-js/impl-trait.rs b/src/test/rustdoc-js/impl-trait.rs new file mode 100644 index 00000000000..fb8869b46f3 --- /dev/null +++ b/src/test/rustdoc-js/impl-trait.rs @@ -0,0 +1,21 @@ +pub trait Aaaaaaa {} + +impl Aaaaaaa for () {} + +pub fn bbbbbbb() -> impl Aaaaaaa { + () +} + +pub struct Ccccccc {} + +impl Ccccccc { + pub fn ddddddd(&self) -> impl Aaaaaaa { + () + } + pub fn eeeeeee(&self, _x: impl Aaaaaaa) -> i32 { + 0 + } + pub fn fffffff(&self, x: impl Aaaaaaa) -> impl Aaaaaaa { + x + } +} diff --git a/src/test/rustdoc-js/raw-pointer.js b/src/test/rustdoc-js/raw-pointer.js new file mode 100644 index 00000000000..140b955ea71 --- /dev/null +++ b/src/test/rustdoc-js/raw-pointer.js @@ -0,0 +1,55 @@ +// ignore-order + +const QUERY = [ + 'Aaaaaaa -> i32', + 'Aaaaaaa -> Aaaaaaa', + 'Aaaaaaa -> usize', + '-> Aaaaaaa', + 'Aaaaaaa', +]; + +const EXPECTED = [ + { + // Aaaaaaa -> i32 + 'others': [ + { 'path': 'raw_pointer::Ccccccc', 'name': 'eeeeeee' }, + ], + }, + { + // Aaaaaaa -> Aaaaaaa + 'others': [ + { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' }, + { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' }, + ], + }, + { + // Aaaaaaa -> usize + 'others': [], + }, + { + // -> Aaaaaaa + 'others': [ + { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' }, + { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' }, + { 'path': 'raw_pointer::Ccccccc', 'name': 'ddddddd' }, + { 'path': 'raw_pointer', 'name': 'bbbbbbb' }, + ], + }, + { + // Aaaaaaa + 'others': [ + { 'path': 'raw_pointer', 'name': 'Aaaaaaa' }, + ], + 'in_args': [ + { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' }, + { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' }, + { 'path': 'raw_pointer::Ccccccc', 'name': 'eeeeeee' }, + ], + 'returned': [ + { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' }, + { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' }, + { 'path': 'raw_pointer::Ccccccc', 'name': 'ddddddd' }, + { 'path': 'raw_pointer', 'name': 'bbbbbbb' }, + ], + }, +]; diff --git a/src/test/rustdoc-js/raw-pointer.rs b/src/test/rustdoc-js/raw-pointer.rs new file mode 100644 index 00000000000..b8ace2e0b7d --- /dev/null +++ b/src/test/rustdoc-js/raw-pointer.rs @@ -0,0 +1,24 @@ +use std::ptr; + +pub struct Aaaaaaa {} + +pub fn bbbbbbb() -> *const Aaaaaaa { + ptr::null() +} + +pub struct Ccccccc {} + +impl Ccccccc { + pub fn ddddddd(&self) -> *const Aaaaaaa { + ptr::null() + } + pub fn eeeeeee(&self, _x: *const Aaaaaaa) -> i32 { + 0 + } + pub fn fffffff(&self, x: *const Aaaaaaa) -> *const Aaaaaaa { + x + } + pub fn ggggggg(&self, x: *mut Aaaaaaa) -> *mut Aaaaaaa { + x + } +} diff --git a/src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.rs new file mode 100644 index 00000000000..fd6ac8372d9 --- /dev/null +++ b/src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.rs @@ -0,0 +1,17 @@ +// Regression test for https://github.com/rust-lang/rust/issues/97432. + +#![feature(no_core)] +#![no_std] +#![no_core] + +// @has same_type_reexported_more_than_once.json +// @set trait_id = - "$.index[*][?(@.name=='Trait')].id" +// @has - "$.index[*][?(@.name=='same_type_reexported_more_than_once')].inner.items[*]" $trait_id +pub use inner::Trait; +// @set reexport_id = - "$.index[*][?(@.name=='Reexport')].id" +// @has - "$.index[*][?(@.name=='same_type_reexported_more_than_once')].inner.items[*]" $reexport_id +pub use inner::Trait as Reexport; + +mod inner { + pub trait Trait {} +} diff --git a/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr b/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr index b60ab6050d7..b54f8200666 100644 --- a/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr +++ b/src/test/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr @@ -3,6 +3,8 @@ error[E0433]: failed to resolve: maybe a missing crate `unresolved_crate`? | LL | use unresolved_crate::module::Name; | ^^^^^^^^^^^^^^^^ maybe a missing crate `unresolved_crate`? + | + = help: consider adding `extern crate unresolved_crate` to use the `unresolved_crate` crate error: Compilation failed, aborting rustdoc diff --git a/src/test/rustdoc-ui/issue-61732.stderr b/src/test/rustdoc-ui/issue-61732.stderr index 82134224911..38fadaa4435 100644 --- a/src/test/rustdoc-ui/issue-61732.stderr +++ b/src/test/rustdoc-ui/issue-61732.stderr @@ -3,6 +3,8 @@ error[E0433]: failed to resolve: maybe a missing crate `r#mod`? | LL | pub(in crate::r#mod) fn main() {} | ^^^^^ maybe a missing crate `r#mod`? + | + = help: consider adding `extern crate r#mod` to use the `r#mod` crate error: Compilation failed, aborting rustdoc diff --git a/src/test/rustdoc/anonymous-reexport.rs b/src/test/rustdoc/anonymous-reexport.rs new file mode 100644 index 00000000000..6b884ff14df --- /dev/null +++ b/src/test/rustdoc/anonymous-reexport.rs @@ -0,0 +1,22 @@ +#![crate_name = "foo"] + +// This test ensures we don't display anonymous (non-inline) re-exports of public items. + +// @has 'foo/index.html' +// @has - '//*[@id="main-content"]' '' +// We check that the only "h2" present is for "Bla". +// @count - '//*[@id="main-content"]/h2' 1 +// @has - '//*[@id="main-content"]/h2' 'Structs' +// @count - '//*[@id="main-content"]//a[@class="struct"]' 1 + +mod ext { + pub trait Foo {} + pub trait Bar {} + pub struct S; +} + +pub use crate::ext::Foo as _; +pub use crate::ext::Bar as _; +pub use crate::ext::S as _; + +pub struct Bla; diff --git a/src/test/rustdoc/inline_cross/auxiliary/implementors_inline.rs b/src/test/rustdoc/inline_cross/auxiliary/implementors_inline.rs new file mode 100644 index 00000000000..b003fb357d0 --- /dev/null +++ b/src/test/rustdoc/inline_cross/auxiliary/implementors_inline.rs @@ -0,0 +1,18 @@ +pub mod my_trait { + pub trait MyTrait { + fn my_fn(&self) -> Self; + } +} + +pub mod prelude { + #[doc(inline)] + pub use crate::my_trait::MyTrait; +} + +pub struct SomeStruct; + +impl my_trait::MyTrait for SomeStruct { + fn my_fn(&self) -> SomeStruct { + SomeStruct + } +} diff --git a/src/test/rustdoc/inline_cross/implementors-js.rs b/src/test/rustdoc/inline_cross/implementors-js.rs new file mode 100644 index 00000000000..c79f05d8d3c --- /dev/null +++ b/src/test/rustdoc/inline_cross/implementors-js.rs @@ -0,0 +1,25 @@ +// aux-build:implementors_inline.rs +// build-aux-docs +// ignore-cross-compile + +extern crate implementors_inline; + +// @!has implementors/implementors_js/trait.MyTrait.js +// @has implementors/implementors_inline/my_trait/trait.MyTrait.js +// @!has implementors/implementors_inline/prelude/trait.MyTrait.js +// @has implementors_inline/my_trait/trait.MyTrait.html +// @has - '//script/@src' '../../implementors/implementors_inline/my_trait/trait.MyTrait.js' +// @has implementors_js/trait.MyTrait.html +// @has - '//script/@src' '../implementors/implementors_inline/my_trait/trait.MyTrait.js' +/// When re-exporting this trait, the HTML will be inlined, +/// but, vitally, the JavaScript will be located only at the +/// one canonical path. +pub use implementors_inline::prelude::MyTrait; + +pub struct OtherStruct; + +impl MyTrait for OtherStruct { + fn my_fn(&self) -> OtherStruct { + OtherStruct + } +} diff --git a/src/test/rustdoc/intra-doc/email-address.rs b/src/test/rustdoc/intra-doc/email-address.rs index ae74fbbc892..24161c3bb48 100644 --- a/src/test/rustdoc/intra-doc/email-address.rs +++ b/src/test/rustdoc/intra-doc/email-address.rs @@ -1,8 +1,10 @@ -#![allow(rustdoc::broken_intra_doc_links)] +#![forbid(rustdoc::broken_intra_doc_links)] //! Email me at <hello@example.com>. //! Email me at <hello-world@example.com>. -//! Email me at <hello@localhost> (this warns but will still become a link). +//! Email me at <hello@localhost>. +//! Email me at <prim@i32>. // @has email_address/index.html '//a[@href="mailto:hello@example.com"]' 'hello@example.com' // @has email_address/index.html '//a[@href="mailto:hello-world@example.com"]' 'hello-world@example.com' // @has email_address/index.html '//a[@href="mailto:hello@localhost"]' 'hello@localhost' +// @has email_address/index.html '//a[@href="mailto:prim@i32"]' 'prim@i32' diff --git a/src/test/rustdoc/issue-75588.rs b/src/test/rustdoc/issue-75588.rs index ac97b94fb35..a8cb16ec34c 100644 --- a/src/test/rustdoc/issue-75588.rs +++ b/src/test/rustdoc/issue-75588.rs @@ -13,5 +13,5 @@ extern crate real_gimli; // @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3[@class="code-header in-band"]' 'impl Deref for EndianSlice' pub use realcore::Deref; -// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3[@class="code-header in-band"]' 'impl Join for Foo' +// @has foo/trait.Join.html '//*[@id="impl-Join"]//h3[@class="code-header in-band"]' 'impl Join for Foo' pub use realcore::Join; diff --git a/src/test/rustdoc/nested-modules.rs b/src/test/rustdoc/nested-modules.rs new file mode 100644 index 00000000000..1596f46740e --- /dev/null +++ b/src/test/rustdoc/nested-modules.rs @@ -0,0 +1,42 @@ +#![crate_name = "aCrate"] + +mod a_module { + pub fn private_function() {} + + pub use a_module::private_function as other_private_function; + + pub mod a_nested_module { + // @has aCrate/a_nested_module/index.html '//a[@href="fn.a_nested_public_function.html"]' 'a_nested_public_function' + // @has aCrate/a_nested_module/fn.a_nested_public_function.html 'pub fn a_nested_public_function()' + pub fn a_nested_public_function() {} + + // @has aCrate/a_nested_module/index.html '//a[@href="fn.another_nested_public_function.html"]' 'another_nested_public_function' + // @has aCrate/a_nested_module/fn.another_nested_public_function.html 'pub fn another_nested_public_function()' + pub use a_nested_module::a_nested_public_function as another_nested_public_function; + } + + // @!has aCrate/a_nested_module/index.html 'yet_another_nested_public_function' + pub use a_nested_module::a_nested_public_function as yet_another_nested_public_function; + + // @!has aCrate/a_nested_module/index.html 'one_last_nested_public_function' + pub use a_nested_module::another_nested_public_function as one_last_nested_public_function; +} + +// @!has aCrate/index.html 'a_module' +// @has aCrate/index.html '//a[@href="a_nested_module/index.html"]' 'a_nested_module' +pub use a_module::a_nested_module; + +// @has aCrate/index.html '//a[@href="fn.a_nested_public_function.html"]' 'a_nested_public_function' +// @has aCrate/index.html '//a[@href="fn.another_nested_public_function.html"]' 'another_nested_public_function' +// @has aCrate/index.html '//a[@href="fn.yet_another_nested_public_function.html"]' 'yet_another_nested_public_function' +// @has aCrate/index.html '//a[@href="fn.one_last_nested_public_function.html"]' 'one_last_nested_public_function' +pub use a_module::{ + a_nested_module::{a_nested_public_function, another_nested_public_function}, + one_last_nested_public_function, yet_another_nested_public_function, +}; + +// @has aCrate/index.html '//a[@href="fn.private_function.html"]' 'private_function' +// @!has aCrate/fn.private_function.html 'a_module' +// @has aCrate/index.html '//a[@href="fn.other_private_function.html"]' 'other_private_function' +// @!has aCrate/fn.other_private_function.html 'a_module' +pub use a_module::{other_private_function, private_function}; diff --git a/src/test/rustdoc/primitive-slice-auto-trait.rs b/src/test/rustdoc/primitive-slice-auto-trait.rs new file mode 100644 index 00000000000..b3f511bc1f1 --- /dev/null +++ b/src/test/rustdoc/primitive-slice-auto-trait.rs @@ -0,0 +1,14 @@ +// compile-flags: --crate-type lib --edition 2018 + +#![crate_name = "foo"] +#![feature(rustdoc_internals)] + +// @has foo/primitive.slice.html '//a[@class="primitive"]' 'slice' +// @has - '//span[@class="in-band"]' 'Primitive Type slice' +// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' +// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations' +// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T] where T: Send' +// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Sync for [T] where T: Sync' +#[doc(primitive = "slice")] +/// this is a test! +mod slice_prim {} diff --git a/src/test/rustdoc/slice-links.link_box_generic.html b/src/test/rustdoc/slice-links.link_box_generic.html new file mode 100644 index 00000000000..38aaf20808c --- /dev/null +++ b/src/test/rustdoc/slice-links.link_box_generic.html @@ -0,0 +1 @@ +<code>pub fn delta<T>() -> <a class="struct" href="struct.MyBox.html" title="struct foo::MyBox">MyBox</a><<a class="primitive" href="{{channel}}/core/primitive.slice.html">[T]</a>></code> \ No newline at end of file diff --git a/src/test/rustdoc/slice-links.link_box_u32.html b/src/test/rustdoc/slice-links.link_box_u32.html new file mode 100644 index 00000000000..42fd721a4ac --- /dev/null +++ b/src/test/rustdoc/slice-links.link_box_u32.html @@ -0,0 +1 @@ +<code>pub fn gamma() -> <a class="struct" href="struct.MyBox.html" title="struct foo::MyBox">MyBox</a><<a class="primitive" href="{{channel}}/core/primitive.slice.html">[</a><a class="primitive" href="{{channel}}/core/primitive.u32.html">u32</a><a class="primitive" href="{{channel}}/core/primitive.slice.html">]</a>></code> \ No newline at end of file diff --git a/src/test/rustdoc/slice-links.link_slice_generic.html b/src/test/rustdoc/slice-links.link_slice_generic.html new file mode 100644 index 00000000000..fe79ca7a82d --- /dev/null +++ b/src/test/rustdoc/slice-links.link_slice_generic.html @@ -0,0 +1 @@ +<code>pub fn beta<T>() -> <a class="primitive" href="{{channel}}/core/primitive.slice.html">&'static [T]</a></code> \ No newline at end of file diff --git a/src/test/rustdoc/slice-links.link_slice_u32.html b/src/test/rustdoc/slice-links.link_slice_u32.html new file mode 100644 index 00000000000..c7e430b0607 --- /dev/null +++ b/src/test/rustdoc/slice-links.link_slice_u32.html @@ -0,0 +1 @@ +<code>pub fn alpha() -> <a class="primitive" href="{{channel}}/core/primitive.slice.html">&'static [</a><a class="primitive" href="{{channel}}/core/primitive.u32.html">u32</a><a class="primitive" href="{{channel}}/core/primitive.slice.html">]</a></code> \ No newline at end of file diff --git a/src/test/rustdoc/slice-links.rs b/src/test/rustdoc/slice-links.rs new file mode 100644 index 00000000000..9a78e963e30 --- /dev/null +++ b/src/test/rustdoc/slice-links.rs @@ -0,0 +1,28 @@ +#![crate_name = "foo"] +#![no_std] + +pub struct MyBox<T: ?Sized>(*const T); + +// @has 'foo/fn.alpha.html' +// @snapshot link_slice_u32 - '//pre[@class="rust fn"]/code' +pub fn alpha() -> &'static [u32] { + loop {} +} + +// @has 'foo/fn.beta.html' +// @snapshot link_slice_generic - '//pre[@class="rust fn"]/code' +pub fn beta<T>() -> &'static [T] { + loop {} +} + +// @has 'foo/fn.gamma.html' +// @snapshot link_box_u32 - '//pre[@class="rust fn"]/code' +pub fn gamma() -> MyBox<[u32]> { + loop {} +} + +// @has 'foo/fn.delta.html' +// @snapshot link_box_generic - '//pre[@class="rust fn"]/code' +pub fn delta<T>() -> MyBox<[T]> { + loop {} +} diff --git a/src/test/ui/async-await/issue-76547.base.stderr b/src/test/ui/async-await/issue-76547.base.stderr index 34705d4838e..109883fbeb7 100644 --- a/src/test/ui/async-await/issue-76547.base.stderr +++ b/src/test/ui/async-await/issue-76547.base.stderr @@ -5,6 +5,12 @@ LL | async fn fut(bufs: &mut [&mut [u8]]) { | ---------------- these two types are declared with different lifetimes... LL | ListFut(bufs).await | ^^^^ ...but data from `bufs` flows into `bufs` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/issue-76547.rs:39:14 @@ -13,6 +19,12 @@ LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { | ---------------- these two types are declared with different lifetimes... LL | ListFut2(bufs).await | ^^^^ ...but data from `bufs` flows into `bufs` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +LL | async fn fut2<'a>(bufs: &'a mut [&'a mut [u8]]) -> i32 { + | ++++ ++ ++ error: aborting due to 2 previous errors diff --git a/src/test/ui/async-await/issue-76547.nll.stderr b/src/test/ui/async-await/issue-76547.nll.stderr index bc30da1e389..0a5a52cb79e 100644 --- a/src/test/ui/async-await/issue-76547.nll.stderr +++ b/src/test/ui/async-await/issue-76547.nll.stderr @@ -7,6 +7,11 @@ LL | async fn fut(bufs: &mut [&mut [u8]]) { | let's call the lifetime of this reference `'1` LL | ListFut(bufs).await | ^^^^ this usage requires that `'1` must outlive `'2` + | +help: consider introducing a named lifetime parameter + | +LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/issue-76547.rs:39:14 @@ -17,6 +22,11 @@ LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { | let's call the lifetime of this reference `'1` LL | ListFut2(bufs).await | ^^^^ this usage requires that `'1` must outlive `'2` + | +help: consider introducing a named lifetime parameter + | +LL | async fn fut2<'a>(bufs: &'a mut [&'a mut [u8]]) -> i32 { + | ++++ ++ ++ error: aborting due to 2 previous errors diff --git a/src/test/ui/async-await/issues/issue-63388-1.base.stderr b/src/test/ui/async-await/issues/issue-63388-1.base.stderr index 2ff85a27a46..f5409a7ca5d 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.base.stderr +++ b/src/test/ui/async-await/issues/issue-63388-1.base.stderr @@ -1,14 +1,12 @@ -error[E0623]: lifetime mismatch +error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/issue-63388-1.rs:19:9 | LL | &'a self, foo: &dyn Foo - | -------- this parameter and the return type are declared with different lifetimes... -LL | ) -> &dyn Foo - | -------- + | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)` ... LL | foo - | ^^^ ...but data from `foo` is returned here + | ^^^ lifetime `'a` required error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/async-await/issues/issue-63388-1.nll.stderr b/src/test/ui/async-await/issues/issue-63388-1.nll.stderr index eee0cee278b..9263a81bb6a 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.nll.stderr +++ b/src/test/ui/async-await/issues/issue-63388-1.nll.stderr @@ -1,17 +1,16 @@ -error: lifetime may not live long enough +error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/issue-63388-1.rs:17:5 | -LL | async fn do_sth<'a>( - | -- lifetime `'a` defined here LL | &'a self, foo: &dyn Foo - | - let's call the lifetime of this reference `'1` + | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)` LL | ) -> &dyn Foo LL | / { LL | | LL | | foo LL | | LL | | } - | |_____^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` + | |_____^ lifetime `'a` required error: aborting due to previous error +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/async-await/issues/issue-63388-1.rs b/src/test/ui/async-await/issues/issue-63388-1.rs index c45d2a42177..f00f9295406 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.rs +++ b/src/test/ui/async-await/issues/issue-63388-1.rs @@ -15,9 +15,9 @@ impl Xyz { &'a self, foo: &dyn Foo ) -> &dyn Foo { - //[nll]~^ ERROR lifetime may not live long enough + //[nll]~^ ERROR explicit lifetime required in the type of `foo` [E0621] foo - //[base]~^ ERROR lifetime mismatch + //[base]~^ ERROR explicit lifetime required in the type of `foo` [E0621] } } diff --git a/src/test/ui/attributes/field-attributes-vis-unresolved.stderr b/src/test/ui/attributes/field-attributes-vis-unresolved.stderr index 41c3cea3021..43976254638 100644 --- a/src/test/ui/attributes/field-attributes-vis-unresolved.stderr +++ b/src/test/ui/attributes/field-attributes-vis-unresolved.stderr @@ -3,12 +3,16 @@ error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? | LL | pub(in nonexistent) field: u8 | ^^^^^^^^^^^ maybe a missing crate `nonexistent`? + | + = help: consider adding `extern crate nonexistent` to use the `nonexistent` crate error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? --> $DIR/field-attributes-vis-unresolved.rs:22:12 | LL | pub(in nonexistent) u8 | ^^^^^^^^^^^ maybe a missing crate `nonexistent`? + | + = help: consider adding `extern crate nonexistent` to use the `nonexistent` crate error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/issue-71546.rs b/src/test/ui/borrowck/issue-71546.rs new file mode 100644 index 00000000000..943f7f86e55 --- /dev/null +++ b/src/test/ui/borrowck/issue-71546.rs @@ -0,0 +1,19 @@ +// Regression test for #71546. + +// ignore-compare-mode-nll +// NLL stderr is different from the original one. + +pub fn serialize_as_csv<V>(value: &V) -> Result<String, &str> +where + V: 'static, + for<'a> &'a V: IntoIterator, + for<'a> <&'a V as IntoIterator>::Item: ToString + 'static, +{ + let csv_str: String = value //~ ERROR: the associated type `<&'a V as IntoIterator>::Item` may not live long enough + .into_iter() + .map(|elem| elem.to_string()) + .collect::<String>(); + Ok(csv_str) +} + +fn main() {} diff --git a/src/test/ui/borrowck/issue-71546.stderr b/src/test/ui/borrowck/issue-71546.stderr new file mode 100644 index 00000000000..d479ca8f1d8 --- /dev/null +++ b/src/test/ui/borrowck/issue-71546.stderr @@ -0,0 +1,20 @@ +error[E0310]: the associated type `<&'a V as IntoIterator>::Item` may not live long enough + --> $DIR/issue-71546.rs:12:27 + | +LL | let csv_str: String = value + | ___________________________^ +LL | | .into_iter() +LL | | .map(|elem| elem.to_string()) + | |_____________________________________^ + | + = help: consider adding an explicit lifetime bound `<&'a V as IntoIterator>::Item: 'static`... + = note: ...so that the type `<&'a V as IntoIterator>::Item` will meet its required lifetime bounds... +note: ...that is required by this bound + --> $DIR/issue-71546.rs:10:55 + | +LL | for<'a> <&'a V as IntoIterator>::Item: ToString + 'static, + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/codemap_tests/two_files.stderr b/src/test/ui/codemap_tests/two_files.stderr index aff51ee9e2f..2eb3fd56783 100644 --- a/src/test/ui/codemap_tests/two_files.stderr +++ b/src/test/ui/codemap_tests/two_files.stderr @@ -5,6 +5,7 @@ LL | impl Bar for Baz { } | ^^^ type aliases cannot be used as traits | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias + --> $DIR/two_files_data.rs:5:1 | LL | trait Bar = dyn Foo; | diff --git a/src/test/ui/coherence/coherence-impls-sized.stderr b/src/test/ui/coherence/coherence-impls-sized.stderr index 9cf5ed38c9c..e1e4acd4cd8 100644 --- a/src/test/ui/coherence/coherence-impls-sized.stderr +++ b/src/test/ui/coherence/coherence-impls-sized.stderr @@ -35,37 +35,37 @@ error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:14:1 | LL | impl Sized for TestE {} - | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + | ^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:17:1 | LL | impl Sized for MyType {} - | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + | ^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:20:1 | LL | impl Sized for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:24:1 | LL | impl Sized for &'static NotSync {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:27:1 | LL | impl Sized for [MyType] {} - | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + | ^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:31:1 | LL | impl Sized for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error: aborting due to 9 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr index c918651ba62..7390a007742 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr @@ -6,6 +6,7 @@ LL | If<{ FRAC <= 32 }>: True, | = note: the crate this constant originates from uses `#![feature(generic_const_exprs)]` help: consider enabling this feature + --> $DIR/issue-94287.rs:1:1 | LL | #![feature(generic_const_exprs)] | diff --git a/src/test/ui/issues/issue-54387.rs b/src/test/ui/consts/issue-54387.rs index 60e3a02f4ce..60e3a02f4ce 100644 --- a/src/test/ui/issues/issue-54387.rs +++ b/src/test/ui/consts/issue-54387.rs diff --git a/src/test/ui/derive-uninhabited-enum-38885.stderr b/src/test/ui/derive-uninhabited-enum-38885.stderr index 2a44e56a330..58aaf978dc7 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.stderr +++ b/src/test/ui/derive-uninhabited-enum-38885.stderr @@ -5,12 +5,7 @@ LL | Void(Void), | ^^^^^^^^^^ | = note: `-W dead-code` implied by `-W unused` -note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis - --> $DIR/derive-uninhabited-enum-38885.rs:10:10 - | -LL | #[derive(Debug)] - | ^^^^^ - = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: 1 warning emitted diff --git a/src/test/ui/derives/clone-debug-dead-code.stderr b/src/test/ui/derives/clone-debug-dead-code.stderr index 67bb574315a..031b8ce713e 100644 --- a/src/test/ui/derives/clone-debug-dead-code.stderr +++ b/src/test/ui/derives/clone-debug-dead-code.stderr @@ -16,12 +16,7 @@ error: field is never read: `f` LL | struct B { f: () } | ^^^^^ | -note: `B` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis - --> $DIR/clone-debug-dead-code.rs:9:10 - | -LL | #[derive(Clone)] - | ^^^^^ - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: `B` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis error: field is never read: `f` --> $DIR/clone-debug-dead-code.rs:14:12 @@ -29,12 +24,7 @@ error: field is never read: `f` LL | struct C { f: () } | ^^^^^ | -note: `C` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis - --> $DIR/clone-debug-dead-code.rs:13:10 - | -LL | #[derive(Debug)] - | ^^^^^ - = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: `C` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis error: field is never read: `f` --> $DIR/clone-debug-dead-code.rs:18:12 @@ -42,12 +32,7 @@ error: field is never read: `f` LL | struct D { f: () } | ^^^^^ | -note: `D` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis - --> $DIR/clone-debug-dead-code.rs:17:10 - | -LL | #[derive(Debug,Clone)] - | ^^^^^ ^^^^^ - = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: `D` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis error: field is never read: `f` --> $DIR/clone-debug-dead-code.rs:21:12 diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr index 23dad2c16b2..570bbac2b21 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr @@ -6,6 +6,7 @@ LL | produces_async! {} | = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info) help: escape `async` to use it as an identifier + --> $DIR/auxiliary/edition-kw-macro-2018.rs:7:19 | LL | () => (pub fn r#async() {}) | ++ diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr index 67f9aa60413..69f275746bd 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr @@ -6,6 +6,7 @@ LL | produces_async! {} | = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info) help: escape `async` to use it as an identifier + --> $DIR/auxiliary/edition-kw-macro-2018.rs:7:19 | LL | () => (pub fn r#async() {}) | ++ diff --git a/src/test/ui/enum-discriminant/forbidden-discriminant-kind-impl.stderr b/src/test/ui/enum-discriminant/forbidden-discriminant-kind-impl.stderr index 54360c4f47b..38cfd13b9b8 100644 --- a/src/test/ui/enum-discriminant/forbidden-discriminant-kind-impl.stderr +++ b/src/test/ui/enum-discriminant/forbidden-discriminant-kind-impl.stderr @@ -2,7 +2,7 @@ error[E0322]: explicit impls for the `DiscriminantKind` trait are not permitted --> $DIR/forbidden-discriminant-kind-impl.rs:9:1 | LL | impl DiscriminantKind for NewType { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'DiscriminantKind' not allowed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `DiscriminantKind` not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0263.rs b/src/test/ui/error-codes/E0263.rs index 4376437823c..92917678e4c 100644 --- a/src/test/ui/error-codes/E0263.rs +++ b/src/test/ui/error-codes/E0263.rs @@ -1,5 +1,5 @@ fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { - //~^ ERROR E0263 + //~^ ERROR E0403 } fn main() {} diff --git a/src/test/ui/error-codes/E0263.stderr b/src/test/ui/error-codes/E0263.stderr index 4dae02b85c3..e3f9aea296a 100644 --- a/src/test/ui/error-codes/E0263.stderr +++ b/src/test/ui/error-codes/E0263.stderr @@ -1,11 +1,11 @@ -error[E0263]: lifetime name `'a` declared twice in the same scope +error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters --> $DIR/E0263.rs:1:16 | LL | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { - | -- ^^ declared twice + | -- ^^ already used | | - | previous declaration here + | first use of `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0263`. +For more information about this error, try `rustc --explain E0403`. diff --git a/src/test/ui/error-codes/E0308-2.stderr b/src/test/ui/error-codes/E0308-2.stderr index 5c1dcb4d4f9..de54a417253 100644 --- a/src/test/ui/error-codes/E0308-2.stderr +++ b/src/test/ui/error-codes/E0308-2.stderr @@ -6,7 +6,7 @@ LL | impl Eq for &dyn DynEq {} | = note: expected trait `<&dyn DynEq as PartialEq>` found trait `<&(dyn DynEq + 'static) as PartialEq>` -note: the lifetime `'_` as defined here... +note: the anonymous lifetime as defined here... --> $DIR/E0308-2.rs:9:13 | LL | impl Eq for &dyn DynEq {} diff --git a/src/test/ui/error-codes/E0432.stderr b/src/test/ui/error-codes/E0432.stderr index afb031c2252..ed9536f164e 100644 --- a/src/test/ui/error-codes/E0432.stderr +++ b/src/test/ui/error-codes/E0432.stderr @@ -3,6 +3,8 @@ error[E0432]: unresolved import `something` | LL | use something::Foo; | ^^^^^^^^^ maybe a missing crate `something`? + | + = help: consider adding `extern crate something` to use the `something` crate error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 2f4c220ee95..3bae23a4aaa 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -3,12 +3,16 @@ error[E0432]: unresolved import `core` | LL | use core::default; | ^^^^ maybe a missing crate `core`? + | + = help: consider adding `extern crate core` to use the `core` crate error[E0433]: failed to resolve: maybe a missing crate `core`? --> $DIR/feature-gate-extern_absolute_paths.rs:4:19 | LL | let _: u8 = ::core::default::Default(); | ^^^^ maybe a missing crate `core`? + | + = help: consider adding `extern crate core` to use the `core` crate error: aborting due to 2 previous errors diff --git a/src/test/ui/for-loop-while/label_break_value.rs b/src/test/ui/for-loop-while/label_break_value.rs index 5776c0b1e0c..ca9d71a7a8b 100644 --- a/src/test/ui/for-loop-while/label_break_value.rs +++ b/src/test/ui/for-loop-while/label_break_value.rs @@ -102,7 +102,7 @@ fn label_break_match(c: u8, xe: u8, ye: i8) { 0 => break 'a 0, v if { if v % 2 == 0 { break 'a 1; }; v % 3 == 0 } => { x += 1; }, v if { 'b: { break 'b v == 5; } } => { x = 41; }, - _ => 'b: { //~ WARNING `'b` shadows a label + _ => 'b: { break 'b (); }, } @@ -128,8 +128,8 @@ fn label_break_macro() { 0 }; assert_eq!(x, 0); - let x: u8 = 'a: { //~ WARNING `'a` shadows a label - 'b: { //~ WARNING `'b` shadows a label + let x: u8 = 'a: { + 'b: { if true { mac1!('a, 1); } diff --git a/src/test/ui/for-loop-while/label_break_value.stderr b/src/test/ui/for-loop-while/label_break_value.stderr deleted file mode 100644 index b1eb3204fd5..00000000000 --- a/src/test/ui/for-loop-while/label_break_value.stderr +++ /dev/null @@ -1,28 +0,0 @@ -warning: label name `'b` shadows a label name that is already in scope - --> $DIR/label_break_value.rs:105:18 - | -LL | v if { 'b: { break 'b v == 5; } } => { x = 41; }, - | -- first declared here -LL | _ => 'b: { - | ^^ label `'b` already in scope - -warning: label name `'a` shadows a label name that is already in scope - --> $DIR/label_break_value.rs:131:17 - | -LL | let x: u8 = 'a: { - | -- first declared here -... -LL | let x: u8 = 'a: { - | ^^ label `'a` already in scope - -warning: label name `'b` shadows a label name that is already in scope - --> $DIR/label_break_value.rs:132:9 - | -LL | 'b: { - | -- first declared here -... -LL | 'b: { - | ^^ label `'b` already in scope - -warning: 3 warnings emitted - diff --git a/src/test/ui/for-loop-while/label_break_value_invalid.rs b/src/test/ui/for-loop-while/label_break_value_invalid.rs index e603c8463b5..149bf17b83c 100644 --- a/src/test/ui/for-loop-while/label_break_value_invalid.rs +++ b/src/test/ui/for-loop-while/label_break_value_invalid.rs @@ -20,14 +20,11 @@ fn lbv_macro_test_hygiene_respected() { macro_rules! mac3 { ($val:expr) => { 'a: { - //~^ WARNING `'a` shadows a label - //~| WARNING `'a` shadows a label - //~| WARNING `'a` shadows a label $val } }; } - let x: u8 = mac3!('b: { //~ WARNING `'b` shadows a label + let x: u8 = mac3!('b: { if true { break 'a 3; //~ ERROR undeclared label `'a` [E0426] } diff --git a/src/test/ui/for-loop-while/label_break_value_invalid.stderr b/src/test/ui/for-loop-while/label_break_value_invalid.stderr index 549b394e14b..7182b8f598f 100644 --- a/src/test/ui/for-loop-while/label_break_value_invalid.stderr +++ b/src/test/ui/for-loop-while/label_break_value_invalid.stderr @@ -10,7 +10,7 @@ LL | mac2!(2); = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0426]: use of undeclared label `'a` - --> $DIR/label_break_value_invalid.rs:32:19 + --> $DIR/label_break_value_invalid.rs:29:19 | LL | let x: u8 = mac3!('b: { | -- a label with a similar name is reachable @@ -22,68 +22,11 @@ LL | break 'a 3; | help: try using similarly named label: `'b` error[E0426]: use of undeclared label `'a` - --> $DIR/label_break_value_invalid.rs:37:29 + --> $DIR/label_break_value_invalid.rs:34:29 | LL | let x: u8 = mac3!(break 'a 4); | ^^ undeclared label `'a` -warning: label name `'a` shadows a label name that is already in scope - --> $DIR/label_break_value_invalid.rs:22:13 - | -LL | let x: u8 = 'a: { - | -- first declared here -... -LL | 'a: { - | ^^ label `'a` already in scope -... -LL | let x: u8 = mac3!('b: { - | _________________- -LL | | if true { -LL | | break 'a 3; -LL | | } -LL | | 0 -LL | | }); - | |______- in this macro invocation - | - = note: this warning originates in the macro `mac3` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'b` shadows a label name that is already in scope - --> $DIR/label_break_value_invalid.rs:30:23 - | -LL | 'b: { - | -- first declared here -... -LL | let x: u8 = mac3!('b: { - | ^^ label `'b` already in scope - -warning: label name `'a` shadows a label name that is already in scope - --> $DIR/label_break_value_invalid.rs:22:13 - | -LL | let x: u8 = 'a: { - | -- first declared here -... -LL | 'a: { - | ^^ label `'a` already in scope -... -LL | let x: u8 = mac3!(break 'a 4); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `mac3` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'a` shadows a label name that is already in scope - --> $DIR/label_break_value_invalid.rs:22:13 - | -LL | 'a: { - | ^^ - | | - | first declared here - | label `'a` already in scope -... -LL | let x: u8 = mac3!(break 'a 4); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `mac3` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors; 4 warnings emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0426`. diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr index 1458bf0c4a4..76d39c88b61 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr @@ -8,7 +8,7 @@ LL | type A = u32; | ^ lifetimes do not match type in trait error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/parameter_number_and_kind_impl.rs:17:12 + --> $DIR/parameter_number_and_kind_impl.rs:17:16 | LL | type B<'a, 'b>; | -- -- @@ -16,9 +16,7 @@ LL | type B<'a, 'b>; | expected 0 type parameters ... LL | type B<'a, T> = Vec<T>; - | ^^ ^ - | | - | found 1 type parameter + | ^ found 1 type parameter error[E0195]: lifetime parameters or bounds on type `C` do not match the trait declaration --> $DIR/parameter_number_and_kind_impl.rs:19:11 diff --git a/src/test/ui/generic-associated-types/shadowing.stderr b/src/test/ui/generic-associated-types/shadowing.stderr index 857757f8940..be765920975 100644 --- a/src/test/ui/generic-associated-types/shadowing.stderr +++ b/src/test/ui/generic-associated-types/shadowing.stderr @@ -1,3 +1,19 @@ +error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope + --> $DIR/shadowing.rs:4:14 + | +LL | trait Shadow<'a> { + | -- first declared here +LL | type Bar<'a>; + | ^^ lifetime `'a` already in scope + +error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope + --> $DIR/shadowing.rs:13:14 + | +LL | impl<'a> NoShadow<'a> for &'a u32 { + | -- first declared here +LL | type Bar<'a> = i32; + | ^^ lifetime `'a` already in scope + error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters --> $DIR/shadowing.rs:18:14 | @@ -14,22 +30,6 @@ LL | impl<T> NoShadowT<T> for Option<T> { LL | type Bar<T> = i32; | ^ already used -error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/shadowing.rs:13:14 - | -LL | impl<'a> NoShadow<'a> for &'a u32 { - | -- first declared here -LL | type Bar<'a> = i32; - | ^^ lifetime `'a` already in scope - -error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/shadowing.rs:4:14 - | -LL | trait Shadow<'a> { - | -- first declared here -LL | type Bar<'a>; - | ^^ lifetime `'a` already in scope - error: aborting due to 4 previous errors Some errors have detailed explanations: E0403, E0496. diff --git a/src/test/ui/hygiene/duplicate_lifetimes.rs b/src/test/ui/hygiene/duplicate_lifetimes.rs index e7312b51dbc..8971fb62626 100644 --- a/src/test/ui/hygiene/duplicate_lifetimes.rs +++ b/src/test/ui/hygiene/duplicate_lifetimes.rs @@ -5,12 +5,12 @@ #[rustc_macro_transparency = "semitransparent"] macro m($a:lifetime) { - fn g<$a, 'a>() {} //~ ERROR lifetime name `'a` declared twice + fn g<$a, 'a>() {} //~ ERROR the name `'a` is already used for a generic parameter } #[rustc_macro_transparency = "transparent"] macro n($a:lifetime) { - fn h<$a, 'a>() {} //~ ERROR lifetime name `'a` declared twice + fn h<$a, 'a>() {} //~ ERROR the name `'a` is already used for a generic parameter } m!('a); diff --git a/src/test/ui/hygiene/duplicate_lifetimes.stderr b/src/test/ui/hygiene/duplicate_lifetimes.stderr index 4d41ebaa437..9f1a7514727 100644 --- a/src/test/ui/hygiene/duplicate_lifetimes.stderr +++ b/src/test/ui/hygiene/duplicate_lifetimes.stderr @@ -1,31 +1,31 @@ -error[E0263]: lifetime name `'a` declared twice in the same scope +error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters --> $DIR/duplicate_lifetimes.rs:8:14 | LL | fn g<$a, 'a>() {} - | ^^ declared twice + | ^^ already used ... LL | m!('a); | ------ | | | - | | previous declaration here + | | first use of `'a` | in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0263]: lifetime name `'a` declared twice in the same scope +error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters --> $DIR/duplicate_lifetimes.rs:13:14 | LL | fn h<$a, 'a>() {} - | ^^ declared twice + | ^^ already used ... LL | n!('a); | ------ | | | - | | previous declaration here + | | first use of `'a` | in this macro invocation | = note: this error originates in the macro `n` (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 E0263`. +For more information about this error, try `rustc --explain E0403`. diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.rs b/src/test/ui/hygiene/hygienic-labels-in-let.rs index 491855d7bec..8cf66f31a0a 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.rs +++ b/src/test/ui/hygiene/hygienic-labels-in-let.rs @@ -13,38 +13,28 @@ macro_rules! loop_x { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: loop { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: loop { + $e + } + }; } macro_rules! while_true { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: while 1 + 1 == 2 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: while 1 + 1 == 2 { + $e + } + }; } macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in 0..1 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: for _ in 0..1 { + $e + } + }; } pub fn main() { @@ -62,8 +52,6 @@ pub fn main() { let k: isize = { 'x: for _ in 0..1 { - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto loop_x!(break 'x); i += 1; @@ -74,10 +62,6 @@ pub fn main() { let l: isize = { 'x: for _ in 0..1 { - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto while_true!(break 'x); i += 1; @@ -88,12 +72,6 @@ pub fn main() { let n: isize = { 'x: for _ in 0..1 { - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto run_once!(continue 'x); i += 1; diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/hygiene/hygienic-labels-in-let.stderr deleted file mode 100644 index 519e3c0880a..00000000000 --- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr +++ /dev/null @@ -1,334 +0,0 @@ -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -LL | // this 'x should refer to the outer loop, lexically -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:64:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:64:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 - | -LL | 'x: loop { $e } - | ^^ - | | - | first declared here - | label `'x` already in scope -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:76:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:76:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:76:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:76:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: 28 warnings emitted - diff --git a/src/test/ui/hygiene/hygienic-labels.rs b/src/test/ui/hygiene/hygienic-labels.rs index c9f494b68b4..6a7d81f045b 100644 --- a/src/test/ui/hygiene/hygienic-labels.rs +++ b/src/test/ui/hygiene/hygienic-labels.rs @@ -10,38 +10,28 @@ macro_rules! loop_x { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: loop { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: loop { + $e + } + }; } macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in 0..1 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: for _ in 0..1 { + $e + } + }; } macro_rules! while_x { ($e: expr) => { // ditto - 'x: while 1 + 1 == 2 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: while 1 + 1 == 2 { + $e + } + }; } pub fn main() { @@ -52,32 +42,17 @@ pub fn main() { } 'x: loop { - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - // ditto loop_x!(break 'x); panic!("break doesn't act hygienically inside infinite loop"); } 'x: while 1 + 1 == 2 { - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - while_x!(break 'x); panic!("break doesn't act hygienically inside infinite while loop"); } 'x: for _ in 0..1 { - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - // ditto run_once!(continue 'x); panic!("continue doesn't act hygienically inside for loop"); diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr deleted file mode 100644 index f0b891fe349..00000000000 --- a/src/test/ui/hygiene/hygienic-labels.stderr +++ /dev/null @@ -1,334 +0,0 @@ -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -LL | // this 'x should refer to the outer loop, lexically -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:54:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: loop { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:54:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: loop { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 - | -LL | 'x: loop { $e } - | ^^ - | | - | first declared here - | label `'x` already in scope -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: 28 warnings emitted - diff --git a/src/test/ui/issues/issue-54966.rs b/src/test/ui/impl-trait/issue-54966.rs index 0ed3c4b3ca9..0ed3c4b3ca9 100644 --- a/src/test/ui/issues/issue-54966.rs +++ b/src/test/ui/impl-trait/issue-54966.rs diff --git a/src/test/ui/issues/issue-54966.stderr b/src/test/ui/impl-trait/issue-54966.stderr index aa9a61cb592..aa9a61cb592 100644 --- a/src/test/ui/issues/issue-54966.stderr +++ b/src/test/ui/impl-trait/issue-54966.stderr diff --git a/src/test/ui/imports/import3.stderr b/src/test/ui/imports/import3.stderr index 7bb413be59f..ca75c9c18bd 100644 --- a/src/test/ui/imports/import3.stderr +++ b/src/test/ui/imports/import3.stderr @@ -3,6 +3,8 @@ error[E0432]: unresolved import `main` | LL | use main::bar; | ^^^^ maybe a missing crate `main`? + | + = help: consider adding `extern crate main` to use the `main` crate error: aborting due to previous error diff --git a/src/test/ui/imports/issue-1697.stderr b/src/test/ui/imports/issue-1697.stderr index a76fd309914..019ef9ad56a 100644 --- a/src/test/ui/imports/issue-1697.stderr +++ b/src/test/ui/imports/issue-1697.stderr @@ -3,6 +3,8 @@ error[E0432]: unresolved import `unresolved` | LL | use unresolved::*; | ^^^^^^^^^^ maybe a missing crate `unresolved`? + | + = help: consider adding `extern crate unresolved` to use the `unresolved` crate error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26873-multifile/A/B.rs b/src/test/ui/imports/issue-26873-multifile/A/B.rs index ab7b0d81605..ab7b0d81605 100644 --- a/src/test/ui/issues/issue-26873-multifile/A/B.rs +++ b/src/test/ui/imports/issue-26873-multifile/A/B.rs diff --git a/src/test/ui/issues/issue-26873-multifile/A/C.rs b/src/test/ui/imports/issue-26873-multifile/A/C.rs index b287283df53..b287283df53 100644 --- a/src/test/ui/issues/issue-26873-multifile/A/C.rs +++ b/src/test/ui/imports/issue-26873-multifile/A/C.rs diff --git a/src/test/ui/issues/issue-26873-multifile/A/mod.rs b/src/test/ui/imports/issue-26873-multifile/A/mod.rs index 0f18772bf1b..0f18772bf1b 100644 --- a/src/test/ui/issues/issue-26873-multifile/A/mod.rs +++ b/src/test/ui/imports/issue-26873-multifile/A/mod.rs diff --git a/src/test/ui/issues/issue-26873-multifile/compiletest-ignore-dir b/src/test/ui/imports/issue-26873-multifile/compiletest-ignore-dir index e69de29bb2d..e69de29bb2d 100644 --- a/src/test/ui/issues/issue-26873-multifile/compiletest-ignore-dir +++ b/src/test/ui/imports/issue-26873-multifile/compiletest-ignore-dir diff --git a/src/test/ui/issues/issue-26873-multifile.rs b/src/test/ui/imports/issue-26873-multifile/issue-26873-multifile.rs index da2acf6c9f7..da2acf6c9f7 100644 --- a/src/test/ui/issues/issue-26873-multifile.rs +++ b/src/test/ui/imports/issue-26873-multifile/issue-26873-multifile.rs diff --git a/src/test/ui/imports/issue-26873-onefile.rs b/src/test/ui/imports/issue-26873-multifile/issue-26873-onefile.rs index f06c6499eb0..f06c6499eb0 100644 --- a/src/test/ui/imports/issue-26873-onefile.rs +++ b/src/test/ui/imports/issue-26873-multifile/issue-26873-onefile.rs diff --git a/src/test/ui/issues/issue-26873-multifile/mod.rs b/src/test/ui/imports/issue-26873-multifile/mod.rs index a1ba53f9191..a1ba53f9191 100644 --- a/src/test/ui/issues/issue-26873-multifile/mod.rs +++ b/src/test/ui/imports/issue-26873-multifile/mod.rs diff --git a/src/test/ui/imports/issue-33464.stderr b/src/test/ui/imports/issue-33464.stderr index d3bf404c99a..c4e5c555899 100644 --- a/src/test/ui/imports/issue-33464.stderr +++ b/src/test/ui/imports/issue-33464.stderr @@ -3,18 +3,24 @@ error[E0432]: unresolved import `abc` | LL | use abc::one_el; | ^^^ maybe a missing crate `abc`? + | + = help: consider adding `extern crate abc` to use the `abc` crate error[E0432]: unresolved import `abc` --> $DIR/issue-33464.rs:5:5 | LL | use abc::{a, bbb, cccccc}; | ^^^ maybe a missing crate `abc`? + | + = help: consider adding `extern crate abc` to use the `abc` crate error[E0432]: unresolved import `a_very_long_name` --> $DIR/issue-33464.rs:7:5 | LL | use a_very_long_name::{el, el2}; | ^^^^^^^^^^^^^^^^ maybe a missing crate `a_very_long_name`? + | + = help: consider adding `extern crate a_very_long_name` to use the `a_very_long_name` crate error: aborting due to 3 previous errors diff --git a/src/test/ui/imports/issue-36881.stderr b/src/test/ui/imports/issue-36881.stderr index caf9d5d6d62..2e1b468603d 100644 --- a/src/test/ui/imports/issue-36881.stderr +++ b/src/test/ui/imports/issue-36881.stderr @@ -3,6 +3,8 @@ error[E0432]: unresolved import `issue_36881_aux` | LL | use issue_36881_aux::Foo; | ^^^^^^^^^^^^^^^ maybe a missing crate `issue_36881_aux`? + | + = help: consider adding `extern crate issue_36881_aux` to use the `issue_36881_aux` crate error: aborting due to previous error diff --git a/src/test/ui/imports/issue-37887.stderr b/src/test/ui/imports/issue-37887.stderr index 944d544098a..75185cad3b7 100644 --- a/src/test/ui/imports/issue-37887.stderr +++ b/src/test/ui/imports/issue-37887.stderr @@ -3,6 +3,8 @@ error[E0432]: unresolved import `libc` | LL | use libc::*; | ^^^^ maybe a missing crate `libc`? + | + = help: consider adding `extern crate libc` to use the `libc` crate error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? --> $DIR/issue-37887.rs:2:5 diff --git a/src/test/ui/imports/issue-53269.stderr b/src/test/ui/imports/issue-53269.stderr index a0e7bf8b61f..29c7556dac4 100644 --- a/src/test/ui/imports/issue-53269.stderr +++ b/src/test/ui/imports/issue-53269.stderr @@ -3,6 +3,8 @@ error[E0432]: unresolved import `nonexistent_module` | LL | use nonexistent_module::mac; | ^^^^^^^^^^^^^^^^^^ maybe a missing crate `nonexistent_module`? + | + = help: consider adding `extern crate nonexistent_module` to use the `nonexistent_module` crate error[E0659]: `mac` is ambiguous --> $DIR/issue-53269.rs:8:5 diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr index 07de3d95902..788fcc830ae 100644 --- a/src/test/ui/imports/issue-55457.stderr +++ b/src/test/ui/imports/issue-55457.stderr @@ -12,6 +12,8 @@ error[E0432]: unresolved import `non_existent` | LL | use non_existent::non_existent; | ^^^^^^^^^^^^ maybe a missing crate `non_existent`? + | + = help: consider adding `extern crate non_existent` to use the `non_existent` crate error: cannot determine resolution for the derive macro `NonExistent` --> $DIR/issue-55457.rs:5:10 diff --git a/src/test/ui/imports/tool-mod-child.stderr b/src/test/ui/imports/tool-mod-child.stderr index efab4f6a74f..6caf15bc724 100644 --- a/src/test/ui/imports/tool-mod-child.stderr +++ b/src/test/ui/imports/tool-mod-child.stderr @@ -3,24 +3,32 @@ error[E0433]: failed to resolve: maybe a missing crate `clippy`? | LL | use clippy::a::b; | ^^^^^^ maybe a missing crate `clippy`? + | + = help: consider adding `extern crate clippy` to use the `clippy` crate error[E0432]: unresolved import `clippy` --> $DIR/tool-mod-child.rs:1:5 | LL | use clippy::a; | ^^^^^^ maybe a missing crate `clippy`? + | + = help: consider adding `extern crate clippy` to use the `clippy` crate error[E0433]: failed to resolve: maybe a missing crate `rustdoc`? --> $DIR/tool-mod-child.rs:5:5 | LL | use rustdoc::a::b; | ^^^^^^^ maybe a missing crate `rustdoc`? + | + = help: consider adding `extern crate rustdoc` to use the `rustdoc` crate error[E0432]: unresolved import `rustdoc` --> $DIR/tool-mod-child.rs:4:5 | LL | use rustdoc::a; | ^^^^^^^ maybe a missing crate `rustdoc`? + | + = help: consider adding `extern crate rustdoc` to use the `rustdoc` crate error: aborting due to 4 previous errors diff --git a/src/test/ui/imports/unresolved-imports-used.stderr b/src/test/ui/imports/unresolved-imports-used.stderr index ddf36089339..73f9d1bfb6c 100644 --- a/src/test/ui/imports/unresolved-imports-used.stderr +++ b/src/test/ui/imports/unresolved-imports-used.stderr @@ -15,24 +15,32 @@ error[E0432]: unresolved import `foo` | LL | use foo::bar; | ^^^ maybe a missing crate `foo`? + | + = help: consider adding `extern crate foo` to use the `foo` crate error[E0432]: unresolved import `baz` --> $DIR/unresolved-imports-used.rs:12:5 | LL | use baz::*; | ^^^ maybe a missing crate `baz`? + | + = help: consider adding `extern crate baz` to use the `baz` crate error[E0432]: unresolved import `foo2` --> $DIR/unresolved-imports-used.rs:14:5 | LL | use foo2::bar2; | ^^^^ maybe a missing crate `foo2`? + | + = help: consider adding `extern crate foo2` to use the `foo2` crate error[E0432]: unresolved import `baz2` --> $DIR/unresolved-imports-used.rs:15:5 | LL | use baz2::*; | ^^^^ maybe a missing crate `baz2`? + | + = help: consider adding `extern crate baz2` to use the `baz2` crate error[E0603]: function `quz` is private --> $DIR/unresolved-imports-used.rs:9:10 diff --git a/src/test/ui/issues/issue-17905-2.stderr b/src/test/ui/issues/issue-17905-2.stderr index c68265f71f2..88b5fbec6cf 100644 --- a/src/test/ui/issues/issue-17905-2.stderr +++ b/src/test/ui/issues/issue-17905-2.stderr @@ -11,7 +11,7 @@ note: the anonymous lifetime defined here... | LL | fn say(self: &Pair<&str, isize>) { | ^^^^ -note: ...does not necessarily outlive the lifetime `'_` as defined here +note: ...does not necessarily outlive the anonymous lifetime as defined here --> $DIR/issue-17905-2.rs:5:5 | LL | &str, @@ -25,7 +25,7 @@ LL | fn say(self: &Pair<&str, isize>) { | = note: expected struct `Pair<&str, _>` found struct `Pair<&str, _>` -note: the lifetime `'_` as defined here... +note: the anonymous lifetime as defined here... --> $DIR/issue-17905-2.rs:5:5 | LL | &str, diff --git a/src/test/ui/issues/issue-65230.stderr b/src/test/ui/issues/issue-65230.stderr index bfeb38d6471..fcabcdea74f 100644 --- a/src/test/ui/issues/issue-65230.stderr +++ b/src/test/ui/issues/issue-65230.stderr @@ -6,7 +6,7 @@ LL | impl T1 for &dyn T2 {} | = note: expected trait `<&dyn T2 as T0>` found trait `<&(dyn T2 + 'static) as T0>` -note: the lifetime `'_` as defined here... +note: the anonymous lifetime as defined here... --> $DIR/issue-65230.rs:8:13 | LL | impl T1 for &dyn T2 {} diff --git a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr index 4c11f354494..c6e6ea1e096 100644 --- a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr +++ b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr @@ -9,6 +9,7 @@ LL | assert_eq!(a, 0); | = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have forgotten to call this function + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | LL | if !(*left_val() == *right_val) { | ++ diff --git a/src/test/ui/issues/issue-28098.rs b/src/test/ui/iterators/issue-28098.rs index 62a90d90d12..62a90d90d12 100644 --- a/src/test/ui/issues/issue-28098.rs +++ b/src/test/ui/iterators/issue-28098.rs diff --git a/src/test/ui/issues/issue-28098.stderr b/src/test/ui/iterators/issue-28098.stderr index 3beb9929244..3beb9929244 100644 --- a/src/test/ui/issues/issue-28098.stderr +++ b/src/test/ui/iterators/issue-28098.stderr diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr index 247d6b0ed71..54ee45c2867 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr @@ -14,6 +14,8 @@ error[E0432]: unresolved import `r#extern` | LL | use extern::foo; | ^^^^^^ maybe a missing crate `r#extern`? + | + = help: consider adding `extern crate r#extern` to use the `r#extern` crate error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/dead-code/unused-variant.stderr b/src/test/ui/lint/dead-code/unused-variant.stderr index 3b5683a7748..57f8ca74f83 100644 --- a/src/test/ui/lint/dead-code/unused-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-variant.stderr @@ -9,12 +9,7 @@ note: the lint level is defined here | LL | #![deny(dead_code)] | ^^^^^^^^^ -note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis - --> $DIR/unused-variant.rs:3:10 - | -LL | #[derive(Clone)] - | ^^^^^ - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis error: aborting due to previous error diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 4bb1a437d24..85adc9ab3bf 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -1,3 +1,12 @@ +warning: label name `'many_used_shadowed` shadows a label name that is already in scope + --> $DIR/unused_labels.rs:62:9 + | +LL | 'many_used_shadowed: for _ in 0..10 { + | ------------------- first declared here +LL | +LL | 'many_used_shadowed: for _ in 0..10 { + | ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope + warning: unused label --> $DIR/unused_labels.rs:11:5 | @@ -52,14 +61,5 @@ warning: unused label LL | 'unused_block_label: { | ^^^^^^^^^^^^^^^^^^^ -warning: label name `'many_used_shadowed` shadows a label name that is already in scope - --> $DIR/unused_labels.rs:62:9 - | -LL | 'many_used_shadowed: for _ in 0..10 { - | ------------------- first declared here -LL | -LL | 'many_used_shadowed: for _ in 0..10 { - | ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope - warning: 9 warnings emitted diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.rs b/src/test/ui/loops/loops-reject-duplicate-labels-2.rs deleted file mode 100644 index 68a19a8f6f7..00000000000 --- a/src/test/ui/loops/loops-reject-duplicate-labels-2.rs +++ /dev/null @@ -1,36 +0,0 @@ -// check-pass -#![feature(label_break_value)] - -// Issue #21633: reject duplicate loop labels and block labels in function bodies. -// -// This is testing the generalization (to the whole function body) -// discussed here: -// https://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833 - -#[allow(unused_labels)] -pub fn foo() { - { 'fl: for _ in 0..10 { break; } } - { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope - { 'lf: loop { break; } } - { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope - { 'wl: while 2 > 1 { break; } } - { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope - { 'lw: loop { break; } } - { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope - { 'fw: for _ in 0..10 { break; } } - { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope - { 'wf: while 2 > 1 { break; } } - { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope - { 'tl: while let Some(_) = None::<i32> { break; } } - { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope - { 'lt: loop { break; } } - { 'lt: while let Some(_) = None::<i32> { break; } } - //~^ WARN label name `'lt` shadows a label name that is already in scope - { 'bl: {} } - { 'bl: {} } //~ WARN label name `'bl` shadows a label name that is already in scope -} - - -pub fn main() { - foo(); -} diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr deleted file mode 100644 index 2c372fcff7a..00000000000 --- a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr +++ /dev/null @@ -1,74 +0,0 @@ -warning: label name `'fl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:13:7 - | -LL | { 'fl: for _ in 0..10 { break; } } - | --- first declared here -LL | { 'fl: loop { break; } } - | ^^^ label `'fl` already in scope - -warning: label name `'lf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:15:7 - | -LL | { 'lf: loop { break; } } - | --- first declared here -LL | { 'lf: for _ in 0..10 { break; } } - | ^^^ label `'lf` already in scope - -warning: label name `'wl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:17:7 - | -LL | { 'wl: while 2 > 1 { break; } } - | --- first declared here -LL | { 'wl: loop { break; } } - | ^^^ label `'wl` already in scope - -warning: label name `'lw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:19:7 - | -LL | { 'lw: loop { break; } } - | --- first declared here -LL | { 'lw: while 2 > 1 { break; } } - | ^^^ label `'lw` already in scope - -warning: label name `'fw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:21:7 - | -LL | { 'fw: for _ in 0..10 { break; } } - | --- first declared here -LL | { 'fw: while 2 > 1 { break; } } - | ^^^ label `'fw` already in scope - -warning: label name `'wf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:23:7 - | -LL | { 'wf: while 2 > 1 { break; } } - | --- first declared here -LL | { 'wf: for _ in 0..10 { break; } } - | ^^^ label `'wf` already in scope - -warning: label name `'tl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:25:7 - | -LL | { 'tl: while let Some(_) = None::<i32> { break; } } - | --- first declared here -LL | { 'tl: loop { break; } } - | ^^^ label `'tl` already in scope - -warning: label name `'lt` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:27:7 - | -LL | { 'lt: loop { break; } } - | --- first declared here -LL | { 'lt: while let Some(_) = None::<i32> { break; } } - | ^^^ label `'lt` already in scope - -warning: label name `'bl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:30:7 - | -LL | { 'bl: {} } - | --- first declared here -LL | { 'bl: {} } - | ^^^ label `'bl` already in scope - -warning: 9 warnings emitted - diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.rs b/src/test/ui/loops/loops-reject-duplicate-labels.rs deleted file mode 100644 index c34bcf3df1d..00000000000 --- a/src/test/ui/loops/loops-reject-duplicate-labels.rs +++ /dev/null @@ -1,49 +0,0 @@ -// check-pass -#![feature(label_break_value)] - -// Issue #21633: reject duplicate loop labels and block labels in function bodies. - -#[allow(unused_labels)] -fn foo() { - 'fl: for _ in 0..10 { break; } - 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope - - 'lf: loop { break; } - 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope - 'wl: while 2 > 1 { break; } - 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope - 'lw: loop { break; } - 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope - 'fw: for _ in 0..10 { break; } - 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope - 'wf: while 2 > 1 { break; } - 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope - 'tl: while let Some(_) = None::<i32> { break; } - 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope - 'lt: loop { break; } - 'lt: while let Some(_) = None::<i32> { break; } - //~^ WARN label name `'lt` shadows a label name that is already in scope - 'bl: {} - 'bl: {} //~ WARN label name `'bl` shadows a label name that is already in scope -} - -// Note however that it is okay for the same label to be reused in -// different methods of one impl, as illustrated here. - -struct S; -impl S { - fn m1(&self) { 'okay: loop { break 'okay; } } - fn m2(&self) { 'okay: loop { break 'okay; } } - fn m3(&self) { 'okay: { break 'okay; } } - fn m4(&self) { 'okay: { break 'okay; } } -} - - -pub fn main() { - let s = S; - s.m1(); - s.m2(); - s.m3(); - s.m4(); - foo(); -} diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.stderr b/src/test/ui/loops/loops-reject-duplicate-labels.stderr deleted file mode 100644 index 3bf3af763ec..00000000000 --- a/src/test/ui/loops/loops-reject-duplicate-labels.stderr +++ /dev/null @@ -1,74 +0,0 @@ -warning: label name `'fl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:9:5 - | -LL | 'fl: for _ in 0..10 { break; } - | --- first declared here -LL | 'fl: loop { break; } - | ^^^ label `'fl` already in scope - -warning: label name `'lf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:12:5 - | -LL | 'lf: loop { break; } - | --- first declared here -LL | 'lf: for _ in 0..10 { break; } - | ^^^ label `'lf` already in scope - -warning: label name `'wl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:14:5 - | -LL | 'wl: while 2 > 1 { break; } - | --- first declared here -LL | 'wl: loop { break; } - | ^^^ label `'wl` already in scope - -warning: label name `'lw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:16:5 - | -LL | 'lw: loop { break; } - | --- first declared here -LL | 'lw: while 2 > 1 { break; } - | ^^^ label `'lw` already in scope - -warning: label name `'fw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:18:5 - | -LL | 'fw: for _ in 0..10 { break; } - | --- first declared here -LL | 'fw: while 2 > 1 { break; } - | ^^^ label `'fw` already in scope - -warning: label name `'wf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:20:5 - | -LL | 'wf: while 2 > 1 { break; } - | --- first declared here -LL | 'wf: for _ in 0..10 { break; } - | ^^^ label `'wf` already in scope - -warning: label name `'tl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:22:5 - | -LL | 'tl: while let Some(_) = None::<i32> { break; } - | --- first declared here -LL | 'tl: loop { break; } - | ^^^ label `'tl` already in scope - -warning: label name `'lt` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:24:5 - | -LL | 'lt: loop { break; } - | --- first declared here -LL | 'lt: while let Some(_) = None::<i32> { break; } - | ^^^ label `'lt` already in scope - -warning: label name `'bl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:27:5 - | -LL | 'bl: {} - | --- first declared here -LL | 'bl: {} - | ^^^ label `'bl` already in scope - -warning: 9 warnings emitted - diff --git a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs deleted file mode 100644 index 741ea0c1ca8..00000000000 --- a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Issue #21633: reject duplicate loop labels in function bodies. -// This is testing interaction between lifetime-params and labels. - -// check-pass - -#![allow(dead_code, unused_variables)] - -fn foo() { - fn foo<'a>() { - 'a: loop { break 'a; } - //~^ WARN label name `'a` shadows a lifetime name that is already in scope - } - - struct Struct<'b, 'c> { _f: &'b i8, _g: &'c i8 } - enum Enum<'d, 'e> { A(&'d i8), B(&'e i8) } - - impl<'d, 'e> Struct<'d, 'e> { - fn meth_okay() { - 'a: loop { break 'a; } - 'b: loop { break 'b; } - 'c: loop { break 'c; } - } - } - - impl <'d, 'e> Enum<'d, 'e> { - fn meth_okay() { - 'a: loop { break 'a; } - 'b: loop { break 'b; } - 'c: loop { break 'c; } - } - } - - impl<'bad, 'c> Struct<'bad, 'c> { - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - - impl<'b, 'bad> Struct<'b, 'bad> { - fn meth_bad2(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - - impl<'b, 'c> Struct<'b, 'c> { - fn meth_bad3<'bad>(x: &'bad i8) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - - fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - - impl <'bad, 'e> Enum<'bad, 'e> { - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - impl <'d, 'bad> Enum<'d, 'bad> { - fn meth_bad2(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - impl <'d, 'e> Enum<'d, 'e> { - fn meth_bad3<'bad>(x: &'bad i8) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - - fn meth_bad4<'a,'bad>(x: &'bad i8) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - - trait HasDefaultMethod1<'bad> { - fn meth_okay() { - 'c: loop { break 'c; } - } - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - trait HasDefaultMethod2<'a,'bad> { - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } - trait HasDefaultMethod3<'a,'b> { - fn meth_bad<'bad>(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - } - } -} - - -pub fn main() { - foo(); -} diff --git a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr deleted file mode 100644 index 0d96c0b3a35..00000000000 --- a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr +++ /dev/null @@ -1,104 +0,0 @@ -warning: label name `'a` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:10:9 - | -LL | fn foo<'a>() { - | -- first declared here -LL | 'a: loop { break 'a; } - | ^^ lifetime `'a` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:35:13 - | -LL | impl<'bad, 'c> Struct<'bad, 'c> { - | ---- first declared here -LL | fn meth_bad(&self) { -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:42:13 - | -LL | impl<'b, 'bad> Struct<'b, 'bad> { - | ---- first declared here -LL | fn meth_bad2(&self) { -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:49:13 - | -LL | fn meth_bad3<'bad>(x: &'bad i8) { - | ---- first declared here -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:54:13 - | -LL | fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { - | ---- first declared here -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:61:13 - | -LL | impl <'bad, 'e> Enum<'bad, 'e> { - | ---- first declared here -LL | fn meth_bad(&self) { -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:67:13 - | -LL | impl <'d, 'bad> Enum<'d, 'bad> { - | ---- first declared here -LL | fn meth_bad2(&self) { -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:73:13 - | -LL | fn meth_bad3<'bad>(x: &'bad i8) { - | ---- first declared here -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:78:13 - | -LL | fn meth_bad4<'a,'bad>(x: &'bad i8) { - | ---- first declared here -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:88:13 - | -LL | trait HasDefaultMethod1<'bad> { - | ---- first declared here -... -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:94:13 - | -LL | trait HasDefaultMethod2<'a,'bad> { - | ---- first declared here -LL | fn meth_bad(&self) { -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:100:13 - | -LL | fn meth_bad<'bad>(&self) { - | ---- first declared here -LL | 'bad: loop { break 'bad; } - | ^^^^ lifetime `'bad` already in scope - -warning: 12 warnings emitted - diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs deleted file mode 100644 index ce2d07eb06a..00000000000 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs +++ /dev/null @@ -1,36 +0,0 @@ -// check-pass -#![feature(label_break_value)] -#![allow(dead_code, unused_variables)] - -// Issue #21633: reject duplicate loop labels and block labels in function bodies. -// -// Test rejection of lifetimes in *expressions* that shadow labels. - -fn foo() { - // Reusing lifetime `'a` in function item is okay. - fn foo<'a>(x: &'a i8) -> i8 { *x } - - // So is reusing `'a` in struct item - struct S1<'a> { x: &'a i8 } impl<'a> S1<'a> { fn m(&self) {} } - // and a method item - struct S2; impl S2 { fn m<'a>(&self) {} } - - let z = 3_i8; - - 'a: loop { - let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; - //~^ WARN lifetime name `'a` shadows a label name that is already in scope - assert_eq!((*b)(&z), z); - break 'a; - } - - 'b: { - let b = Box::new(|x: &()| ()) as Box<dyn for <'b> Fn(&'b ())>; - //~^ WARN lifetime name `'b` shadows a label name that is already in scope - break 'b; - } -} - -pub fn main() { - foo(); -} diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr deleted file mode 100644 index 9702b71600b..00000000000 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: lifetime name `'a` shadows a label name that is already in scope - --> $DIR/loops-reject-lifetime-shadowing-label.rs:21:55 - | -LL | 'a: loop { - | -- first declared here -LL | let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; - | ^^ label `'a` already in scope - -warning: lifetime name `'b` shadows a label name that is already in scope - --> $DIR/loops-reject-lifetime-shadowing-label.rs:28:55 - | -LL | 'b: { - | -- first declared here -LL | let b = Box::new(|x: &()| ()) as Box<dyn for <'b> Fn(&'b ())>; - | ^^ label `'b` already in scope - -warning: 2 warnings emitted - diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.rs b/src/test/ui/macros/macro-lifetime-used-with-labels.rs index 2e9da6f9dc8..59017da3b69 100644 --- a/src/test/ui/macros/macro-lifetime-used-with-labels.rs +++ b/src/test/ui/macros/macro-lifetime-used-with-labels.rs @@ -18,7 +18,7 @@ macro_rules! br { } macro_rules! br2 { ($b:lifetime) => { - 'b: loop { //~ WARNING `'b` shadows a label name that is already in scope + 'b: loop { break $b; // this $b should refer to the outer loop. } } diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr b/src/test/ui/macros/macro-lifetime-used-with-labels.stderr deleted file mode 100644 index 69334e21192..00000000000 --- a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: label name `'b` shadows a label name that is already in scope - --> $DIR/macro-lifetime-used-with-labels.rs:21:9 - | -LL | 'b: loop { - | ^^ label `'b` already in scope -... -LL | 'b: loop { - | -- first declared here -LL | br2!('b); - | -------- in this macro invocation - | - = note: this warning originates in the macro `br2` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: 1 warning emitted - diff --git a/src/test/ui/issues/issue-11319.rs b/src/test/ui/match/issue-11319.rs index ab69ab250ff..ab69ab250ff 100644 --- a/src/test/ui/issues/issue-11319.rs +++ b/src/test/ui/match/issue-11319.rs diff --git a/src/test/ui/issues/issue-11319.stderr b/src/test/ui/match/issue-11319.stderr index fc44205e81e..fc44205e81e 100644 --- a/src/test/ui/issues/issue-11319.stderr +++ b/src/test/ui/match/issue-11319.stderr diff --git a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr index 09978b35f7e..0af58bc61f4 100644 --- a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -46,6 +46,7 @@ LL | bar.pow(2); | ^^^ | help: you must specify a type for this binding, like `i32` + --> $DIR/auxiliary/macro-in-other-crate.rs:3:29 | LL | ($ident:ident) => { let $ident: i32 = 42; } | ~~~~~~~~~~~ diff --git a/src/test/ui/moves/use_of_moved_value_copy_suggestions.fixed b/src/test/ui/moves/use_of_moved_value_copy_suggestions.fixed index ba1b745ba84..45acf5beb12 100644 --- a/src/test/ui/moves/use_of_moved_value_copy_suggestions.fixed +++ b/src/test/ui/moves/use_of_moved_value_copy_suggestions.fixed @@ -21,7 +21,7 @@ fn duplicate_tup2<A: Copy, B: Copy>(t: (A, B)) -> ((A, B), (A, B)) { (t, t) //~ use of moved value: `t` } -fn duplicate_custom<T: Trait + Copy>(t: S<T>) -> (S<T>, S<T>) { +fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { //~^ HELP consider restricting type parameter `T` (t, t) //~ use of moved value: `t` } @@ -39,14 +39,14 @@ trait A {} trait B {} // Test where bounds are added with different bound placements -fn duplicate_custom_1<T: Trait + Copy>(t: S<T>) -> (S<T>, S<T>) where { +fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where { //~^ HELP consider restricting type parameter `T` (t, t) //~ use of moved value: `t` } fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>) where - T: A + Trait + Copy, + T: A + Copy + Trait, //~^ HELP consider further restricting this bound { (t, t) //~ use of moved value: `t` @@ -54,14 +54,14 @@ where fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>) where - T: A + Trait + Copy, + T: A + Copy + Trait, //~^ HELP consider further restricting this bound T: B, { (t, t) //~ use of moved value: `t` } -fn duplicate_custom_4<T: A + Trait + Copy>(t: S<T>) -> (S<T>, S<T>) +fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>) //~^ HELP consider further restricting this bound where T: B, diff --git a/src/test/ui/moves/use_of_moved_value_copy_suggestions.stderr b/src/test/ui/moves/use_of_moved_value_copy_suggestions.stderr index 2353cd079a3..5a84e3b81a6 100644 --- a/src/test/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/src/test/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -75,7 +75,7 @@ LL | (t, t) | help: consider restricting type parameter `T` | -LL | fn duplicate_custom<T: Trait + Copy>(t: S<T>) -> (S<T>, S<T>) { +LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { | ++++++++++++++ error[E0382]: use of moved value: `t` @@ -91,7 +91,7 @@ LL | (t, t) | help: consider restricting type parameter `T` | -LL | fn duplicate_custom_1<T: Trait + Copy>(t: S<T>) -> (S<T>, S<T>) where { +LL | fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where { | ++++++++++++++ error[E0382]: use of moved value: `t` @@ -107,7 +107,7 @@ LL | (t, t) | help: consider further restricting this bound | -LL | T: A + Trait + Copy, +LL | T: A + Copy + Trait, | ++++++++++++++ error[E0382]: use of moved value: `t` @@ -123,7 +123,7 @@ LL | (t, t) | help: consider further restricting this bound | -LL | T: A + Trait + Copy, +LL | T: A + Copy + Trait, | ++++++++++++++ error[E0382]: use of moved value: `t` @@ -139,7 +139,7 @@ LL | (t, t) | help: consider further restricting this bound | -LL | fn duplicate_custom_4<T: A + Trait + Copy>(t: S<T>) -> (S<T>, S<T>) +LL | fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>) | ++++++++++++++ error[E0382]: use of moved value: `t` diff --git a/src/test/ui/nll/issue-52742.base.stderr b/src/test/ui/nll/issue-52742.base.stderr index 259f378f70b..7b1fac082e4 100644 --- a/src/test/ui/nll/issue-52742.base.stderr +++ b/src/test/ui/nll/issue-52742.base.stderr @@ -4,7 +4,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | self.y = b.z | ^^^ | -note: ...the reference is valid for the lifetime `'_` as defined here... +note: ...the reference is valid for the anonymous lifetime as defined here... --> $DIR/issue-52742.rs:15:10 | LL | impl Foo<'_, '_> { diff --git a/src/test/ui/nll/issue-52742.nll.stderr b/src/test/ui/nll/issue-52742.nll.stderr index 6828418a78e..1a2165e0a9d 100644 --- a/src/test/ui/nll/issue-52742.nll.stderr +++ b/src/test/ui/nll/issue-52742.nll.stderr @@ -2,7 +2,7 @@ error: lifetime may not live long enough --> $DIR/issue-52742.rs:17:9 | LL | fn take_bar(&mut self, b: Bar<'_>) { - | --------- -- let's call this `'1` + | --------- - has type `Bar<'1>` | | | has type `&mut Foo<'_, '2>` LL | self.y = b.z diff --git a/src/test/ui/nll/issue-55394.base.stderr b/src/test/ui/nll/issue-55394.base.stderr index cc87954732c..2ec6a7af3f2 100644 --- a/src/test/ui/nll/issue-55394.base.stderr +++ b/src/test/ui/nll/issue-55394.base.stderr @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | Foo { bar } | ^^^ -note: but, the lifetime must be valid for the lifetime `'_` as defined here... +note: but, the lifetime must be valid for the anonymous lifetime as defined here... --> $DIR/issue-55394.rs:11:10 | LL | impl Foo<'_> { diff --git a/src/test/ui/issues/issue-14958.rs b/src/test/ui/overloaded/issue-14958.rs index a12564ca9c0..a12564ca9c0 100644 --- a/src/test/ui/issues/issue-14958.rs +++ b/src/test/ui/overloaded/issue-14958.rs diff --git a/src/test/ui/issues/issue-68091-unicode-ident-after-if.rs b/src/test/ui/parser/issue-68091-unicode-ident-after-if.rs index 00f90cc73b3..00f90cc73b3 100644 --- a/src/test/ui/issues/issue-68091-unicode-ident-after-if.rs +++ b/src/test/ui/parser/issue-68091-unicode-ident-after-if.rs diff --git a/src/test/ui/issues/issue-68091-unicode-ident-after-if.stderr b/src/test/ui/parser/issue-68091-unicode-ident-after-if.stderr index cdd4c670500..cdd4c670500 100644 --- a/src/test/ui/issues/issue-68091-unicode-ident-after-if.stderr +++ b/src/test/ui/parser/issue-68091-unicode-ident-after-if.stderr diff --git a/src/test/ui/issues/issue-68092-unicode-ident-after-incomplete-expr.rs b/src/test/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs index 1a90b4724d4..1a90b4724d4 100644 --- a/src/test/ui/issues/issue-68092-unicode-ident-after-incomplete-expr.rs +++ b/src/test/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs diff --git a/src/test/ui/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr b/src/test/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr index 0b9c364f1f1..0b9c364f1f1 100644 --- a/src/test/ui/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr +++ b/src/test/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr index 5a85aef2b17..c81520c35cd 100644 --- a/src/test/ui/privacy/restricted/test.stderr +++ b/src/test/ui/privacy/restricted/test.stderr @@ -3,6 +3,8 @@ error[E0433]: failed to resolve: maybe a missing crate `bad`? | LL | pub(in bad::path) mod m1 {} | ^^^ maybe a missing crate `bad`? + | + = help: consider adding `extern crate bad` to use the `bad` crate error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/test.rs:51:12 diff --git a/src/test/ui/proc-macro/auxiliary/expand-expr.rs b/src/test/ui/proc-macro/auxiliary/expand-expr.rs index a2e30e2e93b..2bc34f3c6bf 100644 --- a/src/test/ui/proc-macro/auxiliary/expand-expr.rs +++ b/src/test/ui/proc-macro/auxiliary/expand-expr.rs @@ -12,15 +12,6 @@ use std::str::FromStr; #[proc_macro] pub fn expand_expr_is(input: TokenStream) -> TokenStream { - expand_expr_is_inner(input, false) -} - -#[proc_macro] -pub fn expand_expr_is_trim(input: TokenStream) -> TokenStream { - expand_expr_is_inner(input, true) -} - -fn expand_expr_is_inner(input: TokenStream, trim_invisible: bool) -> TokenStream { let mut iter = input.into_iter(); let mut expected_tts = Vec::new(); loop { @@ -31,18 +22,14 @@ fn expand_expr_is_inner(input: TokenStream, trim_invisible: bool) -> TokenStream } } - // If requested, trim the "invisible" delimiters at the start and end. - let expected = expected_tts.into_iter().collect::<TokenStream>().to_string(); - let expected = if trim_invisible { - let len1 = "/*«*/ ".len(); - let len2 = " /*»*/".len(); - &expected[len1..expected.len() - len2] - } else { - &expected[..] - }; - let expanded = iter.collect::<TokenStream>().expand_expr().unwrap().to_string(); - - assert_eq!(expected, expanded); + let expected = expected_tts.into_iter().collect::<TokenStream>(); + let expanded = iter.collect::<TokenStream>().expand_expr().expect("expand_expr failed"); + assert!( + expected.to_string() == expanded.to_string(), + "assert failed\nexpected: `{}`\nexpanded: `{}`", + expected.to_string(), + expanded.to_string() + ); TokenStream::new() } diff --git a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout index 3d0e7eaff00..4de8746a1b4 100644 --- a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout +++ b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout @@ -1,5 +1,4 @@ PRINT-BANG INPUT (DISPLAY): self -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ self /*»*/ PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, @@ -14,10 +13,8 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ ] PRINT-BANG INPUT (DISPLAY): 1 + 1, { "a" }, let a = 1;, String, my_name, 'a, my_val = 30, std::option::Option, pub(in some::path) , [a b c], -30 -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ 1 + 1 /*»*/, /*«*/ { "a" } /*»*/, /*«*/ let a = 1 /*»*/, /*«*/ -String /*»*/, my_name, /*«*/ 'a /*»*/, /*«*/ my_val = 30 /*»*/, /*«*/ -std :: option :: Option /*»*/, /*«*/ pub(in some :: path) /*»*/, [a b c], -/*«*/ - 30 /*»*/ +PRINT-BANG RE-COLLECTED (DISPLAY): 1 + 1, { "a" }, let a = 1, String, my_name, 'a, my_val = 30, +std :: option :: Option, pub(in some :: path), [a b c], - 30 PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, @@ -298,7 +295,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ }, ] PRINT-BANG INPUT (DISPLAY): (a, b) -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ (a, b) /*»*/ PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/capture-unglued-token.stdout b/src/test/ui/proc-macro/capture-unglued-token.stdout index 5fe6ff72b45..7e6b540332c 100644 --- a/src/test/ui/proc-macro/capture-unglued-token.stdout +++ b/src/test/ui/proc-macro/capture-unglued-token.stdout @@ -1,5 +1,5 @@ PRINT-BANG INPUT (DISPLAY): Vec<u8> -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ Vec < u8 > /*»*/ +PRINT-BANG RE-COLLECTED (DISPLAY): Vec < u8 > PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/expand-expr.rs b/src/test/ui/proc-macro/expand-expr.rs index edcb30f892c..d1146d97030 100644 --- a/src/test/ui/proc-macro/expand-expr.rs +++ b/src/test/ui/proc-macro/expand-expr.rs @@ -2,9 +2,9 @@ extern crate expand_expr; -use expand_expr::{check_expand_expr_file, echo_pm, expand_expr_fail, expand_expr_is}; -use expand_expr::{expand_expr_is_trim, recursive_expand}; - +use expand_expr::{ + check_expand_expr_file, echo_pm, expand_expr_fail, expand_expr_is, recursive_expand, +}; // Check builtin macros can be expanded. @@ -47,21 +47,21 @@ macro_rules! echo_expr { macro_rules! simple_lit { ($l:literal) => { - expand_expr_is_trim!($l, $l); - expand_expr_is_trim!($l, echo_lit!($l)); - expand_expr_is_trim!($l, echo_expr!($l)); - expand_expr_is_trim!($l, echo_tts!($l)); - expand_expr_is_trim!($l, echo_pm!($l)); + expand_expr_is!($l, $l); + expand_expr_is!($l, echo_lit!($l)); + expand_expr_is!($l, echo_expr!($l)); + expand_expr_is!($l, echo_tts!($l)); + expand_expr_is!($l, echo_pm!($l)); const _: () = { macro_rules! mac { () => { $l }; } - expand_expr_is_trim!($l, mac!()); - expand_expr_is_trim!($l, echo_expr!(mac!())); - expand_expr_is_trim!($l, echo_tts!(mac!())); - expand_expr_is_trim!($l, echo_pm!(mac!())); + expand_expr_is!($l, mac!()); + expand_expr_is!($l, echo_expr!(mac!())); + expand_expr_is!($l, echo_tts!(mac!())); + expand_expr_is!($l, echo_pm!(mac!())); }; }; } diff --git a/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout b/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout index 04b516fd254..686d53e8876 100644 --- a/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout +++ b/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout @@ -1,6 +1,5 @@ PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = #[allow(warnings)] 0 ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E -{ V = { let _ = /*«*/ #[allow(warnings)] #[allow(warnings)] 0 /*»*/ ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = #[allow(warnings)] #[allow(warnings)] 0 ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -124,7 +123,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { 0; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ 0 /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { 0 } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -204,7 +203,6 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { {} } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ {} /*»*/ } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -283,7 +281,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { PATH; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ PATH /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { PATH } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -361,7 +359,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { 0 + 1; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ 0 + 1 /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { 0 + 1 } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", @@ -452,7 +450,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ }, ] PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { PATH + 1; } ; 0 }, } -PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { /*«*/ PATH + 1 /*»*/ } ; 0 }, } +PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { PATH + 1 } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", diff --git a/src/test/ui/proc-macro/issue-75734-pp-paren.stdout b/src/test/ui/proc-macro/issue-75734-pp-paren.stdout index 55818969c71..0fda6654ff3 100644 --- a/src/test/ui/proc-macro/issue-75734-pp-paren.stdout +++ b/src/test/ui/proc-macro/issue-75734-pp-paren.stdout @@ -96,7 +96,6 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ }, ] PRINT-BANG INPUT (DISPLAY): 1 + 1 * 2 -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ 1 + 1 /*»*/ * 2 PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout b/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout index 6cf8043c34f..60a400a5dea 100644 --- a/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout +++ b/src/test/ui/proc-macro/issue-78675-captured-inner-attrs.stdout @@ -1,7 +1,7 @@ PRINT-BANG INPUT (DISPLAY): foo! { #[fake_attr] mod bar { #![doc = r" Foo"] } } -PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): foo! { #[fake_attr] /*«*/ mod bar { #! [doc = r" Foo"] } /*»*/ } +PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): foo! { #[fake_attr] mod bar { #! [doc = r" Foo"] } } PRINT-BANG INPUT (DEBUG): TokenStream [ Ident { ident: "foo", diff --git a/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout b/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout index adbd653ead4..4b7ed874307 100644 --- a/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout +++ b/src/test/ui/proc-macro/issue-80760-empty-stmt.stdout @@ -1,5 +1,4 @@ PRINT-BANG INPUT (DISPLAY): ; -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ ; /*»*/ PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout b/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout index b912e426d5d..a3d24dd26fe 100644 --- a/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout +++ b/src/test/ui/proc-macro/nested-nonterminal-tokens.stdout @@ -1,6 +1,4 @@ PRINT-BANG INPUT (DISPLAY): 0 + 1 + 2 + 3 -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ 0 + 1 + 2 /*»*/ + 3 -PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): /*«*/ /*«*/ /*«*/ 0 /*»*/ + 1 /*»*/ + 2 /*»*/ + 3 PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/nodelim-groups.stdout b/src/test/ui/proc-macro/nodelim-groups.stdout index 0d2f33b4175..6b410f0bfb7 100644 --- a/src/test/ui/proc-macro/nodelim-groups.stdout +++ b/src/test/ui/proc-macro/nodelim-groups.stdout @@ -1,5 +1,4 @@ PRINT-BANG INPUT (DISPLAY): "hi" 1 + (25) + 1 (1 + 1) -PRINT-BANG RE-COLLECTED (DISPLAY): "hi" /*«*/ 1 + (25) + 1 /*»*/ (1 + 1) PRINT-BANG INPUT (DEBUG): TokenStream [ Literal { kind: Str, @@ -72,9 +71,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ }, ] PRINT-BANG INPUT (DISPLAY): "hi" "hello".len() + "world".len() (1 + 1) -PRINT-BANG RE-COLLECTED (DISPLAY): "hi" /*«*/ "hello".len() + "world".len() /*»*/ (1 + 1) -PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): "hi" /*«*/ /*«*/ "hello".len() /*»*/ + /*«*/ "world".len() /*»*/ /*»*/ -(1 + 1) PRINT-BANG INPUT (DEBUG): TokenStream [ Literal { kind: Str, diff --git a/src/test/ui/proc-macro/nonterminal-expansion.stdout b/src/test/ui/proc-macro/nonterminal-expansion.stdout index 32981e7011d..4d884348f2c 100644 --- a/src/test/ui/proc-macro/nonterminal-expansion.stdout +++ b/src/test/ui/proc-macro/nonterminal-expansion.stdout @@ -1,5 +1,5 @@ PRINT-ATTR_ARGS INPUT (DISPLAY): a, line!(), b -PRINT-ATTR_ARGS RE-COLLECTED (DISPLAY): a, /*«*/ line! () /*»*/, b +PRINT-ATTR_ARGS RE-COLLECTED (DISPLAY): a, line! (), b PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "a", diff --git a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout index ba18ca75d7f..c08e5308138 100644 --- a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout +++ b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout @@ -1,5 +1,5 @@ PRINT-BANG INPUT (DISPLAY): struct S; -PRINT-BANG RE-COLLECTED (DISPLAY): /*«*/ struct S ; /*»*/ +PRINT-BANG RE-COLLECTED (DISPLAY): struct S ; PRINT-BANG INPUT (DEBUG): TokenStream [ Group { delimiter: None, diff --git a/src/test/ui/proc-macro/parent-source-spans.rs b/src/test/ui/proc-macro/parent-source-spans.rs index 71e5065a87a..354657db4db 100644 --- a/src/test/ui/proc-macro/parent-source-spans.rs +++ b/src/test/ui/proc-macro/parent-source-spans.rs @@ -8,16 +8,16 @@ use parent_source_spans::parent_source_spans; macro one($a:expr, $b:expr) { two!($a, $b); - //~^ ERROR first parent: /*«*/ "hello" /*»*/ - //~| ERROR second parent: /*«*/ "world" /*»*/ + //~^ ERROR first parent: "hello" + //~| ERROR second parent: "world" } macro two($a:expr, $b:expr) { three!($a, $b); - //~^ ERROR first final: /*«*/ "hello" /*»*/ - //~| ERROR second final: /*«*/ "world" /*»*/ - //~| ERROR first final: /*«*/ "yay" /*»*/ - //~| ERROR second final: /*«*/ "rust" /*»*/ + //~^ ERROR first final: "hello" + //~| ERROR second final: "world" + //~| ERROR first final: "yay" + //~| ERROR second final: "rust" } // forwarding tokens directly doesn't create a new source chain @@ -34,16 +34,16 @@ macro four($($tokens:tt)*) { fn main() { one!("hello", "world"); - //~^ ERROR first grandparent: /*«*/ "hello" /*»*/ - //~| ERROR second grandparent: /*«*/ "world" /*»*/ - //~| ERROR first source: /*«*/ "hello" /*»*/ - //~| ERROR second source: /*«*/ "world" /*»*/ + //~^ ERROR first grandparent: "hello" + //~| ERROR second grandparent: "world" + //~| ERROR first source: "hello" + //~| ERROR second source: "world" two!("yay", "rust"); - //~^ ERROR first parent: /*«*/ "yay" /*»*/ - //~| ERROR second parent: /*«*/ "rust" /*»*/ - //~| ERROR first source: /*«*/ "yay" /*»*/ - //~| ERROR second source: /*«*/ "rust" /*»*/ + //~^ ERROR first parent: "yay" + //~| ERROR second parent: "rust" + //~| ERROR first source: "yay" + //~| ERROR second source: "rust" three!("hip", "hop"); //~^ ERROR first final: "hip" diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr index e42218ea701..4548269b507 100644 --- a/src/test/ui/proc-macro/parent-source-spans.stderr +++ b/src/test/ui/proc-macro/parent-source-spans.stderr @@ -1,4 +1,4 @@ -error: first final: /*«*/ "hello" /*»*/ +error: first final: "hello" --> $DIR/parent-source-spans.rs:16:12 | LL | three!($a, $b); @@ -9,7 +9,7 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: second final: /*«*/ "world" /*»*/ +error: second final: "world" --> $DIR/parent-source-spans.rs:16:16 | LL | three!($a, $b); @@ -20,7 +20,7 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: first parent: /*«*/ "hello" /*»*/ +error: first parent: "hello" --> $DIR/parent-source-spans.rs:10:5 | LL | two!($a, $b); @@ -31,7 +31,7 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) -error: second parent: /*«*/ "world" /*»*/ +error: second parent: "world" --> $DIR/parent-source-spans.rs:10:5 | LL | two!($a, $b); @@ -42,31 +42,31 @@ LL | one!("hello", "world"); | = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) -error: first grandparent: /*«*/ "hello" /*»*/ +error: first grandparent: "hello" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: second grandparent: /*«*/ "world" /*»*/ +error: second grandparent: "world" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: first source: /*«*/ "hello" /*»*/ +error: first source: "hello" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: second source: /*«*/ "world" /*»*/ +error: second source: "world" --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ -error: first final: /*«*/ "yay" /*»*/ +error: first final: "yay" --> $DIR/parent-source-spans.rs:16:12 | LL | three!($a, $b); @@ -77,7 +77,7 @@ LL | two!("yay", "rust"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: second final: /*«*/ "rust" /*»*/ +error: second final: "rust" --> $DIR/parent-source-spans.rs:16:16 | LL | three!($a, $b); @@ -88,25 +88,25 @@ LL | two!("yay", "rust"); | = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) -error: first parent: /*«*/ "yay" /*»*/ +error: first parent: "yay" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ -error: second parent: /*«*/ "rust" /*»*/ +error: second parent: "rust" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ -error: first source: /*«*/ "yay" /*»*/ +error: first source: "yay" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ -error: second source: /*«*/ "rust" /*»*/ +error: second source: "rust" --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); diff --git a/src/test/ui/regions/regions-name-duplicated.rs b/src/test/ui/regions/regions-name-duplicated.rs index f2adf015315..f6616591a3d 100644 --- a/src/test/ui/regions/regions-name-duplicated.rs +++ b/src/test/ui/regions/regions-name-duplicated.rs @@ -1,5 +1,6 @@ -struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice - x: &'a isize +struct Foo<'a, 'a> { + //~^ ERROR the name `'a` is already used for a generic parameter + x: &'a isize, } fn main() {} diff --git a/src/test/ui/regions/regions-name-duplicated.stderr b/src/test/ui/regions/regions-name-duplicated.stderr index a7e03a61adc..cef73c18d37 100644 --- a/src/test/ui/regions/regions-name-duplicated.stderr +++ b/src/test/ui/regions/regions-name-duplicated.stderr @@ -1,11 +1,11 @@ -error[E0263]: lifetime name `'a` declared twice in the same scope +error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters --> $DIR/regions-name-duplicated.rs:1:16 | LL | struct Foo<'a, 'a> { - | -- ^^ declared twice + | -- ^^ already used | | - | previous declaration here + | first use of `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0263`. +For more information about this error, try `rustc --explain E0403`. diff --git a/src/test/ui/resolve/editions-crate-root-2015.stderr b/src/test/ui/resolve/editions-crate-root-2015.stderr index f8d65fec3d1..00cdd0c58f4 100644 --- a/src/test/ui/resolve/editions-crate-root-2015.stderr +++ b/src/test/ui/resolve/editions-crate-root-2015.stderr @@ -3,12 +3,16 @@ error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? | LL | fn global_inner(_: ::nonexistant::Foo) { | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? + | + = help: consider adding `extern crate nonexistant` to use the `nonexistant` crate error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? --> $DIR/editions-crate-root-2015.rs:7:30 | LL | fn crate_inner(_: crate::nonexistant::Foo) { | ^^^^^^^^^^^ maybe a missing crate `nonexistant`? + | + = help: consider adding `extern crate nonexistant` to use the `nonexistant` crate error[E0412]: cannot find type `nonexistant` in the crate root --> $DIR/editions-crate-root-2015.rs:11:25 diff --git a/src/test/ui/resolve/extern-prelude-fail.stderr b/src/test/ui/resolve/extern-prelude-fail.stderr index a59f4c952bb..a1591914b4d 100644 --- a/src/test/ui/resolve/extern-prelude-fail.stderr +++ b/src/test/ui/resolve/extern-prelude-fail.stderr @@ -3,12 +3,16 @@ error[E0432]: unresolved import `extern_prelude` | LL | use extern_prelude::S; | ^^^^^^^^^^^^^^ maybe a missing crate `extern_prelude`? + | + = help: consider adding `extern crate extern_prelude` to use the `extern_prelude` crate error[E0433]: failed to resolve: maybe a missing crate `extern_prelude`? --> $DIR/extern-prelude-fail.rs:8:15 | LL | let s = ::extern_prelude::S; | ^^^^^^^^^^^^^^ maybe a missing crate `extern_prelude`? + | + = help: consider adding `extern crate extern_prelude` to use the `extern_prelude` crate error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/issue-82865.stderr b/src/test/ui/resolve/issue-82865.stderr index 7898c2a360f..730fd6d6026 100644 --- a/src/test/ui/resolve/issue-82865.stderr +++ b/src/test/ui/resolve/issue-82865.stderr @@ -3,6 +3,8 @@ error[E0433]: failed to resolve: maybe a missing crate `x`? | LL | use x::y::z; | ^ maybe a missing crate `x`? + | + = help: consider adding `extern crate x` to use the `x` crate error[E0599]: no function or associated item named `z` found for struct `Box<_, _>` in the current scope --> $DIR/issue-82865.rs:8:10 diff --git a/src/test/ui/resolve/resolve-bad-visibility.stderr b/src/test/ui/resolve/resolve-bad-visibility.stderr index 197ecf0cb00..2ac41b87562 100644 --- a/src/test/ui/resolve/resolve-bad-visibility.stderr +++ b/src/test/ui/resolve/resolve-bad-visibility.stderr @@ -21,12 +21,16 @@ error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? | LL | pub(in nonexistent) struct G; | ^^^^^^^^^^^ maybe a missing crate `nonexistent`? + | + = help: consider adding `extern crate nonexistent` to use the `nonexistent` crate error[E0433]: failed to resolve: maybe a missing crate `too_soon`? --> $DIR/resolve-bad-visibility.rs:8:8 | LL | pub(in too_soon) struct H; | ^^^^^^^^ maybe a missing crate `too_soon`? + | + = help: consider adding `extern crate too_soon` to use the `too_soon` crate error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs b/src/test/ui/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs new file mode 100644 index 00000000000..f70ca87e304 --- /dev/null +++ b/src/test/ui/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs @@ -0,0 +1,26 @@ +// compile-flags: --test +// run-pass + +// `generic_assert` is completely unimplemented and doesn't generate any logic, thus the +// reason why this test currently passes +#![feature(core_intrinsics, generic_assert, generic_assert_internals)] + +use std::fmt::{Debug, Formatter}; + +#[derive(Clone, Copy, PartialEq)] +struct CopyDebug(i32); + +impl Debug for CopyDebug { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { + f.write_str("With great power comes great electricity bills") + } +} + +#[test] +fn test() { + let _copy_debug = CopyDebug(1); + assert!(_copy_debug == CopyDebug(3)); +} + +fn main() { +} diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr index 570a08cb587..5b8b9bb68ad 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr @@ -2,9 +2,9 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:48 | LL | async fn f(self: Pin<&Self>) -> impl Clone { self } - | - ^^^^^^^^ + | ----- ^^^^^^^^ | | - | hidden type `Pin<&Foo>` captures the lifetime `'_` as defined here + | hidden type `Pin<&Foo>` captures the anonymous lifetime defined here | help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound | diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.base.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.base.stderr index 7985bf266d8..d2106630dfe 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.base.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.base.stderr @@ -5,6 +5,12 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } | ---- ---- ^ ...but data from `f` is returned here | | | this parameter and the return type are declared with different lifetimes... + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f } + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:82 @@ -13,6 +19,12 @@ LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { ( | ---- ----------------- ^ ...but data from `f` is returned here | | | this parameter and the return type are declared with different lifetimes... + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64 diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr index 8a55a7c34d7..3fd58725d02 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr @@ -6,6 +6,11 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } | | | | | let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'2` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f } + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:75 @@ -15,6 +20,11 @@ LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { ( | | | | | let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'2` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64 diff --git a/src/test/ui/self/elision/lt-ref-self-async.base.stderr b/src/test/ui/self/elision/lt-ref-self-async.base.stderr index b4385490614..0e2bbcc3c04 100644 --- a/src/test/ui/self/elision/lt-ref-self-async.base.stderr +++ b/src/test/ui/self/elision/lt-ref-self-async.base.stderr @@ -7,6 +7,12 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/lt-ref-self-async.rs:24:9 @@ -17,6 +23,12 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/lt-ref-self-async.rs:30:9 @@ -27,6 +39,12 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/lt-ref-self-async.rs:36:9 @@ -37,6 +55,12 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/lt-ref-self-async.rs:42:9 @@ -47,6 +71,12 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/lt-ref-self-async.rs:48:9 @@ -57,6 +87,12 @@ LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 6 previous errors diff --git a/src/test/ui/self/elision/lt-ref-self-async.nll.stderr b/src/test/ui/self/elision/lt-ref-self-async.nll.stderr index 2ba9a6596f6..1c889838e70 100644 --- a/src/test/ui/self/elision/lt-ref-self-async.nll.stderr +++ b/src/test/ui/self/elision/lt-ref-self-async.nll.stderr @@ -7,6 +7,11 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:24:9 @@ -17,6 +22,11 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:30:9 @@ -27,6 +37,11 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:36:9 @@ -37,6 +52,11 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:42:9 @@ -47,6 +67,11 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:48:9 @@ -57,6 +82,11 @@ LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 6 previous errors diff --git a/src/test/ui/self/elision/ref-mut-self-async.base.stderr b/src/test/ui/self/elision/ref-mut-self-async.base.stderr index 851337552c9..8ffc0d62242 100644 --- a/src/test/ui/self/elision/ref-mut-self-async.base.stderr +++ b/src/test/ui/self/elision/ref-mut-self-async.base.stderr @@ -7,6 +7,12 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-self-async.rs:24:9 @@ -17,6 +23,12 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-self-async.rs:30:9 @@ -27,6 +39,12 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-self-async.rs:36:9 @@ -37,6 +55,12 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-self-async.rs:42:9 @@ -47,6 +71,12 @@ LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a mut Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-self-async.rs:48:9 @@ -57,6 +87,12 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a mut Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 6 previous errors diff --git a/src/test/ui/self/elision/ref-mut-self-async.nll.stderr b/src/test/ui/self/elision/ref-mut-self-async.nll.stderr index cdd464039cd..9beafcd4ff9 100644 --- a/src/test/ui/self/elision/ref-mut-self-async.nll.stderr +++ b/src/test/ui/self/elision/ref-mut-self-async.nll.stderr @@ -7,6 +7,11 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:24:9 @@ -17,6 +22,11 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:30:9 @@ -27,6 +37,11 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:36:9 @@ -37,6 +52,11 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:42:9 @@ -47,6 +67,11 @@ LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a mut Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:48:9 @@ -57,6 +82,11 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a mut Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 6 previous errors diff --git a/src/test/ui/self/elision/ref-mut-struct-async.base.stderr b/src/test/ui/self/elision/ref-mut-struct-async.base.stderr index 0de11c24875..fefb3fc1944 100644 --- a/src/test/ui/self/elision/ref-mut-struct-async.base.stderr +++ b/src/test/ui/self/elision/ref-mut-struct-async.base.stderr @@ -7,6 +7,12 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-struct-async.rs:22:9 @@ -17,6 +23,12 @@ LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-struct-async.rs:28:9 @@ -27,6 +39,12 @@ LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-struct-async.rs:34:9 @@ -37,6 +55,12 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a mut Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-mut-struct-async.rs:40:9 @@ -47,6 +71,12 @@ LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_ref_Struct<'a>(self: Box<Pin<&'a mut Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 5 previous errors diff --git a/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr b/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr index 0ef410c8df1..7fbecbe76a5 100644 --- a/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr +++ b/src/test/ui/self/elision/ref-mut-struct-async.nll.stderr @@ -7,6 +7,11 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:22:9 @@ -17,6 +22,11 @@ LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:28:9 @@ -27,6 +37,11 @@ LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:34:9 @@ -37,6 +52,11 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a mut Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:40:9 @@ -47,6 +67,11 @@ LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_ref_Struct<'a>(self: Box<Pin<&'a mut Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 5 previous errors diff --git a/src/test/ui/self/elision/ref-self-async.base.stderr b/src/test/ui/self/elision/ref-self-async.base.stderr index fa13b69bb21..2b142b089d5 100644 --- a/src/test/ui/self/elision/ref-self-async.base.stderr +++ b/src/test/ui/self/elision/ref-self-async.base.stderr @@ -7,6 +7,12 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-self-async.rs:34:9 @@ -17,6 +23,12 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-self-async.rs:40:9 @@ -27,6 +39,12 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-self-async.rs:46:9 @@ -37,6 +55,12 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-self-async.rs:52:9 @@ -47,6 +71,12 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-self-async.rs:58:9 @@ -57,6 +87,12 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-self-async.rs:64:9 @@ -67,6 +103,12 @@ LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 { + | ++++ ++ ++ error: aborting due to 7 previous errors diff --git a/src/test/ui/self/elision/ref-self-async.nll.stderr b/src/test/ui/self/elision/ref-self-async.nll.stderr index 77faaa86650..f4e531a817c 100644 --- a/src/test/ui/self/elision/ref-self-async.nll.stderr +++ b/src/test/ui/self/elision/ref-self-async.nll.stderr @@ -7,6 +7,11 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:34:9 @@ -17,6 +22,11 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:40:9 @@ -27,6 +37,11 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:46:9 @@ -37,6 +52,11 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:52:9 @@ -47,6 +67,11 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:58:9 @@ -57,6 +82,11 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:64:9 @@ -67,6 +97,11 @@ LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 { + | ++++ ++ ++ error: aborting due to 7 previous errors diff --git a/src/test/ui/self/elision/ref-struct-async.base.stderr b/src/test/ui/self/elision/ref-struct-async.base.stderr index 8da673d4435..88ddca89804 100644 --- a/src/test/ui/self/elision/ref-struct-async.base.stderr +++ b/src/test/ui/self/elision/ref-struct-async.base.stderr @@ -7,6 +7,12 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-struct-async.rs:22:9 @@ -17,6 +23,12 @@ LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-struct-async.rs:28:9 @@ -27,6 +39,12 @@ LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-struct-async.rs:34:9 @@ -37,6 +55,12 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error[E0623]: lifetime mismatch --> $DIR/ref-struct-async.rs:40:9 @@ -47,6 +71,12 @@ LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { | this parameter and the return type are declared with different lifetimes... LL | f | ^ ...but data from `f` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_Struct<'a>(self: Box<Pin<&'a Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 5 previous errors diff --git a/src/test/ui/self/elision/ref-struct-async.nll.stderr b/src/test/ui/self/elision/ref-struct-async.nll.stderr index ad07c70df87..83c20329c3d 100644 --- a/src/test/ui/self/elision/ref-struct-async.nll.stderr +++ b/src/test/ui/self/elision/ref-struct-async.nll.stderr @@ -7,6 +7,11 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:22:9 @@ -17,6 +22,11 @@ LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:28:9 @@ -27,6 +37,11 @@ LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:34:9 @@ -37,6 +52,11 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:40:9 @@ -47,6 +67,11 @@ LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { | let's call the lifetime of this reference `'2` LL | f | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | async fn box_pin_Struct<'a>(self: Box<Pin<&'a Struct>>, f: &'a u32) -> &u32 { + | ++++ ++ ++ error: aborting due to 5 previous errors diff --git a/src/test/ui/simd/portable-intrinsics-arent-exposed.stderr b/src/test/ui/simd/portable-intrinsics-arent-exposed.stderr index f568aa04295..870f4064de4 100644 --- a/src/test/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/src/test/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -3,6 +3,8 @@ error[E0433]: failed to resolve: maybe a missing crate `core`? | LL | use core::simd::intrinsics; | ^^^^ maybe a missing crate `core`? + | + = help: consider adding `extern crate core` to use the `core` crate error[E0432]: unresolved import `std::simd::intrinsics` --> $DIR/portable-intrinsics-arent-exposed.rs:5:5 diff --git a/src/test/ui/suggestions/enum-method-probe.fixed b/src/test/ui/suggestions/enum-method-probe.fixed new file mode 100644 index 00000000000..6499c92bc6f --- /dev/null +++ b/src/test/ui/suggestions/enum-method-probe.fixed @@ -0,0 +1,59 @@ +// compile-flags: --edition=2021 +// run-rustfix + +#![allow(unused)] + +struct Foo; + +impl Foo { + fn get(&self) -> u8 { + 42 + } +} + +fn test_result_in_result() -> Result<(), ()> { + let res: Result<_, ()> = Ok(Foo); + res?.get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP use the `?` operator + Ok(()) +} + +async fn async_test_result_in_result() -> Result<(), ()> { + let res: Result<_, ()> = Ok(Foo); + res?.get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP use the `?` operator + Ok(()) +} + +fn test_result_in_unit_return() { + let res: Result<_, ()> = Ok(Foo); + res.expect("REASON").get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` +} + +async fn async_test_result_in_unit_return() { + let res: Result<_, ()> = Ok(Foo); + res.expect("REASON").get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` +} + +fn test_option_in_option() -> Option<()> { + let res: Option<_> = Some(Foo); + res?.get(); + //~^ ERROR no method named `get` found for enum `Option` in the current scope + //~| HELP use the `?` operator + Some(()) +} + +fn test_option_in_unit_return() { + let res: Option<_> = Some(Foo); + res.expect("REASON").get(); + //~^ ERROR no method named `get` found for enum `Option` in the current scope + //~| HELP consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None` +} + +fn main() {} diff --git a/src/test/ui/suggestions/enum-method-probe.rs b/src/test/ui/suggestions/enum-method-probe.rs new file mode 100644 index 00000000000..18ea8ed8a58 --- /dev/null +++ b/src/test/ui/suggestions/enum-method-probe.rs @@ -0,0 +1,59 @@ +// compile-flags: --edition=2021 +// run-rustfix + +#![allow(unused)] + +struct Foo; + +impl Foo { + fn get(&self) -> u8 { + 42 + } +} + +fn test_result_in_result() -> Result<(), ()> { + let res: Result<_, ()> = Ok(Foo); + res.get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP use the `?` operator + Ok(()) +} + +async fn async_test_result_in_result() -> Result<(), ()> { + let res: Result<_, ()> = Ok(Foo); + res.get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP use the `?` operator + Ok(()) +} + +fn test_result_in_unit_return() { + let res: Result<_, ()> = Ok(Foo); + res.get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` +} + +async fn async_test_result_in_unit_return() { + let res: Result<_, ()> = Ok(Foo); + res.get(); + //~^ ERROR no method named `get` found for enum `Result` in the current scope + //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` +} + +fn test_option_in_option() -> Option<()> { + let res: Option<_> = Some(Foo); + res.get(); + //~^ ERROR no method named `get` found for enum `Option` in the current scope + //~| HELP use the `?` operator + Some(()) +} + +fn test_option_in_unit_return() { + let res: Option<_> = Some(Foo); + res.get(); + //~^ ERROR no method named `get` found for enum `Option` in the current scope + //~| HELP consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None` +} + +fn main() {} diff --git a/src/test/ui/suggestions/enum-method-probe.stderr b/src/test/ui/suggestions/enum-method-probe.stderr new file mode 100644 index 00000000000..6ed14984f47 --- /dev/null +++ b/src/test/ui/suggestions/enum-method-probe.stderr @@ -0,0 +1,99 @@ +error[E0599]: no method named `get` found for enum `Result` in the current scope + --> $DIR/enum-method-probe.rs:24:9 + | +LL | res.get(); + | ^^^ method not found in `Result<Foo, ()>` + | +note: the method `get` exists on the type `Foo` + --> $DIR/enum-method-probe.rs:9:5 + | +LL | fn get(&self) -> u8 { + | ^^^^^^^^^^^^^^^^^^^ +help: use the `?` operator to extract the `Foo` value, propagating a `Result::Err` value to the caller + | +LL | res?.get(); + | + + +error[E0599]: no method named `get` found for enum `Result` in the current scope + --> $DIR/enum-method-probe.rs:39:9 + | +LL | res.get(); + | ^^^ method not found in `Result<Foo, ()>` + | +note: the method `get` exists on the type `Foo` + --> $DIR/enum-method-probe.rs:9:5 + | +LL | fn get(&self) -> u8 { + | ^^^^^^^^^^^^^^^^^^^ +help: consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` + | +LL | res.expect("REASON").get(); + | +++++++++++++++++ + +error[E0599]: no method named `get` found for enum `Result` in the current scope + --> $DIR/enum-method-probe.rs:16:9 + | +LL | res.get(); + | ^^^ method not found in `Result<Foo, ()>` + | +note: the method `get` exists on the type `Foo` + --> $DIR/enum-method-probe.rs:9:5 + | +LL | fn get(&self) -> u8 { + | ^^^^^^^^^^^^^^^^^^^ +help: use the `?` operator to extract the `Foo` value, propagating a `Result::Err` value to the caller + | +LL | res?.get(); + | + + +error[E0599]: no method named `get` found for enum `Result` in the current scope + --> $DIR/enum-method-probe.rs:32:9 + | +LL | res.get(); + | ^^^ method not found in `Result<Foo, ()>` + | +note: the method `get` exists on the type `Foo` + --> $DIR/enum-method-probe.rs:9:5 + | +LL | fn get(&self) -> u8 { + | ^^^^^^^^^^^^^^^^^^^ +help: consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` + | +LL | res.expect("REASON").get(); + | +++++++++++++++++ + +error[E0599]: no method named `get` found for enum `Option` in the current scope + --> $DIR/enum-method-probe.rs:46:9 + | +LL | res.get(); + | ^^^ method not found in `Option<Foo>` + | +note: the method `get` exists on the type `Foo` + --> $DIR/enum-method-probe.rs:9:5 + | +LL | fn get(&self) -> u8 { + | ^^^^^^^^^^^^^^^^^^^ +help: use the `?` operator to extract the `Foo` value, propagating an `Option::None` value to the caller + | +LL | res?.get(); + | + + +error[E0599]: no method named `get` found for enum `Option` in the current scope + --> $DIR/enum-method-probe.rs:54:9 + | +LL | res.get(); + | ^^^ method not found in `Option<Foo>` + | +note: the method `get` exists on the type `Foo` + --> $DIR/enum-method-probe.rs:9:5 + | +LL | fn get(&self) -> u8 { + | ^^^^^^^^^^^^^^^^^^^ +help: consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None` + | +LL | res.expect("REASON").get(); + | +++++++++++++++++ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed new file mode 100644 index 00000000000..ac0b14fba83 --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed @@ -0,0 +1,16 @@ +// run-rustfix +use std::fmt::Debug; + +#[derive(Debug, Copy, Clone)] +pub struct Vector2<T: Debug + Copy + Clone>{ + pub x: T, + pub y: T +} + +#[derive(Debug, Copy, Clone)] +pub struct AABB<K: Debug + std::marker::Copy>{ + pub loc: Vector2<K>, //~ ERROR the trait bound `K: Copy` is not satisfied + pub size: Vector2<K> +} + +fn main() {} diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.rs b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.rs new file mode 100644 index 00000000000..31f8cd6fcf7 --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.rs @@ -0,0 +1,16 @@ +// run-rustfix +use std::fmt::Debug; + +#[derive(Debug, Copy, Clone)] +pub struct Vector2<T: Debug + Copy + Clone>{ + pub x: T, + pub y: T +} + +#[derive(Debug, Copy, Clone)] +pub struct AABB<K: Debug>{ + pub loc: Vector2<K>, //~ ERROR the trait bound `K: Copy` is not satisfied + pub size: Vector2<K> +} + +fn main() {} diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr new file mode 100644 index 00000000000..03082be690f --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:12:14 + | +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^ the trait `Copy` is not implemented for `K` + | +note: required by a bound in `Vector2` + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:5:31 + | +LL | pub struct Vector2<T: Debug + Copy + Clone>{ + | ^^^^ required by this bound in `Vector2` +help: consider further restricting this bound + | +LL | pub struct AABB<K: Debug + std::marker::Copy>{ + | +++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed new file mode 100644 index 00000000000..304360d48a2 --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed @@ -0,0 +1,16 @@ +//run-rustfix +use std::fmt::Debug; + +#[derive(Debug, Copy, Clone)] +pub struct Vector2<T: Debug + Copy + Clone>{ + pub x: T, + pub y: T +} + +#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type +pub struct AABB<K: Copy + Debug>{ + pub loc: Vector2<K>, + pub size: Vector2<K> +} + +fn main() {} diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs new file mode 100644 index 00000000000..14e1fbb3311 --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs @@ -0,0 +1,16 @@ +//run-rustfix +use std::fmt::Debug; + +#[derive(Debug, Copy, Clone)] +pub struct Vector2<T: Debug + Copy + Clone>{ + pub x: T, + pub y: T +} + +#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type +pub struct AABB<K: Copy>{ + pub loc: Vector2<K>, + pub size: Vector2<K> +} + +fn main() {} diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr new file mode 100644 index 00000000000..4eb1e318d97 --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr @@ -0,0 +1,27 @@ +error[E0204]: the trait `Copy` may not be implemented for this type + --> $DIR/missing-bound-in-derive-copy-impl-3.rs:10:17 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^ +LL | pub struct AABB<K: Copy>{ +LL | pub loc: Vector2<K>, + | ------------------- this field does not implement `Copy` +LL | pub size: Vector2<K> + | -------------------- this field does not implement `Copy` + | +note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` + --> $DIR/missing-bound-in-derive-copy-impl-3.rs:12:5 + | +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ +LL | pub size: Vector2<K> + | ^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | pub struct AABB<K: Copy + Debug>{ + | +++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0204`. diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl.rs b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl.rs new file mode 100644 index 00000000000..52163bddd4f --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl.rs @@ -0,0 +1,15 @@ +use std::fmt::Debug; + +#[derive(Debug, Copy, Clone)] +pub struct Vector2<T: Debug + Copy + Clone>{ + pub x: T, + pub y: T +} + +#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type +pub struct AABB<K>{ + pub loc: Vector2<K>, + pub size: Vector2<K> +} + +fn main() {} diff --git a/src/test/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl.stderr new file mode 100644 index 00000000000..1cf2ab95bc3 --- /dev/null +++ b/src/test/ui/suggestions/missing-bound-in-derive-copy-impl.stderr @@ -0,0 +1,27 @@ +error[E0204]: the trait `Copy` may not be implemented for this type + --> $DIR/missing-bound-in-derive-copy-impl.rs:9:17 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^ +LL | pub struct AABB<K>{ +LL | pub loc: Vector2<K>, + | ------------------- this field does not implement `Copy` +LL | pub size: Vector2<K> + | -------------------- this field does not implement `Copy` + | +note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` + --> $DIR/missing-bound-in-derive-copy-impl.rs:11:5 + | +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ +LL | pub size: Vector2<K> + | ^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `K` + | +LL | pub struct AABB<K: Debug>{ + | +++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0204`. diff --git a/src/test/ui/issues/issue-8153.rs b/src/test/ui/traits/issue-8153.rs index 81a8f5338eb..81a8f5338eb 100644 --- a/src/test/ui/issues/issue-8153.rs +++ b/src/test/ui/traits/issue-8153.rs diff --git a/src/test/ui/issues/issue-8153.stderr b/src/test/ui/traits/issue-8153.stderr index 4389c3dc288..4389c3dc288 100644 --- a/src/test/ui/issues/issue-8153.stderr +++ b/src/test/ui/traits/issue-8153.stderr diff --git a/src/test/ui/traits/issue-97576.rs b/src/test/ui/traits/issue-97576.rs new file mode 100644 index 00000000000..fdc85e9fa89 --- /dev/null +++ b/src/test/ui/traits/issue-97576.rs @@ -0,0 +1,13 @@ +struct Foo { + bar: String, +} + +impl Foo { + pub fn new(bar: impl ToString) -> Self { + Self { + bar: bar.into(), //~ ERROR the trait bound `String: From<impl ToString>` is not satisfied + } + } +} + +fn main() {} diff --git a/src/test/ui/traits/issue-97576.stderr b/src/test/ui/traits/issue-97576.stderr new file mode 100644 index 00000000000..bdee073d6e3 --- /dev/null +++ b/src/test/ui/traits/issue-97576.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `String: From<impl ToString>` is not satisfied + --> $DIR/issue-97576.rs:8:22 + | +LL | bar: bar.into(), + | ^^^^ the trait `From<impl ToString>` is not implemented for `String` + | + = note: required because of the requirements on the impl of `Into<String>` for `impl ToString` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-14933.rs b/src/test/ui/type-alias/issue-14933.rs index bd95332caba..bd95332caba 100644 --- a/src/test/ui/issues/issue-14933.rs +++ b/src/test/ui/type-alias/issue-14933.rs diff --git a/src/test/ui/type/ascription/issue-47666.stderr b/src/test/ui/type/ascription/issue-47666.stderr index 59b35292726..b59a73af9f9 100644 --- a/src/test/ui/type/ascription/issue-47666.stderr +++ b/src/test/ui/type/ascription/issue-47666.stderr @@ -1,4 +1,4 @@ -error: expected type, found `<[_]>::into_vec(box [0, 1])` +error: expected type, found `<[_]>::into_vec(#[rustc_box] ::alloc::boxed::Box::new([0, 1]))` --> $DIR/issue-47666.rs:3:25 | LL | let _ = Option:Some(vec![0, 1]); diff --git a/src/test/ui/issues/issue-13853-2.rs b/src/test/ui/typeck/issue-13853-2.rs index 27319c98d6e..27319c98d6e 100644 --- a/src/test/ui/issues/issue-13853-2.rs +++ b/src/test/ui/typeck/issue-13853-2.rs diff --git a/src/test/ui/issues/issue-13853-2.stderr b/src/test/ui/typeck/issue-13853-2.stderr index 92068df6c05..92068df6c05 100644 --- a/src/test/ui/issues/issue-13853-2.stderr +++ b/src/test/ui/typeck/issue-13853-2.stderr diff --git a/src/test/ui/issues/issue-13853-5.rs b/src/test/ui/typeck/issue-13853-5.rs index 2afdf95aacf..2afdf95aacf 100644 --- a/src/test/ui/issues/issue-13853-5.rs +++ b/src/test/ui/typeck/issue-13853-5.rs diff --git a/src/test/ui/issues/issue-13853-5.stderr b/src/test/ui/typeck/issue-13853-5.stderr index 3d8f824ec94..3d8f824ec94 100644 --- a/src/test/ui/issues/issue-13853-5.stderr +++ b/src/test/ui/typeck/issue-13853-5.stderr diff --git a/src/test/ui/issues/issue-13853.rs b/src/test/ui/typeck/issue-13853.rs index ac9886d2e72..ac9886d2e72 100644 --- a/src/test/ui/issues/issue-13853.rs +++ b/src/test/ui/typeck/issue-13853.rs diff --git a/src/test/ui/issues/issue-13853.stderr b/src/test/ui/typeck/issue-13853.stderr index 657bda5f62b..657bda5f62b 100644 --- a/src/test/ui/issues/issue-13853.stderr +++ b/src/test/ui/typeck/issue-13853.stderr diff --git a/src/test/ui/unresolved/unresolved-asterisk-imports.stderr b/src/test/ui/unresolved/unresolved-asterisk-imports.stderr index a789179db65..8df8eab34a7 100644 --- a/src/test/ui/unresolved/unresolved-asterisk-imports.stderr +++ b/src/test/ui/unresolved/unresolved-asterisk-imports.stderr @@ -3,6 +3,8 @@ error[E0432]: unresolved import `not_existing_crate` | LL | use not_existing_crate::*; | ^^^^^^^^^^^^^^^^^^ maybe a missing crate `not_existing_crate`? + | + = help: consider adding `extern crate not_existing_crate` to use the `not_existing_crate` crate error: aborting due to previous error diff --git a/src/test/ui/unresolved/unresolved-import.rs b/src/test/ui/unresolved/unresolved-import.rs index b65c3dfb90b..4125c593c74 100644 --- a/src/test/ui/unresolved/unresolved-import.rs +++ b/src/test/ui/unresolved/unresolved-import.rs @@ -1,5 +1,6 @@ use foo::bar; //~ ERROR unresolved import `foo` [E0432] //~^ maybe a missing crate `foo`? + //~| HELP consider adding `extern crate foo` to use the `foo` crate use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] //~| no `Baz` in `bar` diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr index d4bfea57809..0dd928c8b6f 100644 --- a/src/test/ui/unresolved/unresolved-import.stderr +++ b/src/test/ui/unresolved/unresolved-import.stderr @@ -3,9 +3,11 @@ error[E0432]: unresolved import `foo` | LL | use foo::bar; | ^^^ maybe a missing crate `foo`? + | + = help: consider adding `extern crate foo` to use the `foo` crate error[E0432]: unresolved import `bar::Baz` - --> $DIR/unresolved-import.rs:4:5 + --> $DIR/unresolved-import.rs:5:5 | LL | use bar::Baz as x; | ^^^^^---^^^^^ @@ -14,7 +16,7 @@ LL | use bar::Baz as x; | no `Baz` in `bar` error[E0432]: unresolved import `food::baz` - --> $DIR/unresolved-import.rs:9:5 + --> $DIR/unresolved-import.rs:10:5 | LL | use food::baz; | ^^^^^^--- @@ -23,7 +25,7 @@ LL | use food::baz; | no `baz` in `food` error[E0432]: unresolved import `food::beens` - --> $DIR/unresolved-import.rs:14:12 + --> $DIR/unresolved-import.rs:15:12 | LL | use food::{beens as Foo}; | -----^^^^^^^ @@ -32,13 +34,13 @@ LL | use food::{beens as Foo}; | help: a similar name exists in the module: `beans` error[E0432]: unresolved import `MyEnum` - --> $DIR/unresolved-import.rs:38:9 + --> $DIR/unresolved-import.rs:39:9 | LL | use MyEnum::*; | ^^^^^^ help: a similar path exists: `self::MyEnum` error[E0432]: unresolved import `Enum` - --> $DIR/unresolved-import.rs:48:9 + --> $DIR/unresolved-import.rs:49:9 | LL | use Enum::*; | ^^^^ help: a similar path exists: `self::Enum` |
