From f97e075e92a068a66ff955ba64e1cf9066c9548b Mon Sep 17 00:00:00 2001 From: Ellen Date: Tue, 2 Mar 2021 15:47:06 +0000 Subject: errooaaar~ --- .../cross_crate_predicate.stderr | 36 ++++++++++++---------- .../const_evaluatable_checked/different-fn.stderr | 6 +--- .../dont-eagerly-error-in-is-const-evaluatable.rs | 17 ++++++++++ .../ui/const_evaluatable/needs_where_clause.stderr | 6 +--- .../ui/const_evaluatable/no_where_clause.stderr | 6 +--- 5 files changed, 40 insertions(+), 31 deletions(-) create mode 100644 src/test/ui/const-generics/const_evaluatable_checked/dont-eagerly-error-in-is-const-evaluatable.rs (limited to 'src/test') diff --git a/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr b/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr index 1beb5315d10..84b2665d5bf 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr @@ -3,48 +3,52 @@ error: unconstrained generic constant | LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` - --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 + | + ::: $DIR/auxiliary/const_evaluatable_lib.rs:6:10 | LL | [u8; std::mem::size_of::() - 1]: Sized, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---------------------------- required by this bound in `test1` + | + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` error: unconstrained generic constant --> $DIR/cross_crate_predicate.rs:7:13 | LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` - --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 + | + ::: $DIR/auxiliary/const_evaluatable_lib.rs:4:27 | LL | pub fn test1() -> [u8; std::mem::size_of::() - 1] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---------------------------- required by this bound in `test1` + | + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` error: unconstrained generic constant --> $DIR/cross_crate_predicate.rs:7:13 | LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` - --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 + | + ::: $DIR/auxiliary/const_evaluatable_lib.rs:6:10 | LL | [u8; std::mem::size_of::() - 1]: Sized, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---------------------------- required by this bound in `test1` + | + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` error: unconstrained generic constant --> $DIR/cross_crate_predicate.rs:7:13 | LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` - --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 + | + ::: $DIR/auxiliary/const_evaluatable_lib.rs:4:27 | LL | pub fn test1() -> [u8; std::mem::size_of::() - 1] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---------------------------- required by this bound in `test1` + | + = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` error: aborting due to 4 previous errors diff --git a/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr b/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr index 8cdc9b57750..7c11a47b2f0 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr @@ -4,11 +4,7 @@ error: unconstrained generic constant LL | [0; size_of::>()] | ^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: `where [u8; size_of::>()]: Sized` - --> $DIR/different-fn.rs:10:9 - | -LL | [0; size_of::>()] - | ^^^^^^^^^^^^^^^^^^^ + = help: try adding a `where` bound using this expression: `where [(); size_of::>()]:` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/dont-eagerly-error-in-is-const-evaluatable.rs b/src/test/ui/const-generics/const_evaluatable_checked/dont-eagerly-error-in-is-const-evaluatable.rs new file mode 100644 index 00000000000..92a410afcb1 --- /dev/null +++ b/src/test/ui/const-generics/const_evaluatable_checked/dont-eagerly-error-in-is-const-evaluatable.rs @@ -0,0 +1,17 @@ +// run-pass +#![feature(const_generics)] +#![feature(const_evaluatable_checked)] +#![allow(incomplete_features)] + +// This test is a repro for #82279. It checks that we don't error +// when calling is_const_evaluatable on `std::mem::size_of::()` +// when looking for candidates that may prove `T: Foo` in `foo` + +trait Foo {} + +#[allow(dead_code)] +fn foo() {} + +impl Foo for T where [(); std::mem::size_of::()]: {} + +fn main() {} diff --git a/src/test/ui/const_evaluatable/needs_where_clause.stderr b/src/test/ui/const_evaluatable/needs_where_clause.stderr index 945105d1a2d..7b41e39b7d7 100644 --- a/src/test/ui/const_evaluatable/needs_where_clause.stderr +++ b/src/test/ui/const_evaluatable/needs_where_clause.stderr @@ -4,11 +4,7 @@ error: unconstrained generic constant LL | b: [f32; complex_maths::(N)], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: `where [u8; complex_maths::(N)]: Sized` - --> $DIR/needs_where_clause.rs:11:12 - | -LL | b: [f32; complex_maths::(N)], - | ^^^^^^^^^^^^^^^^^^^^^ + = help: try adding a `where` bound using this expression: `where [(); complex_maths::(N)]:` error: aborting due to previous error diff --git a/src/test/ui/const_evaluatable/no_where_clause.stderr b/src/test/ui/const_evaluatable/no_where_clause.stderr index 84a65f0d1d2..3e5c2f5cad1 100644 --- a/src/test/ui/const_evaluatable/no_where_clause.stderr +++ b/src/test/ui/const_evaluatable/no_where_clause.stderr @@ -4,11 +4,7 @@ error: unconstrained generic constant LL | b: [f32; complex_maths(N)], | ^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: `where [u8; complex_maths(N)]: Sized` - --> $DIR/no_where_clause.rs:10:12 - | -LL | b: [f32; complex_maths(N)], - | ^^^^^^^^^^^^^^^^ + = help: try adding a `where` bound using this expression: `where [(); complex_maths(N)]:` error: aborting due to previous error -- cgit 1.4.1-3-g733a5 From f6a35d7df276bdc939746786f7d43b05e60f7dcd Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Fri, 19 Mar 2021 11:10:01 -0400 Subject: Extend `proc_macro_back_compat` lint to `js-sys` With this PR, we now lint for all cases where we perform some kind of proc-macro back-compat hack. The `js-sys` had an internal fix made to properly handle `None`-delimited groups, so we need to manually check the version in the filename. As a result, we no longer apply the back-compat hack to cases where the version number is missing file the file path. This should not affect any users of the `crates.io` crate. --- compiler/rustc_expand/src/proc_macro_server.rs | 34 +++++++++++++++-- .../group-compat-hack/group-compat-hack.rs | 9 ++++- .../group-compat-hack/group-compat-hack.stderr | 43 +++++++++++++++++++--- .../group-compat-hack/group-compat-hack.stdout | 13 ++++--- .../group-compat-hack/js-sys-0.3.40/src/lib.rs | 7 ++++ 5 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs (limited to 'src/test') diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index cb41bc81225..1ea26b4eab4 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -739,9 +739,8 @@ fn ident_name_compatibility_hack( let time_macros_impl = macro_name == sym::impl_macros && matches_prefix("time-macros-impl", "lib.rs"); - if time_macros_impl - || (macro_name == sym::arrays && matches_prefix("js-sys", "lib.rs")) - { + let js_sys = macro_name == sym::arrays && matches_prefix("js-sys", "lib.rs"); + if time_macros_impl || js_sys { let snippet = source_map.span_to_snippet(orig_span); if snippet.as_deref() == Ok("$name") { if time_macros_impl { @@ -754,8 +753,35 @@ fn ident_name_compatibility_hack( "the `time-macros-impl` crate will stop compiling in futures version of Rust. \ Please update to the latest version of the `time` crate to avoid breakage".to_string()) ); + return Some((*ident, *is_raw)); + } + if js_sys { + if let Some(c) = path + .components() + .flat_map(|c| c.as_os_str().to_str()) + .find(|c| c.starts_with("js-sys")) + { + let mut version = c.trim_start_matches("js-sys-").split("."); + if version.next() == Some("0") + && version.next() == Some("3") + && version + .next() + .and_then(|c| c.parse::().ok()) + .map_or(false, |v| v < 40) + { + rustc.sess.buffer_lint_with_diagnostic( + &PROC_MACRO_BACK_COMPAT, + orig_span, + ast::CRATE_NODE_ID, + "using an old version of `js-sys`", + BuiltinLintDiagnostics::ProcMacroBackCompat( + "older versions of the `js-sys` crate will stop compiling in future versions of Rust; \ + please update to `js-sys` v0.3.40 or above".to_string()) + ); + return Some((*ident, *is_raw)); + } + } } - return Some((*ident, *is_raw)); } } diff --git a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs index d9687490cad..2b742771d6f 100644 --- a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs +++ b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs @@ -43,7 +43,8 @@ mod with_version { struct Foo; impl_macros!(Foo); //~ WARN using an old version //~| WARN this was previously - arrays!(Foo); + arrays!(Foo); //~ WARN using an old version + //~| WARN this was previously other!(Foo); } @@ -77,5 +78,11 @@ mod actori_web_version_test { tuple_from_req!(Foo); } +mod with_good_js_sys_version { + include!("js-sys-0.3.40/src/lib.rs"); + struct Foo; + arrays!(Foo); +} + fn main() {} diff --git a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr index e2b680f8d27..effcd68cf96 100644 --- a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr +++ b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr @@ -31,13 +31,29 @@ LL | impl_macros!(Foo); = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +warning: using an old version of `js-sys` + --> $DIR/js-sys-0.3.17/src/lib.rs:5:32 + | +LL | #[my_macro] struct Two($name); + | ^^^^^ + | + ::: $DIR/group-compat-hack.rs:46:5 + | +LL | arrays!(Foo); + | ------------- in this macro invocation + | + = 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 #83125 + = note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above + = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + warning: using an old version of `actix-web` --> $DIR/actix-web/src/extract.rs:5:34 | LL | #[my_macro] struct Three($T); | ^^ | - ::: $DIR/group-compat-hack.rs:54:5 + ::: $DIR/group-compat-hack.rs:55:5 | LL | tuple_from_req!(Foo); | --------------------- in this macro invocation @@ -53,7 +69,7 @@ warning: using an old version of `actix-web` LL | #[my_macro] struct Three($T); | ^^ | - ::: $DIR/group-compat-hack.rs:62:5 + ::: $DIR/group-compat-hack.rs:63:5 | LL | tuple_from_req!(Foo); | --------------------- in this macro invocation @@ -63,7 +79,7 @@ LL | tuple_from_req!(Foo); = note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -warning: 4 warnings emitted +warning: 5 warnings emitted Future incompatibility report: Future breakage date: None, diagnostic: warning: using an old version of `time-macros-impl` @@ -100,6 +116,23 @@ LL | impl_macros!(Foo); = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +Future breakage date: None, diagnostic: +warning: using an old version of `js-sys` + --> $DIR/js-sys-0.3.17/src/lib.rs:5:32 + | +LL | #[my_macro] struct Two($name); + | ^^^^^ + | + ::: $DIR/group-compat-hack.rs:46:5 + | +LL | arrays!(Foo); + | ------------- in this macro invocation + | + = 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 #83125 + = note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above + = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + Future breakage date: None, diagnostic: warning: using an old version of `actix-web` --> $DIR/actix-web/src/extract.rs:5:34 @@ -107,7 +140,7 @@ warning: using an old version of `actix-web` LL | #[my_macro] struct Three($T); | ^^ | - ::: $DIR/group-compat-hack.rs:54:5 + ::: $DIR/group-compat-hack.rs:55:5 | LL | tuple_from_req!(Foo); | --------------------- in this macro invocation @@ -124,7 +157,7 @@ warning: using an old version of `actix-web` LL | #[my_macro] struct Three($T); | ^^ | - ::: $DIR/group-compat-hack.rs:62:5 + ::: $DIR/group-compat-hack.rs:63:5 | LL | tuple_from_req!(Foo); | --------------------- in this macro invocation diff --git a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout index 3fe744e12ff..82d6bc33bf9 100644 --- a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout +++ b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout @@ -1,10 +1,11 @@ Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/time-macros-impl/src/lib.rs:5:21: 5:27 (#6) }, Ident { ident: "One", span: $DIR/time-macros-impl/src/lib.rs:5:28: 5:31 (#6) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:27:18: 27:21 (#0) }], span: $DIR/time-macros-impl/src/lib.rs:5:31: 5:38 (#6) }, Punct { ch: ';', spacing: Alone, span: $DIR/time-macros-impl/src/lib.rs:5:38: 5:39 (#6) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/js-sys/src/lib.rs:5:21: 5:27 (#10) }, Ident { ident: "Two", span: $DIR/js-sys/src/lib.rs:5:28: 5:31 (#10) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:29:13: 29:16 (#0) }], span: $DIR/js-sys/src/lib.rs:5:31: 5:38 (#10) }, Punct { ch: ';', spacing: Alone, span: $DIR/js-sys/src/lib.rs:5:38: 5:39 (#10) }] +Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/js-sys/src/lib.rs:5:21: 5:27 (#10) }, Ident { ident: "Two", span: $DIR/js-sys/src/lib.rs:5:28: 5:31 (#10) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:29:13: 29:16 (#0) }], span: $DIR/js-sys/src/lib.rs:5:32: 5:37 (#10) }], span: $DIR/js-sys/src/lib.rs:5:31: 5:38 (#10) }, Punct { ch: ';', spacing: Alone, span: $DIR/js-sys/src/lib.rs:5:38: 5:39 (#10) }] Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/group-compat-hack.rs:22:25: 22:31 (#14) }, Ident { ident: "Three", span: $DIR/group-compat-hack.rs:22:32: 22:37 (#14) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:30:12: 30:15 (#0) }], span: $DIR/group-compat-hack.rs:22:38: 22:43 (#14) }], span: $DIR/group-compat-hack.rs:22:37: 22:44 (#14) }, Punct { ch: ';', spacing: Alone, span: $DIR/group-compat-hack.rs:22:44: 22:45 (#14) }] Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:21: 5:27 (#20) }, Ident { ident: "One", span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:28: 5:31 (#20) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:44:18: 44:21 (#0) }], span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:31: 5:38 (#20) }, Punct { ch: ';', spacing: Alone, span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:38: 5:39 (#20) }] Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/js-sys-0.3.17/src/lib.rs:5:21: 5:27 (#24) }, Ident { ident: "Two", span: $DIR/js-sys-0.3.17/src/lib.rs:5:28: 5:31 (#24) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:46:13: 46:16 (#0) }], span: $DIR/js-sys-0.3.17/src/lib.rs:5:31: 5:38 (#24) }, Punct { ch: ';', spacing: Alone, span: $DIR/js-sys-0.3.17/src/lib.rs:5:38: 5:39 (#24) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/group-compat-hack.rs:39:25: 39:31 (#28) }, Ident { ident: "Three", span: $DIR/group-compat-hack.rs:39:32: 39:37 (#28) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:47:12: 47:15 (#0) }], span: $DIR/group-compat-hack.rs:39:38: 39:43 (#28) }], span: $DIR/group-compat-hack.rs:39:37: 39:44 (#28) }, Punct { ch: ';', spacing: Alone, span: $DIR/group-compat-hack.rs:39:44: 39:45 (#28) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actix-web/src/extract.rs:5:21: 5:27 (#33) }, Ident { ident: "Three", span: $DIR/actix-web/src/extract.rs:5:28: 5:33 (#33) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:54:21: 54:24 (#0) }], span: $DIR/actix-web/src/extract.rs:5:33: 5:37 (#33) }, Punct { ch: ';', spacing: Alone, span: $DIR/actix-web/src/extract.rs:5:37: 5:38 (#33) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actix-web-2.0.0/src/extract.rs:5:21: 5:27 (#38) }, Ident { ident: "Three", span: $DIR/actix-web-2.0.0/src/extract.rs:5:28: 5:33 (#38) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:62:21: 62:24 (#0) }], span: $DIR/actix-web-2.0.0/src/extract.rs:5:33: 5:37 (#38) }, Punct { ch: ';', spacing: Alone, span: $DIR/actix-web-2.0.0/src/extract.rs:5:37: 5:38 (#38) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actori-web/src/extract.rs:5:21: 5:27 (#43) }, Ident { ident: "Four", span: $DIR/actori-web/src/extract.rs:5:28: 5:32 (#43) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:70:21: 70:24 (#0) }], span: $DIR/actori-web/src/extract.rs:5:33: 5:35 (#43) }], span: $DIR/actori-web/src/extract.rs:5:32: 5:36 (#43) }, Punct { ch: ';', spacing: Alone, span: $DIR/actori-web/src/extract.rs:5:36: 5:37 (#43) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actori-web-2.0.0/src/extract.rs:5:21: 5:27 (#48) }, Ident { ident: "Four", span: $DIR/actori-web-2.0.0/src/extract.rs:5:28: 5:32 (#48) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:77:21: 77:24 (#0) }], span: $DIR/actori-web-2.0.0/src/extract.rs:5:33: 5:35 (#48) }], span: $DIR/actori-web-2.0.0/src/extract.rs:5:32: 5:36 (#48) }, Punct { ch: ';', spacing: Alone, span: $DIR/actori-web-2.0.0/src/extract.rs:5:36: 5:37 (#48) }] +Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/group-compat-hack.rs:39:25: 39:31 (#28) }, Ident { ident: "Three", span: $DIR/group-compat-hack.rs:39:32: 39:37 (#28) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:48:12: 48:15 (#0) }], span: $DIR/group-compat-hack.rs:39:38: 39:43 (#28) }], span: $DIR/group-compat-hack.rs:39:37: 39:44 (#28) }, Punct { ch: ';', spacing: Alone, span: $DIR/group-compat-hack.rs:39:44: 39:45 (#28) }] +Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actix-web/src/extract.rs:5:21: 5:27 (#33) }, Ident { ident: "Three", span: $DIR/actix-web/src/extract.rs:5:28: 5:33 (#33) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:55:21: 55:24 (#0) }], span: $DIR/actix-web/src/extract.rs:5:33: 5:37 (#33) }, Punct { ch: ';', spacing: Alone, span: $DIR/actix-web/src/extract.rs:5:37: 5:38 (#33) }] +Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actix-web-2.0.0/src/extract.rs:5:21: 5:27 (#38) }, Ident { ident: "Three", span: $DIR/actix-web-2.0.0/src/extract.rs:5:28: 5:33 (#38) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:63:21: 63:24 (#0) }], span: $DIR/actix-web-2.0.0/src/extract.rs:5:33: 5:37 (#38) }, Punct { ch: ';', spacing: Alone, span: $DIR/actix-web-2.0.0/src/extract.rs:5:37: 5:38 (#38) }] +Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actori-web/src/extract.rs:5:21: 5:27 (#43) }, Ident { ident: "Four", span: $DIR/actori-web/src/extract.rs:5:28: 5:32 (#43) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:71:21: 71:24 (#0) }], span: $DIR/actori-web/src/extract.rs:5:33: 5:35 (#43) }], span: $DIR/actori-web/src/extract.rs:5:32: 5:36 (#43) }, Punct { ch: ';', spacing: Alone, span: $DIR/actori-web/src/extract.rs:5:36: 5:37 (#43) }] +Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actori-web-2.0.0/src/extract.rs:5:21: 5:27 (#48) }, Ident { ident: "Four", span: $DIR/actori-web-2.0.0/src/extract.rs:5:28: 5:32 (#48) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:78:21: 78:24 (#0) }], span: $DIR/actori-web-2.0.0/src/extract.rs:5:33: 5:35 (#48) }], span: $DIR/actori-web-2.0.0/src/extract.rs:5:32: 5:36 (#48) }, Punct { ch: ';', spacing: Alone, span: $DIR/actori-web-2.0.0/src/extract.rs:5:36: 5:37 (#48) }] +Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/js-sys-0.3.40/src/lib.rs:5:21: 5:27 (#53) }, Ident { ident: "Two", span: $DIR/js-sys-0.3.40/src/lib.rs:5:28: 5:31 (#53) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:84:13: 84:16 (#0) }], span: $DIR/js-sys-0.3.40/src/lib.rs:5:32: 5:37 (#53) }], span: $DIR/js-sys-0.3.40/src/lib.rs:5:31: 5:38 (#53) }, Punct { ch: ';', spacing: Alone, span: $DIR/js-sys-0.3.40/src/lib.rs:5:38: 5:39 (#53) }] diff --git a/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs b/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs new file mode 100644 index 00000000000..d1a66940ebf --- /dev/null +++ b/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs @@ -0,0 +1,7 @@ +// ignore-test this is not a test + +macro_rules! arrays { + ($name:ident) => { + #[my_macro] struct Two($name); + } +} -- cgit 1.4.1-3-g733a5 From 34901708930ddd01a93c5dbd35f0102a6d054e7f Mon Sep 17 00:00:00 2001 From: Caio Date: Sat, 20 Mar 2021 11:41:24 -0300 Subject: Move some tests to more reasonable directories - 5 --- src/test/ui/associated-types/issue-23208.rs | 26 ++++++++ src/test/ui/associated-types/issue-31597.rs | 29 +++++++++ src/test/ui/binding/shadow.rs | 24 +++++++ src/test/ui/concat-rpass.rs | 18 ----- src/test/ui/consts/issue-52060.rs | 7 ++ src/test/ui/consts/issue-52060.stderr | 11 ++++ src/test/ui/consts/mir_check_nonconst.rs | 11 ++++ src/test/ui/consts/mir_check_nonconst.stderr | 9 +++ src/test/ui/fn_must_use.rs | 76 ---------------------- src/test/ui/fn_must_use.stderr | 59 ----------------- .../generator/issue-45729-unsafe-in-generator.rs | 9 +++ .../issue-45729-unsafe-in-generator.stderr | 11 ++++ src/test/ui/impl-trait-in-bindings-issue-73003.rs | 8 --- .../ui/impl-trait-in-bindings-issue-73003.stderr | 11 ---- src/test/ui/impl-trait-in-bindings.rs | 49 -------------- src/test/ui/impl-trait-in-bindings.stderr | 11 ---- .../impl-trait-in-bindings-issue-73003.rs | 8 +++ .../impl-trait-in-bindings-issue-73003.stderr | 11 ++++ src/test/ui/impl-trait/impl-trait-in-bindings.rs | 49 ++++++++++++++ .../ui/impl-trait/impl-trait-in-bindings.stderr | 11 ++++ src/test/ui/issues/issue-10392.rs | 30 --------- src/test/ui/issues/issue-1701.rs | 26 -------- src/test/ui/issues/issue-23208.rs | 26 -------- src/test/ui/issues/issue-31597.rs | 29 --------- .../ui/issues/issue-45729-unsafe-in-generator.rs | 9 --- .../issues/issue-45729-unsafe-in-generator.stderr | 11 ---- src/test/ui/issues/issue-48508-aux.rs | 7 -- src/test/ui/issues/issue-48508.rs | 21 ------ src/test/ui/issues/issue-52060.rs | 7 -- src/test/ui/issues/issue-52060.stderr | 11 ---- src/test/ui/issues/issue-65611.rs | 63 ------------------ src/test/ui/issues/issue-65611.stderr | 21 ------ ...ssue-68000-unicode-ident-after-missing-comma.rs | 6 -- ...-68000-unicode-ident-after-missing-comma.stderr | 17 ----- src/test/ui/issues/issue-78372.rs | 14 ---- src/test/ui/issues/issue-78372.stderr | 62 ------------------ src/test/ui/lint/fn_must_use.rs | 76 ++++++++++++++++++++++ src/test/ui/lint/fn_must_use.stderr | 59 +++++++++++++++++ src/test/ui/macros/concat-rpass.rs | 18 +++++ src/test/ui/mir_check_nonconst.rs | 11 ---- src/test/ui/mir_check_nonconst.stderr | 9 --- src/test/ui/no-implicit-prelude.rs | 18 ----- src/test/ui/no-implicit-prelude.stderr | 65 ------------------ src/test/ui/parser/issue-48508-aux.rs | 7 ++ src/test/ui/parser/issue-48508.rs | 21 ++++++ ...ssue-68000-unicode-ident-after-missing-comma.rs | 6 ++ ...-68000-unicode-ident-after-missing-comma.stderr | 17 +++++ src/test/ui/pattern/issue-10392.rs | 30 +++++++++ src/test/ui/resolve/no-implicit-prelude.rs | 18 +++++ src/test/ui/resolve/no-implicit-prelude.stderr | 65 ++++++++++++++++++ src/test/ui/shadow.rs | 24 ------- src/test/ui/structs-enums/issue-1701.rs | 26 ++++++++ src/test/ui/traits/issue-78372.rs | 14 ++++ src/test/ui/traits/issue-78372.stderr | 62 ++++++++++++++++++ src/test/ui/typeck/issue-65611.rs | 63 ++++++++++++++++++ src/test/ui/typeck/issue-65611.stderr | 21 ++++++ src/tools/tidy/src/ui_tests.rs | 4 +- 57 files changed, 721 insertions(+), 721 deletions(-) create mode 100644 src/test/ui/associated-types/issue-23208.rs create mode 100644 src/test/ui/associated-types/issue-31597.rs create mode 100644 src/test/ui/binding/shadow.rs delete mode 100644 src/test/ui/concat-rpass.rs create mode 100644 src/test/ui/consts/issue-52060.rs create mode 100644 src/test/ui/consts/issue-52060.stderr create mode 100644 src/test/ui/consts/mir_check_nonconst.rs create mode 100644 src/test/ui/consts/mir_check_nonconst.stderr delete mode 100644 src/test/ui/fn_must_use.rs delete mode 100644 src/test/ui/fn_must_use.stderr create mode 100644 src/test/ui/generator/issue-45729-unsafe-in-generator.rs create mode 100644 src/test/ui/generator/issue-45729-unsafe-in-generator.stderr delete mode 100644 src/test/ui/impl-trait-in-bindings-issue-73003.rs delete mode 100644 src/test/ui/impl-trait-in-bindings-issue-73003.stderr delete mode 100644 src/test/ui/impl-trait-in-bindings.rs delete mode 100644 src/test/ui/impl-trait-in-bindings.stderr create mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs create mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr create mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings.rs create mode 100644 src/test/ui/impl-trait/impl-trait-in-bindings.stderr delete mode 100644 src/test/ui/issues/issue-10392.rs delete mode 100644 src/test/ui/issues/issue-1701.rs delete mode 100644 src/test/ui/issues/issue-23208.rs delete mode 100644 src/test/ui/issues/issue-31597.rs delete mode 100644 src/test/ui/issues/issue-45729-unsafe-in-generator.rs delete mode 100644 src/test/ui/issues/issue-45729-unsafe-in-generator.stderr delete mode 100644 src/test/ui/issues/issue-48508-aux.rs delete mode 100644 src/test/ui/issues/issue-48508.rs delete mode 100644 src/test/ui/issues/issue-52060.rs delete mode 100644 src/test/ui/issues/issue-52060.stderr delete mode 100644 src/test/ui/issues/issue-65611.rs delete mode 100644 src/test/ui/issues/issue-65611.stderr delete mode 100644 src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.rs delete mode 100644 src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.stderr delete mode 100644 src/test/ui/issues/issue-78372.rs delete mode 100644 src/test/ui/issues/issue-78372.stderr create mode 100644 src/test/ui/lint/fn_must_use.rs create mode 100644 src/test/ui/lint/fn_must_use.stderr create mode 100644 src/test/ui/macros/concat-rpass.rs delete mode 100644 src/test/ui/mir_check_nonconst.rs delete mode 100644 src/test/ui/mir_check_nonconst.stderr delete mode 100644 src/test/ui/no-implicit-prelude.rs delete mode 100644 src/test/ui/no-implicit-prelude.stderr create mode 100644 src/test/ui/parser/issue-48508-aux.rs create mode 100644 src/test/ui/parser/issue-48508.rs create mode 100644 src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.rs create mode 100644 src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.stderr create mode 100644 src/test/ui/pattern/issue-10392.rs create mode 100644 src/test/ui/resolve/no-implicit-prelude.rs create mode 100644 src/test/ui/resolve/no-implicit-prelude.stderr delete mode 100644 src/test/ui/shadow.rs create mode 100644 src/test/ui/structs-enums/issue-1701.rs create mode 100644 src/test/ui/traits/issue-78372.rs create mode 100644 src/test/ui/traits/issue-78372.stderr create mode 100644 src/test/ui/typeck/issue-65611.rs create mode 100644 src/test/ui/typeck/issue-65611.stderr (limited to 'src/test') diff --git a/src/test/ui/associated-types/issue-23208.rs b/src/test/ui/associated-types/issue-23208.rs new file mode 100644 index 00000000000..fd4ffe5d6e1 --- /dev/null +++ b/src/test/ui/associated-types/issue-23208.rs @@ -0,0 +1,26 @@ +// run-pass +trait TheTrait : TheSuperTrait<::Item> { + type Item; +} + +trait TheSuperTrait { + fn get(&self) -> T; +} + +impl TheTrait for i32 { + type Item = u32; +} + +impl TheSuperTrait for i32 { + fn get(&self) -> u32 { + *self as u32 + } +} + +fn foo>(t: &T) -> u32 { + t.get() +} + +fn main() { + foo::(&22); +} diff --git a/src/test/ui/associated-types/issue-31597.rs b/src/test/ui/associated-types/issue-31597.rs new file mode 100644 index 00000000000..2872be6d6c8 --- /dev/null +++ b/src/test/ui/associated-types/issue-31597.rs @@ -0,0 +1,29 @@ +// check-pass +#![allow(dead_code)] +trait Make { + type Out; + + fn make() -> Self::Out; +} + +impl Make for () { + type Out = (); + + fn make() -> Self::Out {} +} + +// Also make sure we don't hit an ICE when the projection can't be known +fn f() -> ::Out { loop {} } + +// ...and that it works with a blanket impl +trait Tr { + type Assoc; +} + +impl Tr for T { + type Assoc = (); +} + +fn g() -> ::Assoc { } + +fn main() {} diff --git a/src/test/ui/binding/shadow.rs b/src/test/ui/binding/shadow.rs new file mode 100644 index 00000000000..2495c8f47e7 --- /dev/null +++ b/src/test/ui/binding/shadow.rs @@ -0,0 +1,24 @@ +// run-pass + +#![allow(non_camel_case_types)] +#![allow(dead_code)] +fn foo(c: Vec ) { + let a: isize = 5; + let mut b: Vec = Vec::new(); + + + match t::none:: { + t::some::(_) => { + for _i in &c { + println!("{}", a); + let a = 17; + b.push(a); + } + } + _ => { } + } +} + +enum t { none, some(T), } + +pub fn main() { let x = 10; let x = x + 20; assert_eq!(x, 30); foo(Vec::new()); } diff --git a/src/test/ui/concat-rpass.rs b/src/test/ui/concat-rpass.rs deleted file mode 100644 index 0c30a39d6a2..00000000000 --- a/src/test/ui/concat-rpass.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass - -pub fn main() { - assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_string()); - assert_eq!(format!(concat!()), "".to_string()); - // check trailing comma is allowed in concat - assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_string()); - - assert_eq!( - concat!(1, 2, 3, 4f32, 4.0, 'a', true), - "12344.0atrue" - ); - - assert!(match "12344.0atrue" { - concat!(1, 2, 3, 4f32, 4.0, 'a', true) => true, - _ => false - }) -} diff --git a/src/test/ui/consts/issue-52060.rs b/src/test/ui/consts/issue-52060.rs new file mode 100644 index 00000000000..13b914c0331 --- /dev/null +++ b/src/test/ui/consts/issue-52060.rs @@ -0,0 +1,7 @@ +// Regression test for https://github.com/rust-lang/rust/issues/52060 +// The compiler shouldn't ICE in this case +static A: &'static [u32] = &[1]; +static B: [u32; 1] = [0; A.len()]; +//~^ ERROR [E0013] + +fn main() {} diff --git a/src/test/ui/consts/issue-52060.stderr b/src/test/ui/consts/issue-52060.stderr new file mode 100644 index 00000000000..95e5f2a8282 --- /dev/null +++ b/src/test/ui/consts/issue-52060.stderr @@ -0,0 +1,11 @@ +error[E0013]: constants cannot refer to statics + --> $DIR/issue-52060.rs:4:26 + | +LL | static B: [u32; 1] = [0; A.len()]; + | ^ + | + = help: consider extracting the value of the `static` to a `const`, and referring to that + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0013`. diff --git a/src/test/ui/consts/mir_check_nonconst.rs b/src/test/ui/consts/mir_check_nonconst.rs new file mode 100644 index 00000000000..b8ec0c3c449 --- /dev/null +++ b/src/test/ui/consts/mir_check_nonconst.rs @@ -0,0 +1,11 @@ +#![allow(dead_code)] + +struct Foo { a: u8 } +fn bar() -> Foo { + Foo { a: 5 } +} + +static foo: Foo = bar(); +//~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants + +fn main() {} diff --git a/src/test/ui/consts/mir_check_nonconst.stderr b/src/test/ui/consts/mir_check_nonconst.stderr new file mode 100644 index 00000000000..30f68ba4372 --- /dev/null +++ b/src/test/ui/consts/mir_check_nonconst.stderr @@ -0,0 +1,9 @@ +error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants + --> $DIR/mir_check_nonconst.rs:8:19 + | +LL | static foo: Foo = bar(); + | ^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/fn_must_use.rs b/src/test/ui/fn_must_use.rs deleted file mode 100644 index b4e9da0fc84..00000000000 --- a/src/test/ui/fn_must_use.rs +++ /dev/null @@ -1,76 +0,0 @@ -// check-pass - -#![warn(unused_must_use)] - -#[derive(PartialEq, Eq)] -struct MyStruct { - n: usize, -} - -impl MyStruct { - #[must_use] - fn need_to_use_this_method_value(&self) -> usize { - self.n - } - - #[must_use] - fn need_to_use_this_associated_function_value() -> isize { - -1 - } -} - -trait EvenNature { - #[must_use = "no side effects"] - fn is_even(&self) -> bool; -} - -impl EvenNature for MyStruct { - fn is_even(&self) -> bool { - self.n % 2 == 0 - } -} - -trait Replaceable { - fn replace(&mut self, substitute: usize) -> usize; -} - -impl Replaceable for MyStruct { - // ↓ N.b.: `#[must_use]` attribute on a particular trait implementation - // method won't work; the attribute should be on the method signature in - // the trait's definition. - #[must_use] - fn replace(&mut self, substitute: usize) -> usize { - let previously = self.n; - self.n = substitute; - previously - } -} - -#[must_use = "it's important"] -fn need_to_use_this_value() -> bool { - false -} - -fn main() { - need_to_use_this_value(); //~ WARN unused return value - - let mut m = MyStruct { n: 2 }; - let n = MyStruct { n: 3 }; - - m.need_to_use_this_method_value(); //~ WARN unused return value - m.is_even(); // trait method! - //~^ WARN unused return value - - MyStruct::need_to_use_this_associated_function_value(); - //~^ WARN unused return value - - m.replace(3); // won't warn (annotation needs to be in trait definition) - - // comparison methods are `must_use` - 2.eq(&3); //~ WARN unused return value - m.eq(&n); //~ WARN unused return value - - // lint includes comparison operators - 2 == 3; //~ WARN unused comparison - m == n; //~ WARN unused comparison -} diff --git a/src/test/ui/fn_must_use.stderr b/src/test/ui/fn_must_use.stderr deleted file mode 100644 index d6b1cf3ae1f..00000000000 --- a/src/test/ui/fn_must_use.stderr +++ /dev/null @@ -1,59 +0,0 @@ -warning: unused return value of `need_to_use_this_value` that must be used - --> $DIR/fn_must_use.rs:55:5 - | -LL | need_to_use_this_value(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/fn_must_use.rs:3:9 - | -LL | #![warn(unused_must_use)] - | ^^^^^^^^^^^^^^^ - = note: it's important - -warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used - --> $DIR/fn_must_use.rs:60:5 - | -LL | m.need_to_use_this_method_value(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused return value of `EvenNature::is_even` that must be used - --> $DIR/fn_must_use.rs:61:5 - | -LL | m.is_even(); // trait method! - | ^^^^^^^^^^^^ - | - = note: no side effects - -warning: unused return value of `MyStruct::need_to_use_this_associated_function_value` that must be used - --> $DIR/fn_must_use.rs:64:5 - | -LL | MyStruct::need_to_use_this_associated_function_value(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused return value of `std::cmp::PartialEq::eq` that must be used - --> $DIR/fn_must_use.rs:70:5 - | -LL | 2.eq(&3); - | ^^^^^^^^^ - -warning: unused return value of `std::cmp::PartialEq::eq` that must be used - --> $DIR/fn_must_use.rs:71:5 - | -LL | m.eq(&n); - | ^^^^^^^^^ - -warning: unused comparison that must be used - --> $DIR/fn_must_use.rs:74:5 - | -LL | 2 == 3; - | ^^^^^^ - -warning: unused comparison that must be used - --> $DIR/fn_must_use.rs:75:5 - | -LL | m == n; - | ^^^^^^ - -warning: 8 warnings emitted - diff --git a/src/test/ui/generator/issue-45729-unsafe-in-generator.rs b/src/test/ui/generator/issue-45729-unsafe-in-generator.rs new file mode 100644 index 00000000000..638a1994bb5 --- /dev/null +++ b/src/test/ui/generator/issue-45729-unsafe-in-generator.rs @@ -0,0 +1,9 @@ +#![feature(generators)] + +fn main() { + let _ = || { + *(1 as *mut u32) = 42; + //~^ ERROR dereference of raw pointer is unsafe + yield; + }; +} diff --git a/src/test/ui/generator/issue-45729-unsafe-in-generator.stderr b/src/test/ui/generator/issue-45729-unsafe-in-generator.stderr new file mode 100644 index 00000000000..2aab6807aaa --- /dev/null +++ b/src/test/ui/generator/issue-45729-unsafe-in-generator.stderr @@ -0,0 +1,11 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-45729-unsafe-in-generator.rs:5:9 + | +LL | *(1 as *mut u32) = 42; + | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer + | + = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/impl-trait-in-bindings-issue-73003.rs b/src/test/ui/impl-trait-in-bindings-issue-73003.rs deleted file mode 100644 index fd8fe5f48df..00000000000 --- a/src/test/ui/impl-trait-in-bindings-issue-73003.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check-pass - -#![feature(impl_trait_in_bindings)] -//~^ WARN the feature `impl_trait_in_bindings` is incomplete - -const _: impl Fn() = ||(); - -fn main() {} diff --git a/src/test/ui/impl-trait-in-bindings-issue-73003.stderr b/src/test/ui/impl-trait-in-bindings-issue-73003.stderr deleted file mode 100644 index 715671c8add..00000000000 --- a/src/test/ui/impl-trait-in-bindings-issue-73003.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/impl-trait-in-bindings-issue-73003.rs:3:12 - | -LL | #![feature(impl_trait_in_bindings)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #63065 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/impl-trait-in-bindings.rs b/src/test/ui/impl-trait-in-bindings.rs deleted file mode 100644 index c7fae45d5ca..00000000000 --- a/src/test/ui/impl-trait-in-bindings.rs +++ /dev/null @@ -1,49 +0,0 @@ -// run-pass - -#![feature(impl_trait_in_bindings)] -//~^ WARN the feature `impl_trait_in_bindings` is incomplete - -use std::fmt::Debug; - -const FOO: impl Debug + Clone + PartialEq = 42; - -static BAR: impl Debug + Clone + PartialEq = 42; - -fn a(x: T) { - let y: impl Clone = x; - let _ = y.clone(); -} - -fn b(x: T) { - let f = move || { - let y: impl Clone = x; - let _ = y.clone(); - }; - f(); -} - -trait Foo { - fn a(x: T) { - let y: impl Clone = x; - let _ = y.clone(); - } -} - -impl Foo for i32 { - fn a(x: T) { - let y: impl Clone = x; - let _ = y.clone(); - } -} - -fn main() { - let foo: impl Debug + Clone + PartialEq = 42; - - assert_eq!(FOO.clone(), 42); - assert_eq!(BAR.clone(), 42); - assert_eq!(foo.clone(), 42); - - a(42); - b(42); - i32::a(42); -} diff --git a/src/test/ui/impl-trait-in-bindings.stderr b/src/test/ui/impl-trait-in-bindings.stderr deleted file mode 100644 index bf739d4722f..00000000000 --- a/src/test/ui/impl-trait-in-bindings.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/impl-trait-in-bindings.rs:3:12 - | -LL | #![feature(impl_trait_in_bindings)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #63065 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs b/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs new file mode 100644 index 00000000000..fd8fe5f48df --- /dev/null +++ b/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.rs @@ -0,0 +1,8 @@ +// check-pass + +#![feature(impl_trait_in_bindings)] +//~^ WARN the feature `impl_trait_in_bindings` is incomplete + +const _: impl Fn() = ||(); + +fn main() {} diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr b/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr new file mode 100644 index 00000000000..715671c8add --- /dev/null +++ b/src/test/ui/impl-trait/impl-trait-in-bindings-issue-73003.stderr @@ -0,0 +1,11 @@ +warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/impl-trait-in-bindings-issue-73003.rs:3:12 + | +LL | #![feature(impl_trait_in_bindings)] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #63065 for more information + +warning: 1 warning emitted + diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings.rs b/src/test/ui/impl-trait/impl-trait-in-bindings.rs new file mode 100644 index 00000000000..c7fae45d5ca --- /dev/null +++ b/src/test/ui/impl-trait/impl-trait-in-bindings.rs @@ -0,0 +1,49 @@ +// run-pass + +#![feature(impl_trait_in_bindings)] +//~^ WARN the feature `impl_trait_in_bindings` is incomplete + +use std::fmt::Debug; + +const FOO: impl Debug + Clone + PartialEq = 42; + +static BAR: impl Debug + Clone + PartialEq = 42; + +fn a(x: T) { + let y: impl Clone = x; + let _ = y.clone(); +} + +fn b(x: T) { + let f = move || { + let y: impl Clone = x; + let _ = y.clone(); + }; + f(); +} + +trait Foo { + fn a(x: T) { + let y: impl Clone = x; + let _ = y.clone(); + } +} + +impl Foo for i32 { + fn a(x: T) { + let y: impl Clone = x; + let _ = y.clone(); + } +} + +fn main() { + let foo: impl Debug + Clone + PartialEq = 42; + + assert_eq!(FOO.clone(), 42); + assert_eq!(BAR.clone(), 42); + assert_eq!(foo.clone(), 42); + + a(42); + b(42); + i32::a(42); +} diff --git a/src/test/ui/impl-trait/impl-trait-in-bindings.stderr b/src/test/ui/impl-trait/impl-trait-in-bindings.stderr new file mode 100644 index 00000000000..bf739d4722f --- /dev/null +++ b/src/test/ui/impl-trait/impl-trait-in-bindings.stderr @@ -0,0 +1,11 @@ +warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/impl-trait-in-bindings.rs:3:12 + | +LL | #![feature(impl_trait_in_bindings)] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #63065 for more information + +warning: 1 warning emitted + diff --git a/src/test/ui/issues/issue-10392.rs b/src/test/ui/issues/issue-10392.rs deleted file mode 100644 index 926fa94800e..00000000000 --- a/src/test/ui/issues/issue-10392.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass -#![allow(unused_variables)] - -struct A { foo: isize } -struct B { a: isize, b: isize, c: isize } - -fn mka() -> A { panic!() } -fn mkb() -> B { panic!() } - -fn test() { - let A { foo, } = mka(); - let A { - foo, - } = mka(); - - let B { a, b, c, } = mkb(); - - match mka() { - A { foo: _foo, } => {} - } - - match Some(mka()) { - Some(A { foo: _foo, }) => {} - None => {} - } -} - -pub fn main() { - if false { test() } -} diff --git a/src/test/ui/issues/issue-1701.rs b/src/test/ui/issues/issue-1701.rs deleted file mode 100644 index bae32a77765..00000000000 --- a/src/test/ui/issues/issue-1701.rs +++ /dev/null @@ -1,26 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - - -enum pattern { tabby, tortoiseshell, calico } -enum breed { beagle, rottweiler, pug } -type name = String; -enum ear_kind { lop, upright } -enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } - -fn noise(a: animal) -> Option { - match a { - animal::cat(..) => { Some("meow".to_string()) } - animal::dog(..) => { Some("woof".to_string()) } - animal::rabbit(..) => { None } - animal::tiger => { Some("roar".to_string()) } - } -} - -pub fn main() { - assert_eq!(noise(animal::cat(pattern::tabby)), Some("meow".to_string())); - assert_eq!(noise(animal::dog(breed::pug)), Some("woof".to_string())); - assert_eq!(noise(animal::rabbit("Hilbert".to_string(), ear_kind::upright)), None); - assert_eq!(noise(animal::tiger), Some("roar".to_string())); -} diff --git a/src/test/ui/issues/issue-23208.rs b/src/test/ui/issues/issue-23208.rs deleted file mode 100644 index fd4ffe5d6e1..00000000000 --- a/src/test/ui/issues/issue-23208.rs +++ /dev/null @@ -1,26 +0,0 @@ -// run-pass -trait TheTrait : TheSuperTrait<::Item> { - type Item; -} - -trait TheSuperTrait { - fn get(&self) -> T; -} - -impl TheTrait for i32 { - type Item = u32; -} - -impl TheSuperTrait for i32 { - fn get(&self) -> u32 { - *self as u32 - } -} - -fn foo>(t: &T) -> u32 { - t.get() -} - -fn main() { - foo::(&22); -} diff --git a/src/test/ui/issues/issue-31597.rs b/src/test/ui/issues/issue-31597.rs deleted file mode 100644 index 2872be6d6c8..00000000000 --- a/src/test/ui/issues/issue-31597.rs +++ /dev/null @@ -1,29 +0,0 @@ -// check-pass -#![allow(dead_code)] -trait Make { - type Out; - - fn make() -> Self::Out; -} - -impl Make for () { - type Out = (); - - fn make() -> Self::Out {} -} - -// Also make sure we don't hit an ICE when the projection can't be known -fn f() -> ::Out { loop {} } - -// ...and that it works with a blanket impl -trait Tr { - type Assoc; -} - -impl Tr for T { - type Assoc = (); -} - -fn g() -> ::Assoc { } - -fn main() {} diff --git a/src/test/ui/issues/issue-45729-unsafe-in-generator.rs b/src/test/ui/issues/issue-45729-unsafe-in-generator.rs deleted file mode 100644 index 638a1994bb5..00000000000 --- a/src/test/ui/issues/issue-45729-unsafe-in-generator.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![feature(generators)] - -fn main() { - let _ = || { - *(1 as *mut u32) = 42; - //~^ ERROR dereference of raw pointer is unsafe - yield; - }; -} diff --git a/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr b/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr deleted file mode 100644 index 2aab6807aaa..00000000000 --- a/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45729-unsafe-in-generator.rs:5:9 - | -LL | *(1 as *mut u32) = 42; - | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer - | - = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-48508-aux.rs b/src/test/ui/issues/issue-48508-aux.rs deleted file mode 100644 index ebdc70a04df..00000000000 --- a/src/test/ui/issues/issue-48508-aux.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -// ignore-test Not a test. Used by issue-48508.rs - -pub fn other() -> f64 { - let µ = 1.0; - µ -} diff --git a/src/test/ui/issues/issue-48508.rs b/src/test/ui/issues/issue-48508.rs deleted file mode 100644 index 8dc9351260e..00000000000 --- a/src/test/ui/issues/issue-48508.rs +++ /dev/null @@ -1,21 +0,0 @@ -// run-pass -// Regression test for issue #48508: -// -// Confusion between global and local file offsets caused incorrect handling of multibyte character -// spans when compiling multiple files. One visible effect was an ICE generating debug information -// when a multibyte character is at the end of a scope. The problematic code is actually in -// issue-48508-aux.rs - -// compile-flags:-g -// ignore-pretty issue #37195 -// ignore-asmjs wasm2js does not support source maps yet - -#![feature(non_ascii_idents)] -#![allow(uncommon_codepoints)] - -#[path = "issue-48508-aux.rs"] -mod other_file; - -fn main() { - other_file::other(); -} diff --git a/src/test/ui/issues/issue-52060.rs b/src/test/ui/issues/issue-52060.rs deleted file mode 100644 index 13b914c0331..00000000000 --- a/src/test/ui/issues/issue-52060.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Regression test for https://github.com/rust-lang/rust/issues/52060 -// The compiler shouldn't ICE in this case -static A: &'static [u32] = &[1]; -static B: [u32; 1] = [0; A.len()]; -//~^ ERROR [E0013] - -fn main() {} diff --git a/src/test/ui/issues/issue-52060.stderr b/src/test/ui/issues/issue-52060.stderr deleted file mode 100644 index 95e5f2a8282..00000000000 --- a/src/test/ui/issues/issue-52060.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0013]: constants cannot refer to statics - --> $DIR/issue-52060.rs:4:26 - | -LL | static B: [u32; 1] = [0; A.len()]; - | ^ - | - = help: consider extracting the value of the `static` to a `const`, and referring to that - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0013`. diff --git a/src/test/ui/issues/issue-65611.rs b/src/test/ui/issues/issue-65611.rs deleted file mode 100644 index b74ee1b0c6e..00000000000 --- a/src/test/ui/issues/issue-65611.rs +++ /dev/null @@ -1,63 +0,0 @@ -use std::mem::MaybeUninit; -use std::ops::Deref; - -pub unsafe trait Array { - /// The array’s element type - type Item; - #[doc(hidden)] - /// The smallest index type that indexes the array. - type Index: Index; - #[doc(hidden)] - fn as_ptr(&self) -> *const Self::Item; - #[doc(hidden)] - fn as_mut_ptr(&mut self) -> *mut Self::Item; - #[doc(hidden)] - fn capacity() -> usize; -} - -pub trait Index : PartialEq + Copy { - fn to_usize(self) -> usize; - fn from(usize) -> Self; -} - -impl Index for usize { - fn to_usize(self) -> usize { self } - fn from(val: usize) -> Self { - val - } -} - -unsafe impl Array for [T; 1] { - type Item = T; - type Index = usize; - fn as_ptr(&self) -> *const T { self as *const _ as *const _ } - fn as_mut_ptr(&mut self) -> *mut T { self as *mut _ as *mut _} - fn capacity() -> usize { 1 } -} - -impl Deref for ArrayVec { - type Target = [A::Item]; - #[inline] - fn deref(&self) -> &[A::Item] { - panic!() - } -} - -pub struct ArrayVec { - xs: MaybeUninit, - len: usize, -} - -impl ArrayVec { - pub fn new() -> ArrayVec { - panic!() - } -} - -fn main() { - let mut buffer = ArrayVec::new(); - let x = buffer.last().unwrap().0.clone(); - //~^ ERROR type annotations needed - //~| ERROR no field `0` on type `&_` - buffer.reverse(); -} diff --git a/src/test/ui/issues/issue-65611.stderr b/src/test/ui/issues/issue-65611.stderr deleted file mode 100644 index e3c005a0593..00000000000 --- a/src/test/ui/issues/issue-65611.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-65611.rs:59:20 - | -LL | let x = buffer.last().unwrap().0.clone(); - | -------^^^^-- - | | | - | | cannot infer type for type parameter `T` - | this method call resolves to `Option<&T>` - | - = note: type must be known at this point - -error[E0609]: no field `0` on type `&_` - --> $DIR/issue-65611.rs:59:36 - | -LL | let x = buffer.last().unwrap().0.clone(); - | ^ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0282, E0609. -For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.rs b/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.rs deleted file mode 100644 index 3c49a5a9752..00000000000 --- a/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub struct Foo { - pub bar: Vecö - //~^ ERROR expected `,`, or `}`, found `ö` -} //~ ERROR expected `:`, found `}` - -fn main() {} diff --git a/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.stderr b/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.stderr deleted file mode 100644 index ef365a61643..00000000000 --- a/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: expected `,`, or `}`, found `ö` - --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:2:22 - | -LL | pub bar: Vecö - | ^ help: try adding a comma: `,` - -error: expected `:`, found `}` - --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:4:1 - | -LL | pub bar: Vecö - | - expected `:` -LL | -LL | } - | ^ unexpected token - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/issues/issue-78372.rs b/src/test/ui/issues/issue-78372.rs deleted file mode 100644 index 77a8c92c81c..00000000000 --- a/src/test/ui/issues/issue-78372.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::ops::DispatchFromDyn; //~ ERROR use of unstable library feature 'dispatch_from_dyn' -struct Smaht(PhantomData); //~ ERROR cannot find type `PhantomData` in this scope -impl DispatchFromDyn> for T {} //~ ERROR cannot find type `U` in this scope -//~^ ERROR cannot find type `MISC` in this scope -//~| ERROR use of unstable library feature 'dispatch_from_dyn' -//~| ERROR the trait `DispatchFromDyn` may only be implemented for a coercion between structures -//~| ERROR type parameter `T` must be covered by another type when it appears before the first -trait Foo: X {} -trait X { - fn foo(self: Smaht); -} -trait Marker {} -impl Marker for dyn Foo {} -fn main() {} diff --git a/src/test/ui/issues/issue-78372.stderr b/src/test/ui/issues/issue-78372.stderr deleted file mode 100644 index 9267e838cea..00000000000 --- a/src/test/ui/issues/issue-78372.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error[E0412]: cannot find type `PhantomData` in this scope - --> $DIR/issue-78372.rs:2:23 - | -LL | struct Smaht(PhantomData); - | ^^^^^^^^^^^ not found in this scope - | -help: consider importing this struct - | -LL | use std::marker::PhantomData; - | - -error[E0412]: cannot find type `U` in this scope - --> $DIR/issue-78372.rs:3:31 - | -LL | impl DispatchFromDyn> for T {} - | - ^ help: a type parameter with a similar name exists: `T` - | | - | similarly named type parameter `T` defined here - -error[E0412]: cannot find type `MISC` in this scope - --> $DIR/issue-78372.rs:3:34 - | -LL | impl DispatchFromDyn> for T {} - | - ^^^^ not found in this scope - | | - | help: you might be missing a type parameter: `, MISC` - -error[E0658]: use of unstable library feature 'dispatch_from_dyn' - --> $DIR/issue-78372.rs:1:5 - | -LL | use std::ops::DispatchFromDyn; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable - -error[E0658]: use of unstable library feature 'dispatch_from_dyn' - --> $DIR/issue-78372.rs:3:9 - | -LL | impl DispatchFromDyn> for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable - -error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures - --> $DIR/issue-78372.rs:3:1 - | -LL | impl DispatchFromDyn> for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Smaht<[type error], [type error]>`) - --> $DIR/issue-78372.rs:3:6 - | -LL | impl DispatchFromDyn> for T {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Smaht<[type error], [type error]>`) - | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type - = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last - -error: aborting due to 7 previous errors - -Some errors have detailed explanations: E0210, E0378, E0412, E0658. -For more information about an error, try `rustc --explain E0210`. diff --git a/src/test/ui/lint/fn_must_use.rs b/src/test/ui/lint/fn_must_use.rs new file mode 100644 index 00000000000..b4e9da0fc84 --- /dev/null +++ b/src/test/ui/lint/fn_must_use.rs @@ -0,0 +1,76 @@ +// check-pass + +#![warn(unused_must_use)] + +#[derive(PartialEq, Eq)] +struct MyStruct { + n: usize, +} + +impl MyStruct { + #[must_use] + fn need_to_use_this_method_value(&self) -> usize { + self.n + } + + #[must_use] + fn need_to_use_this_associated_function_value() -> isize { + -1 + } +} + +trait EvenNature { + #[must_use = "no side effects"] + fn is_even(&self) -> bool; +} + +impl EvenNature for MyStruct { + fn is_even(&self) -> bool { + self.n % 2 == 0 + } +} + +trait Replaceable { + fn replace(&mut self, substitute: usize) -> usize; +} + +impl Replaceable for MyStruct { + // ↓ N.b.: `#[must_use]` attribute on a particular trait implementation + // method won't work; the attribute should be on the method signature in + // the trait's definition. + #[must_use] + fn replace(&mut self, substitute: usize) -> usize { + let previously = self.n; + self.n = substitute; + previously + } +} + +#[must_use = "it's important"] +fn need_to_use_this_value() -> bool { + false +} + +fn main() { + need_to_use_this_value(); //~ WARN unused return value + + let mut m = MyStruct { n: 2 }; + let n = MyStruct { n: 3 }; + + m.need_to_use_this_method_value(); //~ WARN unused return value + m.is_even(); // trait method! + //~^ WARN unused return value + + MyStruct::need_to_use_this_associated_function_value(); + //~^ WARN unused return value + + m.replace(3); // won't warn (annotation needs to be in trait definition) + + // comparison methods are `must_use` + 2.eq(&3); //~ WARN unused return value + m.eq(&n); //~ WARN unused return value + + // lint includes comparison operators + 2 == 3; //~ WARN unused comparison + m == n; //~ WARN unused comparison +} diff --git a/src/test/ui/lint/fn_must_use.stderr b/src/test/ui/lint/fn_must_use.stderr new file mode 100644 index 00000000000..d6b1cf3ae1f --- /dev/null +++ b/src/test/ui/lint/fn_must_use.stderr @@ -0,0 +1,59 @@ +warning: unused return value of `need_to_use_this_value` that must be used + --> $DIR/fn_must_use.rs:55:5 + | +LL | need_to_use_this_value(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/fn_must_use.rs:3:9 + | +LL | #![warn(unused_must_use)] + | ^^^^^^^^^^^^^^^ + = note: it's important + +warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used + --> $DIR/fn_must_use.rs:60:5 + | +LL | m.need_to_use_this_method_value(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused return value of `EvenNature::is_even` that must be used + --> $DIR/fn_must_use.rs:61:5 + | +LL | m.is_even(); // trait method! + | ^^^^^^^^^^^^ + | + = note: no side effects + +warning: unused return value of `MyStruct::need_to_use_this_associated_function_value` that must be used + --> $DIR/fn_must_use.rs:64:5 + | +LL | MyStruct::need_to_use_this_associated_function_value(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused return value of `std::cmp::PartialEq::eq` that must be used + --> $DIR/fn_must_use.rs:70:5 + | +LL | 2.eq(&3); + | ^^^^^^^^^ + +warning: unused return value of `std::cmp::PartialEq::eq` that must be used + --> $DIR/fn_must_use.rs:71:5 + | +LL | m.eq(&n); + | ^^^^^^^^^ + +warning: unused comparison that must be used + --> $DIR/fn_must_use.rs:74:5 + | +LL | 2 == 3; + | ^^^^^^ + +warning: unused comparison that must be used + --> $DIR/fn_must_use.rs:75:5 + | +LL | m == n; + | ^^^^^^ + +warning: 8 warnings emitted + diff --git a/src/test/ui/macros/concat-rpass.rs b/src/test/ui/macros/concat-rpass.rs new file mode 100644 index 00000000000..0c30a39d6a2 --- /dev/null +++ b/src/test/ui/macros/concat-rpass.rs @@ -0,0 +1,18 @@ +// run-pass + +pub fn main() { + assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_string()); + assert_eq!(format!(concat!()), "".to_string()); + // check trailing comma is allowed in concat + assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_string()); + + assert_eq!( + concat!(1, 2, 3, 4f32, 4.0, 'a', true), + "12344.0atrue" + ); + + assert!(match "12344.0atrue" { + concat!(1, 2, 3, 4f32, 4.0, 'a', true) => true, + _ => false + }) +} diff --git a/src/test/ui/mir_check_nonconst.rs b/src/test/ui/mir_check_nonconst.rs deleted file mode 100644 index b8ec0c3c449..00000000000 --- a/src/test/ui/mir_check_nonconst.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![allow(dead_code)] - -struct Foo { a: u8 } -fn bar() -> Foo { - Foo { a: 5 } -} - -static foo: Foo = bar(); -//~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants - -fn main() {} diff --git a/src/test/ui/mir_check_nonconst.stderr b/src/test/ui/mir_check_nonconst.stderr deleted file mode 100644 index 30f68ba4372..00000000000 --- a/src/test/ui/mir_check_nonconst.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/mir_check_nonconst.rs:8:19 - | -LL | static foo: Foo = bar(); - | ^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/no-implicit-prelude.rs b/src/test/ui/no-implicit-prelude.rs deleted file mode 100644 index 4b0ca4d524e..00000000000 --- a/src/test/ui/no-implicit-prelude.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![no_implicit_prelude] - -// Test that things from the prelude aren't in scope. Use many of them -// so that renaming some things won't magically make this test fail -// for the wrong reason (e.g., if `Add` changes to `Addition`, and -// `no_implicit_prelude` stops working, then the `impl Add` will still -// fail with the same error message). - -struct Test; -impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope -impl Clone for Test {} //~ ERROR expected trait, found derive macro `Clone` -impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope -impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope -impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope - -fn main() { - drop(2) //~ ERROR cannot find function `drop` in this scope -} diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr deleted file mode 100644 index 36a9b65b7d1..00000000000 --- a/src/test/ui/no-implicit-prelude.stderr +++ /dev/null @@ -1,65 +0,0 @@ -error[E0405]: cannot find trait `Add` in this scope - --> $DIR/no-implicit-prelude.rs:10:6 - | -LL | impl Add for Test {} - | ^^^ not found in this scope - | -help: consider importing this trait - | -LL | use std::ops::Add; - | - -error[E0404]: expected trait, found derive macro `Clone` - --> $DIR/no-implicit-prelude.rs:11:6 - | -LL | impl Clone for Test {} - | ^^^^^ not a trait - | -help: consider importing this trait instead - | -LL | use std::clone::Clone; - | - -error[E0405]: cannot find trait `Iterator` in this scope - --> $DIR/no-implicit-prelude.rs:12:6 - | -LL | impl Iterator for Test {} - | ^^^^^^^^ not found in this scope - | -help: consider importing this trait - | -LL | use std::iter::Iterator; - | - -error[E0405]: cannot find trait `ToString` in this scope - --> $DIR/no-implicit-prelude.rs:13:6 - | -LL | impl ToString for Test {} - | ^^^^^^^^ not found in this scope - | -help: consider importing this trait - | -LL | use std::string::ToString; - | - -error[E0405]: cannot find trait `Writer` in this scope - --> $DIR/no-implicit-prelude.rs:14:6 - | -LL | impl Writer for Test {} - | ^^^^^^ not found in this scope - -error[E0425]: cannot find function `drop` in this scope - --> $DIR/no-implicit-prelude.rs:17:5 - | -LL | drop(2) - | ^^^^ not found in this scope - | -help: consider importing this function - | -LL | use std::mem::drop; - | - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0404, E0405, E0425. -For more information about an error, try `rustc --explain E0404`. diff --git a/src/test/ui/parser/issue-48508-aux.rs b/src/test/ui/parser/issue-48508-aux.rs new file mode 100644 index 00000000000..ebdc70a04df --- /dev/null +++ b/src/test/ui/parser/issue-48508-aux.rs @@ -0,0 +1,7 @@ +// run-pass +// ignore-test Not a test. Used by issue-48508.rs + +pub fn other() -> f64 { + let µ = 1.0; + µ +} diff --git a/src/test/ui/parser/issue-48508.rs b/src/test/ui/parser/issue-48508.rs new file mode 100644 index 00000000000..8dc9351260e --- /dev/null +++ b/src/test/ui/parser/issue-48508.rs @@ -0,0 +1,21 @@ +// run-pass +// Regression test for issue #48508: +// +// Confusion between global and local file offsets caused incorrect handling of multibyte character +// spans when compiling multiple files. One visible effect was an ICE generating debug information +// when a multibyte character is at the end of a scope. The problematic code is actually in +// issue-48508-aux.rs + +// compile-flags:-g +// ignore-pretty issue #37195 +// ignore-asmjs wasm2js does not support source maps yet + +#![feature(non_ascii_idents)] +#![allow(uncommon_codepoints)] + +#[path = "issue-48508-aux.rs"] +mod other_file; + +fn main() { + other_file::other(); +} diff --git a/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.rs b/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.rs new file mode 100644 index 00000000000..3c49a5a9752 --- /dev/null +++ b/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.rs @@ -0,0 +1,6 @@ +pub struct Foo { + pub bar: Vecö + //~^ ERROR expected `,`, or `}`, found `ö` +} //~ ERROR expected `:`, found `}` + +fn main() {} diff --git a/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.stderr b/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.stderr new file mode 100644 index 00000000000..ef365a61643 --- /dev/null +++ b/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.stderr @@ -0,0 +1,17 @@ +error: expected `,`, or `}`, found `ö` + --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:2:22 + | +LL | pub bar: Vecö + | ^ help: try adding a comma: `,` + +error: expected `:`, found `}` + --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:4:1 + | +LL | pub bar: Vecö + | - expected `:` +LL | +LL | } + | ^ unexpected token + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/pattern/issue-10392.rs b/src/test/ui/pattern/issue-10392.rs new file mode 100644 index 00000000000..926fa94800e --- /dev/null +++ b/src/test/ui/pattern/issue-10392.rs @@ -0,0 +1,30 @@ +// run-pass +#![allow(unused_variables)] + +struct A { foo: isize } +struct B { a: isize, b: isize, c: isize } + +fn mka() -> A { panic!() } +fn mkb() -> B { panic!() } + +fn test() { + let A { foo, } = mka(); + let A { + foo, + } = mka(); + + let B { a, b, c, } = mkb(); + + match mka() { + A { foo: _foo, } => {} + } + + match Some(mka()) { + Some(A { foo: _foo, }) => {} + None => {} + } +} + +pub fn main() { + if false { test() } +} diff --git a/src/test/ui/resolve/no-implicit-prelude.rs b/src/test/ui/resolve/no-implicit-prelude.rs new file mode 100644 index 00000000000..4b0ca4d524e --- /dev/null +++ b/src/test/ui/resolve/no-implicit-prelude.rs @@ -0,0 +1,18 @@ +#![no_implicit_prelude] + +// Test that things from the prelude aren't in scope. Use many of them +// so that renaming some things won't magically make this test fail +// for the wrong reason (e.g., if `Add` changes to `Addition`, and +// `no_implicit_prelude` stops working, then the `impl Add` will still +// fail with the same error message). + +struct Test; +impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +impl Clone for Test {} //~ ERROR expected trait, found derive macro `Clone` +impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope + +fn main() { + drop(2) //~ ERROR cannot find function `drop` in this scope +} diff --git a/src/test/ui/resolve/no-implicit-prelude.stderr b/src/test/ui/resolve/no-implicit-prelude.stderr new file mode 100644 index 00000000000..36a9b65b7d1 --- /dev/null +++ b/src/test/ui/resolve/no-implicit-prelude.stderr @@ -0,0 +1,65 @@ +error[E0405]: cannot find trait `Add` in this scope + --> $DIR/no-implicit-prelude.rs:10:6 + | +LL | impl Add for Test {} + | ^^^ not found in this scope + | +help: consider importing this trait + | +LL | use std::ops::Add; + | + +error[E0404]: expected trait, found derive macro `Clone` + --> $DIR/no-implicit-prelude.rs:11:6 + | +LL | impl Clone for Test {} + | ^^^^^ not a trait + | +help: consider importing this trait instead + | +LL | use std::clone::Clone; + | + +error[E0405]: cannot find trait `Iterator` in this scope + --> $DIR/no-implicit-prelude.rs:12:6 + | +LL | impl Iterator for Test {} + | ^^^^^^^^ not found in this scope + | +help: consider importing this trait + | +LL | use std::iter::Iterator; + | + +error[E0405]: cannot find trait `ToString` in this scope + --> $DIR/no-implicit-prelude.rs:13:6 + | +LL | impl ToString for Test {} + | ^^^^^^^^ not found in this scope + | +help: consider importing this trait + | +LL | use std::string::ToString; + | + +error[E0405]: cannot find trait `Writer` in this scope + --> $DIR/no-implicit-prelude.rs:14:6 + | +LL | impl Writer for Test {} + | ^^^^^^ not found in this scope + +error[E0425]: cannot find function `drop` in this scope + --> $DIR/no-implicit-prelude.rs:17:5 + | +LL | drop(2) + | ^^^^ not found in this scope + | +help: consider importing this function + | +LL | use std::mem::drop; + | + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0404, E0405, E0425. +For more information about an error, try `rustc --explain E0404`. diff --git a/src/test/ui/shadow.rs b/src/test/ui/shadow.rs deleted file mode 100644 index 2495c8f47e7..00000000000 --- a/src/test/ui/shadow.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass - -#![allow(non_camel_case_types)] -#![allow(dead_code)] -fn foo(c: Vec ) { - let a: isize = 5; - let mut b: Vec = Vec::new(); - - - match t::none:: { - t::some::(_) => { - for _i in &c { - println!("{}", a); - let a = 17; - b.push(a); - } - } - _ => { } - } -} - -enum t { none, some(T), } - -pub fn main() { let x = 10; let x = x + 20; assert_eq!(x, 30); foo(Vec::new()); } diff --git a/src/test/ui/structs-enums/issue-1701.rs b/src/test/ui/structs-enums/issue-1701.rs new file mode 100644 index 00000000000..bae32a77765 --- /dev/null +++ b/src/test/ui/structs-enums/issue-1701.rs @@ -0,0 +1,26 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + + +enum pattern { tabby, tortoiseshell, calico } +enum breed { beagle, rottweiler, pug } +type name = String; +enum ear_kind { lop, upright } +enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } + +fn noise(a: animal) -> Option { + match a { + animal::cat(..) => { Some("meow".to_string()) } + animal::dog(..) => { Some("woof".to_string()) } + animal::rabbit(..) => { None } + animal::tiger => { Some("roar".to_string()) } + } +} + +pub fn main() { + assert_eq!(noise(animal::cat(pattern::tabby)), Some("meow".to_string())); + assert_eq!(noise(animal::dog(breed::pug)), Some("woof".to_string())); + assert_eq!(noise(animal::rabbit("Hilbert".to_string(), ear_kind::upright)), None); + assert_eq!(noise(animal::tiger), Some("roar".to_string())); +} diff --git a/src/test/ui/traits/issue-78372.rs b/src/test/ui/traits/issue-78372.rs new file mode 100644 index 00000000000..77a8c92c81c --- /dev/null +++ b/src/test/ui/traits/issue-78372.rs @@ -0,0 +1,14 @@ +use std::ops::DispatchFromDyn; //~ ERROR use of unstable library feature 'dispatch_from_dyn' +struct Smaht(PhantomData); //~ ERROR cannot find type `PhantomData` in this scope +impl DispatchFromDyn> for T {} //~ ERROR cannot find type `U` in this scope +//~^ ERROR cannot find type `MISC` in this scope +//~| ERROR use of unstable library feature 'dispatch_from_dyn' +//~| ERROR the trait `DispatchFromDyn` may only be implemented for a coercion between structures +//~| ERROR type parameter `T` must be covered by another type when it appears before the first +trait Foo: X {} +trait X { + fn foo(self: Smaht); +} +trait Marker {} +impl Marker for dyn Foo {} +fn main() {} diff --git a/src/test/ui/traits/issue-78372.stderr b/src/test/ui/traits/issue-78372.stderr new file mode 100644 index 00000000000..9267e838cea --- /dev/null +++ b/src/test/ui/traits/issue-78372.stderr @@ -0,0 +1,62 @@ +error[E0412]: cannot find type `PhantomData` in this scope + --> $DIR/issue-78372.rs:2:23 + | +LL | struct Smaht(PhantomData); + | ^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +LL | use std::marker::PhantomData; + | + +error[E0412]: cannot find type `U` in this scope + --> $DIR/issue-78372.rs:3:31 + | +LL | impl DispatchFromDyn> for T {} + | - ^ help: a type parameter with a similar name exists: `T` + | | + | similarly named type parameter `T` defined here + +error[E0412]: cannot find type `MISC` in this scope + --> $DIR/issue-78372.rs:3:34 + | +LL | impl DispatchFromDyn> for T {} + | - ^^^^ not found in this scope + | | + | help: you might be missing a type parameter: `, MISC` + +error[E0658]: use of unstable library feature 'dispatch_from_dyn' + --> $DIR/issue-78372.rs:1:5 + | +LL | use std::ops::DispatchFromDyn; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable + +error[E0658]: use of unstable library feature 'dispatch_from_dyn' + --> $DIR/issue-78372.rs:3:9 + | +LL | impl DispatchFromDyn> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable + +error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures + --> $DIR/issue-78372.rs:3:1 + | +LL | impl DispatchFromDyn> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Smaht<[type error], [type error]>`) + --> $DIR/issue-78372.rs:3:6 + | +LL | impl DispatchFromDyn> for T {} + | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Smaht<[type error], [type error]>`) + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0210, E0378, E0412, E0658. +For more information about an error, try `rustc --explain E0210`. diff --git a/src/test/ui/typeck/issue-65611.rs b/src/test/ui/typeck/issue-65611.rs new file mode 100644 index 00000000000..b74ee1b0c6e --- /dev/null +++ b/src/test/ui/typeck/issue-65611.rs @@ -0,0 +1,63 @@ +use std::mem::MaybeUninit; +use std::ops::Deref; + +pub unsafe trait Array { + /// The array’s element type + type Item; + #[doc(hidden)] + /// The smallest index type that indexes the array. + type Index: Index; + #[doc(hidden)] + fn as_ptr(&self) -> *const Self::Item; + #[doc(hidden)] + fn as_mut_ptr(&mut self) -> *mut Self::Item; + #[doc(hidden)] + fn capacity() -> usize; +} + +pub trait Index : PartialEq + Copy { + fn to_usize(self) -> usize; + fn from(usize) -> Self; +} + +impl Index for usize { + fn to_usize(self) -> usize { self } + fn from(val: usize) -> Self { + val + } +} + +unsafe impl Array for [T; 1] { + type Item = T; + type Index = usize; + fn as_ptr(&self) -> *const T { self as *const _ as *const _ } + fn as_mut_ptr(&mut self) -> *mut T { self as *mut _ as *mut _} + fn capacity() -> usize { 1 } +} + +impl Deref for ArrayVec { + type Target = [A::Item]; + #[inline] + fn deref(&self) -> &[A::Item] { + panic!() + } +} + +pub struct ArrayVec { + xs: MaybeUninit, + len: usize, +} + +impl ArrayVec { + pub fn new() -> ArrayVec { + panic!() + } +} + +fn main() { + let mut buffer = ArrayVec::new(); + let x = buffer.last().unwrap().0.clone(); + //~^ ERROR type annotations needed + //~| ERROR no field `0` on type `&_` + buffer.reverse(); +} diff --git a/src/test/ui/typeck/issue-65611.stderr b/src/test/ui/typeck/issue-65611.stderr new file mode 100644 index 00000000000..e3c005a0593 --- /dev/null +++ b/src/test/ui/typeck/issue-65611.stderr @@ -0,0 +1,21 @@ +error[E0282]: type annotations needed + --> $DIR/issue-65611.rs:59:20 + | +LL | let x = buffer.last().unwrap().0.clone(); + | -------^^^^-- + | | | + | | cannot infer type for type parameter `T` + | this method call resolves to `Option<&T>` + | + = note: type must be known at this point + +error[E0609]: no field `0` on type `&_` + --> $DIR/issue-65611.rs:59:36 + | +LL | let x = buffer.last().unwrap().0.clone(); + | ^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0282, E0609. +For more information about an error, try `rustc --explain E0282`. diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 3374a8c9b73..7cc660454b4 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,8 +7,8 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 1408; -const ISSUES_ENTRY_LIMIT: usize = 2565; +const ROOT_ENTRY_LIMIT: usize = 1390; +const ISSUES_ENTRY_LIMIT: usize = 2551; fn check_entries(path: &Path, bad: &mut bool) { let dirs = walkdir::WalkDir::new(&path.join("test/ui")) -- cgit 1.4.1-3-g733a5 From 2885ca3cce4b0ca44dce0d4ed02115498c369595 Mon Sep 17 00:00:00 2001 From: lcnr Date: Sat, 13 Mar 2021 17:52:50 +0100 Subject: bless mir-opt tests --- .../const_promotion_extern_static.BAR.PromoteTemps.diff | 4 ++-- .../const_promotion_extern_static.FOO.PromoteTemps.diff | 4 ++-- .../bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff | 4 ++-- .../bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff | 4 ++-- .../const_prop_fails_gracefully.main.ConstProp.diff | 4 ++-- src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff | 4 ++-- src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff | 4 ++-- .../mir-opt/const_prop/ref_deref_project.main.ConstProp.diff | 4 ++-- .../const_prop/ref_deref_project.main.PromoteTemps.diff | 4 ++-- .../mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff | 4 ++-- .../mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff | 4 ++-- src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir | 8 ++++---- src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff | 4 ++-- src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff | 4 ++-- .../mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff | 4 ++-- .../mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff | 4 ++-- .../lower_intrinsics.discriminant.LowerIntrinsics.diff | 12 ++++++------ ...atch_false_edges.full_tested_match.PromoteTemps.after.mir | 4 ++-- .../mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir | 4 ++-- 19 files changed, 44 insertions(+), 44 deletions(-) (limited to 'src/test') diff --git a/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff b/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff index 5ba76c4f0bd..4e990dd6b70 100644 --- a/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff +++ b/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff @@ -22,7 +22,7 @@ - // + ty: &i32 - // + val: Value(Scalar(alloc0)) + // + ty: &[&i32; 1] -+ // + val: Unevaluated(WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[317d]::BAR), const_param_did: None }, [], Some(promoted[0])) ++ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[317d]::BAR), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant - // + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34 - // + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) } @@ -30,7 +30,7 @@ - _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35 - _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35 + // + span: $DIR/const-promotion-extern-static.rs:9:31: 9:35 -+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[317d]::BAR), const_param_did: None }, [], Some(promoted[0])) } ++ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[317d]::BAR), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } + _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35 _1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35 - StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35 diff --git a/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff b/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff index 1565cc7d5e7..0a9a3f3c2c5 100644 --- a/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff +++ b/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff @@ -24,7 +24,7 @@ - // + ty: *const i32 - // + val: Value(Scalar(alloc2)) + // + ty: &[&i32; 1] -+ // + val: Unevaluated(WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[317d]::FOO), const_param_did: None }, [], Some(promoted[0])) ++ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[317d]::FOO), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant - // + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43 - // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) } @@ -32,7 +32,7 @@ - _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46 - _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46 + // + span: $DIR/const-promotion-extern-static.rs:13:31: 13:46 -+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[317d]::FOO), const_param_did: None }, [], Some(promoted[0])) } ++ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[317d]::FOO), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } + _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46 _1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46 - StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46 diff --git a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff index 8c10b3518d8..baa8988f152 100644 --- a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff @@ -28,10 +28,10 @@ _9 = const main::promoted[0]; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 // ty::Const // + ty: &[i32; 3] - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 - // + literal: Const { ty: &[i32; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _3 = _9; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 diff --git a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff index 8c10b3518d8..baa8988f152 100644 --- a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff @@ -28,10 +28,10 @@ _9 = const main::promoted[0]; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 // ty::Const // + ty: &[i32; 3] - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 - // + literal: Const { ty: &[i32; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _3 = _9; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 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 60346458646..8ba11df7e0e 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 @@ -19,10 +19,10 @@ _3 = const FOO; // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16 // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[317d]::main::FOO), const_param_did: None }, [], None) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[317d]::main::FOO), const_param_did: None }, substs: [], promoted: None }) // mir::Constant // + span: $DIR/const_prop_fails_gracefully.rs:7:13: 7:16 - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[317d]::main::FOO), const_param_did: None }, [], None) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[317d]::main::FOO), const_param_did: None }, substs: [], promoted: None }) } _2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16 _1 = move _2 as usize (Misc); // 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 diff --git a/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff b/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff index 4fd1b8b2276..56683d7ef03 100644 --- a/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff @@ -14,10 +14,10 @@ _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref.rs:5:6: 5:10 // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/ref_deref.rs:5:6: 5:10 - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _2 = _4; // scope 0 at $DIR/ref_deref.rs:5:6: 5:10 - _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:5:5: 5:10 + _1 = const 4_i32; // scope 0 at $DIR/ref_deref.rs:5:5: 5:10 diff --git a/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff b/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff index e7ebfee7f3e..e1c8085b31b 100644 --- a/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff +++ b/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff @@ -17,10 +17,10 @@ + _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref.rs:5:6: 5:10 + // ty::Const + // + ty: &i32 -+ // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, [], Some(promoted[0])) ++ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) + // mir::Constant + // + span: $DIR/ref_deref.rs:5:6: 5:10 -+ // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, [], Some(promoted[0])) } ++ // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } + _2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:5:6: 5:10 _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:5:5: 5:10 - StorageDead(_3); // scope 0 at $DIR/ref_deref.rs:5:10: 5:11 diff --git a/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff b/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff index 812c7c97718..cce4831b6fe 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff @@ -14,10 +14,10 @@ _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 // ty::Const // + ty: &(i32, i32) - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/ref_deref_project.rs:5:6: 5:17 - // + literal: Const { ty: &(i32, i32), val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 _1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17 StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 diff --git a/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff b/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff index 588c291bcc3..93ba9de8202 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff +++ b/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff @@ -17,10 +17,10 @@ + _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 + // ty::Const + // + ty: &(i32, i32) -+ // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, [], Some(promoted[0])) ++ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) + // mir::Constant + // + span: $DIR/ref_deref_project.rs:5:6: 5:17 -+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, [], Some(promoted[0])) } ++ // + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } + _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 _1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17 - StorageDead(_3); // scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 diff --git a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff index 240cc8e2311..20f93f874c5 100644 --- a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff @@ -21,10 +21,10 @@ _9 = const main::promoted[0]; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 // ty::Const // + ty: &[u32; 3] - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/slice_len.rs:5:6: 5:19 - // + literal: Const { ty: &[u32; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _4 = _9; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 _3 = _4; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:5:6: 5:19 diff --git a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff index 240cc8e2311..20f93f874c5 100644 --- a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff @@ -21,10 +21,10 @@ _9 = const main::promoted[0]; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 // ty::Const // + ty: &[u32; 3] - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/slice_len.rs:5:6: 5:19 - // + literal: Const { ty: &[u32; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _4 = _9; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 _3 = _4; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:5:6: 5:19 diff --git a/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir b/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir index b9fe84fcd04..0b5dc2b20fc 100644 --- a/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir @@ -35,10 +35,10 @@ fn bar() -> bool { _10 = const bar::promoted[1]; // scope 1 at $DIR/inline-retag.rs:12:7: 12:9 // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, [], Some(promoted[1])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[1]) }) // mir::Constant // + span: $DIR/inline-retag.rs:12:7: 12:9 - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, [], Some(promoted[1])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[1]) }) } Retag(_10); // scope 1 at $DIR/inline-retag.rs:12:7: 12:9 _4 = &(*_10); // scope 1 at $DIR/inline-retag.rs:12:7: 12:9 Retag(_4); // scope 1 at $DIR/inline-retag.rs:12:7: 12:9 @@ -49,10 +49,10 @@ fn bar() -> bool { _9 = const bar::promoted[0]; // scope 1 at $DIR/inline-retag.rs:12:11: 12:14 // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/inline-retag.rs:12:11: 12:14 - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } Retag(_9); // scope 1 at $DIR/inline-retag.rs:12:11: 12:14 _7 = &(*_9); // scope 1 at $DIR/inline-retag.rs:12:11: 12:14 Retag(_7); // scope 1 at $DIR/inline-retag.rs:12:11: 12:14 diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index f6e6614bb6e..1ba56016776 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -63,10 +63,10 @@ _20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _8 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index f6e6614bb6e..1ba56016776 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -63,10 +63,10 @@ _20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _8 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index bd24522271b..5ae26b73a65 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -84,10 +84,10 @@ _28 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _11 = _28; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index bd24522271b..5ae26b73a65 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -84,10 +84,10 @@ _28 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _11 = _28; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff b/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff index 7da2ff02006..83650d837b0 100644 --- a/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff +++ b/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff @@ -47,10 +47,10 @@ _19 = const discriminant::::promoted[2]; // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, [T], Some(promoted[2])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[2]) }) // mir::Constant // + span: $DIR/lower_intrinsics.rs:70:42: 70:44 - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, [T], Some(promoted[2])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[2]) }) } _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 - _5 = discriminant_value::(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45 @@ -71,10 +71,10 @@ _18 = const discriminant::::promoted[1]; // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 // ty::Const // + ty: &() - // + val: Unevaluated(WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, [T], Some(promoted[1])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[1]) }) // mir::Constant // + span: $DIR/lower_intrinsics.rs:71:42: 71:45 - // + literal: Const { ty: &(), val: Unevaluated(WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, [T], Some(promoted[1])) } + // + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[1]) }) } _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 - _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46 @@ -95,10 +95,10 @@ _17 = const discriminant::::promoted[0]; // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 // ty::Const // + ty: &E - // + val: Unevaluated(WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, [T], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/lower_intrinsics.rs:72:42: 72:47 - // + literal: Const { ty: &E, val: Unevaluated(WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, [T], Some(promoted[0])) } + // + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[0]) }) } _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 - _13 = discriminant_value::(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48 diff --git a/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir b/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir index 2332e5beafe..242138754c5 100644 --- a/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir +++ b/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir @@ -54,10 +54,10 @@ fn full_tested_match() -> () { _11 = const full_tested_match::promoted[0]; // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15 // ty::Const // + ty: &std::option::Option - // + val: Unevaluated(WithOptConstParam { did: DefId(0:5 ~ match_false_edges[317d]::full_tested_match), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ match_false_edges[317d]::full_tested_match), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/match_false_edges.rs:16:14: 16:15 - // + literal: Const { ty: &std::option::Option, val: Unevaluated(WithOptConstParam { did: DefId(0:5 ~ match_false_edges[317d]::full_tested_match), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &std::option::Option, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ match_false_edges[317d]::full_tested_match), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } _6 = &(((*_11) as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15 _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27 StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:16:20: 16:27 diff --git a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir index 8c7d79262b2..d25f98db9f6 100644 --- a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir @@ -149,10 +149,10 @@ fn main() -> () { _27 = const main::promoted[0]; // scope 7 at $DIR/retag.rs:47:21: 47:23 // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:13 ~ retag[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:13 ~ retag[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) // mir::Constant // + span: $DIR/retag.rs:47:21: 47:23 - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:13 ~ retag[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:13 ~ retag[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) } Retag(_27); // scope 7 at $DIR/retag.rs:47:21: 47:23 _23 = &(*_27); // scope 7 at $DIR/retag.rs:47:21: 47:23 Retag(_23); // scope 7 at $DIR/retag.rs:47:21: 47:23 -- cgit 1.4.1-3-g733a5