diff options
Diffstat (limited to 'tests')
87 files changed, 744 insertions, 295 deletions
diff --git a/tests/codegen/asm/aarch64-clobbers.rs b/tests/codegen/asm/aarch64-clobbers.rs new file mode 100644 index 00000000000..900e6629fd2 --- /dev/null +++ b/tests/codegen/asm/aarch64-clobbers.rs @@ -0,0 +1,51 @@ +//@ revisions: aarch64 aarch64_fixed_x18 aarch64_no_x18 aarch64_reserve_x18 arm64ec +//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu +//@[aarch64] needs-llvm-components: aarch64 +//@[aarch64_fixed_x18] compile-flags: --target aarch64-unknown-linux-gnu -Zfixed-x18 +//@[aarch64_fixed_x18] needs-llvm-components: aarch64 +//@[aarch64_no_x18] compile-flags: --target aarch64-pc-windows-msvc +//@[aarch64_no_x18] needs-llvm-components: aarch64 +// aarch64-unknown-trusty uses aarch64-unknown-unknown-musl which doesn't +// reserve x18 by default as llvm_target, and pass +reserve-x18 in target-spec. +//@[aarch64_reserve_x18] compile-flags: --target aarch64-unknown-trusty +//@[aarch64_reserve_x18] needs-llvm-components: aarch64 +//@[arm64ec] compile-flags: --target arm64ec-pc-windows-msvc +//@[arm64ec] needs-llvm-components: aarch64 +// ignore-tidy-linelength + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +// CHECK-LABEL: @cc_clobber +// CHECK: call void asm sideeffect "", "~{cc}"() +#[no_mangle] +pub unsafe fn cc_clobber() { + asm!("", options(nostack, nomem)); +} + +// CHECK-LABEL: @no_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn no_clobber() { + asm!("", options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @clobber_abi +// aarch64: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w18},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() +// aarch64_fixed_x18: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() +// aarch64_no_x18: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() +// aarch64_reserve_x18: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() +// arm64ec: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w15},={w16},={w17},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15}"() +#[no_mangle] +pub unsafe fn clobber_abi() { + asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); +} diff --git a/tests/codegen/asm/arm64ec-clobbers.rs b/tests/codegen/asm/arm64ec-clobbers.rs deleted file mode 100644 index 80059331642..00000000000 --- a/tests/codegen/asm/arm64ec-clobbers.rs +++ /dev/null @@ -1,36 +0,0 @@ -//@ assembly-output: emit-asm -//@ compile-flags: --target arm64ec-pc-windows-msvc -//@ needs-llvm-components: aarch64 - -#![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items)] -#![no_core] - -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -// CHECK-LABEL: @cc_clobber -// CHECK: call void asm sideeffect "", "~{cc}"() -#[no_mangle] -pub unsafe fn cc_clobber() { - asm!("", options(nostack, nomem)); -} - -// CHECK-LABEL: @no_clobber -// CHECK: call void asm sideeffect "", ""() -#[no_mangle] -pub unsafe fn no_clobber() { - asm!("", options(nostack, nomem, preserves_flags)); -} - -// CHECK-LABEL: @clobber_abi -// CHECK: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w15},={w16},={w17},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15}"() -#[no_mangle] -pub unsafe fn clobber_abi() { - asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); -} diff --git a/tests/codegen/asm/hexagon-clobbers.rs b/tests/codegen/asm/hexagon-clobbers.rs new file mode 100644 index 00000000000..6bb662ead99 --- /dev/null +++ b/tests/codegen/asm/hexagon-clobbers.rs @@ -0,0 +1,37 @@ +//@ revisions: hexagon +//@[hexagon] compile-flags: --target hexagon-unknown-linux-musl +//@[hexagon] needs-llvm-components: hexagon +//@ compile-flags: -Zmerge-functions=disabled + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +// CHECK-LABEL: @flags_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn flags_clobber() { + asm!("", options(nostack, nomem)); +} + +// CHECK-LABEL: @no_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn no_clobber() { + asm!("", options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @p0_clobber +// CHECK: call void asm sideeffect "", "~{p0}"() +#[no_mangle] +pub unsafe fn p0_clobber() { + asm!("", out("p0") _, options(nostack, nomem, preserves_flags)); +} diff --git a/tests/codegen/asm/riscv-clobbers.rs b/tests/codegen/asm/riscv-clobbers.rs new file mode 100644 index 00000000000..59b2705a449 --- /dev/null +++ b/tests/codegen/asm/riscv-clobbers.rs @@ -0,0 +1,44 @@ +//@ assembly-output: emit-asm +//@ revisions: rv32i rv64i rv32e +//@[rv32i] compile-flags: --target riscv32i-unknown-none-elf +//@[rv32i] needs-llvm-components: riscv +//@[rv64i] compile-flags: --target riscv64imac-unknown-none-elf +//@[rv64i] needs-llvm-components: riscv +//@[rv32e] compile-flags: --target riscv32e-unknown-none-elf +//@[rv32e] needs-llvm-components: riscv +// ignore-tidy-linelength + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +// CHECK-LABEL: @flags_clobber +// CHECK: call void asm sideeffect "", "~{vtype},~{vl},~{vxsat},~{vxrm}"() +#[no_mangle] +pub unsafe fn flags_clobber() { + asm!("", options(nostack, nomem)); +} + +// CHECK-LABEL: @no_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn no_clobber() { + asm!("", options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @clobber_abi +// rv32i: asm sideeffect "", "={x1},={x5},={x6},={x7},={x10},={x11},={x12},={x13},={x14},={x15},={x16},={x17},={x28},={x29},={x30},={x31},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f28},~{f29},~{f30},~{f31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() +// rv64i: asm sideeffect "", "={x1},={x5},={x6},={x7},={x10},={x11},={x12},={x13},={x14},={x15},={x16},={x17},={x28},={x29},={x30},={x31},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f28},~{f29},~{f30},~{f31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() +// rv32e: asm sideeffect "", "={x1},={x5},={x6},={x7},={x10},={x11},={x12},={x13},={x14},={x15},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f28},~{f29},~{f30},~{f31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() +#[no_mangle] +pub unsafe fn clobber_abi() { + asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); +} diff --git a/tests/crashes/126646.rs b/tests/crashes/126646.rs deleted file mode 100644 index 24e3530320a..00000000000 --- a/tests/crashes/126646.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ known-bug: rust-lang/rust#126646 -mod foo { - pub trait Callable { - type Output; - fn call() -> Self::Output; - } - - impl<'a, V: ?Sized> Callable for &'a () { - type Output = (); - } -} -use foo::*; - -fn test<'a>() -> impl Sized { - <&'a () as Callable>::call() -} - -fn main() {} diff --git a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff index cbb11d50f79..39d52ba698a 100644 --- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff @@ -33,12 +33,12 @@ + coverage ExpressionId(3) => Expression { lhs: Counter(3), op: Add, rhs: Counter(2) }; + coverage ExpressionId(4) => Expression { lhs: Expression(3), op: Add, rhs: Counter(1) }; + coverage ExpressionId(5) => Expression { lhs: Expression(4), op: Add, rhs: Expression(2) }; -+ coverage Code(Counter(0)) => 14:1 - 15:21; -+ coverage Code(Counter(3)) => 16:17 - 16:33; -+ coverage Code(Counter(2)) => 17:17 - 17:33; -+ coverage Code(Counter(1)) => 18:17 - 18:33; -+ coverage Code(Expression(2)) => 19:17 - 19:33; -+ coverage Code(Expression(5)) => 21:1 - 21:2; ++ coverage Code(Counter(0)) => $DIR/branch_match_arms.rs:14:1: 15:21 (#0); ++ coverage Code(Counter(3)) => $DIR/branch_match_arms.rs:16:17: 16:33 (#0); ++ coverage Code(Counter(2)) => $DIR/branch_match_arms.rs:17:17: 17:33 (#0); ++ coverage Code(Counter(1)) => $DIR/branch_match_arms.rs:18:17: 18:33 (#0); ++ coverage Code(Expression(2)) => $DIR/branch_match_arms.rs:19:17: 19:33 (#0); ++ coverage Code(Expression(5)) => $DIR/branch_match_arms.rs:21:2: 21:2 (#0); + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff index 2efb1fd0a17..148ff86354b 100644 --- a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff @@ -5,7 +5,7 @@ let mut _0: bool; + coverage body span: $DIR/instrument_coverage.rs:19:18: 21:2 (#0) -+ coverage Code(Counter(0)) => 19:1 - 21:2; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:19:1: 21:2 (#0); + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff index a179824d6c7..b480d1ac13a 100644 --- a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff @@ -9,11 +9,11 @@ + coverage body span: $DIR/instrument_coverage.rs:10:11: 16:2 (#0) + coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Add, rhs: Counter(1) }; -+ coverage Code(Counter(0)) => 10:1 - 10:11; -+ coverage Code(Expression(0)) => 12:12 - 12:17; -+ coverage Code(Counter(0)) => 13:13 - 13:18; -+ coverage Code(Counter(1)) => 14:9 - 14:10; -+ coverage Code(Counter(0)) => 16:1 - 16:2; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:10:1: 10:11 (#0); ++ coverage Code(Expression(0)) => $DIR/instrument_coverage.rs:12:12: 12:17 (#0); ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:13:13: 13:18 (#0); ++ coverage Code(Counter(1)) => $DIR/instrument_coverage.rs:14:10: 14:10 (#0); ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:16:2: 16:2 (#0); + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff index 082539369f7..2c7ec6e85eb 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff @@ -9,11 +9,11 @@ coverage body span: $DIR/instrument_coverage_cleanup.rs:13:11: 15:2 (#0) coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) }; - coverage Code(Counter(0)) => 13:1 - 14:36; - coverage Code(Expression(0)) => 14:37 - 14:39; - coverage Code(Counter(1)) => 14:38 - 14:39; - coverage Code(Counter(0)) => 15:1 - 15:2; - coverage Branch { true_term: Expression(0), false_term: Counter(1) } => 14:8 - 14:36; + coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0); + coverage Code(Expression(0)) => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); + coverage Code(Counter(1)) => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); + coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); + coverage Branch { true_term: Expression(0), false_term: Counter(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); bb0: { Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff index 8635818c6a7..c08265eb0e9 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff @@ -9,11 +9,11 @@ + coverage body span: $DIR/instrument_coverage_cleanup.rs:13:11: 15:2 (#0) + coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) }; -+ coverage Code(Counter(0)) => 13:1 - 14:36; -+ coverage Code(Expression(0)) => 14:37 - 14:39; -+ coverage Code(Counter(1)) => 14:38 - 14:39; -+ coverage Code(Counter(0)) => 15:1 - 15:2; -+ coverage Branch { true_term: Expression(0), false_term: Counter(1) } => 14:8 - 14:36; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0); ++ coverage Code(Expression(0)) => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); ++ coverage Code(Counter(1)) => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); ++ coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); ++ coverage Branch { true_term: Expression(0), false_term: Counter(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/ui-fulldeps/obtain-borrowck.rs b/tests/ui-fulldeps/obtain-borrowck.rs index e6c703addd9..af98f93297b 100644 --- a/tests/ui-fulldeps/obtain-borrowck.rs +++ b/tests/ui-fulldeps/obtain-borrowck.rs @@ -25,19 +25,20 @@ extern crate rustc_interface; extern crate rustc_middle; extern crate rustc_session; +use std::cell::RefCell; +use std::collections::HashMap; +use std::thread_local; + use rustc_borrowck::consumers::{self, BodyWithBorrowckFacts, ConsumerOptions}; use rustc_driver::Compilation; use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; +use rustc_interface::Config; use rustc_interface::interface::Compiler; -use rustc_interface::{Config, Queries}; use rustc_middle::query::queries::mir_borrowck::ProvidedValue; use rustc_middle::ty::TyCtxt; use rustc_middle::util::Providers; use rustc_session::Session; -use std::cell::RefCell; -use std::collections::HashMap; -use std::thread_local; fn main() { let exit_code = rustc_driver::catch_with_exit_code(move || { @@ -63,55 +64,49 @@ impl rustc_driver::Callbacks for CompilerCalls { // In this callback we trigger borrow checking of all functions and obtain // the result. - fn after_analysis<'tcx>( - &mut self, - compiler: &Compiler, - queries: &'tcx Queries<'tcx>, - ) -> Compilation { - compiler.sess.dcx().abort_if_errors(); - queries.global_ctxt().unwrap().enter(|tcx| { - // Collect definition ids of MIR bodies. - let hir = tcx.hir(); - let mut bodies = Vec::new(); - - let crate_items = tcx.hir_crate_items(()); - for id in crate_items.free_items() { - if matches!(tcx.def_kind(id.owner_id), DefKind::Fn) { - bodies.push(id.owner_id); - } + fn after_analysis<'tcx>(&mut self, _compiler: &Compiler, tcx: TyCtxt<'tcx>) -> Compilation { + tcx.sess.dcx().abort_if_errors(); + // Collect definition ids of MIR bodies. + let hir = tcx.hir(); + let mut bodies = Vec::new(); + + let crate_items = tcx.hir_crate_items(()); + for id in crate_items.free_items() { + if matches!(tcx.def_kind(id.owner_id), DefKind::Fn) { + bodies.push(id.owner_id); } - - for id in crate_items.trait_items() { - if matches!(tcx.def_kind(id.owner_id), DefKind::AssocFn) { - let trait_item = hir.trait_item(id); - if let rustc_hir::TraitItemKind::Fn(_, trait_fn) = &trait_item.kind { - if let rustc_hir::TraitFn::Provided(_) = trait_fn { - bodies.push(trait_item.owner_id); - } + } + + for id in crate_items.trait_items() { + if matches!(tcx.def_kind(id.owner_id), DefKind::AssocFn) { + let trait_item = hir.trait_item(id); + if let rustc_hir::TraitItemKind::Fn(_, trait_fn) = &trait_item.kind { + if let rustc_hir::TraitFn::Provided(_) = trait_fn { + bodies.push(trait_item.owner_id); } } } + } - for id in crate_items.impl_items() { - if matches!(tcx.def_kind(id.owner_id), DefKind::AssocFn) { - bodies.push(id.owner_id); - } - } - - // Trigger borrow checking of all bodies. - for def_id in bodies { - let _ = tcx.optimized_mir(def_id); - } - - // See what bodies were borrow checked. - let mut bodies = get_bodies(tcx); - bodies.sort_by(|(def_id1, _), (def_id2, _)| def_id1.cmp(def_id2)); - println!("Bodies retrieved for:"); - for (def_id, body) in bodies { - println!("{}", def_id); - assert!(body.input_facts.unwrap().cfg_edge.len() > 0); + for id in crate_items.impl_items() { + if matches!(tcx.def_kind(id.owner_id), DefKind::AssocFn) { + bodies.push(id.owner_id); } - }); + } + + // Trigger borrow checking of all bodies. + for def_id in bodies { + let _ = tcx.optimized_mir(def_id); + } + + // See what bodies were borrow checked. + let mut bodies = get_bodies(tcx); + bodies.sort_by(|(def_id1, _), (def_id2, _)| def_id1.cmp(def_id2)); + println!("Bodies retrieved for:"); + for (def_id, body) in bodies { + println!("{}", def_id); + assert!(body.input_facts.unwrap().cfg_edge.len() > 0); + } Compilation::Continue } diff --git a/tests/ui-fulldeps/stable-mir/check_abi.rs b/tests/ui-fulldeps/stable-mir/check_abi.rs index 5b7da7bb129..8caf3032afc 100644 --- a/tests/ui-fulldeps/stable-mir/check_abi.rs +++ b/tests/ui-fulldeps/stable-mir/check_abi.rs @@ -11,6 +11,7 @@ #![feature(ascii_char, ascii_char_variants)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_allocation.rs b/tests/ui-fulldeps/stable-mir/check_allocation.rs index 1e2f640f39f..072c8ba6a44 100644 --- a/tests/ui-fulldeps/stable-mir/check_allocation.rs +++ b/tests/ui-fulldeps/stable-mir/check_allocation.rs @@ -13,6 +13,7 @@ #![feature(ascii_char, ascii_char_variants)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_attribute.rs b/tests/ui-fulldeps/stable-mir/check_attribute.rs index 131fd99ebaa..22481e275a9 100644 --- a/tests/ui-fulldeps/stable-mir/check_attribute.rs +++ b/tests/ui-fulldeps/stable-mir/check_attribute.rs @@ -9,6 +9,7 @@ #![feature(rustc_private)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_binop.rs b/tests/ui-fulldeps/stable-mir/check_binop.rs index 3b52d88de3c..8c44e285108 100644 --- a/tests/ui-fulldeps/stable-mir/check_binop.rs +++ b/tests/ui-fulldeps/stable-mir/check_binop.rs @@ -9,6 +9,7 @@ #![feature(rustc_private)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_crate_defs.rs b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs index e039ca07dd4..ed093903381 100644 --- a/tests/ui-fulldeps/stable-mir/check_crate_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs @@ -10,6 +10,7 @@ #![feature(assert_matches)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_def_ty.rs b/tests/ui-fulldeps/stable-mir/check_def_ty.rs index ec3cf1753e2..482dbd22d5f 100644 --- a/tests/ui-fulldeps/stable-mir/check_def_ty.rs +++ b/tests/ui-fulldeps/stable-mir/check_def_ty.rs @@ -11,6 +11,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_defs.rs b/tests/ui-fulldeps/stable-mir/check_defs.rs index 3402b345818..bf1f1a2ceab 100644 --- a/tests/ui-fulldeps/stable-mir/check_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_defs.rs @@ -10,6 +10,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_instance.rs b/tests/ui-fulldeps/stable-mir/check_instance.rs index 7d63e202fa6..464350b1045 100644 --- a/tests/ui-fulldeps/stable-mir/check_instance.rs +++ b/tests/ui-fulldeps/stable-mir/check_instance.rs @@ -10,6 +10,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs index 3534228f73e..6edebaf756c 100644 --- a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs +++ b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs @@ -13,6 +13,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; extern crate rustc_hir; #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/check_item_kind.rs b/tests/ui-fulldeps/stable-mir/check_item_kind.rs index 91baa074c10..23b54e6c60b 100644 --- a/tests/ui-fulldeps/stable-mir/check_item_kind.rs +++ b/tests/ui-fulldeps/stable-mir/check_item_kind.rs @@ -10,6 +10,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_normalization.rs b/tests/ui-fulldeps/stable-mir/check_normalization.rs index 72e410f8080..928173b154b 100644 --- a/tests/ui-fulldeps/stable-mir/check_normalization.rs +++ b/tests/ui-fulldeps/stable-mir/check_normalization.rs @@ -9,6 +9,7 @@ #![feature(rustc_private)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs index 8721f243587..304a7ce9255 100644 --- a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs +++ b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs @@ -10,6 +10,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_transform.rs b/tests/ui-fulldeps/stable-mir/check_transform.rs index 40217b9aa95..bcf79c456b0 100644 --- a/tests/ui-fulldeps/stable-mir/check_transform.rs +++ b/tests/ui-fulldeps/stable-mir/check_transform.rs @@ -11,6 +11,7 @@ #![feature(ascii_char, ascii_char_variants)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs index 0715e0cfc52..e21508c9b46 100644 --- a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs +++ b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs @@ -11,6 +11,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/compilation-result.rs b/tests/ui-fulldeps/stable-mir/compilation-result.rs index 286bbd7c594..d921de73f43 100644 --- a/tests/ui-fulldeps/stable-mir/compilation-result.rs +++ b/tests/ui-fulldeps/stable-mir/compilation-result.rs @@ -10,6 +10,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 6b458c5d923..53be8eb10c1 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -11,6 +11,7 @@ #![feature(assert_matches)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/projections.rs b/tests/ui-fulldeps/stable-mir/projections.rs index a8bf4c1d399..fdb7eeed1b0 100644 --- a/tests/ui-fulldeps/stable-mir/projections.rs +++ b/tests/ui-fulldeps/stable-mir/projections.rs @@ -11,6 +11,7 @@ #![feature(assert_matches)] extern crate rustc_hir; +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs index f1bc03781b9..666000d3b07 100644 --- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs +++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs @@ -10,6 +10,7 @@ #![feature(rustc_private)] #![feature(assert_matches)] +extern crate rustc_middle; #[macro_use] extern crate rustc_smir; extern crate rustc_driver; diff --git a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.rs b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.rs index 8fe79b97d9b..977ef604b34 100644 --- a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.rs +++ b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.rs @@ -15,6 +15,7 @@ impl Foo for Def { pub fn test<A: Foo, B: Foo>() { let _array = [4; <A as Foo>::Y]; //~^ ERROR constant expression depends on a generic parameter + //~| ERROR constant expression depends on a generic parameter } fn main() { diff --git a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr index cd830394285..8202342c65d 100644 --- a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr +++ b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr @@ -6,5 +6,13 @@ LL | let _array = [4; <A as Foo>::Y]; | = note: this may fail depending on what value the parameter takes -error: aborting due to 1 previous error +error: constant expression depends on a generic parameter + --> $DIR/associated-const-type-parameter-arrays-2.rs:16:18 + | +LL | let _array = [4; <A as Foo>::Y]; + | ^^^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/pin-ergonomics/coerce-non-pointer-pin.rs b/tests/ui/async-await/pin-ergonomics/coerce-non-pointer-pin.rs new file mode 100644 index 00000000000..a95665f126d --- /dev/null +++ b/tests/ui/async-await/pin-ergonomics/coerce-non-pointer-pin.rs @@ -0,0 +1,10 @@ +//@ check-pass + +#![feature(pin_ergonomics)] +//~^ WARN the feature `pin_ergonomics` is incomplete + +use std::pin::Pin; + +fn main() { + let _: Pin<Box<()>> = Box::pin(()); +} diff --git a/tests/ui/async-await/pin-ergonomics/coerce-non-pointer-pin.stderr b/tests/ui/async-await/pin-ergonomics/coerce-non-pointer-pin.stderr new file mode 100644 index 00000000000..2deb5b09884 --- /dev/null +++ b/tests/ui/async-await/pin-ergonomics/coerce-non-pointer-pin.stderr @@ -0,0 +1,11 @@ +warning: the feature `pin_ergonomics` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/coerce-non-pointer-pin.rs:3:12 + | +LL | #![feature(pin_ergonomics)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/pin-reborrow-arg.rs b/tests/ui/async-await/pin-ergonomics/reborrow-arg.rs index 2008bd1f52d..2008bd1f52d 100644 --- a/tests/ui/async-await/pin-reborrow-arg.rs +++ b/tests/ui/async-await/pin-ergonomics/reborrow-arg.rs diff --git a/tests/ui/async-await/pin-reborrow-const-as-mut.rs b/tests/ui/async-await/pin-ergonomics/reborrow-const-as-mut.rs index 27c70a7b4df..27c70a7b4df 100644 --- a/tests/ui/async-await/pin-reborrow-const-as-mut.rs +++ b/tests/ui/async-await/pin-ergonomics/reborrow-const-as-mut.rs diff --git a/tests/ui/async-await/pin-reborrow-const-as-mut.stderr b/tests/ui/async-await/pin-ergonomics/reborrow-const-as-mut.stderr index 2c2d9ec2717..36bbf1c493a 100644 --- a/tests/ui/async-await/pin-reborrow-const-as-mut.stderr +++ b/tests/ui/async-await/pin-ergonomics/reborrow-const-as-mut.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/pin-reborrow-const-as-mut.rs:14:9 + --> $DIR/reborrow-const-as-mut.rs:14:9 | LL | foo(x); | --- ^ types differ in mutability @@ -9,7 +9,7 @@ LL | foo(x); = note: expected struct `Pin<&mut Foo>` found struct `Pin<&Foo>` note: function defined here - --> $DIR/pin-reborrow-const-as-mut.rs:10:4 + --> $DIR/reborrow-const-as-mut.rs:10:4 | LL | fn foo(_: Pin<&mut Foo>) { | ^^^ ---------------- diff --git a/tests/ui/async-await/pin-reborrow-once.rs b/tests/ui/async-await/pin-ergonomics/reborrow-once.rs index 241efadef7d..241efadef7d 100644 --- a/tests/ui/async-await/pin-reborrow-once.rs +++ b/tests/ui/async-await/pin-ergonomics/reborrow-once.rs diff --git a/tests/ui/async-await/pin-reborrow-once.stderr b/tests/ui/async-await/pin-ergonomics/reborrow-once.stderr index b8fde8ffee8..a1ea2b4a57a 100644 --- a/tests/ui/async-await/pin-reborrow-once.stderr +++ b/tests/ui/async-await/pin-ergonomics/reborrow-once.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x.__pointer` as mutable more than once at a time - --> $DIR/pin-reborrow-once.rs:12:14 + --> $DIR/reborrow-once.rs:12:14 | LL | twice(x, x); | ----- - ^ second mutable borrow occurs here diff --git a/tests/ui/async-await/pin-reborrow-self.rs b/tests/ui/async-await/pin-ergonomics/reborrow-self.rs index ee617617da0..ee617617da0 100644 --- a/tests/ui/async-await/pin-reborrow-self.rs +++ b/tests/ui/async-await/pin-ergonomics/reborrow-self.rs diff --git a/tests/ui/async-await/pin-reborrow-shorter.rs b/tests/ui/async-await/pin-ergonomics/reborrow-shorter.rs index 06c266e0035..06c266e0035 100644 --- a/tests/ui/async-await/pin-reborrow-shorter.rs +++ b/tests/ui/async-await/pin-ergonomics/reborrow-shorter.rs diff --git a/tests/ui/async-await/pin-sugar-ambiguity.rs b/tests/ui/async-await/pin-ergonomics/sugar-ambiguity.rs index d183000931e..d183000931e 100644 --- a/tests/ui/async-await/pin-sugar-ambiguity.rs +++ b/tests/ui/async-await/pin-ergonomics/sugar-ambiguity.rs diff --git a/tests/ui/async-await/pin-sugar-no-const.rs b/tests/ui/async-await/pin-ergonomics/sugar-no-const.rs index dd6456b6034..dd6456b6034 100644 --- a/tests/ui/async-await/pin-sugar-no-const.rs +++ b/tests/ui/async-await/pin-ergonomics/sugar-no-const.rs diff --git a/tests/ui/async-await/pin-sugar-no-const.stderr b/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr index 5f01156c1f0..822cfffcb8c 100644 --- a/tests/ui/async-await/pin-sugar-no-const.stderr +++ b/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `::`, `;`, `<`, or `=`, found `i32` - --> $DIR/pin-sugar-no-const.rs:7:18 + --> $DIR/sugar-no-const.rs:7:18 | LL | let _x: &pin i32 = todo!(); | - ^^^ expected one of `!`, `(`, `::`, `;`, `<`, or `=` diff --git a/tests/ui/async-await/pin-sugar.rs b/tests/ui/async-await/pin-ergonomics/sugar.rs index 8dbdec418b1..8dbdec418b1 100644 --- a/tests/ui/async-await/pin-sugar.rs +++ b/tests/ui/async-await/pin-ergonomics/sugar.rs diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index 0a993214f5a..32eb01c7018 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -251,7 +251,7 @@ warning: unexpected `cfg` condition value: `zebra` LL | cfg!(target_feature = "zebra"); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 251 more + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 252 more = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: 27 warnings emitted diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index ca6a173d638..4d375d80e77 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -174,7 +174,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_feature = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `leoncasa`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `partword-atomics`, `pauth-lr`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `quadword-atomics`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-b16b16`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tail-call`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v8plus`, `v9`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `wide-arithmetic`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zaamo`, `zabha`, `zalrsc`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt` + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `leoncasa`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `partword-atomics`, `pauth-lr`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `quadword-atomics`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `reserve-x18`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-b16b16`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tail-call`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v8plus`, `v9`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `wide-arithmetic`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zaamo`, `zabha`, `zalrsc`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` diff --git a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr index ce7fce25993..06a6a5f59d6 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr +++ b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr @@ -53,7 +53,7 @@ LL | let _: [u8; baz::<'b>(&())]; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:26:23 + --> $DIR/const-arg-in-const-arg.rs:27:23 | LL | let _ = [0; bar::<N>()]; | ^ cannot perform const operation using `N` @@ -62,7 +62,7 @@ LL | let _ = [0; bar::<N>()]; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:28:23 + --> $DIR/const-arg-in-const-arg.rs:29:23 | LL | let _ = [0; faz::<'a>(&())]; | ^^ cannot perform const operation using `'a` @@ -71,7 +71,7 @@ LL | let _ = [0; faz::<'a>(&())]; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:30:23 + --> $DIR/const-arg-in-const-arg.rs:31:23 | LL | let _ = [0; baz::<'a>(&())]; | ^^ cannot perform const operation using `'a` @@ -80,7 +80,7 @@ LL | let _ = [0; baz::<'a>(&())]; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:31:23 + --> $DIR/const-arg-in-const-arg.rs:32:23 | LL | let _ = [0; faz::<'b>(&())]; | ^^ cannot perform const operation using `'b` @@ -89,7 +89,7 @@ LL | let _ = [0; faz::<'b>(&())]; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:33:23 + --> $DIR/const-arg-in-const-arg.rs:34:23 | LL | let _ = [0; baz::<'b>(&())]; | ^^ cannot perform const operation using `'b` @@ -98,7 +98,7 @@ LL | let _ = [0; baz::<'b>(&())]; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:34:24 + --> $DIR/const-arg-in-const-arg.rs:35:24 | LL | let _: Foo<{ foo::<T>() }>; | ^ cannot perform const operation using `T` @@ -107,7 +107,7 @@ LL | let _: Foo<{ foo::<T>() }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:35:24 + --> $DIR/const-arg-in-const-arg.rs:36:24 | LL | let _: Foo<{ bar::<N>() }>; | ^ cannot perform const operation using `N` @@ -116,7 +116,7 @@ LL | let _: Foo<{ bar::<N>() }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:37:24 + --> $DIR/const-arg-in-const-arg.rs:38:24 | LL | let _: Foo<{ faz::<'a>(&()) }>; | ^^ cannot perform const operation using `'a` @@ -125,7 +125,7 @@ LL | let _: Foo<{ faz::<'a>(&()) }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:39:24 + --> $DIR/const-arg-in-const-arg.rs:40:24 | LL | let _: Foo<{ baz::<'a>(&()) }>; | ^^ cannot perform const operation using `'a` @@ -134,7 +134,7 @@ LL | let _: Foo<{ baz::<'a>(&()) }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:40:24 + --> $DIR/const-arg-in-const-arg.rs:41:24 | LL | let _: Foo<{ faz::<'b>(&()) }>; | ^^ cannot perform const operation using `'b` @@ -143,7 +143,7 @@ LL | let _: Foo<{ faz::<'b>(&()) }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:42:24 + --> $DIR/const-arg-in-const-arg.rs:43:24 | LL | let _: Foo<{ baz::<'b>(&()) }>; | ^^ cannot perform const operation using `'b` @@ -152,7 +152,7 @@ LL | let _: Foo<{ baz::<'b>(&()) }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:43:27 + --> $DIR/const-arg-in-const-arg.rs:44:27 | LL | let _ = Foo::<{ foo::<T>() }>; | ^ cannot perform const operation using `T` @@ -161,7 +161,7 @@ LL | let _ = Foo::<{ foo::<T>() }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:44:27 + --> $DIR/const-arg-in-const-arg.rs:45:27 | LL | let _ = Foo::<{ bar::<N>() }>; | ^ cannot perform const operation using `N` @@ -170,7 +170,7 @@ LL | let _ = Foo::<{ bar::<N>() }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:46:27 + --> $DIR/const-arg-in-const-arg.rs:47:27 | LL | let _ = Foo::<{ faz::<'a>(&()) }>; | ^^ cannot perform const operation using `'a` @@ -179,7 +179,7 @@ LL | let _ = Foo::<{ faz::<'a>(&()) }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:48:27 + --> $DIR/const-arg-in-const-arg.rs:49:27 | LL | let _ = Foo::<{ baz::<'a>(&()) }>; | ^^ cannot perform const operation using `'a` @@ -188,7 +188,7 @@ LL | let _ = Foo::<{ baz::<'a>(&()) }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:49:27 + --> $DIR/const-arg-in-const-arg.rs:50:27 | LL | let _ = Foo::<{ faz::<'b>(&()) }>; | ^^ cannot perform const operation using `'b` @@ -197,7 +197,7 @@ LL | let _ = Foo::<{ faz::<'b>(&()) }>; = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:51:27 + --> $DIR/const-arg-in-const-arg.rs:52:27 | LL | let _ = Foo::<{ baz::<'b>(&()) }>; | ^^ cannot perform const operation using `'b` @@ -241,7 +241,7 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0747]: unresolved item provided when a constant was expected - --> $DIR/const-arg-in-const-arg.rs:35:24 + --> $DIR/const-arg-in-const-arg.rs:36:24 | LL | let _: Foo<{ bar::<N>() }>; | ^ @@ -252,7 +252,7 @@ LL | let _: Foo<{ bar::<{ N }>() }>; | + + error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:37:24 + --> $DIR/const-arg-in-const-arg.rs:38:24 | LL | let _: Foo<{ faz::<'a>(&()) }>; | ^^ @@ -264,7 +264,7 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:40:24 + --> $DIR/const-arg-in-const-arg.rs:41:24 | LL | let _: Foo<{ faz::<'b>(&()) }>; | ^^ @@ -283,8 +283,16 @@ LL | let _ = [0; foo::<T>()]; | = note: this may fail depending on what value the parameter takes +error: constant expression depends on a generic parameter + --> $DIR/const-arg-in-const-arg.rs:25:13 + | +LL | let _ = [0; foo::<T>()]; + | ^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + error[E0747]: unresolved item provided when a constant was expected - --> $DIR/const-arg-in-const-arg.rs:26:23 + --> $DIR/const-arg-in-const-arg.rs:27:23 | LL | let _ = [0; bar::<N>()]; | ^ @@ -295,7 +303,7 @@ LL | let _ = [0; bar::<{ N }>()]; | + + error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:28:23 + --> $DIR/const-arg-in-const-arg.rs:29:23 | LL | let _ = [0; faz::<'a>(&())]; | ^^ @@ -307,7 +315,7 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:31:23 + --> $DIR/const-arg-in-const-arg.rs:32:23 | LL | let _ = [0; faz::<'b>(&())]; | ^^ @@ -319,7 +327,7 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0747]: unresolved item provided when a constant was expected - --> $DIR/const-arg-in-const-arg.rs:44:27 + --> $DIR/const-arg-in-const-arg.rs:45:27 | LL | let _ = Foo::<{ bar::<N>() }>; | ^ @@ -330,7 +338,7 @@ LL | let _ = Foo::<{ bar::<{ N }>() }>; | + + error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:46:27 + --> $DIR/const-arg-in-const-arg.rs:47:27 | LL | let _ = Foo::<{ faz::<'a>(&()) }>; | ^^ @@ -342,7 +350,7 @@ LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:49:27 + --> $DIR/const-arg-in-const-arg.rs:50:27 | LL | let _ = Foo::<{ faz::<'b>(&()) }>; | ^^ @@ -353,7 +361,7 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: aborting due to 36 previous errors +error: aborting due to 37 previous errors Some errors have detailed explanations: E0747, E0794. For more information about an error, try `rustc --explain E0747`. diff --git a/tests/ui/const-generics/const-arg-in-const-arg.rs b/tests/ui/const-generics/const-arg-in-const-arg.rs index 27b74489fe8..0e1c6552edf 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.rs +++ b/tests/ui/const-generics/const-arg-in-const-arg.rs @@ -23,6 +23,7 @@ fn test<'a, 'b, T, const N: usize>() where &'b (): Sized { let _: [u8; baz::<'b>(&())]; //[min]~ ERROR generic parameters may not let _ = [0; foo::<T>()]; //[min]~ ERROR constant expression depends on a generic parameter + //[min]~^ ERROR constant expression depends on a generic parameter let _ = [0; bar::<N>()]; //[min]~ ERROR generic parameters may not //[min]~^ ERROR unresolved item provided when a constant was expected let _ = [0; faz::<'a>(&())]; //[min]~ ERROR generic parameters may not diff --git a/tests/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr b/tests/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr index 632ece0ddcb..7e318f8786f 100644 --- a/tests/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr +++ b/tests/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr @@ -1,12 +1,4 @@ error: overly complex generic constant - --> $DIR/dependence_lint.rs:17:9 - | -LL | [0; if false { size_of::<T>() } else { 3 }]; // lint on stable, error with gce - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ control flow is not supported in generic constants - | - = help: consider moving this anonymous constant into a `const` function - -error: overly complex generic constant --> $DIR/dependence_lint.rs:21:17 | LL | let _: [u8; if true { size_of::<T>() } else { 3 }]; // error on stable, error with gce @@ -36,5 +28,13 @@ help: try adding a `where` bound LL | fn foo<T>() where [(); size_of::<*mut T>()]: { | ++++++++++++++++++++++++++++++++ +error: overly complex generic constant + --> $DIR/dependence_lint.rs:17:9 + | +LL | [0; if false { size_of::<T>() } else { 3 }]; // lint on stable, error with gce + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ control flow is not supported in generic constants + | + = help: consider moving this anonymous constant into a `const` function + error: aborting due to 4 previous errors diff --git a/tests/ui/consts/too_generic_eval_ice.rs b/tests/ui/consts/too_generic_eval_ice.rs index 8b3f4b714e1..0d46a4c8276 100644 --- a/tests/ui/consts/too_generic_eval_ice.rs +++ b/tests/ui/consts/too_generic_eval_ice.rs @@ -7,6 +7,7 @@ impl<A, B> Foo<A, B> { [5; Self::HOST_SIZE] == [6; 0] //~^ ERROR constant expression depends on a generic parameter //~| ERROR constant expression depends on a generic parameter + //~| ERROR constant expression depends on a generic parameter //~| ERROR can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]` } } diff --git a/tests/ui/consts/too_generic_eval_ice.stderr b/tests/ui/consts/too_generic_eval_ice.stderr index 58a61b938d6..b48be16a24c 100644 --- a/tests/ui/consts/too_generic_eval_ice.stderr +++ b/tests/ui/consts/too_generic_eval_ice.stderr @@ -7,6 +7,14 @@ LL | [5; Self::HOST_SIZE] == [6; 0] = note: this may fail depending on what value the parameter takes error: constant expression depends on a generic parameter + --> $DIR/too_generic_eval_ice.rs:7:9 + | +LL | [5; Self::HOST_SIZE] == [6; 0] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: constant expression depends on a generic parameter --> $DIR/too_generic_eval_ice.rs:7:30 | LL | [5; Self::HOST_SIZE] == [6; 0] @@ -32,6 +40,6 @@ LL | [5; Self::HOST_SIZE] == [6; 0] `[T; N]` implements `PartialEq<[U]>` and 3 others -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/error-codes/E0746.stderr b/tests/ui/error-codes/E0746.stderr index cfc747cb1e2..ce3e9736969 100644 --- a/tests/ui/error-codes/E0746.stderr +++ b/tests/ui/error-codes/E0746.stderr @@ -19,8 +19,11 @@ error[E0746]: return type cannot have an unboxed trait object LL | fn bar() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | - = help: if there were a single returned type, you could use `impl Trait` instead -help: box the return type, and wrap all of the returned values in `Box::new` +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL | fn bar() -> impl Trait { + | ~~~~ +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn bar() -> Box<dyn Trait> { LL | if true { diff --git a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr index 8716088ccbd..9ed3d21c13c 100644 --- a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr +++ b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr @@ -261,8 +261,11 @@ error[E0746]: return type cannot have an unboxed trait object LL | fn bat() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | - = help: if there were a single returned type, you could use `impl Trait` instead -help: box the return type, and wrap all of the returned values in `Box::new` +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL | fn bat() -> impl Trait { + | ~~~~ +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn bat() -> Box<dyn Trait> { LL | if true { @@ -277,8 +280,11 @@ error[E0746]: return type cannot have an unboxed trait object LL | fn bay() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | - = help: if there were a single returned type, you could use `impl Trait` instead -help: box the return type, and wrap all of the returned values in `Box::new` +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL | fn bay() -> impl Trait { + | ~~~~ +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn bay() -> Box<dyn Trait> { LL | if true { diff --git a/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.rs b/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.rs new file mode 100644 index 00000000000..30ca3d271b8 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.rs @@ -0,0 +1,30 @@ +// Make sure that we don't accidentally collect an RPITIT hidden type that does not +// hold for all instantiations of the trait signature. + +trait MkStatic { + fn mk_static(self) -> &'static str; +} + +impl MkStatic for &'static str { + fn mk_static(self) -> &'static str { self } +} + +trait Foo { + fn foo<'a: 'static, 'late>(&'late self) -> impl MkStatic; +} + +impl Foo for str { + fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static { + //~^ ERROR method not compatible with trait + self + } +} + +fn call_foo<T: Foo + ?Sized>(t: &T) -> &'static str { + t.foo().mk_static() +} + +fn main() { + let s = call_foo(String::from("hello, world").as_str()); + println!("> {s}"); +} diff --git a/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr b/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr new file mode 100644 index 00000000000..95d8699e19f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr @@ -0,0 +1,22 @@ +error[E0308]: method not compatible with trait + --> $DIR/do-not-imply-from-trait-impl.rs:17:38 + | +LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static { + | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected signature `fn(&'late _) -> _` + found signature `fn(&'a _) -> _` +note: the lifetime `'late` as defined here... + --> $DIR/do-not-imply-from-trait-impl.rs:13:25 + | +LL | fn foo<'a: 'static, 'late>(&'late self) -> impl MkStatic; + | ^^^^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/do-not-imply-from-trait-impl.rs:17:12 + | +LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static { + | ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr index 6f6b787b6fe..a23879eb6c3 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr @@ -11,12 +11,12 @@ note: type in trait | LL | fn early<'early, T>(x: &'early T) -> impl Sized; | ^^^^^^^^^ - = note: expected signature `fn(&T)` - found signature `fn(&'late ())` + = note: expected signature `fn(&'early T)` + found signature `fn(&())` help: change the parameter type to match the trait | -LL | fn early<'late, T>(_: &T) {} - | ~~ +LL | fn early<'late, T>(_: &'early T) {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr index 3430055dab1..4c10422f985 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr @@ -6,9 +6,9 @@ LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) { | = note: the pointer is valid for the static lifetime note: but the referenced data is only valid for the anonymous lifetime defined here - --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:18 + --> $DIR/rpitit-hidden-types-self-implied-wf.rs:2:18 | -LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) { +LL | fn extend(_: &str) -> (impl Sized + '_, &'static str); | ^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr index 56b83cbca77..b27d7870955 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr @@ -1,14 +1,15 @@ -error[E0623]: lifetime mismatch +error[E0477]: the type `impl Future<Output = Vec<u8>>` does not fulfill the required lifetime --> $DIR/signature-mismatch.rs:77:10 | -LL | &'a self, - | -------- this parameter and the return type are declared with different lifetimes... -... LL | ) -> impl Future<Output = Vec<u8>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | ...but data from `buff` is returned here + | +note: type must outlive the lifetime `'a` as defined here as required by this binding + --> $DIR/signature-mismatch.rs:73:32 + | +LL | fn async_fn_reduce_outlive<'a, 'b, T>( + | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0623`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs index 55b9a0de5ff..a9885c6a298 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs @@ -75,7 +75,7 @@ impl AsyncTrait for Struct { buff: &'b [u8], t: T, ) -> impl Future<Output = Vec<u8>> { - //[failure]~^ ERROR lifetime mismatch + //[failure]~^ ERROR the type `impl Future<Output = Vec<u8>>` does not fulfill the required lifetime async move { let _t = t; vec![] diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr index e1856b92910..360f0d7e7f3 100644 --- a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr +++ b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr @@ -1,10 +1,11 @@ error: return type captures more lifetimes than trait definition --> $DIR/rpitit-impl-captures-too-much.rs:10:39 | +LL | fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>; + | -- this lifetime was captured +... LL | fn hello(self_: Invariant<'_>) -> impl Sized + use<'_> {} - | -- ^^^^^^^^^^^^^^^^^^^^ - | | - | this lifetime was captured + | ^^^^^^^^^^^^^^^^^^^^ | note: hidden type must only reference lifetimes captured by this impl trait --> $DIR/rpitit-impl-captures-too-much.rs:6:39 diff --git a/tests/ui/issues/issue-39211.rs b/tests/ui/issues/issue-39211.rs index 6f3834d51a1..ab86afc3410 100644 --- a/tests/ui/issues/issue-39211.rs +++ b/tests/ui/issues/issue-39211.rs @@ -8,6 +8,7 @@ trait Mat { fn m<M: Mat>() { let a = [3; M::Row::DIM]; //~^ ERROR constant expression depends on a generic parameter + //~| ERROR constant expression depends on a generic parameter } fn main() { } diff --git a/tests/ui/issues/issue-39211.stderr b/tests/ui/issues/issue-39211.stderr index 15c9a80bb35..2124bc667ff 100644 --- a/tests/ui/issues/issue-39211.stderr +++ b/tests/ui/issues/issue-39211.stderr @@ -6,5 +6,13 @@ LL | let a = [3; M::Row::DIM]; | = note: this may fail depending on what value the parameter takes -error: aborting due to 1 previous error +error: constant expression depends on a generic parameter + --> $DIR/issue-39211.rs:9:13 + | +LL | let a = [3; M::Row::DIM]; + | ^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to 2 previous errors diff --git a/tests/ui/lint/group-forbid-always-trumps-cli.stderr b/tests/ui/lint/forbid-always-trumps-cli.allow-first-group.stderr index ed1242eacfc..07773ee4ddf 100644 --- a/tests/ui/lint/group-forbid-always-trumps-cli.stderr +++ b/tests/ui/lint/forbid-always-trumps-cli.allow-first-group.stderr @@ -1,5 +1,5 @@ error: unused variable: `x` - --> $DIR/group-forbid-always-trumps-cli.rs:4:9 + --> $DIR/forbid-always-trumps-cli.rs:15:9 | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` diff --git a/tests/ui/lint/forbid-always-trumps-cli.allow-first-lint.stderr b/tests/ui/lint/forbid-always-trumps-cli.allow-first-lint.stderr new file mode 100644 index 00000000000..cf357ef8ca8 --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.allow-first-lint.stderr @@ -0,0 +1,10 @@ +error: unused variable: `x` + --> $DIR/forbid-always-trumps-cli.rs:15:9 + | +LL | let x = 1; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | + = note: requested on the command line with `-F unused-variables` + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/forbid-always-trumps-cli.allow-first-mix1.stderr b/tests/ui/lint/forbid-always-trumps-cli.allow-first-mix1.stderr new file mode 100644 index 00000000000..07773ee4ddf --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.allow-first-mix1.stderr @@ -0,0 +1,10 @@ +error: unused variable: `x` + --> $DIR/forbid-always-trumps-cli.rs:15:9 + | +LL | let x = 1; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | + = note: `-F unused-variables` implied by `-F unused` + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/forbid-always-trumps-cli.allow-first-mix2.stderr b/tests/ui/lint/forbid-always-trumps-cli.allow-first-mix2.stderr new file mode 100644 index 00000000000..cf357ef8ca8 --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.allow-first-mix2.stderr @@ -0,0 +1,10 @@ +error: unused variable: `x` + --> $DIR/forbid-always-trumps-cli.rs:15:9 + | +LL | let x = 1; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | + = note: requested on the command line with `-F unused-variables` + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/forbid-always-trumps-cli.forbid-first-group.stderr b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-group.stderr new file mode 100644 index 00000000000..07773ee4ddf --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-group.stderr @@ -0,0 +1,10 @@ +error: unused variable: `x` + --> $DIR/forbid-always-trumps-cli.rs:15:9 + | +LL | let x = 1; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | + = note: `-F unused-variables` implied by `-F unused` + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/forbid-always-trumps-cli.forbid-first-lint.stderr b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-lint.stderr new file mode 100644 index 00000000000..cf357ef8ca8 --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-lint.stderr @@ -0,0 +1,10 @@ +error: unused variable: `x` + --> $DIR/forbid-always-trumps-cli.rs:15:9 + | +LL | let x = 1; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | + = note: requested on the command line with `-F unused-variables` + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/forbid-always-trumps-cli.forbid-first-mix1.stderr b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-mix1.stderr new file mode 100644 index 00000000000..07773ee4ddf --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-mix1.stderr @@ -0,0 +1,10 @@ +error: unused variable: `x` + --> $DIR/forbid-always-trumps-cli.rs:15:9 + | +LL | let x = 1; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | + = note: `-F unused-variables` implied by `-F unused` + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/forbid-always-trumps-cli.forbid-first-mix2.stderr b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-mix2.stderr new file mode 100644 index 00000000000..cf357ef8ca8 --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.forbid-first-mix2.stderr @@ -0,0 +1,10 @@ +error: unused variable: `x` + --> $DIR/forbid-always-trumps-cli.rs:15:9 + | +LL | let x = 1; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | + = note: requested on the command line with `-F unused-variables` + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/forbid-always-trumps-cli.rs b/tests/ui/lint/forbid-always-trumps-cli.rs new file mode 100644 index 00000000000..d94cc2e8efe --- /dev/null +++ b/tests/ui/lint/forbid-always-trumps-cli.rs @@ -0,0 +1,17 @@ +//! Ensure that "forbid" always trumps" allow" in CLI arguments, no matter the order +//! and no matter whether it is used with a lint group vs an individual lint. +// ignore-tidy-linelength +//@ revisions: forbid-first-group allow-first-group forbid-first-lint allow-first-lint forbid-first-mix1 allow-first-mix1 forbid-first-mix2 allow-first-mix2 +//@[forbid-first-group] compile-flags: -F unused -A unused +//@[allow-first-group] compile-flags: -A unused -F unused +//@[forbid-first-lint] compile-flags: -F unused_variables -A unused_variables +//@[allow-first-lint] compile-flags: -A unused_variables -F unused_variables +//@[forbid-first-mix1] compile-flags: -F unused -A unused_variables +//@[allow-first-mix1] compile-flags: -A unused_variables -F unused +//@[forbid-first-mix2] compile-flags: -F unused_variables -A unused +//@[allow-first-mix2] compile-flags: -A unused -F unused_variables + +fn main() { + let x = 1; + //~^ ERROR unused variable: `x` +} diff --git a/tests/ui/lint/group-forbid-always-trumps-cli.rs b/tests/ui/lint/group-forbid-always-trumps-cli.rs deleted file mode 100644 index 4b63452bf5d..00000000000 --- a/tests/ui/lint/group-forbid-always-trumps-cli.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ compile-flags: -F unused -A unused - -fn main() { - let x = 1; - //~^ ERROR unused variable: `x` -} diff --git a/tests/ui/rust-2024/reserved-guarded-strings-lexing.rs b/tests/ui/rust-2024/reserved-guarded-strings-lexing.rs index 83e0dcbb4be..43413f7470e 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-lexing.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings-lexing.rs @@ -26,24 +26,24 @@ macro_rules! demo7 { fn main() { demo3!(## "foo"); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!(### "foo"); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!(## "foo"#); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo7!(### "foo"###); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo5!(###"foo"#); @@ -56,14 +56,14 @@ fn main() { demo5!(#"foo"###); //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!("foo"###); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 // Non-ascii identifiers diff --git a/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr b/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr index e2e1ac42f05..4d54a08617b 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr +++ b/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr @@ -28,7 +28,7 @@ error: identifiers cannot contain emoji: `🙃` LL | demo3!(🙃#""); | ^^ -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:28:12 | LL | demo3!(## "foo"); @@ -41,12 +41,12 @@ note: the lint level is defined here | LL | #![warn(rust_2024_guarded_string_incompatible_syntax)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo3!(# # "foo"); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:31:12 | LL | demo4!(### "foo"); @@ -54,12 +54,12 @@ LL | demo4!(### "foo"); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# ## "foo"); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:31:13 | LL | demo4!(### "foo"); @@ -67,12 +67,12 @@ LL | demo4!(### "foo"); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(## # "foo"); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:36:12 | LL | demo4!(## "foo"#); @@ -80,12 +80,12 @@ LL | demo4!(## "foo"#); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# # "foo"#); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:39:12 | LL | demo7!(### "foo"###); @@ -93,12 +93,12 @@ LL | demo7!(### "foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(# ## "foo"###); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:39:13 | LL | demo7!(### "foo"###); @@ -106,12 +106,12 @@ LL | demo7!(### "foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(## # "foo"###); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:39:21 | LL | demo7!(### "foo"###); @@ -119,12 +119,12 @@ LL | demo7!(### "foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(### "foo"# ##); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:39:22 | LL | demo7!(### "foo"###); @@ -132,7 +132,7 @@ LL | demo7!(### "foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(### "foo"## #); | + @@ -189,7 +189,7 @@ help: insert whitespace here to avoid this being parsed as a guarded string in R LL | demo5!(# "foo"###); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:56:18 | LL | demo5!(#"foo"###); @@ -197,12 +197,12 @@ LL | demo5!(#"foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo5!(#"foo"# ##); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:56:19 | LL | demo5!(#"foo"###); @@ -210,12 +210,12 @@ LL | demo5!(#"foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo5!(#"foo"## #); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:63:17 | LL | demo4!("foo"###); @@ -223,12 +223,12 @@ LL | demo4!("foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"# ##); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-lexing.rs:63:18 | LL | demo4!("foo"###); @@ -236,7 +236,7 @@ LL | demo4!("foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"## #); | + diff --git a/tests/ui/rust-2024/reserved-guarded-strings-migration.fixed b/tests/ui/rust-2024/reserved-guarded-strings-migration.fixed index d92df7b5375..ef00ed3f610 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-migration.fixed +++ b/tests/ui/rust-2024/reserved-guarded-strings-migration.fixed @@ -38,28 +38,28 @@ fn main() { demo2!("foo"#); demo3!(# # "foo"); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!(# # # "foo"); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!(# # "foo"#); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo6!(# # # "foo"# #); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!("foo"# # #); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo2!(# ""); @@ -94,6 +94,6 @@ fn main() { //~| WARNING hard error in Rust 2024 //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 } diff --git a/tests/ui/rust-2024/reserved-guarded-strings-migration.rs b/tests/ui/rust-2024/reserved-guarded-strings-migration.rs index 5905f2abe32..cf2d8716ad2 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-migration.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings-migration.rs @@ -38,28 +38,28 @@ fn main() { demo2!("foo"#); demo3!(## "foo"); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!(### "foo"); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!(## "foo"#); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo6!(### "foo"##); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo4!("foo"###); - //~^ WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~^ WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 demo2!(#""); @@ -94,6 +94,6 @@ fn main() { //~| WARNING hard error in Rust 2024 //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 - //~| WARNING parsed as a guarded string in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] + //~| WARNING reserved token in Rust 2024 [rust_2024_guarded_string_incompatible_syntax] //~| WARNING hard error in Rust 2024 } diff --git a/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr b/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr index d7f8e5c9b4b..b17ae941ef4 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr +++ b/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr @@ -1,4 +1,4 @@ -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:40:12 | LL | demo3!(## "foo"); @@ -11,12 +11,12 @@ note: the lint level is defined here | LL | #![warn(rust_2024_guarded_string_incompatible_syntax)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo3!(# # "foo"); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:43:12 | LL | demo4!(### "foo"); @@ -24,12 +24,12 @@ LL | demo4!(### "foo"); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# ## "foo"); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:43:13 | LL | demo4!(### "foo"); @@ -37,12 +37,12 @@ LL | demo4!(### "foo"); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(## # "foo"); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:48:12 | LL | demo4!(## "foo"#); @@ -50,12 +50,12 @@ LL | demo4!(## "foo"#); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# # "foo"#); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:51:12 | LL | demo6!(### "foo"##); @@ -63,12 +63,12 @@ LL | demo6!(### "foo"##); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo6!(# ## "foo"##); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:51:13 | LL | demo6!(### "foo"##); @@ -76,12 +76,12 @@ LL | demo6!(### "foo"##); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo6!(## # "foo"##); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:51:21 | LL | demo6!(### "foo"##); @@ -89,12 +89,12 @@ LL | demo6!(### "foo"##); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo6!(### "foo"# #); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:59:17 | LL | demo4!("foo"###); @@ -102,12 +102,12 @@ LL | demo4!("foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"# ##); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:59:18 | LL | demo4!("foo"###); @@ -115,7 +115,7 @@ LL | demo4!("foo"###); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"## #); | + @@ -276,7 +276,7 @@ help: insert whitespace here to avoid this being parsed as a guarded string in R LL | demo5!(## "foo"##); | + -warning: will be parsed as a guarded string in Rust 2024 +warning: reserved token in Rust 2024 --> $DIR/reserved-guarded-strings-migration.rs:92:19 | LL | demo5!(##"foo"##); @@ -284,7 +284,7 @@ LL | demo5!(##"foo"##); | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! = note: for more information, see issue #123735 <https://github.com/rust-lang/rust/issues/123735> -help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 +help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo5!(##"foo"# #); | + diff --git a/tests/ui/rust-2024/reserved-guarded-strings.rs b/tests/ui/rust-2024/reserved-guarded-strings.rs index 878881c1d24..ae68d34cb86 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings.rs @@ -46,13 +46,13 @@ fn main() { //~^ ERROR prefix `blah` is unknown //~| ERROR invalid string literal - demo2!(## "foo"); //~ ERROR invalid string literal - demo3!("foo"###); //~ ERROR invalid string literal - demo3!(### "foo"); //~ ERROR invalid string literal - demo3!(## "foo"#); //~ ERROR invalid string literal + demo2!(## "foo"); //~ reserved multi-hash token is forbidden + demo3!("foo"###); //~ reserved multi-hash token is forbidden + demo3!(### "foo"); //~ reserved multi-hash token is forbidden + demo3!(## "foo"#); //~ reserved multi-hash token is forbidden demo5!(### "foo"###); - //~^ ERROR invalid string literal - //~| ERROR invalid string literal + //~^ reserved multi-hash token is forbidden + //~| reserved multi-hash token is forbidden demo1!(#""); //~ ERROR invalid string literal demo1!(#""#); //~ ERROR invalid string literal @@ -65,7 +65,7 @@ fn main() { demo1!(###"foo"###); //~ ERROR invalid string literal demo2!(#"foo"###); //~^ ERROR invalid string literal - //~| ERROR invalid string literal + //~| ERROR reserved multi-hash token is forbidden // More than 255 hashes demon!(####################################################################################################################################################################################################################################################################"foo"); diff --git a/tests/ui/rust-2024/reserved-guarded-strings.stderr b/tests/ui/rust-2024/reserved-guarded-strings.stderr index c8f8557b0f4..0f3b06147c4 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings.stderr +++ b/tests/ui/rust-2024/reserved-guarded-strings.stderr @@ -34,73 +34,73 @@ help: consider inserting whitespace here LL | demo2!(blah# "xx"#); | + -error: invalid string literal +error: reserved multi-hash token is forbidden --> $DIR/reserved-guarded-strings.rs:49:12 | LL | demo2!(## "foo"); | ^^ | - = note: unprefixed guarded string literals are reserved for future use since Rust 2024 + = note: sequences of two or more # are reserved for future use since Rust 2024 help: consider inserting whitespace here | LL | demo2!(# # "foo"); | + -error: invalid string literal +error: reserved multi-hash token is forbidden --> $DIR/reserved-guarded-strings.rs:50:17 | LL | demo3!("foo"###); | ^^ | - = note: unprefixed guarded string literals are reserved for future use since Rust 2024 + = note: sequences of two or more # are reserved for future use since Rust 2024 help: consider inserting whitespace here | LL | demo3!("foo"# ##); | + -error: invalid string literal +error: reserved multi-hash token is forbidden --> $DIR/reserved-guarded-strings.rs:51:12 | LL | demo3!(### "foo"); | ^^ | - = note: unprefixed guarded string literals are reserved for future use since Rust 2024 + = note: sequences of two or more # are reserved for future use since Rust 2024 help: consider inserting whitespace here | LL | demo3!(# ## "foo"); | + -error: invalid string literal +error: reserved multi-hash token is forbidden --> $DIR/reserved-guarded-strings.rs:52:12 | LL | demo3!(## "foo"#); | ^^ | - = note: unprefixed guarded string literals are reserved for future use since Rust 2024 + = note: sequences of two or more # are reserved for future use since Rust 2024 help: consider inserting whitespace here | LL | demo3!(# # "foo"#); | + -error: invalid string literal +error: reserved multi-hash token is forbidden --> $DIR/reserved-guarded-strings.rs:53:12 | LL | demo5!(### "foo"###); | ^^ | - = note: unprefixed guarded string literals are reserved for future use since Rust 2024 + = note: sequences of two or more # are reserved for future use since Rust 2024 help: consider inserting whitespace here | LL | demo5!(# ## "foo"###); | + -error: invalid string literal +error: reserved multi-hash token is forbidden --> $DIR/reserved-guarded-strings.rs:53:21 | LL | demo5!(### "foo"###); | ^^ | - = note: unprefixed guarded string literals are reserved for future use since Rust 2024 + = note: sequences of two or more # are reserved for future use since Rust 2024 help: consider inserting whitespace here | LL | demo5!(### "foo"# ##); @@ -226,13 +226,13 @@ help: consider inserting whitespace here LL | demo2!(# "foo"###); | + -error: invalid string literal +error: reserved multi-hash token is forbidden --> $DIR/reserved-guarded-strings.rs:66:19 | LL | demo2!(#"foo"###); | ^^ | - = note: unprefixed guarded string literals are reserved for future use since Rust 2024 + = note: sequences of two or more # are reserved for future use since Rust 2024 help: consider inserting whitespace here | LL | demo2!(#"foo"## #); diff --git a/tests/ui/traits/next-solver/alias-bound-unsound.rs b/tests/ui/traits/next-solver/alias-bound-unsound.rs index 272e5db3b7a..0236826c3ed 100644 --- a/tests/ui/traits/next-solver/alias-bound-unsound.rs +++ b/tests/ui/traits/next-solver/alias-bound-unsound.rs @@ -28,5 +28,6 @@ fn main() { //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` + //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` println!("{x}"); } diff --git a/tests/ui/traits/next-solver/alias-bound-unsound.stderr b/tests/ui/traits/next-solver/alias-bound-unsound.stderr index e5cf5b6bc3d..7e3737d120b 100644 --- a/tests/ui/traits/next-solver/alias-bound-unsound.stderr +++ b/tests/ui/traits/next-solver/alias-bound-unsound.stderr @@ -24,6 +24,14 @@ error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _` LL | drop(<() as Foo>::copy_me(&x)); | ^^^^^^^^^^^^^^^^^^^^^^^^ +error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _` + --> $DIR/alias-bound-unsound.rs:24:10 + | +LL | drop(<() as Foo>::copy_me(&x)); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed` --> $DIR/alias-bound-unsound.rs:24:31 | @@ -50,6 +58,6 @@ error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _` LL | drop(<() as Foo>::copy_me(&x)); | ^^ -error: aborting due to 7 previous errors +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/non-wf-ret.rs b/tests/ui/traits/next-solver/non-wf-ret.rs new file mode 100644 index 00000000000..c54d61c895d --- /dev/null +++ b/tests/ui/traits/next-solver/non-wf-ret.rs @@ -0,0 +1,47 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +use std::ops::Deref; + +pub struct List<T> { + skel: [T], +} + +impl<'a, T: Copy> IntoIterator for &'a List<T> { + type Item = T; + type IntoIter = std::iter::Copied<<&'a [T] as IntoIterator>::IntoIter>; + + fn into_iter(self) -> Self::IntoIter { + todo!() + } +} + +impl<T> Deref for List<T> { + type Target = [T]; + + fn deref(&self) -> &[T] { + todo!() + } +} + +impl<T> List<T> { + fn iter(&self) -> <&Self as IntoIterator>::IntoIter + where + T: Copy, + { + todo!() + } +} + +fn test<Q>(t: &List<Q>) { + // Checking that `<&List<Q> as IntoIterator>::IntoIter` is WF + // will disqualify the inherent method, since normalizing it + // requires `Q: Copy` which does not hold. and allow us to fall + // through to the deref'd `<[Q]>::iter` method which works. + // + // In the old solver, the same behavior is achieved by just + // eagerly normalizing the return type. + t.iter(); +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/structurally-normalize-in-borrowck-field-projection.rs b/tests/ui/traits/next-solver/structurally-normalize-in-borrowck-field-projection.rs new file mode 100644 index 00000000000..d2d68128fde --- /dev/null +++ b/tests/ui/traits/next-solver/structurally-normalize-in-borrowck-field-projection.rs @@ -0,0 +1,32 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +trait Interner: Sized { + type Value; +} + +enum Kind<I: Interner> { + Value(I::Value), +} + +struct Intern; + +impl Interner for Intern { + type Value = Wrap<u32>; +} + +struct Wrap<T>(T); + +type KindAlias = Kind<Intern>; + +trait PrettyPrinter: Sized { + fn hello(c: KindAlias) { + match c { + KindAlias::Value(Wrap(v)) => { + println!("{v:?}"); + } + } + } +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/typeck/resolve-before-checking-builtin-ptr.rs b/tests/ui/traits/next-solver/typeck/resolve-before-checking-builtin-ptr.rs new file mode 100644 index 00000000000..d47f705a8ab --- /dev/null +++ b/tests/ui/traits/next-solver/typeck/resolve-before-checking-builtin-ptr.rs @@ -0,0 +1,20 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +trait Mirror { + type Assoc; +} +impl<T> Mirror for T { + type Assoc = T; +} + +struct Place { + field: <&'static [u8] as Mirror>::Assoc, +} + +fn main() { + let local = Place { field: &[] }; + let z = || { + let y = &local.field[0]; + }; +} diff --git a/tests/ui/traits/next-solver/typeck/resolve-before-checking-never.rs b/tests/ui/traits/next-solver/typeck/resolve-before-checking-never.rs new file mode 100644 index 00000000000..6df1fd5d4ba --- /dev/null +++ b/tests/ui/traits/next-solver/typeck/resolve-before-checking-never.rs @@ -0,0 +1,20 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +#![feature(never_type)] + +trait Mirror { + type Assoc; +} +impl<T> Mirror for T { + type Assoc = T; +} + +fn diverge() -> <! as Mirror>::Assoc { todo!() } + +fn main() { + let close = || { + diverge(); + }; + let x: u32 = close(); +} diff --git a/tests/ui/traits/resolve-impl-before-constrain-check.rs b/tests/ui/traits/resolve-impl-before-constrain-check.rs new file mode 100644 index 00000000000..87f9c241e40 --- /dev/null +++ b/tests/ui/traits/resolve-impl-before-constrain-check.rs @@ -0,0 +1,20 @@ +// Need a different module so we try to build the mir for `test` +// before analyzing `mod foo`. + +mod foo { + pub trait Callable { + fn call(); + } + + impl<V: ?Sized> Callable for () { + //~^ ERROR the type parameter `V` is not constrained by the impl trait, self type, or predicates + fn call() {} + } +} +use foo::*; + +fn test() -> impl Sized { + <() as Callable>::call() +} + +fn main() {} diff --git a/tests/ui/traits/resolve-impl-before-constrain-check.stderr b/tests/ui/traits/resolve-impl-before-constrain-check.stderr new file mode 100644 index 00000000000..e8e569ba625 --- /dev/null +++ b/tests/ui/traits/resolve-impl-before-constrain-check.stderr @@ -0,0 +1,9 @@ +error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates + --> $DIR/resolve-impl-before-constrain-check.rs:9:10 + | +LL | impl<V: ?Sized> Callable for () { + | ^ unconstrained type parameter + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0207`. |
