diff options
Diffstat (limited to 'tests')
109 files changed, 340 insertions, 457 deletions
diff --git a/tests/ui/asm/naked-functions-ffi.rs b/tests/ui/asm/naked-functions-ffi.rs index 565c440022d..4ba5ccc57f6 100644 --- a/tests/ui/asm/naked-functions-ffi.rs +++ b/tests/ui/asm/naked-functions-ffi.rs @@ -7,6 +7,5 @@ use std::arch::naked_asm; #[unsafe(naked)] pub extern "C" fn naked(p: char) -> u128 { //~^ WARN uses type `char` - //~| WARN uses type `u128` naked_asm!("") } diff --git a/tests/ui/asm/naked-functions-ffi.stderr b/tests/ui/asm/naked-functions-ffi.stderr index 9df6185498e..f7893a3b8de 100644 --- a/tests/ui/asm/naked-functions-ffi.stderr +++ b/tests/ui/asm/naked-functions-ffi.stderr @@ -8,13 +8,5 @@ LL | pub extern "C" fn naked(p: char) -> u128 { = note: the `char` type has no C equivalent = note: `#[warn(improper_ctypes_definitions)]` on by default -warning: `extern` fn uses type `u128`, which is not FFI-safe - --> $DIR/naked-functions-ffi.rs:8:37 - | -LL | pub extern "C" fn naked(p: char) -> u128 { - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -warning: 2 warnings emitted +warning: 1 warning emitted diff --git a/tests/ui/autoref-autoderef/autoderef-privacy.rs b/tests/ui/autoref-autoderef/autoderef-privacy.rs index d2a217257e5..5fa28750f73 100644 --- a/tests/ui/autoref-autoderef/autoderef-privacy.rs +++ b/tests/ui/autoref-autoderef/autoderef-privacy.rs @@ -14,28 +14,28 @@ impl Bar2 { mod foo { #[derive(Default)] - pub struct Bar { i: ::Bar2 } + pub struct Bar { i: crate::Bar2 } #[derive(Default)] - pub struct Baz(::Baz2); + pub struct Baz(crate::Baz2); impl Bar { fn f(&self) -> bool { false } } impl ::std::ops::Deref for Bar { - type Target = ::Bar2; - fn deref(&self) -> &::Bar2 { &self.i } + type Target = crate::Bar2; + fn deref(&self) -> &crate::Bar2 { &self.i } } impl ::std::ops::Deref for Baz { - type Target = ::Baz2; - fn deref(&self) -> &::Baz2 { &self.0 } + type Target = crate::Baz2; + fn deref(&self) -> &crate::Baz2 { &self.0 } } pub fn f(bar: &Bar, baz: &Baz) { // Since the private fields and methods are visible here, there should be no autoderefs. - let _: &::Bar2 = &bar.i; - let _: &::Baz2 = &baz.0; + let _: &crate::Bar2 = &bar.i; + let _: &crate::Baz2 = &baz.0; assert!(!bar.f()); } } diff --git a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs b/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs index d08504005a5..06413e13526 100644 --- a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs +++ b/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs @@ -16,7 +16,7 @@ pub mod name_pool { } pub mod rust { - pub use name_pool::add; + pub use crate::name_pool::add; pub type rt = Box<()>; diff --git a/tests/ui/auxiliary/pub-and-stability.rs b/tests/ui/auxiliary/pub-and-stability.rs index d2d07f99398..8866233b61e 100644 --- a/tests/ui/auxiliary/pub-and-stability.rs +++ b/tests/ui/auxiliary/pub-and-stability.rs @@ -44,7 +44,7 @@ mod m { #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY pub(crate) b_crate: i32, #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY - pub(in m) c_mod: i32, + pub(in crate::m) c_mod: i32, #[stable(feature = "unit_test", since = "1.0.0")] // SILLY d_priv: i32 } @@ -60,7 +60,7 @@ mod m { pub i32, pub(crate) i32, - pub(in m) i32, + pub(in crate::m) i32, i32); impl Record { @@ -113,7 +113,7 @@ mod m { #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY - pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } + pub(in crate::m) fn pub_mod(&self) -> i32 { self.d_priv } #[stable(feature = "unit_test", since = "1.0.0")] // SILLY fn private(&self) -> i32 { self.d_priv } } @@ -127,7 +127,7 @@ mod m { pub fn stable(&self) -> i32 { self.0 } pub(crate) fn pub_crate(&self) -> i32 { self.0 } - pub(in m) fn pub_mod(&self) -> i32 { self.0 } + pub(in crate::m) fn pub_mod(&self) -> i32 { self.0 } fn private(&self) -> i32 { self.0 } } } diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index eb66633f9dd..ec81ba2e3d8 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -62,6 +62,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `c` `cache` `cmpxchg16b` +`concurrent-functions` `crc` `crt-static` `cssc` @@ -159,6 +160,15 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `lzcnt` `m` `mclass` +`message-security-assist-extension12` +`message-security-assist-extension3` +`message-security-assist-extension4` +`message-security-assist-extension5` +`message-security-assist-extension8` +`message-security-assist-extension9` +`miscellaneous-extensions-2` +`miscellaneous-extensions-3` +`miscellaneous-extensions-4` `mops` `movbe` `movrs` @@ -287,9 +297,11 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `vector` `vector-enhancements-1` `vector-enhancements-2` +`vector-enhancements-3` `vector-packed-decimal` `vector-packed-decimal-enhancement` `vector-packed-decimal-enhancement-2` +`vector-packed-decimal-enhancement-3` `vfp2` `vfp3` `vfp4` diff --git a/tests/ui/coherence/coherence_inherent.rs b/tests/ui/coherence/coherence_inherent.rs index f3ebf000386..b2007e3437d 100644 --- a/tests/ui/coherence/coherence_inherent.rs +++ b/tests/ui/coherence/coherence_inherent.rs @@ -15,8 +15,8 @@ mod Lib { mod Import { // Trait is in scope here: - use Lib::TheStruct; - use Lib::TheTrait; + use crate::Lib::TheStruct; + use crate::Lib::TheTrait; fn call_the_fn(s: &TheStruct) { s.the_fn(); @@ -25,7 +25,7 @@ mod Import { mod NoImport { // Trait is not in scope here: - use Lib::TheStruct; + use crate::Lib::TheStruct; fn call_the_fn(s: &TheStruct) { s.the_fn(); diff --git a/tests/ui/consts/const-blocks/migrate-fail.rs b/tests/ui/consts/const-blocks/migrate-fail.rs index fddbfbb9d32..e7dbb68d920 100644 --- a/tests/ui/consts/const-blocks/migrate-fail.rs +++ b/tests/ui/consts/const-blocks/migrate-fail.rs @@ -4,7 +4,7 @@ struct Bar; mod non_constants { - use Bar; + use crate::Bar; fn no_impl_copy_empty_value_multiple_elements() { let x = None; diff --git a/tests/ui/consts/const-blocks/migrate-pass.rs b/tests/ui/consts/const-blocks/migrate-pass.rs index 308834bd646..629d4db0dc6 100644 --- a/tests/ui/consts/const-blocks/migrate-pass.rs +++ b/tests/ui/consts/const-blocks/migrate-pass.rs @@ -5,7 +5,7 @@ struct Bar; mod constants { - use Bar; + use crate::Bar; fn no_impl_copy_empty_value_no_elements() { const FOO: Option<Bar> = None; @@ -69,7 +69,7 @@ mod constants { } mod non_constants { - use Bar; + use crate::Bar; fn no_impl_copy_empty_value_no_elements() { let x = None; diff --git a/tests/ui/consts/const-blocks/nll-fail.rs b/tests/ui/consts/const-blocks/nll-fail.rs index fddbfbb9d32..e7dbb68d920 100644 --- a/tests/ui/consts/const-blocks/nll-fail.rs +++ b/tests/ui/consts/const-blocks/nll-fail.rs @@ -4,7 +4,7 @@ struct Bar; mod non_constants { - use Bar; + use crate::Bar; fn no_impl_copy_empty_value_multiple_elements() { let x = None; diff --git a/tests/ui/consts/const-blocks/nll-pass.rs b/tests/ui/consts/const-blocks/nll-pass.rs index 308834bd646..629d4db0dc6 100644 --- a/tests/ui/consts/const-blocks/nll-pass.rs +++ b/tests/ui/consts/const-blocks/nll-pass.rs @@ -5,7 +5,7 @@ struct Bar; mod constants { - use Bar; + use crate::Bar; fn no_impl_copy_empty_value_no_elements() { const FOO: Option<Bar> = None; @@ -69,7 +69,7 @@ mod constants { } mod non_constants { - use Bar; + use crate::Bar; fn no_impl_copy_empty_value_no_elements() { let x = None; diff --git a/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs b/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs index 39f912066ec..fe9aef42feb 100644 --- a/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs +++ b/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs @@ -31,11 +31,11 @@ mod foo { } pub mod bar { - pub use foo::reexported_a as e; - pub use foo::reexported_b as f; - pub use foo::reexported_c as g; - pub use foo::reexported_d as h; - pub use foo::reexported_e as i; + pub use crate::foo::reexported_a as e; + pub use crate::foo::reexported_b as f; + pub use crate::foo::reexported_c as g; + pub use crate::foo::reexported_d as h; + pub use crate::foo::reexported_e as i; } pub static a: isize = 0; diff --git a/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs b/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs index 9525ff2e5ef..9a7a10529fa 100644 --- a/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs +++ b/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs @@ -15,7 +15,7 @@ pub trait Foo: Sized { } mod x { - use Foo; + use crate::Foo; #[rustc_if_this_changed] impl Foo for char { type T = char; } @@ -24,7 +24,7 @@ mod x { } mod y { - use Foo; + use crate::Foo; #[rustc_then_this_would_need(typeck)] //~ ERROR OK pub fn use_char_assoc() { diff --git a/tests/ui/dep-graph/dep-graph-caller-callee.rs b/tests/ui/dep-graph/dep-graph-caller-callee.rs index e56cd5202e5..b1318a169d9 100644 --- a/tests/ui/dep-graph/dep-graph-caller-callee.rs +++ b/tests/ui/dep-graph/dep-graph-caller-callee.rs @@ -15,7 +15,7 @@ mod x { } mod y { - use x; + use crate::x; // These dependencies SHOULD exist: #[rustc_then_this_would_need(typeck)] //~ ERROR OK @@ -25,7 +25,7 @@ mod y { } mod z { - use y; + use crate::y; // These are expected to yield errors, because changes to `x` // affect the BODY of `y`, but not its signature. diff --git a/tests/ui/dep-graph/dep-graph-struct-signature.rs b/tests/ui/dep-graph/dep-graph-struct-signature.rs index 5303c6d2e53..eea81b26f9f 100644 --- a/tests/ui/dep-graph/dep-graph-struct-signature.rs +++ b/tests/ui/dep-graph/dep-graph-struct-signature.rs @@ -23,7 +23,7 @@ struct WontChange { // these are valid dependencies mod signatures { - use WillChange; + use crate::WillChange; #[rustc_then_this_would_need(type_of)] //~ ERROR no path #[rustc_then_this_would_need(associated_item)] //~ ERROR no path @@ -70,7 +70,7 @@ mod signatures { } mod invalid_signatures { - use WontChange; + use crate::WontChange; #[rustc_then_this_would_need(type_of)] //~ ERROR no path trait A { diff --git a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs index b3e8e9a512e..eab4c792105 100644 --- a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs +++ b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs @@ -19,7 +19,7 @@ pub trait Bar: Sized { } mod x { - use {Foo, Bar}; + use crate::{Foo, Bar}; #[rustc_if_this_changed] impl Foo for u32 { } @@ -28,7 +28,7 @@ mod x { } mod y { - use {Foo, Bar}; + use crate::{Foo, Bar}; #[rustc_then_this_would_need(typeck)] //~ ERROR OK pub fn with_char() { @@ -37,7 +37,7 @@ mod y { } mod z { - use y; + use crate::y; #[rustc_then_this_would_need(typeck)] //~ ERROR no path pub fn z() { diff --git a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs index 7c612158bf0..859505a4a7a 100644 --- a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs +++ b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs @@ -18,7 +18,7 @@ pub trait Bar: Sized { } mod x { - use {Foo, Bar}; + use crate::{Foo, Bar}; #[rustc_if_this_changed] impl Foo for char { } @@ -27,7 +27,7 @@ mod x { } mod y { - use {Foo, Bar}; + use crate::{Foo, Bar}; #[rustc_then_this_would_need(typeck)] //~ ERROR no path pub fn call_bar() { @@ -36,7 +36,7 @@ mod y { } mod z { - use y; + use crate::y; #[rustc_then_this_would_need(typeck)] //~ ERROR no path pub fn z() { diff --git a/tests/ui/dep-graph/dep-graph-trait-impl.rs b/tests/ui/dep-graph/dep-graph-trait-impl.rs index 38cc88e567d..5cf0d34e007 100644 --- a/tests/ui/dep-graph/dep-graph-trait-impl.rs +++ b/tests/ui/dep-graph/dep-graph-trait-impl.rs @@ -14,7 +14,7 @@ pub trait Foo: Sized { } mod x { - use Foo; + use crate::Foo; #[rustc_if_this_changed] impl Foo for char { } @@ -23,7 +23,7 @@ mod x { } mod y { - use Foo; + use crate::Foo; #[rustc_then_this_would_need(typeck)] //~ ERROR OK pub fn with_char() { @@ -49,7 +49,7 @@ mod y { } mod z { - use y; + use crate::y; // These are expected to yield errors, because changes to `x` // affect the BODY of `y`, but not its signature. diff --git a/tests/ui/derived-errors/issue-31997.rs b/tests/ui/derived-errors/issue-31997.rs index ff619313afb..59f19e4fde2 100644 --- a/tests/ui/derived-errors/issue-31997.rs +++ b/tests/ui/derived-errors/issue-31997.rs @@ -11,7 +11,7 @@ fn closure<F, T>(x: F) -> Result<T, ()> } fn foo() -> Result<(), ()> { - try!(closure(|| bar(core::ptr::null_mut()))); //~ ERROR cannot find function `bar` in this scope + closure(|| bar(core::ptr::null_mut()))?; //~ ERROR cannot find function `bar` in this scope Ok(()) } diff --git a/tests/ui/derived-errors/issue-31997.stderr b/tests/ui/derived-errors/issue-31997.stderr index 7d6415fef83..f5afb94fbd6 100644 --- a/tests/ui/derived-errors/issue-31997.stderr +++ b/tests/ui/derived-errors/issue-31997.stderr @@ -1,8 +1,8 @@ error[E0425]: cannot find function `bar` in this scope - --> $DIR/issue-31997.rs:14:21 + --> $DIR/issue-31997.rs:14:16 | -LL | try!(closure(|| bar(core::ptr::null_mut()))); - | ^^^ not found in this scope +LL | closure(|| bar(core::ptr::null_mut()))?; + | ^^^ not found in this scope error: aborting due to 1 previous error diff --git a/tests/ui/drop/issue-23338-ensure-param-drop-order.rs b/tests/ui/drop/issue-23338-ensure-param-drop-order.rs index 6fee4520cbc..54a9d3324b9 100644 --- a/tests/ui/drop/issue-23338-ensure-param-drop-order.rs +++ b/tests/ui/drop/issue-23338-ensure-param-drop-order.rs @@ -163,7 +163,7 @@ pub mod d { }; self.log.borrow_mut().push(self.uid); indent_println(self.trail, &format!("+-- Drop {}", self)); - indent_println(::PREF_INDENT, ""); + indent_println(super::PREF_INDENT, ""); } } } diff --git a/tests/ui/drop/issue-23611-enum-swap-in-drop.rs b/tests/ui/drop/issue-23611-enum-swap-in-drop.rs index 410b07b16fc..208c6e2ada3 100644 --- a/tests/ui/drop/issue-23611-enum-swap-in-drop.rs +++ b/tests/ui/drop/issue-23611-enum-swap-in-drop.rs @@ -256,7 +256,7 @@ pub mod d { }; self.log.borrow_mut().push(self.uid); indent_println(self.trail, &format!("+-- Drop {}", self)); - indent_println(::PREF_INDENT, ""); + indent_println(super::PREF_INDENT, ""); } } } diff --git a/tests/ui/dropck/dropck_trait_cycle_checked.rs b/tests/ui/dropck/dropck_trait_cycle_checked.rs index be6ec3e4ed1..ffe43480b12 100644 --- a/tests/ui/dropck/dropck_trait_cycle_checked.rs +++ b/tests/ui/dropck/dropck_trait_cycle_checked.rs @@ -17,7 +17,7 @@ mod s { } mod id { - use s; + use crate::s; #[derive(Debug)] pub struct Id { orig_count: usize, diff --git a/tests/ui/error-codes/E0659.rs b/tests/ui/error-codes/E0659.rs index c00026bb7a7..d056f1d96dd 100644 --- a/tests/ui/error-codes/E0659.rs +++ b/tests/ui/error-codes/E0659.rs @@ -7,8 +7,8 @@ mod earth { } mod collider { - pub use moon::*; - pub use earth::*; + pub use crate::moon::*; + pub use crate::earth::*; } fn main() { diff --git a/tests/ui/error-codes/E0659.stderr b/tests/ui/error-codes/E0659.stderr index dbb72bb6759..371250b811b 100644 --- a/tests/ui/error-codes/E0659.stderr +++ b/tests/ui/error-codes/E0659.stderr @@ -8,14 +8,14 @@ LL | collider::foo(); note: `foo` could refer to the function imported here --> $DIR/E0659.rs:10:13 | -LL | pub use moon::*; - | ^^^^^^^ +LL | pub use crate::moon::*; + | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate note: `foo` could also refer to the function imported here --> $DIR/E0659.rs:11:13 | -LL | pub use earth::*; - | ^^^^^^^^ +LL | pub use crate::earth::*; + | ^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate error: aborting due to 1 previous error diff --git a/tests/ui/explore-issue-38412.stderr b/tests/ui/explore-issue-38412.stderr index 884184ec16e..fca5c738d27 100644 --- a/tests/ui/explore-issue-38412.stderr +++ b/tests/ui/explore-issue-38412.stderr @@ -103,8 +103,8 @@ LL | r.pub_mod(); | ::: $DIR/auxiliary/pub-and-stability.rs:116:9 | -LL | pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } - | ---------------------------------- private method defined here +LL | pub(in crate::m) fn pub_mod(&self) -> i32 { self.d_priv } + | ----------------------------------------- private method defined here error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:50:7 @@ -156,8 +156,8 @@ LL | t.pub_mod(); | ::: $DIR/auxiliary/pub-and-stability.rs:130:9 | -LL | pub(in m) fn pub_mod(&self) -> i32 { self.0 } - | ---------------------------------- private method defined here +LL | pub(in crate::m) fn pub_mod(&self) -> i32 { self.0 } + | ----------------------------------------- private method defined here error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:63:7 diff --git a/tests/ui/imports/duplicate.rs b/tests/ui/imports/duplicate.rs index 0c5a376da38..69ec82aafbd 100644 --- a/tests/ui/imports/duplicate.rs +++ b/tests/ui/imports/duplicate.rs @@ -7,27 +7,27 @@ mod b { } mod c { - pub use a::foo; + pub use crate::a::foo; } mod d { - use a::foo; - use a::foo; //~ ERROR the name `foo` is defined multiple times + use crate::a::foo; + use crate::a::foo; //~ ERROR the name `foo` is defined multiple times } mod e { - pub use a::*; - pub use c::*; // ok + pub use crate::a::*; + pub use crate::c::*; // ok } mod f { - pub use a::*; - pub use b::*; + pub use crate::a::*; + pub use crate::b::*; } mod g { - pub use a::*; - pub use f::*; + pub use crate::a::*; + pub use crate::f::*; } fn main() { diff --git a/tests/ui/imports/duplicate.stderr b/tests/ui/imports/duplicate.stderr index d7a7dfce921..f7dc7312b9d 100644 --- a/tests/ui/imports/duplicate.stderr +++ b/tests/ui/imports/duplicate.stderr @@ -1,10 +1,10 @@ error[E0252]: the name `foo` is defined multiple times --> $DIR/duplicate.rs:15:9 | -LL | use a::foo; - | ------ previous import of the value `foo` here -LL | use a::foo; - | ^^^^^^ `foo` reimported here +LL | use crate::a::foo; + | ------------- previous import of the value `foo` here +LL | use crate::a::foo; + | ^^^^^^^^^^^^^ `foo` reimported here | = note: `foo` must be defined only once in the value namespace of this module @@ -38,14 +38,14 @@ LL | f::foo(); note: `foo` could refer to the function imported here --> $DIR/duplicate.rs:24:13 | -LL | pub use a::*; - | ^^^^ +LL | pub use crate::a::*; + | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate note: `foo` could also refer to the function imported here --> $DIR/duplicate.rs:25:13 | -LL | pub use b::*; - | ^^^^ +LL | pub use crate::b::*; + | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate error[E0659]: `foo` is ambiguous @@ -80,14 +80,14 @@ LL | g::foo(); note: `foo` could refer to the function imported here --> $DIR/duplicate.rs:24:13 | -LL | pub use a::*; - | ^^^^ +LL | pub use crate::a::*; + | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate note: `foo` could also refer to the function imported here --> $DIR/duplicate.rs:25:13 | -LL | pub use b::*; - | ^^^^ +LL | pub use crate::b::*; + | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate = note: `#[warn(ambiguous_glob_imports)]` on by default diff --git a/tests/ui/imports/export-glob-imports-target.rs b/tests/ui/imports/export-glob-imports-target.rs index 6fde9fef0b6..84b9ffa83ff 100644 --- a/tests/ui/imports/export-glob-imports-target.rs +++ b/tests/ui/imports/export-glob-imports-target.rs @@ -9,7 +9,7 @@ mod foo { - use foo::bar::*; + use crate::foo::bar::*; pub mod bar { pub static a : isize = 10; } diff --git a/tests/ui/imports/glob-cycles.rs b/tests/ui/imports/glob-cycles.rs index 066aa3b53ea..d9850bec4ca 100644 --- a/tests/ui/imports/glob-cycles.rs +++ b/tests/ui/imports/glob-cycles.rs @@ -1,12 +1,12 @@ //@ check-pass mod foo { - pub use bar::*; - pub use main as f; + pub use crate::bar::*; + pub use crate::main as f; } mod bar { - pub use foo::*; + pub use crate::foo::*; } pub use foo::*; diff --git a/tests/ui/imports/glob-shadowing.rs b/tests/ui/imports/glob-shadowing.rs index 3a33b592b00..72848aac511 100644 --- a/tests/ui/imports/glob-shadowing.rs +++ b/tests/ui/imports/glob-shadowing.rs @@ -6,7 +6,7 @@ mod m { } mod glob_in_normal_module { - use m::*; + use crate::m::*; fn check() { let x = env!("PATH"); //~ ERROR `env` is ambiguous } @@ -14,7 +14,7 @@ mod glob_in_normal_module { mod glob_in_block_module { fn block() { - use m::*; + use crate::m::*; fn check() { let x = env!("PATH"); //~ ERROR `env` is ambiguous } @@ -24,7 +24,7 @@ mod glob_in_block_module { mod glob_shadows_item { pub macro fenv($e: expr) { $e } fn block() { - use m::*; + use crate::m::*; fn check() { let x = fenv!(); //~ ERROR `fenv` is ambiguous } diff --git a/tests/ui/imports/glob-shadowing.stderr b/tests/ui/imports/glob-shadowing.stderr index aff2eff68ac..0ce8d4f54f8 100644 --- a/tests/ui/imports/glob-shadowing.stderr +++ b/tests/ui/imports/glob-shadowing.stderr @@ -9,8 +9,8 @@ LL | let x = env!("PATH"); note: `env` could also refer to the macro imported here --> $DIR/glob-shadowing.rs:9:9 | -LL | use m::*; - | ^^^^ +LL | use crate::m::*; + | ^^^^^^^^^^^ = help: consider adding an explicit import of `env` to disambiguate = help: or use `self::env` to refer to this macro unambiguously @@ -25,8 +25,8 @@ LL | let x = env!("PATH"); note: `env` could also refer to the macro imported here --> $DIR/glob-shadowing.rs:17:13 | -LL | use m::*; - | ^^^^ +LL | use crate::m::*; + | ^^^^^^^^^^^ = help: consider adding an explicit import of `env` to disambiguate error[E0659]: `fenv` is ambiguous @@ -39,8 +39,8 @@ LL | let x = fenv!(); note: `fenv` could refer to the macro imported here --> $DIR/glob-shadowing.rs:27:13 | -LL | use m::*; - | ^^^^ +LL | use crate::m::*; + | ^^^^^^^^^^^ = help: consider adding an explicit import of `fenv` to disambiguate note: `fenv` could also refer to the macro defined here --> $DIR/glob-shadowing.rs:25:5 diff --git a/tests/ui/imports/import-glob-1.rs b/tests/ui/imports/import-glob-1.rs index 510f3814567..8beec4ce469 100644 --- a/tests/ui/imports/import-glob-1.rs +++ b/tests/ui/imports/import-glob-1.rs @@ -21,7 +21,7 @@ mod bar { } mod foo { - use bar::Baz::{Baz1, Baz2}; + use crate::bar::Baz::{Baz1, Baz2}; } fn main() {} diff --git a/tests/ui/imports/import-glob-circular.rs b/tests/ui/imports/import-glob-circular.rs index e47fa870c06..2dcfc7721fa 100644 --- a/tests/ui/imports/import-glob-circular.rs +++ b/tests/ui/imports/import-glob-circular.rs @@ -1,17 +1,17 @@ mod circ1 { - pub use circ2::f2; + pub use crate::circ2::f2; pub fn f1() { println!("f1"); } pub fn common() -> usize { return 0; } } mod circ2 { - pub use circ1::f1; + pub use crate::circ1::f1; pub fn f2() { println!("f2"); } pub fn common() -> usize { return 1; } } mod test { - use circ1::*; + use crate::circ1::*; fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope } diff --git a/tests/ui/imports/import-loop-2.rs b/tests/ui/imports/import-loop-2.rs index 1bd0f06c671..42f9a07fff3 100644 --- a/tests/ui/imports/import-loop-2.rs +++ b/tests/ui/imports/import-loop-2.rs @@ -1,9 +1,9 @@ mod a { - pub use b::x; + pub use crate::b::x; } mod b { - pub use a::x; //~ ERROR unresolved import `a::x` + pub use crate::a::x; //~ ERROR unresolved import `crate::a::x` fn main() { let y = x; } } diff --git a/tests/ui/imports/import-loop-2.stderr b/tests/ui/imports/import-loop-2.stderr index 2521b6e7c04..2ef40c4e218 100644 --- a/tests/ui/imports/import-loop-2.stderr +++ b/tests/ui/imports/import-loop-2.stderr @@ -1,8 +1,8 @@ -error[E0432]: unresolved import `a::x` +error[E0432]: unresolved import `crate::a::x` --> $DIR/import-loop-2.rs:6:13 | -LL | pub use a::x; - | ^^^^ no `x` in `a` +LL | pub use crate::a::x; + | ^^^^^^^^^^^ no `x` in `a` error: aborting due to 1 previous error diff --git a/tests/ui/imports/import-loop.rs b/tests/ui/imports/import-loop.rs index fc5bd32adee..92483770711 100644 --- a/tests/ui/imports/import-loop.rs +++ b/tests/ui/imports/import-loop.rs @@ -1,7 +1,7 @@ use y::x; mod y { - pub use y::x; //~ ERROR unresolved import `y::x` + pub use crate::y::x; //~ ERROR unresolved import `crate::y::x` } fn main() { } diff --git a/tests/ui/imports/import-loop.stderr b/tests/ui/imports/import-loop.stderr index 801fc2552b6..888ca11293c 100644 --- a/tests/ui/imports/import-loop.stderr +++ b/tests/ui/imports/import-loop.stderr @@ -1,8 +1,8 @@ -error[E0432]: unresolved import `y::x` +error[E0432]: unresolved import `crate::y::x` --> $DIR/import-loop.rs:4:13 | -LL | pub use y::x; - | ^^^^ no `x` in `y` +LL | pub use crate::y::x; + | ^^^^^^^^^^^ no `x` in `y` error: aborting due to 1 previous error diff --git a/tests/ui/imports/import-rpass.rs b/tests/ui/imports/import-rpass.rs index 97c64fd9c63..f03f974d573 100644 --- a/tests/ui/imports/import-rpass.rs +++ b/tests/ui/imports/import-rpass.rs @@ -4,8 +4,8 @@ mod foo { } mod bar { - use foo::x; - use foo::x as z; + use crate::foo::x; + use crate::foo::x as z; pub fn thing() { x(10); z(10); } } diff --git a/tests/ui/imports/import4.rs b/tests/ui/imports/import4.rs index 01535fc6f45..f670cc06201 100644 --- a/tests/ui/imports/import4.rs +++ b/tests/ui/imports/import4.rs @@ -1,4 +1,4 @@ -mod a { pub use b::foo; } -mod b { pub use a::foo; } //~ ERROR unresolved import `a::foo` +mod a { pub use crate::b::foo; } +mod b { pub use crate::a::foo; } //~ ERROR unresolved import `crate::a::foo` fn main() { println!("loop"); } diff --git a/tests/ui/imports/import4.stderr b/tests/ui/imports/import4.stderr index c979d6c9ae2..4faa5f0520a 100644 --- a/tests/ui/imports/import4.stderr +++ b/tests/ui/imports/import4.stderr @@ -1,8 +1,8 @@ -error[E0432]: unresolved import `a::foo` +error[E0432]: unresolved import `crate::a::foo` --> $DIR/import4.rs:2:17 | -LL | mod b { pub use a::foo; } - | ^^^^^^ no `foo` in `a` +LL | mod b { pub use crate::a::foo; } + | ^^^^^^^^^^^^^ no `foo` in `a` error: aborting due to 1 previous error diff --git a/tests/ui/imports/import5.rs b/tests/ui/imports/import5.rs index 96d6c62d48a..7c7d99d7175 100644 --- a/tests/ui/imports/import5.rs +++ b/tests/ui/imports/import5.rs @@ -1,7 +1,7 @@ //@ run-pass use foo::bar; mod foo { - pub use foo::zed::bar; + pub use crate::foo::zed::bar; pub mod zed { pub fn bar() { println!("foo"); } } diff --git a/tests/ui/imports/import6.rs b/tests/ui/imports/import6.rs index 8632c21e5f7..1677003c0ec 100644 --- a/tests/ui/imports/import6.rs +++ b/tests/ui/imports/import6.rs @@ -10,6 +10,6 @@ mod foo { } } mod bar { - pub use foo::zed::baz; + pub use crate::foo::zed::baz; } pub fn main() { baz(); } diff --git a/tests/ui/imports/imports.rs b/tests/ui/imports/imports.rs index a770103c212..b5c25eb0447 100644 --- a/tests/ui/imports/imports.rs +++ b/tests/ui/imports/imports.rs @@ -3,7 +3,7 @@ // Like other items, private imports can be imported and used non-lexically in paths. mod a { - use a as foo; + use crate::a as foo; use self::foo::foo as bar; mod b { @@ -18,22 +18,22 @@ pub fn f() -> bool { true } // Items and explicit imports shadow globs. fn g() { - use foo::*; - use bar::*; + use crate::foo::*; + use crate::bar::*; fn f() -> bool { true } let _: bool = f(); } fn h() { - use foo::*; - use bar::*; - use f; + use crate::foo::*; + use crate::bar::*; + use crate::f; let _: bool = f(); } // Here, there appears to be shadowing but isn't because of namespaces. mod b { - use foo::*; // This imports `f` in the value namespace. + use crate::foo::*; // This imports `f` in the value namespace. use super::b as f; // This imports `f` only in the type namespace, fn test() { self::f(); } // so the glob isn't shadowed. } @@ -55,12 +55,13 @@ mod c { // Unused names can be ambiguous. mod d { - pub use foo::*; // This imports `f` in the value namespace. - pub use bar::*; // This also imports `f` in the value namespace. + pub use crate::foo::*; // This imports `f` in the value namespace. + pub use crate::bar::*; // This also imports `f` in the value namespace. } mod e { - pub use d::*; // n.b. Since `e::f` is not used, this is not considered to be a use of `d::f`. + pub use crate::d::*; // n.b. Since `e::f` is not used, + // this is not considered to be a use of `d::f`. } fn main() {} diff --git a/tests/ui/imports/issue-18083.rs b/tests/ui/imports/issue-18083.rs index 97c0bc83ad5..c111c9b5aa8 100644 --- a/tests/ui/imports/issue-18083.rs +++ b/tests/ui/imports/issue-18083.rs @@ -5,7 +5,7 @@ // each other and be reported as unresolved. mod a { - use b::{B}; + use crate::b::{B}; pub use self::inner::A; mod inner { @@ -14,7 +14,7 @@ mod a { } mod b { - use a::{A}; + use crate::a::{A}; pub use self::inner::B; mod inner { diff --git a/tests/ui/imports/issue-19498.rs b/tests/ui/imports/issue-19498.rs index 5b9ce85fd8b..ae4e5fd35e5 100644 --- a/tests/ui/imports/issue-19498.rs +++ b/tests/ui/imports/issue-19498.rs @@ -7,7 +7,7 @@ mod A {} //~ ERROR the name `A` is defined multiple times pub mod B {} //~ ERROR the name `B` is defined multiple times //~| NOTE `B` redefined here mod C { - use C::D; + use crate::C::D; mod D {} //~ ERROR the name `D` is defined multiple times //~| NOTE `D` redefined here } diff --git a/tests/ui/imports/issue-19498.stderr b/tests/ui/imports/issue-19498.stderr index eb0d68a24c9..a4ddff3ed99 100644 --- a/tests/ui/imports/issue-19498.stderr +++ b/tests/ui/imports/issue-19498.stderr @@ -31,16 +31,16 @@ LL | use self::B as OtherB; error[E0255]: the name `D` is defined multiple times --> $DIR/issue-19498.rs:11:5 | -LL | use C::D; - | ---- previous import of the module `D` here +LL | use crate::C::D; + | ----------- previous import of the module `D` here LL | mod D {} | ^^^^^ `D` redefined here | = note: `D` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use C::D as OtherD; - | +++++++++ +LL | use crate::C::D as OtherD; + | +++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/imports/issue-32222.rs b/tests/ui/imports/issue-32222.rs index 8c528bc0a1e..6f5530a065c 100644 --- a/tests/ui/imports/issue-32222.rs +++ b/tests/ui/imports/issue-32222.rs @@ -16,7 +16,7 @@ mod a { } mod b { - pub use a::bar; + pub use crate::a::bar; } fn main() {} diff --git a/tests/ui/imports/issue-4366-2.rs b/tests/ui/imports/issue-4366-2.rs index c777b750252..e92d964f889 100644 --- a/tests/ui/imports/issue-4366-2.rs +++ b/tests/ui/imports/issue-4366-2.rs @@ -7,11 +7,11 @@ mod foo { } mod a { pub mod b { - use foo::foo; + use crate::foo::foo; type Bar = isize; } pub mod sub { - use a::b::*; + use crate::a::b::*; fn sub() -> Bar { 1 } //~^ ERROR cannot find type `Bar` in this scope } diff --git a/tests/ui/imports/issue-4366.rs b/tests/ui/imports/issue-4366.rs index 9ec2e58ecad..e2d89fdaff3 100644 --- a/tests/ui/imports/issue-4366.rs +++ b/tests/ui/imports/issue-4366.rs @@ -10,11 +10,11 @@ mod foo { } mod a { pub mod b { - use foo::foo; + use crate::foo::foo; type Bar = isize; } pub mod sub { - use a::b::*; + use crate::a::b::*; fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope } } diff --git a/tests/ui/imports/issue-4865-1.rs b/tests/ui/imports/issue-4865-1.rs index 1a72b1b5e3f..7c34d105550 100644 --- a/tests/ui/imports/issue-4865-1.rs +++ b/tests/ui/imports/issue-4865-1.rs @@ -6,16 +6,16 @@ // because these previous imports were not resolved. pub mod a { - use b::fn_b; - use c::*; + use crate::b::fn_b; + use crate::c::*; pub fn fn_a(){ } } pub mod b { - use a::fn_a; - use c::*; + use crate::a::fn_a; + use crate::c::*; pub fn fn_b(){ } diff --git a/tests/ui/imports/issue-4865-2.rs b/tests/ui/imports/issue-4865-2.rs index 746a74658dd..60ce2a468d9 100644 --- a/tests/ui/imports/issue-4865-2.rs +++ b/tests/ui/imports/issue-4865-2.rs @@ -12,7 +12,7 @@ pub mod say { } pub mod hello { - use say; + use crate::say; pub fn hello() { say::hello(); diff --git a/tests/ui/imports/issue-4865-3.rs b/tests/ui/imports/issue-4865-3.rs index 130223558cb..d9d17f4dd47 100644 --- a/tests/ui/imports/issue-4865-3.rs +++ b/tests/ui/imports/issue-4865-3.rs @@ -4,11 +4,11 @@ // they are not `pub`. pub mod a { - use b::*; + use crate::b::*; } pub mod b { - use a::*; + use crate::a::*; } use a::*; diff --git a/tests/ui/imports/issue-8208.rs b/tests/ui/imports/issue-8208.rs index 997d4d227b3..f6d88f830f2 100644 --- a/tests/ui/imports/issue-8208.rs +++ b/tests/ui/imports/issue-8208.rs @@ -2,7 +2,7 @@ use self::*; //~ ERROR: unresolved import `self::*` [E0432] //~^ NOTE cannot glob-import a module into itself mod foo { - use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] + use crate::foo::*; //~ ERROR: unresolved import `crate::foo::*` [E0432] //~^ NOTE cannot glob-import a module into itself mod bar { diff --git a/tests/ui/imports/issue-8208.stderr b/tests/ui/imports/issue-8208.stderr index e59aea12cda..0fbe4d35fab 100644 --- a/tests/ui/imports/issue-8208.stderr +++ b/tests/ui/imports/issue-8208.stderr @@ -4,11 +4,11 @@ error[E0432]: unresolved import `self::*` LL | use self::*; | ^^^^^^^ cannot glob-import a module into itself -error[E0432]: unresolved import `foo::*` +error[E0432]: unresolved import `crate::foo::*` --> $DIR/issue-8208.rs:5:9 | -LL | use foo::*; - | ^^^^^^ cannot glob-import a module into itself +LL | use crate::foo::*; + | ^^^^^^^^^^^^^ cannot glob-import a module into itself error[E0432]: unresolved import `super::bar::*` --> $DIR/issue-8208.rs:9:13 diff --git a/tests/ui/imports/issue-8640.rs b/tests/ui/imports/issue-8640.rs index 51a02a32ec8..7cf73d0e93e 100644 --- a/tests/ui/imports/issue-8640.rs +++ b/tests/ui/imports/issue-8640.rs @@ -1,7 +1,7 @@ #[allow(unused_imports)] mod foo { - use baz::bar; + use crate::baz::bar; mod bar {} //~^ ERROR the name `bar` is defined multiple times } diff --git a/tests/ui/imports/issue-8640.stderr b/tests/ui/imports/issue-8640.stderr index d22fddb1a69..3ce57e3a44a 100644 --- a/tests/ui/imports/issue-8640.stderr +++ b/tests/ui/imports/issue-8640.stderr @@ -1,16 +1,16 @@ error[E0255]: the name `bar` is defined multiple times --> $DIR/issue-8640.rs:5:5 | -LL | use baz::bar; - | -------- previous import of the module `bar` here +LL | use crate::baz::bar; + | --------------- previous import of the module `bar` here LL | mod bar {} | ^^^^^^^ `bar` redefined here | = note: `bar` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use baz::bar as other_bar; - | ++++++++++++ +LL | use crate::baz::bar as other_bar; + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/imports/local-modularized-tricky-fail-2.rs b/tests/ui/imports/local-modularized-tricky-fail-2.rs index 386de88bc3d..80b242b456c 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-2.rs +++ b/tests/ui/imports/local-modularized-tricky-fail-2.rs @@ -10,13 +10,13 @@ macro_rules! define_exported { () => { define_exported!(); mod m { - use exported; + use crate::exported; //~^ ERROR macro-expanded `macro_export` macros from the current crate cannot //~| WARN this was previously accepted } fn main() { - ::exported!(); + crate::exported!(); //~^ ERROR macro-expanded `macro_export` macros from the current crate cannot //~| WARN this was previously accepted } diff --git a/tests/ui/imports/local-modularized-tricky-fail-2.stderr b/tests/ui/imports/local-modularized-tricky-fail-2.stderr index 2c1965ac0a4..49f5c72947f 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-2.stderr +++ b/tests/ui/imports/local-modularized-tricky-fail-2.stderr @@ -1,8 +1,8 @@ error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths --> $DIR/local-modularized-tricky-fail-2.rs:13:9 | -LL | use exported; - | ^^^^^^^^ +LL | use crate::exported; + | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234> @@ -22,8 +22,8 @@ LL | define_exported!(); error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths --> $DIR/local-modularized-tricky-fail-2.rs:19:5 | -LL | ::exported!(); - | ^^^^^^^^^^ +LL | crate::exported!(); + | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234> diff --git a/tests/ui/imports/macros.rs b/tests/ui/imports/macros.rs index 7f479571e5e..cf67e08c87a 100644 --- a/tests/ui/imports/macros.rs +++ b/tests/ui/imports/macros.rs @@ -8,13 +8,13 @@ mod foo { mod m1 { m!(use two_macros::*;); - use foo::m; // This shadows the glob import + use crate::foo::m; // This shadows the glob import } mod m2 { use two_macros::*; m! { //~ ERROR ambiguous - use foo::m; + use crate::foo::m; } } diff --git a/tests/ui/imports/macros.stderr b/tests/ui/imports/macros.stderr index e34e5359b48..25a678c6b37 100644 --- a/tests/ui/imports/macros.stderr +++ b/tests/ui/imports/macros.stderr @@ -8,8 +8,8 @@ LL | m! { note: `m` could refer to the macro imported here --> $DIR/macros.rs:17:13 | -LL | use foo::m; - | ^^^^^^ +LL | use crate::foo::m; + | ^^^^^^^^^^^^^ note: `m` could also refer to the macro imported here --> $DIR/macros.rs:15:9 | diff --git a/tests/ui/imports/reexport-star.rs b/tests/ui/imports/reexport-star.rs index 461dc23b4dc..9bf4a6ce0c4 100644 --- a/tests/ui/imports/reexport-star.rs +++ b/tests/ui/imports/reexport-star.rs @@ -6,7 +6,7 @@ mod a { } mod b { - pub use a::*; + pub use crate::a::*; } pub fn main() { diff --git a/tests/ui/imports/reexports.rs b/tests/ui/imports/reexports.rs index 2a1a62834ce..6ad704b53fc 100644 --- a/tests/ui/imports/reexports.rs +++ b/tests/ui/imports/reexports.rs @@ -33,8 +33,8 @@ mod b { mod c { // Test that `foo` is not re-exported. - use b::a::foo::S; //~ ERROR `foo` - use b::b::foo::S as T; //~ ERROR `foo` + use crate::b::a::foo::S; //~ ERROR `foo` + use crate::b::b::foo::S as T; //~ ERROR `foo` } fn main() {} diff --git a/tests/ui/imports/reexports.stderr b/tests/ui/imports/reexports.stderr index fa05c0c0f8e..0ebcf8e58d6 100644 --- a/tests/ui/imports/reexports.stderr +++ b/tests/ui/imports/reexports.stderr @@ -11,10 +11,10 @@ LL | pub use super::foo; | ^^^^^^^^^^ error[E0603]: module import `foo` is private - --> $DIR/reexports.rs:36:15 + --> $DIR/reexports.rs:36:22 | -LL | use b::a::foo::S; - | ^^^ private module import +LL | use crate::b::a::foo::S; + | ^^^ private module import | note: the module import `foo` is defined here... --> $DIR/reexports.rs:24:17 @@ -28,10 +28,10 @@ LL | mod foo { | ^^^^^^^ error[E0603]: module import `foo` is private - --> $DIR/reexports.rs:37:15 + --> $DIR/reexports.rs:37:22 | -LL | use b::b::foo::S as T; - | ^^^ private module import +LL | use crate::b::b::foo::S as T; + | ^^^ private module import | note: the module import `foo` is defined here... --> $DIR/reexports.rs:29:17 diff --git a/tests/ui/imports/shadow_builtin_macros.rs b/tests/ui/imports/shadow_builtin_macros.rs index 5a149067408..7d318dfdb43 100644 --- a/tests/ui/imports/shadow_builtin_macros.rs +++ b/tests/ui/imports/shadow_builtin_macros.rs @@ -6,17 +6,17 @@ mod foo { } mod m1 { - use foo::panic; // ok + use crate::foo::panic; // ok fn f() { panic!(); } } mod m2 { - use foo::*; + use crate::foo::*; fn f() { panic!(); } //~ ERROR ambiguous } mod m3 { - ::two_macros::m!(use foo::panic;); + ::two_macros::m!(use crate::foo::panic;); fn f() { panic!(); } //~ ERROR ambiguous } @@ -40,12 +40,12 @@ mod bar { } mod m6 { - use bar::n; // ok + use crate::bar::n; // ok n!(); } mod m7 { - use bar::*; + use crate::bar::*; n!(); //~ ERROR ambiguous } diff --git a/tests/ui/imports/shadow_builtin_macros.stderr b/tests/ui/imports/shadow_builtin_macros.stderr index 6ffb31c20e6..c828b1193d8 100644 --- a/tests/ui/imports/shadow_builtin_macros.stderr +++ b/tests/ui/imports/shadow_builtin_macros.stderr @@ -9,8 +9,8 @@ LL | fn f() { panic!(); } note: `panic` could also refer to the macro imported here --> $DIR/shadow_builtin_macros.rs:14:9 | -LL | use foo::*; - | ^^^^^^ +LL | use crate::foo::*; + | ^^^^^^^^^^^^^ = help: consider adding an explicit import of `panic` to disambiguate = help: or use `self::panic` to refer to this macro unambiguously @@ -42,8 +42,8 @@ LL | n!(); note: `n` could refer to the macro imported here --> $DIR/shadow_builtin_macros.rs:48:9 | -LL | use bar::*; - | ^^^^^^ +LL | use crate::bar::*; + | ^^^^^^^^^^^^^ = help: consider adding an explicit import of `n` to disambiguate = help: or use `self::n` to refer to this macro unambiguously note: `n` could also refer to the macro imported here @@ -63,8 +63,8 @@ LL | fn f() { panic!(); } note: `panic` could also refer to the macro imported here --> $DIR/shadow_builtin_macros.rs:19:26 | -LL | ::two_macros::m!(use foo::panic;); - | ^^^^^^^^^^ +LL | ::two_macros::m!(use crate::foo::panic;); + | ^^^^^^^^^^^^^^^^^ = help: use `self::panic` to refer to this macro unambiguously error: aborting due to 4 previous errors diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs index c42a4b94e29..a467c445d61 100644 --- a/tests/ui/intrinsics/intrinsic-alignment.rs +++ b/tests/ui/intrinsics/intrinsic-alignment.rs @@ -24,16 +24,16 @@ mod m { #[cfg(target_arch = "x86")] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::<u64>(), 8); - assert_eq!(::rusti::min_align_of::<u64>(), 4); + assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); + assert_eq!(crate::rusti::min_align_of::<u64>(), 4); } } #[cfg(not(target_arch = "x86"))] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::<u64>(), 8); - assert_eq!(::rusti::min_align_of::<u64>(), 8); + assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } } @@ -43,8 +43,8 @@ mod m { #[cfg(target_arch = "x86_64")] pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::<u64>(), 8); - assert_eq!(::rusti::min_align_of::<u64>(), 8); + assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } } @@ -53,8 +53,8 @@ mod m { mod m { pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::<u64>(), 8); - assert_eq!(::rusti::min_align_of::<u64>(), 8); + assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } } @@ -63,8 +63,8 @@ mod m { mod m { pub fn main() { unsafe { - assert_eq!(::rusti::pref_align_of::<u64>(), 8); - assert_eq!(::rusti::min_align_of::<u64>(), 8); + assert_eq!(crate::rusti::pref_align_of::<u64>(), 8); + assert_eq!(crate::rusti::min_align_of::<u64>(), 8); } } } diff --git a/tests/ui/issues/issue-10806.rs b/tests/ui/issues/issue-10806.rs index 72d99ae3a79..31315dc7c93 100644 --- a/tests/ui/issues/issue-10806.rs +++ b/tests/ui/issues/issue-10806.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ run-pass #![allow(unused_imports)] diff --git a/tests/ui/issues/issue-12729.rs b/tests/ui/issues/issue-12729.rs index 74014981df5..4d45846bc60 100644 --- a/tests/ui/issues/issue-12729.rs +++ b/tests/ui/issues/issue-12729.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-13105.rs b/tests/ui/issues/issue-13105.rs index 0dd78372a26..d119aa9c788 100644 --- a/tests/ui/issues/issue-13105.rs +++ b/tests/ui/issues/issue-13105.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ check-pass trait Foo { diff --git a/tests/ui/issues/issue-13775.rs b/tests/ui/issues/issue-13775.rs index 500ec6782a8..1477dab9e21 100644 --- a/tests/ui/issues/issue-13775.rs +++ b/tests/ui/issues/issue-13775.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ check-pass trait Foo { diff --git a/tests/ui/issues/issue-15774.rs b/tests/ui/issues/issue-15774.rs index 8eb327a0d5e..dadd59cc077 100644 --- a/tests/ui/issues/issue-15774.rs +++ b/tests/ui/issues/issue-15774.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ run-pass #![deny(warnings)] diff --git a/tests/ui/issues/issue-34074.rs b/tests/ui/issues/issue-34074.rs index 9b3dee11d9b..d642c74d412 100644 --- a/tests/ui/issues/issue-34074.rs +++ b/tests/ui/issues/issue-34074.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ check-pass // Make sure several unnamed function parameters don't conflict with each other diff --git a/tests/ui/issues/issue-50571.fixed b/tests/ui/issues/issue-50571.fixed index 37ed729be81..6d73f17cca4 100644 --- a/tests/ui/issues/issue-50571.fixed +++ b/tests/ui/issues/issue-50571.fixed @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ run-rustfix #![allow(dead_code)] diff --git a/tests/ui/issues/issue-50571.rs b/tests/ui/issues/issue-50571.rs index 97a042d3ec1..dd840ffe4d1 100644 --- a/tests/ui/issues/issue-50571.rs +++ b/tests/ui/issues/issue-50571.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ run-rustfix #![allow(dead_code)] diff --git a/tests/ui/issues/issue-50571.stderr b/tests/ui/issues/issue-50571.stderr index 86709410670..9b00fe0f5db 100644 --- a/tests/ui/issues/issue-50571.stderr +++ b/tests/ui/issues/issue-50571.stderr @@ -1,5 +1,5 @@ error[E0642]: patterns aren't allowed in methods without bodies - --> $DIR/issue-50571.rs:5:12 + --> $DIR/issue-50571.rs:6:12 | LL | fn foo([a, b]: [i32; 2]) {} | ^^^^^^ diff --git a/tests/ui/issues/issue-86756.rs b/tests/ui/issues/issue-86756.rs index 7f864eb2850..55a6c144839 100644 --- a/tests/ui/issues/issue-86756.rs +++ b/tests/ui/issues/issue-86756.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 trait Foo<T, T = T> {} //~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters diff --git a/tests/ui/issues/issue-86756.stderr b/tests/ui/issues/issue-86756.stderr index 728d7ea7095..0f68b764850 100644 --- a/tests/ui/issues/issue-86756.stderr +++ b/tests/ui/issues/issue-86756.stderr @@ -1,5 +1,5 @@ error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/issue-86756.rs:1:14 + --> $DIR/issue-86756.rs:2:14 | LL | trait Foo<T, T = T> {} | - ^ already used @@ -7,13 +7,13 @@ LL | trait Foo<T, T = T> {} | first use of `T` error[E0412]: cannot find type `dyn` in this scope - --> $DIR/issue-86756.rs:5:10 + --> $DIR/issue-86756.rs:6:10 | LL | eq::<dyn, Foo> | ^^^ not found in this scope warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-86756.rs:5:15 + --> $DIR/issue-86756.rs:6:15 | LL | eq::<dyn, Foo> | ^^^ @@ -27,13 +27,13 @@ LL | eq::<dyn, dyn Foo> | +++ error[E0107]: missing generics for trait `Foo` - --> $DIR/issue-86756.rs:5:15 + --> $DIR/issue-86756.rs:6:15 | LL | eq::<dyn, Foo> | ^^^ expected at least 1 generic argument | note: trait defined here, with at least 1 generic parameter: `T` - --> $DIR/issue-86756.rs:1:7 + --> $DIR/issue-86756.rs:2:7 | LL | trait Foo<T, T = T> {} | ^^^ - diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs index 52781d9c6d8..5b290899a70 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs @@ -1,4 +1,5 @@ //@ revisions: rust2015 rust2018 rust2021 +//@[rust2015] edition:2015 //@[rust2018] edition:2018 //@[rust2021] edition:2021 fn main() { diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr index 2f92225de1f..be3b114baf9 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr @@ -1,5 +1,5 @@ error[E0762]: unterminated character literal - --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26 + --> $DIR/lex-bad-str-literal-as-char-3.rs:6:26 | LL | println!('hello world'); | ^^^ diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr index 2f92225de1f..be3b114baf9 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr @@ -1,5 +1,5 @@ error[E0762]: unterminated character literal - --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26 + --> $DIR/lex-bad-str-literal-as-char-3.rs:6:26 | LL | println!('hello world'); | ^^^ diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr index e10046e58e4..605cb66df1c 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr @@ -1,5 +1,5 @@ error: prefix `world` is unknown - --> $DIR/lex-bad-str-literal-as-char-3.rs:5:21 + --> $DIR/lex-bad-str-literal-as-char-3.rs:6:21 | LL | println!('hello world'); | ^^^^^ unknown prefix @@ -12,7 +12,7 @@ LL + println!("hello world"); | error[E0762]: unterminated character literal - --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26 + --> $DIR/lex-bad-str-literal-as-char-3.rs:6:26 | LL | println!('hello world'); | ^^^ diff --git a/tests/ui/lifetimes/bare-trait-object-borrowck.rs b/tests/ui/lifetimes/bare-trait-object-borrowck.rs index c54d3effffe..4b81b66118a 100644 --- a/tests/ui/lifetimes/bare-trait-object-borrowck.rs +++ b/tests/ui/lifetimes/bare-trait-object-borrowck.rs @@ -1,5 +1,7 @@ -#![allow(bare_trait_objects)] +//@ edition: 2015 //@ check-pass +#![allow(bare_trait_objects)] + pub struct FormatWith<'a, I, F> { sep: &'a str, /// FormatWith uses interior mutability because Display::fmt takes &self. diff --git a/tests/ui/lifetimes/bare-trait-object.rs b/tests/ui/lifetimes/bare-trait-object.rs index 2feb8a880b1..e74f8ac03ea 100644 --- a/tests/ui/lifetimes/bare-trait-object.rs +++ b/tests/ui/lifetimes/bare-trait-object.rs @@ -1,4 +1,5 @@ // Verify that lifetime resolution correctly accounts for `Fn` bare trait objects. +//@ edition: 2015 //@ check-pass #![allow(bare_trait_objects)] diff --git a/tests/ui/lint/bare-trait-objects-path.rs b/tests/ui/lint/bare-trait-objects-path.rs index 0e2294715cd..9643c48c9b8 100644 --- a/tests/ui/lint/bare-trait-objects-path.rs +++ b/tests/ui/lint/bare-trait-objects-path.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 #![feature(associated_type_defaults)] trait Assoc { diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr index e611abd31f3..25f3e857806 100644 --- a/tests/ui/lint/bare-trait-objects-path.stderr +++ b/tests/ui/lint/bare-trait-objects-path.stderr @@ -1,5 +1,5 @@ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/bare-trait-objects-path.rs:14:5 + --> $DIR/bare-trait-objects-path.rs:15:5 | LL | Dyn::func(); | ^^^ @@ -13,7 +13,7 @@ LL | <dyn Dyn>::func(); | ++++ + warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/bare-trait-objects-path.rs:17:5 + --> $DIR/bare-trait-objects-path.rs:18:5 | LL | ::Dyn::func(); | ^^^^^ @@ -26,7 +26,7 @@ LL | <dyn (::Dyn)>::func(); | ++++++ ++ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/bare-trait-objects-path.rs:20:5 + --> $DIR/bare-trait-objects-path.rs:21:5 | LL | Dyn::CONST; | ^^^ @@ -39,7 +39,7 @@ LL | <dyn Dyn>::CONST; | ++++ + warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/bare-trait-objects-path.rs:23:12 + --> $DIR/bare-trait-objects-path.rs:24:12 | LL | let _: Dyn::Ty; | ^^^ @@ -52,7 +52,7 @@ LL | let _: <dyn Dyn>::Ty; | ++++ + error[E0223]: ambiguous associated type - --> $DIR/bare-trait-objects-path.rs:23:12 + --> $DIR/bare-trait-objects-path.rs:24:12 | LL | let _: Dyn::Ty; | ^^^^^^^ diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs index 612da86c956..f900f998d06 100644 --- a/tests/ui/lint/lint-ctypes-enum.rs +++ b/tests/ui/lint/lint-ctypes-enum.rs @@ -85,8 +85,8 @@ extern "C" { fn repr_c(x: ReprC); fn repr_u8(x: U8); fn repr_isize(x: Isize); - fn repr_u128(x: U128); //~ ERROR `extern` block uses type `U128` - fn repr_i128(x: I128); //~ ERROR `extern` block uses type `I128` + fn repr_u128(x: U128); + fn repr_i128(x: I128); fn option_ref(x: Option<&'static u8>); fn option_fn(x: Option<extern "C" fn()>); fn option_nonnull(x: Option<std::ptr::NonNull<u8>>); @@ -96,14 +96,12 @@ extern "C" { fn option_nonzero_u32(x: Option<num::NonZero<u32>>); fn option_nonzero_u64(x: Option<num::NonZero<u64>>); fn option_nonzero_u128(x: Option<num::NonZero<u128>>); - //~^ ERROR `extern` block uses type `u128` fn option_nonzero_usize(x: Option<num::NonZero<usize>>); fn option_nonzero_i8(x: Option<num::NonZero<i8>>); fn option_nonzero_i16(x: Option<num::NonZero<i16>>); fn option_nonzero_i32(x: Option<num::NonZero<i32>>); fn option_nonzero_i64(x: Option<num::NonZero<i64>>); fn option_nonzero_i128(x: Option<num::NonZero<i128>>); - //~^ ERROR `extern` block uses type `i128` fn option_nonzero_isize(x: Option<num::NonZero<isize>>); fn option_transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>); fn option_transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>); @@ -121,14 +119,12 @@ extern "C" { fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>); fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>); fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); - //~^ ERROR `extern` block uses type `u128` fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>); fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>); fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>); fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>); fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>); fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); - //~^ ERROR `extern` block uses type `i128` fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>); fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>); fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>); @@ -159,14 +155,12 @@ extern "C" { fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>); fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>); fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); - //~^ ERROR `extern` block uses type `u128` fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>); fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>); fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>); fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>); fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>); fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); - //~^ ERROR `extern` block uses type `i128` fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>); fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>); fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>); diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr index 50a6f526f26..40d22723309 100644 --- a/tests/ui/lint/lint-ctypes-enum.stderr +++ b/tests/ui/lint/lint-ctypes-enum.stderr @@ -45,50 +45,8 @@ note: the type is defined here LL | enum T { | ^^^^^^ -error: `extern` block uses type `U128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:88:21 - | -LL | fn repr_u128(x: U128); - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI -note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:44:1 - | -LL | enum U128 { - | ^^^^^^^^^ - -error: `extern` block uses type `I128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:89:21 - | -LL | fn repr_i128(x: I128); - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI -note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:51:1 - | -LL | enum I128 { - | ^^^^^^^^^ - -error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:98:31 - | -LL | fn option_nonzero_u128(x: Option<num::NonZero<u128>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:105:31 - | -LL | fn option_nonzero_i128(x: Option<num::NonZero<i128>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:110:36 + --> $DIR/lint-ctypes-enum.rs:108:36 | LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -97,7 +55,7 @@ LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8> = note: enum has no representation hint error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:112:28 + --> $DIR/lint-ctypes-enum.rs:110:28 | LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -106,7 +64,7 @@ LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `Option<u8>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:113:21 + --> $DIR/lint-ctypes-enum.rs:111:21 | LL | fn option_u8(x: Option<u8>); | ^^^^^^^^^^ not FFI-safe @@ -114,24 +72,8 @@ LL | fn option_u8(x: Option<u8>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:123:33 - | -LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:130:33 - | -LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:135:38 + --> $DIR/lint-ctypes-enum.rs:131:38 | LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -140,7 +82,7 @@ LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u = note: enum has no representation hint error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:137:30 + --> $DIR/lint-ctypes-enum.rs:133:30 | LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -149,7 +91,7 @@ LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, U>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:141:51 + --> $DIR/lint-ctypes-enum.rs:137:51 | LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -158,7 +100,7 @@ LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:143:53 + --> $DIR/lint-ctypes-enum.rs:139:53 | LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -167,7 +109,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8> = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:145:51 + --> $DIR/lint-ctypes-enum.rs:141:51 | LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -176,7 +118,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:148:49 + --> $DIR/lint-ctypes-enum.rs:144:49 | LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -185,7 +127,7 @@ LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Fi = note: enum has no representation hint error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:150:30 + --> $DIR/lint-ctypes-enum.rs:146:30 | LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -193,24 +135,8 @@ LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:161:33 - | -LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:168:33 - | -LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:173:38 + --> $DIR/lint-ctypes-enum.rs:167:38 | LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -219,7 +145,7 @@ LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZe = note: enum has no representation hint error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:175:30 + --> $DIR/lint-ctypes-enum.rs:169:30 | LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -228,7 +154,7 @@ LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `Result<U, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:179:51 + --> $DIR/lint-ctypes-enum.rs:173:51 | LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -237,7 +163,7 @@ LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8 = note: enum has no representation hint error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:181:53 + --> $DIR/lint-ctypes-enum.rs:175:53 | LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -246,7 +172,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero< = note: enum has no representation hint error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:183:51 + --> $DIR/lint-ctypes-enum.rs:177:51 | LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -255,7 +181,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num = note: enum has no representation hint error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:186:49 + --> $DIR/lint-ctypes-enum.rs:180:49 | LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -264,7 +190,7 @@ LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero< = note: enum has no representation hint error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:188:30 + --> $DIR/lint-ctypes-enum.rs:182:30 | LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -273,7 +199,7 @@ LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:190:27 + --> $DIR/lint-ctypes-enum.rs:184:27 | LL | fn result_unit_t_e(x: Result<(), ()>); | ^^^^^^^^^^^^^^ not FFI-safe @@ -281,5 +207,5 @@ LL | fn result_unit_t_e(x: Result<(), ()>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: aborting due to 29 previous errors +error: aborting due to 21 previous errors diff --git a/tests/ui/lint/lint-ctypes-fn.rs b/tests/ui/lint/lint-ctypes-fn.rs index 73820c86d1a..0b84098e390 100644 --- a/tests/ui/lint/lint-ctypes-fn.rs +++ b/tests/ui/lint/lint-ctypes-fn.rs @@ -89,12 +89,6 @@ pub extern "C" fn boxed_trait(p: Box<dyn Trait>) { } pub extern "C" fn char_type(p: char) { } //~^ ERROR uses type `char` -pub extern "C" fn i128_type(p: i128) { } -//~^ ERROR uses type `i128` - -pub extern "C" fn u128_type(p: u128) { } -//~^ ERROR uses type `u128` - pub extern "C" fn tuple_type(p: (i32, i32)) { } //~^ ERROR uses type `(i32, i32)` @@ -120,9 +114,6 @@ pub extern "C" fn fn_type2(p: fn()) { } pub extern "C" fn fn_contained(p: RustBadRet) { } -pub extern "C" fn transparent_i128(p: TransparentI128) { } -//~^ ERROR: uses type `i128` - pub extern "C" fn transparent_str(p: TransparentStr) { } //~^ ERROR: uses type `str` @@ -161,6 +152,12 @@ pub extern "C" fn good17(p: TransparentCustomZst) { } #[allow(improper_ctypes_definitions)] pub extern "C" fn good18(_: &String) { } +pub extern "C" fn good_i128_type(p: i128) { } + +pub extern "C" fn good_u128_type(p: u128) { } + +pub extern "C" fn good_transparent_i128(p: TransparentI128) { } + #[cfg(not(target_arch = "wasm32"))] pub extern "C" fn good1(size: *const c_int) { } diff --git a/tests/ui/lint/lint-ctypes-fn.stderr b/tests/ui/lint/lint-ctypes-fn.stderr index a62533a4be1..a19c04a63b5 100644 --- a/tests/ui/lint/lint-ctypes-fn.stderr +++ b/tests/ui/lint/lint-ctypes-fn.stderr @@ -54,24 +54,8 @@ LL | pub extern "C" fn char_type(p: char) { } = help: consider using `u32` or `libc::wchar_t` instead = note: the `char` type has no C equivalent -error: `extern` fn uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:92:32 - | -LL | pub extern "C" fn i128_type(p: i128) { } - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -error: `extern` fn uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:95:32 - | -LL | pub extern "C" fn u128_type(p: u128) { } - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:98:33 + --> $DIR/lint-ctypes-fn.rs:92:33 | LL | pub extern "C" fn tuple_type(p: (i32, i32)) { } | ^^^^^^^^^^ not FFI-safe @@ -80,7 +64,7 @@ LL | pub extern "C" fn tuple_type(p: (i32, i32)) { } = note: tuples have unspecified layout error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:101:34 + --> $DIR/lint-ctypes-fn.rs:95:34 | LL | pub extern "C" fn tuple_type2(p: I32Pair) { } | ^^^^^^^ not FFI-safe @@ -89,7 +73,7 @@ LL | pub extern "C" fn tuple_type2(p: I32Pair) { } = note: tuples have unspecified layout error: `extern` fn uses type `ZeroSize`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:104:32 + --> $DIR/lint-ctypes-fn.rs:98:32 | LL | pub extern "C" fn zero_size(p: ZeroSize) { } | ^^^^^^^^ not FFI-safe @@ -103,7 +87,7 @@ LL | pub struct ZeroSize; | ^^^^^^^^^^^^^^^^^^^ error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:107:40 + --> $DIR/lint-ctypes-fn.rs:101:40 | LL | pub extern "C" fn zero_size_phantom(p: ZeroSizeWithPhantomData) { } | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -116,7 +100,7 @@ LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:110:51 + --> $DIR/lint-ctypes-fn.rs:104:51 | LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> { | ^^^^^^^^^^^^^^^^^ not FFI-safe @@ -124,7 +108,7 @@ LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> { = note: composed only of `PhantomData` error: `extern` fn uses type `fn()`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:115:30 + --> $DIR/lint-ctypes-fn.rs:109:30 | LL | pub extern "C" fn fn_type(p: RustFn) { } | ^^^^^^ not FFI-safe @@ -133,7 +117,7 @@ LL | pub extern "C" fn fn_type(p: RustFn) { } = note: this function pointer has Rust-specific calling convention error: `extern` fn uses type `fn()`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:118:31 + --> $DIR/lint-ctypes-fn.rs:112:31 | LL | pub extern "C" fn fn_type2(p: fn()) { } | ^^^^ not FFI-safe @@ -141,16 +125,8 @@ LL | pub extern "C" fn fn_type2(p: fn()) { } = help: consider using an `extern fn(...) -> ...` function pointer instead = note: this function pointer has Rust-specific calling convention -error: `extern` fn uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:123:39 - | -LL | pub extern "C" fn transparent_i128(p: TransparentI128) { } - | ^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - error: `extern` fn uses type `str`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:126:38 + --> $DIR/lint-ctypes-fn.rs:117:38 | LL | pub extern "C" fn transparent_str(p: TransparentStr) { } | ^^^^^^^^^^^^^^ not FFI-safe @@ -159,7 +135,7 @@ LL | pub extern "C" fn transparent_str(p: TransparentStr) { } = note: string slices have no C equivalent error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:172:43 + --> $DIR/lint-ctypes-fn.rs:169:43 | LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> { | ^^^^^^^^^^^^^^^^^ not FFI-safe @@ -167,7 +143,7 @@ LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> { = note: composed only of `PhantomData` error: `extern` fn uses type `Vec<T>`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:185:39 + --> $DIR/lint-ctypes-fn.rs:182:39 | LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { } | ^^^^^^ not FFI-safe @@ -176,7 +152,7 @@ LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { } = note: this struct has unspecified layout error: `extern` fn uses type `Vec<T>`, which is not FFI-safe - --> $DIR/lint-ctypes-fn.rs:188:41 + --> $DIR/lint-ctypes-fn.rs:185:41 | LL | pub extern "C" fn used_generic5<T>() -> Vec<T> { | ^^^^^^ not FFI-safe @@ -184,5 +160,5 @@ LL | pub extern "C" fn used_generic5<T>() -> Vec<T> { = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -error: aborting due to 20 previous errors +error: aborting due to 17 previous errors diff --git a/tests/ui/lint/lint-ctypes.rs b/tests/ui/lint/lint-ctypes.rs index 6dd9be10a48..47586c826ab 100644 --- a/tests/ui/lint/lint-ctypes.rs +++ b/tests/ui/lint/lint-ctypes.rs @@ -54,8 +54,6 @@ extern "C" { pub fn opt_box_type(p: Option<Box<u32>>); //~^ ERROR uses type `Option<Box<u32>>` pub fn char_type(p: char); //~ ERROR uses type `char` - pub fn i128_type(p: i128); //~ ERROR uses type `i128` - pub fn u128_type(p: u128); //~ ERROR uses type `u128` pub fn trait_type(p: &dyn Bar); //~ ERROR uses type `dyn Bar` pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` @@ -67,7 +65,6 @@ extern "C" { pub fn fn_type(p: RustFn); //~ ERROR uses type `fn()` pub fn fn_type2(p: fn()); //~ ERROR uses type `fn()` pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `Box<u32>` - pub fn transparent_i128(p: TransparentI128); //~ ERROR: uses type `i128` pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str` pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `Box<u32>` pub fn raw_array(arr: [u8; 8]); //~ ERROR: uses type `[u8; 8]` @@ -77,9 +74,6 @@ extern "C" { pub fn no_niche_b(b: Option<UnsafeCell<&i32>>); //~^ ERROR: uses type `Option<UnsafeCell<&i32>>` - pub static static_u128_type: u128; //~ ERROR: uses type `u128` - pub static static_u128_array_type: [u128; 16]; //~ ERROR: uses type `u128` - pub fn good3(fptr: Option<extern "C" fn()>); pub fn good4(aptr: &[u8; 4 as usize]); pub fn good5(s: StructWithProjection); @@ -99,7 +93,11 @@ extern "C" { pub fn good18(_: &String); pub fn good20(arr: *const [u8; 8]); pub static good21: [u8; 8]; - + pub fn good_i128_type(p: i128); + pub fn good_u128_type(p: u128); + pub fn good_transparent_i128(p: TransparentI128); + pub static good_static_u128_type: u128; + pub static good_static_u128_array_type: [u128; 16]; } #[allow(improper_ctypes)] diff --git a/tests/ui/lint/lint-ctypes.stderr b/tests/ui/lint/lint-ctypes.stderr index 8137ae868d3..3fb36647d4f 100644 --- a/tests/ui/lint/lint-ctypes.stderr +++ b/tests/ui/lint/lint-ctypes.stderr @@ -85,24 +85,8 @@ LL | pub fn char_type(p: char); = help: consider using `u32` or `libc::wchar_t` instead = note: the `char` type has no C equivalent -error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:57:25 - | -LL | pub fn i128_type(p: i128); - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:58:25 - | -LL | pub fn u128_type(p: u128); - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - error: `extern` block uses type `dyn Bar`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:59:26 + --> $DIR/lint-ctypes.rs:57:26 | LL | pub fn trait_type(p: &dyn Bar); | ^^^^^^^^ not FFI-safe @@ -110,7 +94,7 @@ LL | pub fn trait_type(p: &dyn Bar); = note: trait objects have no C equivalent error: `extern` block uses type `(i32, i32)`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:60:26 + --> $DIR/lint-ctypes.rs:58:26 | LL | pub fn tuple_type(p: (i32, i32)); | ^^^^^^^^^^ not FFI-safe @@ -119,7 +103,7 @@ LL | pub fn tuple_type(p: (i32, i32)); = note: tuples have unspecified layout error: `extern` block uses type `(i32, i32)`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:61:27 + --> $DIR/lint-ctypes.rs:59:27 | LL | pub fn tuple_type2(p: I32Pair); | ^^^^^^^ not FFI-safe @@ -128,7 +112,7 @@ LL | pub fn tuple_type2(p: I32Pair); = note: tuples have unspecified layout error: `extern` block uses type `ZeroSize`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:62:25 + --> $DIR/lint-ctypes.rs:60:25 | LL | pub fn zero_size(p: ZeroSize); | ^^^^^^^^ not FFI-safe @@ -142,7 +126,7 @@ LL | pub struct ZeroSize; | ^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:63:33 + --> $DIR/lint-ctypes.rs:61:33 | LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -155,7 +139,7 @@ LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `PhantomData<bool>`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:66:12 + --> $DIR/lint-ctypes.rs:64:12 | LL | -> ::std::marker::PhantomData<bool>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -163,7 +147,7 @@ LL | -> ::std::marker::PhantomData<bool>; = note: composed only of `PhantomData` error: `extern` block uses type `fn()`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:67:23 + --> $DIR/lint-ctypes.rs:65:23 | LL | pub fn fn_type(p: RustFn); | ^^^^^^ not FFI-safe @@ -172,7 +156,7 @@ LL | pub fn fn_type(p: RustFn); = note: this function pointer has Rust-specific calling convention error: `extern` block uses type `fn()`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:68:24 + --> $DIR/lint-ctypes.rs:66:24 | LL | pub fn fn_type2(p: fn()); | ^^^^ not FFI-safe @@ -181,7 +165,7 @@ LL | pub fn fn_type2(p: fn()); = note: this function pointer has Rust-specific calling convention error: `extern` block uses type `Box<u32>`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:69:28 + --> $DIR/lint-ctypes.rs:67:28 | LL | pub fn fn_contained(p: RustBadRet); | ^^^^^^^^^^ not FFI-safe @@ -189,16 +173,8 @@ LL | pub fn fn_contained(p: RustBadRet); = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:70:32 - | -LL | pub fn transparent_i128(p: TransparentI128); - | ^^^^^^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - error: `extern` block uses type `str`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:71:31 + --> $DIR/lint-ctypes.rs:68:31 | LL | pub fn transparent_str(p: TransparentStr); | ^^^^^^^^^^^^^^ not FFI-safe @@ -207,7 +183,7 @@ LL | pub fn transparent_str(p: TransparentStr); = note: string slices have no C equivalent error: `extern` block uses type `Box<u32>`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:72:30 + --> $DIR/lint-ctypes.rs:69:30 | LL | pub fn transparent_fn(p: TransparentBadFn); | ^^^^^^^^^^^^^^^^ not FFI-safe @@ -216,7 +192,7 @@ LL | pub fn transparent_fn(p: TransparentBadFn); = note: this struct has unspecified layout error: `extern` block uses type `[u8; 8]`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:73:27 + --> $DIR/lint-ctypes.rs:70:27 | LL | pub fn raw_array(arr: [u8; 8]); | ^^^^^^^ not FFI-safe @@ -225,7 +201,7 @@ LL | pub fn raw_array(arr: [u8; 8]); = note: passing raw arrays by value is not FFI-safe error: `extern` block uses type `Option<UnsafeCell<extern "C" fn()>>`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:75:26 + --> $DIR/lint-ctypes.rs:72:26 | LL | pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -234,7 +210,7 @@ LL | pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>); = note: enum has no representation hint error: `extern` block uses type `Option<UnsafeCell<&i32>>`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:77:26 + --> $DIR/lint-ctypes.rs:74:26 | LL | pub fn no_niche_b(b: Option<UnsafeCell<&i32>>); | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -242,21 +218,5 @@ LL | pub fn no_niche_b(b: Option<UnsafeCell<&i32>>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:80:34 - | -LL | pub static static_u128_type: u128; - | ^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes.rs:81:40 - | -LL | pub static static_u128_array_type: [u128; 16]; - | ^^^^^^^^^^ not FFI-safe - | - = note: 128-bit integers don't currently have a known stable ABI - -error: aborting due to 27 previous errors +error: aborting due to 22 previous errors diff --git a/tests/ui/lint/lint-pre-expansion-extern-module.rs b/tests/ui/lint/lint-pre-expansion-extern-module.rs index f1ab0cf3b74..e85261befbc 100644 --- a/tests/ui/lint/lint-pre-expansion-extern-module.rs +++ b/tests/ui/lint/lint-pre-expansion-extern-module.rs @@ -1,5 +1,6 @@ //@ check-pass //@ compile-flags: -W rust-2018-compatibility +//@ edition: 2015 fn main() {} diff --git a/tests/ui/lint/lint-qualification.fixed b/tests/ui/lint/lint-qualification.fixed index 7c8fd5236e6..04067b6b6ff 100644 --- a/tests/ui/lint/lint-qualification.fixed +++ b/tests/ui/lint/lint-qualification.fixed @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ run-rustfix #![deny(unused_qualifications)] #![deny(unused_imports)] diff --git a/tests/ui/lint/lint-qualification.rs b/tests/ui/lint/lint-qualification.rs index 009b3080d5c..20c261bf878 100644 --- a/tests/ui/lint/lint-qualification.rs +++ b/tests/ui/lint/lint-qualification.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ run-rustfix #![deny(unused_qualifications)] #![deny(unused_imports)] diff --git a/tests/ui/lint/lint-qualification.stderr b/tests/ui/lint/lint-qualification.stderr index cefa54a12ae..1e8b8da1e86 100644 --- a/tests/ui/lint/lint-qualification.stderr +++ b/tests/ui/lint/lint-qualification.stderr @@ -1,11 +1,11 @@ error: unnecessary qualification - --> $DIR/lint-qualification.rs:12:5 + --> $DIR/lint-qualification.rs:13:5 | LL | foo::bar(); | ^^^^^^^^ | note: the lint level is defined here - --> $DIR/lint-qualification.rs:2:9 + --> $DIR/lint-qualification.rs:3:9 | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL + bar(); | error: unnecessary qualification - --> $DIR/lint-qualification.rs:13:5 + --> $DIR/lint-qualification.rs:14:5 | LL | crate::foo::bar(); | ^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL + bar(); | error: unnecessary qualification - --> $DIR/lint-qualification.rs:18:13 + --> $DIR/lint-qualification.rs:19:13 | LL | let _ = std::string::String::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL + let _ = String::new(); | error: unnecessary qualification - --> $DIR/lint-qualification.rs:20:12 + --> $DIR/lint-qualification.rs:21:12 | LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new(); | ^^^^^^^^^^^^^^^^^^^^^ @@ -52,7 +52,7 @@ LL + let _: Vec<String> = std::vec::Vec::<String>::new(); | error: unnecessary qualification - --> $DIR/lint-qualification.rs:20:36 + --> $DIR/lint-qualification.rs:21:36 | LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -64,19 +64,19 @@ LL + let _: std::vec::Vec<String> = Vec::<String>::new(); | error: unused import: `std::fmt` - --> $DIR/lint-qualification.rs:24:9 + --> $DIR/lint-qualification.rs:25:9 | LL | use std::fmt; | ^^^^^^^^ | note: the lint level is defined here - --> $DIR/lint-qualification.rs:3:9 + --> $DIR/lint-qualification.rs:4:9 | LL | #![deny(unused_imports)] | ^^^^^^^^^^^^^^ error: unnecessary qualification - --> $DIR/lint-qualification.rs:29:13 + --> $DIR/lint-qualification.rs:30:13 | LL | let _ = <bool as std::default::Default>::default(); // issue #121999 (modified) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.rs b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.rs index 6abe3602abe..7dc9ba0afea 100644 --- a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.rs +++ b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.rs @@ -1,3 +1,4 @@ +//@ edition: 2015 //@ check-pass #![warn(redundant_imports)] diff --git a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr index 2b0e16a87dc..48d5c275055 100644 --- a/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr +++ b/tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr @@ -1,5 +1,5 @@ warning: the item `Some` is imported redundantly - --> $DIR/use-redundant-prelude-rust-2015.rs:5:5 + --> $DIR/use-redundant-prelude-rust-2015.rs:6:5 | LL | use std::option::Option::Some; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,13 +8,13 @@ LL | use std::option::Option::Some; = note: the item `Some` is already defined here | note: the lint level is defined here - --> $DIR/use-redundant-prelude-rust-2015.rs:2:9 + --> $DIR/use-redundant-prelude-rust-2015.rs:3:9 | LL | #![warn(redundant_imports)] | ^^^^^^^^^^^^^^^^^ warning: the item `None` is imported redundantly - --> $DIR/use-redundant-prelude-rust-2015.rs:6:5 + --> $DIR/use-redundant-prelude-rust-2015.rs:7:5 | LL | use std::option::Option::None; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | use std::option::Option::None; = note: the item `None` is already defined here warning: the item `Ok` is imported redundantly - --> $DIR/use-redundant-prelude-rust-2015.rs:8:5 + --> $DIR/use-redundant-prelude-rust-2015.rs:9:5 | LL | use std::result::Result::Ok; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ LL | use std::result::Result::Ok; = note: the item `Ok` is already defined here warning: the item `Err` is imported redundantly - --> $DIR/use-redundant-prelude-rust-2015.rs:9:5 + --> $DIR/use-redundant-prelude-rust-2015.rs:10:5 | LL | use std::result::Result::Err; | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/macros/try-macro.rs b/tests/ui/macros/try-macro.rs index b579143583e..f6268654cfc 100644 --- a/tests/ui/macros/try-macro.rs +++ b/tests/ui/macros/try-macro.rs @@ -1,4 +1,5 @@ //@ run-pass +//@ edition: 2015 #![allow(deprecated)] // for deprecated `try!()` macro use std::num::{ParseFloatError, ParseIntError}; diff --git a/tests/ui/parser/dyn-trait-compatibility.rs b/tests/ui/parser/dyn-trait-compatibility.rs index 717b14c5941..c6e84284fbe 100644 --- a/tests/ui/parser/dyn-trait-compatibility.rs +++ b/tests/ui/parser/dyn-trait-compatibility.rs @@ -1,3 +1,5 @@ +//@ edition: 2015 + type A0 = dyn; //~^ ERROR cannot find type `dyn` in this scope type A1 = dyn::dyn; diff --git a/tests/ui/parser/dyn-trait-compatibility.stderr b/tests/ui/parser/dyn-trait-compatibility.stderr index 08e0a50010a..a57c033c1e1 100644 --- a/tests/ui/parser/dyn-trait-compatibility.stderr +++ b/tests/ui/parser/dyn-trait-compatibility.stderr @@ -1,47 +1,47 @@ error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:1:11 + --> $DIR/dyn-trait-compatibility.rs:3:11 | LL | type A0 = dyn; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:5:11 + --> $DIR/dyn-trait-compatibility.rs:7:11 | LL | type A2 = dyn<dyn, dyn>; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:5:15 + --> $DIR/dyn-trait-compatibility.rs:7:15 | LL | type A2 = dyn<dyn, dyn>; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:5:20 + --> $DIR/dyn-trait-compatibility.rs:7:20 | LL | type A2 = dyn<dyn, dyn>; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:9:11 + --> $DIR/dyn-trait-compatibility.rs:11:11 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | ^^^ not found in this scope error[E0405]: cannot find trait `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:9:23 + --> $DIR/dyn-trait-compatibility.rs:11:23 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:9:16 + --> $DIR/dyn-trait-compatibility.rs:11:16 | LL | type A3 = dyn<<dyn as dyn>::dyn>; | ^^^ not found in this scope error[E0433]: failed to resolve: use of unresolved module or unlinked crate `dyn` - --> $DIR/dyn-trait-compatibility.rs:3:11 + --> $DIR/dyn-trait-compatibility.rs:5:11 | LL | type A1 = dyn::dyn; | ^^^ use of unresolved module or unlinked crate `dyn` diff --git a/tests/ui/parser/extern-crate-async.rs b/tests/ui/parser/extern-crate-async.rs index 529e0f1ab5c..13bd786d092 100644 --- a/tests/ui/parser/extern-crate-async.rs +++ b/tests/ui/parser/extern-crate-async.rs @@ -1,6 +1,7 @@ -// Make sure that we don't parse `extern crate async` +// Make sure that we don't parse `extern crate async` as // the front matter of a function leading us astray. +//@ edition: 2015 //@ check-pass fn main() {} diff --git a/tests/ui/parser/fn-field-parse-error-ice.rs b/tests/ui/parser/fn-field-parse-error-ice.rs index 188257ea53a..f1bc561b89f 100644 --- a/tests/ui/parser/fn-field-parse-error-ice.rs +++ b/tests/ui/parser/fn-field-parse-error-ice.rs @@ -1,4 +1,5 @@ // Regression test for #85794 +//@ edition: 2015 struct Baz { inner : dyn fn () diff --git a/tests/ui/parser/fn-field-parse-error-ice.stderr b/tests/ui/parser/fn-field-parse-error-ice.stderr index 3bf68e8cc04..6f033e2b0c6 100644 --- a/tests/ui/parser/fn-field-parse-error-ice.stderr +++ b/tests/ui/parser/fn-field-parse-error-ice.stderr @@ -1,11 +1,11 @@ error: expected `,`, or `}`, found keyword `fn` - --> $DIR/fn-field-parse-error-ice.rs:4:16 + --> $DIR/fn-field-parse-error-ice.rs:5:16 | LL | inner : dyn fn () | ^ help: try adding a comma: `,` error: expected identifier, found keyword `fn` - --> $DIR/fn-field-parse-error-ice.rs:4:17 + --> $DIR/fn-field-parse-error-ice.rs:5:17 | LL | struct Baz { | --- while parsing this struct @@ -18,7 +18,7 @@ LL | inner : dyn r#fn () | ++ error[E0412]: cannot find type `dyn` in this scope - --> $DIR/fn-field-parse-error-ice.rs:4:13 + --> $DIR/fn-field-parse-error-ice.rs:5:13 | LL | inner : dyn fn () | ^^^ not found in this scope diff --git a/tests/ui/parser/issues/issue-114219.rs b/tests/ui/parser/issues/issue-114219.rs index 332258b628c..3f7e0f685ac 100644 --- a/tests/ui/parser/issues/issue-114219.rs +++ b/tests/ui/parser/issues/issue-114219.rs @@ -1,3 +1,5 @@ +//@ edition: 2015 + fn main() { async move {}; //~^ ERROR `async move` blocks are only allowed in Rust 2018 or later diff --git a/tests/ui/parser/issues/issue-114219.stderr b/tests/ui/parser/issues/issue-114219.stderr index 02323cb99cb..1243ef8b180 100644 --- a/tests/ui/parser/issues/issue-114219.stderr +++ b/tests/ui/parser/issues/issue-114219.stderr @@ -1,5 +1,5 @@ error: `async move` blocks are only allowed in Rust 2018 or later - --> $DIR/issue-114219.rs:2:5 + --> $DIR/issue-114219.rs:4:5 | LL | async move {}; | ^^^^^^^^^^ diff --git a/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.rs b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.rs index b9e3c5783eb..b78832bbe3d 100644 --- a/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.rs +++ b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.rs @@ -1,3 +1,5 @@ +//@ edition: 2015 + trait Trait {} fn test(_: &for<'a> dyn Trait) {} diff --git a/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.stderr b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.stderr index a012220e8c7..3745cf8b077 100644 --- a/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.stderr +++ b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.stderr @@ -1,5 +1,5 @@ error: `for<...>` expected after `dyn`, not before - --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:3:21 + --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:5:21 | LL | fn test(_: &for<'a> dyn Trait) {} | ^^^ @@ -11,7 +11,7 @@ LL + fn test(_: &dyn for<'a> Trait) {} | error: `for<...>` expected after `impl`, not before - --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:6:21 + --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:8:21 | LL | fn test2(_: for<'a> impl Trait) {} | ^^^^ @@ -23,7 +23,7 @@ LL + fn test2(_: impl for<'a> Trait) {} | error: expected identifier, found `>` - --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:10:24 + --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:12:24 | LL | type A2 = dyn<for<> dyn>; | ^ expected identifier diff --git a/tests/ui/proc-macro/trait-fn-args-2015.rs b/tests/ui/proc-macro/trait-fn-args-2015.rs index c25bd768efe..010d986a86d 100644 --- a/tests/ui/proc-macro/trait-fn-args-2015.rs +++ b/tests/ui/proc-macro/trait-fn-args-2015.rs @@ -1,6 +1,7 @@ // Unnamed arguments in trait functions can be passed through proc macros on 2015 edition. //@ check-pass +//@ edition: 2015 //@ proc-macro: test-macros.rs #![allow(anonymous_parameters)] |
