diff --git a/compiler/rustc_ast_lowering/messages.ftl b/compiler/rustc_ast_lowering/messages.ftl index 5ef76fb64aaf2..a8498d771da67 100644 --- a/compiler/rustc_ast_lowering/messages.ftl +++ b/compiler/rustc_ast_lowering/messages.ftl @@ -172,9 +172,6 @@ ast_lowering_template_modifier = template modifier ast_lowering_this_not_async = this is not `async` -ast_lowering_underscore_array_length_unstable = - using `_` for array lengths is unstable - ast_lowering_underscore_expr_lhs_assign = in expressions, `_` can only be used on the left-hand side of an assignment .label = `_` not allowed here diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index b99df8bd7e552..f070759ca8174 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -48,7 +48,7 @@ use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::spawn; use rustc_data_structures::tagged_ptr::TaggedRef; -use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, StashKey}; +use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle}; use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res}; use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId}; use rustc_hir::{ @@ -59,7 +59,7 @@ use rustc_index::{Idx, IndexSlice, IndexVec}; use rustc_macros::extension; use rustc_middle::span_bug; use rustc_middle::ty::{ResolverAstLowering, TyCtxt}; -use rustc_session::parse::{add_feature_diagnostics, feature_err}; +use rustc_session::parse::add_feature_diagnostics; use rustc_span::symbol::{Ident, Symbol, kw, sym}; use rustc_span::{DUMMY_SP, DesugaringKind, Span}; use smallvec::SmallVec; @@ -2068,15 +2068,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // `ExprKind::Paren(ExprKind::Underscore)` and should also be lowered to `GenericArg::Infer` match c.value.peel_parens().kind { ExprKind::Underscore => { - if !self.tcx.features().generic_arg_infer() { - feature_err( - &self.tcx.sess, - sym::generic_arg_infer, - c.value.span, - fluent_generated::ast_lowering_underscore_array_length_unstable, - ) - .stash(c.value.span, StashKey::UnderscoreForArrayLengths); - } let ct_kind = hir::ConstArgKind::Infer(self.lower_span(c.value.span), ()); self.arena.alloc(hir::ConstArg { hir_id: self.lower_node_id(c.id), kind: ct_kind }) } diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index b1c185220f45b..cfe0f4e5d6cb6 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -220,6 +220,8 @@ declare_features! ( (accepted, fn_must_use, "1.27.0", Some(43302)), /// Allows capturing variables in scope using format_args! (accepted, format_args_capture, "1.58.0", Some(67984)), + /// Infer generic args for both consts and types. + (accepted, generic_arg_infer, "CURRENT_RUSTC_VERSION", Some(85077)), /// Allows associated types to be generic, e.g., `type Foo;` (RFC 1598). (accepted, generic_associated_types, "1.65.0", Some(44265)), /// Allows attributes on lifetime/type formal parameters in generics (RFC 1327). diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 594021d78d2e4..8c6411342f28d 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -516,8 +516,6 @@ declare_features! ( (unstable, frontmatter, "1.88.0", Some(136889)), /// Allows defining gen blocks and `gen fn`. (unstable, gen_blocks, "1.75.0", Some(117078)), - /// Infer generic args for both consts and types. - (unstable, generic_arg_infer, "1.55.0", Some(85077)), /// Allows non-trivial generic constants which have to have wfness manually propagated to callers (incomplete, generic_const_exprs, "1.56.0", Some(76560)), /// Allows generic parameters and where-clauses on free & associated const items. diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 141d96b57e579..902a2e15dffde 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -452,13 +452,6 @@ fn infer_placeholder_type<'tcx>( if let Some(ty) = node.ty() { visitor.visit_ty_unambig(ty); } - // If we have just one span, let's try to steal a const `_` feature error. - let try_steal_span = if !tcx.features().generic_arg_infer() && visitor.spans.len() == 1 - { - visitor.spans.first().copied() - } else { - None - }; // If we didn't find any infer tys, then just fallback to `span`. if visitor.spans.is_empty() { visitor.spans.push(span); @@ -489,15 +482,7 @@ fn infer_placeholder_type<'tcx>( } } - if let Some(try_steal_span) = try_steal_span { - cx.dcx().try_steal_replace_and_emit_err( - try_steal_span, - StashKey::UnderscoreForArrayLengths, - diag, - ) - } else { - diag.emit() - } + diag.emit() }); Ty::new_error(tcx, guar) } diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs index 3a26b8331f8b3..8c7c3750865cf 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs @@ -8,7 +8,7 @@ use rustc_middle::ty::{ self, GenericArgsRef, GenericParamDef, GenericParamDefKind, IsSuggestable, Ty, }; use rustc_session::lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS; -use rustc_span::{kw, sym}; +use rustc_span::kw; use smallvec::SmallVec; use tracing::{debug, instrument}; @@ -258,19 +258,6 @@ pub fn lower_generic_args<'tcx: 'a, 'a>( GenericParamDefKind::Const { .. }, _, ) => { - if let GenericParamDefKind::Const { .. } = param.kind - && let GenericArg::Infer(inf) = arg - && !tcx.features().generic_arg_infer() - { - rustc_session::parse::feature_err( - tcx.sess, - sym::generic_arg_infer, - inf.span, - "const arguments cannot yet be inferred with `_`", - ) - .emit(); - } - // We lower to an infer even when the feature gate is not enabled // as it is useful for diagnostics to be able to see a `ConstKind::Infer` args.push(ctx.provided_kind(&args, param, arg)); diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 88855831788db..6231c3425c880 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -153,7 +153,6 @@ #![feature(f16)] #![feature(freeze_impls)] #![feature(fundamental)] -#![feature(generic_arg_infer)] #![feature(if_let_guard)] #![feature(intra_doc_pointers)] #![feature(intrinsics)] diff --git a/src/tools/clippy/tests/ui/single_range_in_vec_init.rs b/src/tools/clippy/tests/ui/single_range_in_vec_init.rs index 25884450b0842..0888019e101ce 100644 --- a/src/tools/clippy/tests/ui/single_range_in_vec_init.rs +++ b/src/tools/clippy/tests/ui/single_range_in_vec_init.rs @@ -2,7 +2,6 @@ //@no-rustfix: overlapping suggestions #![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::useless_vec, unused)] #![warn(clippy::single_range_in_vec_init)] -#![feature(generic_arg_infer)] #[macro_use] extern crate proc_macros; diff --git a/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr b/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr index a99127a7606fb..b21338e38a3cb 100644 --- a/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr +++ b/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr @@ -1,5 +1,5 @@ error: an array of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:26:5 + --> tests/ui/single_range_in_vec_init.rs:25:5 | LL | [0..200]; | ^^^^^^^^ @@ -18,7 +18,7 @@ LL + [0; 200]; | error: a `Vec` of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:28:5 + --> tests/ui/single_range_in_vec_init.rs:27:5 | LL | vec![0..200]; | ^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL + vec![0; 200]; | error: an array of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:30:5 + --> tests/ui/single_range_in_vec_init.rs:29:5 | LL | [0u8..200]; | ^^^^^^^^^^ @@ -52,7 +52,7 @@ LL + [0u8; 200]; | error: an array of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:32:5 + --> tests/ui/single_range_in_vec_init.rs:31:5 | LL | [0usize..200]; | ^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL + [0usize; 200]; | error: an array of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:34:5 + --> tests/ui/single_range_in_vec_init.rs:33:5 | LL | [0..200usize]; | ^^^^^^^^^^^^^ @@ -86,7 +86,7 @@ LL + [0; 200usize]; | error: a `Vec` of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:36:5 + --> tests/ui/single_range_in_vec_init.rs:35:5 | LL | vec![0u8..200]; | ^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL + vec![0u8; 200]; | error: a `Vec` of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:38:5 + --> tests/ui/single_range_in_vec_init.rs:37:5 | LL | vec![0usize..200]; | ^^^^^^^^^^^^^^^^^ @@ -120,7 +120,7 @@ LL + vec![0usize; 200]; | error: a `Vec` of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:40:5 + --> tests/ui/single_range_in_vec_init.rs:39:5 | LL | vec![0..200usize]; | ^^^^^^^^^^^^^^^^^ @@ -137,7 +137,7 @@ LL + vec![0; 200usize]; | error: an array of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:43:5 + --> tests/ui/single_range_in_vec_init.rs:42:5 | LL | [0..200isize]; | ^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL + (0..200isize).collect::>(); | error: a `Vec` of `Range` that is only one element - --> tests/ui/single_range_in_vec_init.rs:45:5 + --> tests/ui/single_range_in_vec_init.rs:44:5 | LL | vec![0..200isize]; | ^^^^^^^^^^^^^^^^^ diff --git a/tests/crashes/111419.rs b/tests/crashes/111419.rs index 3a1a13df1985a..36f15e1d0a26e 100644 --- a/tests/crashes/111419.rs +++ b/tests/crashes/111419.rs @@ -1,6 +1,6 @@ //@ known-bug: #111419 #![allow(incomplete_features)] -#![feature(generic_const_exprs, generic_arg_infer)] +#![feature(generic_const_exprs)] pub trait Example where diff --git a/tests/ui/array-slice-vec/suggest-array-length.fixed b/tests/ui/array-slice-vec/suggest-array-length.fixed index 2eacc2517d310..ae1c6583c238b 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.fixed +++ b/tests/ui/array-slice-vec/suggest-array-length.fixed @@ -10,14 +10,9 @@ fn main() { //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables static REF_STATIK: &[u8; 1] = &[1]; //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables - let foo: [i32; 3] = [1, 2, 3]; - //~^ ERROR using `_` for array lengths is unstable - let bar: [i32; 3] = [0; 3]; - //~^ ERROR using `_` for array lengths is unstable - let ref_foo: &[i32; 3] = &[1, 2, 3]; - //~^ ERROR using `_` for array lengths is unstable - let ref_bar: &[i32; 3] = &[0; 3]; - //~^ ERROR using `_` for array lengths is unstable - let multiple_ref_foo: &&[i32; 3] = &&[1, 2, 3]; - //~^ ERROR using `_` for array lengths is unstable + let foo: [i32; _] = [1, 2, 3]; + let bar: [i32; _] = [0; 3]; + let ref_foo: &[i32; _] = &[1, 2, 3]; + let ref_bar: &[i32; _] = &[0; 3]; + let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; } diff --git a/tests/ui/array-slice-vec/suggest-array-length.rs b/tests/ui/array-slice-vec/suggest-array-length.rs index fb4424cfed99d..e53118014b2a4 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.rs +++ b/tests/ui/array-slice-vec/suggest-array-length.rs @@ -11,13 +11,8 @@ fn main() { static REF_STATIK: &[u8; _] = &[1]; //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables let foo: [i32; _] = [1, 2, 3]; - //~^ ERROR using `_` for array lengths is unstable let bar: [i32; _] = [0; 3]; - //~^ ERROR using `_` for array lengths is unstable let ref_foo: &[i32; _] = &[1, 2, 3]; - //~^ ERROR using `_` for array lengths is unstable let ref_bar: &[i32; _] = &[0; 3]; - //~^ ERROR using `_` for array lengths is unstable let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; - //~^ ERROR using `_` for array lengths is unstable } diff --git a/tests/ui/array-slice-vec/suggest-array-length.stderr b/tests/ui/array-slice-vec/suggest-array-length.stderr index 14d10832e3608..e498f2ca4f580 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.stderr +++ b/tests/ui/array-slice-vec/suggest-array-length.stderr @@ -46,57 +46,6 @@ LL - static REF_STATIK: &[u8; _] = &[1]; LL + static REF_STATIK: &[u8; 1] = &[1]; | -error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:13:20 - | -LL | let foo: [i32; _] = [1, 2, 3]; - | ^ help: consider specifying the array length: `3` - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:15:20 - | -LL | let bar: [i32; _] = [0; 3]; - | ^ help: consider specifying the array length: `3` - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:17:25 - | -LL | let ref_foo: &[i32; _] = &[1, 2, 3]; - | ^ help: consider specifying the array length: `3` - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:19:25 - | -LL | let ref_bar: &[i32; _] = &[0; 3]; - | ^ help: consider specifying the array length: `3` - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:21:35 - | -LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; - | ^ help: consider specifying the array length: `3` - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 9 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0121, E0658. -For more information about an error, try `rustc --explain E0121`. +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/async-await/issues/issue-95307.rs b/tests/ui/async-await/issues/issue-95307.rs index 27903a667fb5c..83df65612b486 100644 --- a/tests/ui/async-await/issues/issue-95307.rs +++ b/tests/ui/async-await/issues/issue-95307.rs @@ -6,7 +6,6 @@ pub trait C { async fn new() -> [u8; _]; //~^ ERROR: the placeholder `_` is not allowed within types on item signatures for functions - //~| ERROR using `_` for array lengths is unstable } fn main() {} diff --git a/tests/ui/async-await/issues/issue-95307.stderr b/tests/ui/async-await/issues/issue-95307.stderr index 90100f391637a..c670686f7c9d5 100644 --- a/tests/ui/async-await/issues/issue-95307.stderr +++ b/tests/ui/async-await/issues/issue-95307.stderr @@ -4,17 +4,6 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures LL | async fn new() -> [u8; _]; | ^ not allowed in type signatures -error[E0658]: using `_` for array lengths is unstable - --> $DIR/issue-95307.rs:7:28 - | -LL | async fn new() -> [u8; _]; - | ^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0121, E0658. -For more information about an error, try `rustc --explain E0121`. +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/closures/binder/forbid_ambig_const_infers.rs b/tests/ui/closures/binder/forbid_ambig_const_infers.rs index e9d783711ee3e..eb258e0ed9f75 100644 --- a/tests/ui/closures/binder/forbid_ambig_const_infers.rs +++ b/tests/ui/closures/binder/forbid_ambig_const_infers.rs @@ -1,4 +1,4 @@ -#![feature(generic_arg_infer, closure_lifetime_binder)] +#![feature(closure_lifetime_binder)] struct Foo([u32; N]); diff --git a/tests/ui/closures/binder/forbid_ambig_type_infers.rs b/tests/ui/closures/binder/forbid_ambig_type_infers.rs index 4e717ef3a179d..ca44a5db96d0f 100644 --- a/tests/ui/closures/binder/forbid_ambig_type_infers.rs +++ b/tests/ui/closures/binder/forbid_ambig_type_infers.rs @@ -1,4 +1,4 @@ -#![feature(generic_arg_infer, closure_lifetime_binder)] +#![feature(closure_lifetime_binder)] struct Foo(T); diff --git a/tests/ui/closures/binder/forbid_const_infer.rs b/tests/ui/closures/binder/forbid_const_infer.rs index f5b8bf188dfee..8c8f0456f503e 100644 --- a/tests/ui/closures/binder/forbid_const_infer.rs +++ b/tests/ui/closures/binder/forbid_const_infer.rs @@ -1,4 +1,4 @@ -#![feature(generic_arg_infer, closure_lifetime_binder)] +#![feature(closure_lifetime_binder)] fn main() { let c = for<'a> |b: &'a [u32; _]| -> u32 { b[0] }; diff --git a/tests/ui/const-generics/associated_const_equality/equality_bound_with_infer.rs b/tests/ui/const-generics/associated_const_equality/equality_bound_with_infer.rs index f45b7c3268b17..dc42e00c2e834 100644 --- a/tests/ui/const-generics/associated_const_equality/equality_bound_with_infer.rs +++ b/tests/ui/const-generics/associated_const_equality/equality_bound_with_infer.rs @@ -1,4 +1,4 @@ -#![feature(generic_arg_infer, associated_const_equality, generic_const_items)] +#![feature(associated_const_equality, generic_const_items)] #![expect(incomplete_features)] // Regression test for #133066 where we would try to evaluate `<() as Foo>::ASSOC<_>` even diff --git a/tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs b/tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs index c1f725db126a0..c3a6767011483 100644 --- a/tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs +++ b/tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs @@ -1,6 +1,5 @@ //@ check-pass -#![feature(generic_arg_infer)] #![crate_type = "lib"] // Test that encoding the hallucinated `DefId` for the `_` const argument doesn't diff --git a/tests/ui/const-generics/generic_arg_infer/array-repeat-expr.rs b/tests/ui/const-generics/generic_arg_infer/array-repeat-expr.rs index 34091badfa7f1..fff9f2cc94d84 100644 --- a/tests/ui/const-generics/generic_arg_infer/array-repeat-expr.rs +++ b/tests/ui/const-generics/generic_arg_infer/array-repeat-expr.rs @@ -1,7 +1,6 @@ //@ run-pass // To avoid having to `or` gate `_` as an expr. -#![feature(generic_arg_infer)] fn foo() -> [u8; 3] { let x: [u8; _] = [0; _]; diff --git a/tests/ui/const-generics/generic_arg_infer/dont-use-defaults.rs b/tests/ui/const-generics/generic_arg_infer/dont-use-defaults.rs index 613ea9da99da3..d4a1468c04965 100644 --- a/tests/ui/const-generics/generic_arg_infer/dont-use-defaults.rs +++ b/tests/ui/const-generics/generic_arg_infer/dont-use-defaults.rs @@ -1,7 +1,4 @@ //@ run-pass -#![feature(generic_arg_infer)] - -// test that we dont use defaults to aide in type inference struct Foo; impl Foo { diff --git a/tests/ui/const-generics/generic_arg_infer/in-signature.rs b/tests/ui/const-generics/generic_arg_infer/in-signature.rs index cd852a269435e..cd0235bf45aa8 100644 --- a/tests/ui/const-generics/generic_arg_infer/in-signature.rs +++ b/tests/ui/const-generics/generic_arg_infer/in-signature.rs @@ -1,5 +1,4 @@ #![crate_type = "rlib"] -#![feature(generic_arg_infer)] struct Foo; struct Bar(T); diff --git a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr index 12d84268f955c..f964fc8d2f2c5 100644 --- a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr +++ b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr @@ -1,5 +1,5 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types - --> $DIR/in-signature.rs:7:21 + --> $DIR/in-signature.rs:6:21 | LL | fn arr_fn() -> [u8; _] { | -----^- @@ -8,7 +8,7 @@ LL | fn arr_fn() -> [u8; _] { | help: replace with the correct return type: `[u8; 3]` error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types - --> $DIR/in-signature.rs:12:24 + --> $DIR/in-signature.rs:11:24 | LL | fn ty_fn() -> Bar { | ---------^- @@ -17,7 +17,7 @@ LL | fn ty_fn() -> Bar { | help: replace with the correct return type: `Bar` error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types - --> $DIR/in-signature.rs:17:25 + --> $DIR/in-signature.rs:16:25 | LL | fn ty_fn_mixed() -> Bar<_, _> { | ----^--^- @@ -27,7 +27,7 @@ LL | fn ty_fn_mixed() -> Bar<_, _> { | help: replace with the correct return type: `Bar` error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants - --> $DIR/in-signature.rs:22:20 + --> $DIR/in-signature.rs:21:20 | LL | const ARR_CT: [u8; _] = [0; 3]; | ^ not allowed in type signatures @@ -39,7 +39,7 @@ LL + const ARR_CT: [u8; 3] = [0; 3]; | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables - --> $DIR/in-signature.rs:24:25 + --> $DIR/in-signature.rs:23:25 | LL | static ARR_STATIC: [u8; _] = [0; 3]; | ^ not allowed in type signatures @@ -51,7 +51,7 @@ LL + static ARR_STATIC: [u8; 3] = [0; 3]; | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants - --> $DIR/in-signature.rs:26:23 + --> $DIR/in-signature.rs:25:23 | LL | const TY_CT: Bar = Bar::(0); | ^ not allowed in type signatures @@ -63,7 +63,7 @@ LL + const TY_CT: Bar = Bar::(0); | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables - --> $DIR/in-signature.rs:28:28 + --> $DIR/in-signature.rs:27:28 | LL | static TY_STATIC: Bar = Bar::(0); | ^ not allowed in type signatures @@ -75,7 +75,7 @@ LL + static TY_STATIC: Bar = Bar::(0); | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants - --> $DIR/in-signature.rs:30:24 + --> $DIR/in-signature.rs:29:24 | LL | const TY_CT_MIXED: Bar<_, _> = Bar::(0); | ^ ^ not allowed in type signatures @@ -89,7 +89,7 @@ LL + const TY_CT_MIXED: Bar = Bar::(0); | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables - --> $DIR/in-signature.rs:32:29 + --> $DIR/in-signature.rs:31:29 | LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::(0); | ^ ^ not allowed in type signatures @@ -103,19 +103,19 @@ LL + static TY_STATIC_MIXED: Bar = Bar::(0); | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types - --> $DIR/in-signature.rs:51:23 + --> $DIR/in-signature.rs:50:23 | LL | type Assoc = [u8; _]; | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types - --> $DIR/in-signature.rs:55:27 + --> $DIR/in-signature.rs:54:27 | LL | type Assoc = Bar; | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types - --> $DIR/in-signature.rs:59:22 + --> $DIR/in-signature.rs:58:22 | LL | type Assoc = Bar<_, _>; | ^ ^ not allowed in type signatures @@ -123,19 +123,19 @@ LL | type Assoc = Bar<_, _>; | not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/in-signature.rs:35:21 + --> $DIR/in-signature.rs:34:21 | LL | const ARR: [u8; _]; | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/in-signature.rs:39:25 + --> $DIR/in-signature.rs:38:25 | LL | const ARR: Bar; | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/in-signature.rs:43:20 + --> $DIR/in-signature.rs:42:20 | LL | const ARR: Bar<_, _>; | ^ ^ not allowed in type signatures diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs index c254b4ee09d2e..dcdcd250ea926 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs @@ -1,5 +1,3 @@ -#![feature(generic_arg_infer)] - struct All<'a, T, const N: usize> { v: &'a T, } diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index a9c57dbf26a0e..88645f839fc57 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -1,17 +1,17 @@ error: expected identifier, found reserved identifier `_` - --> $DIR/infer-arg-test.rs:7:17 + --> $DIR/infer-arg-test.rs:5:17 | LL | struct BadInfer<_>; | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/infer-arg-test.rs:13:17 + --> $DIR/infer-arg-test.rs:11:17 | LL | fn bad_infer_fn<_>() {} | ^ expected identifier, found reserved identifier error[E0392]: type parameter `_` is never used - --> $DIR/infer-arg-test.rs:7:17 + --> $DIR/infer-arg-test.rs:5:17 | LL | struct BadInfer<_>; | ^ unused type parameter @@ -20,7 +20,7 @@ LL | struct BadInfer<_>; = help: if you intended `_` to be a const parameter, use `const _: /* Type */` instead error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supplied - --> $DIR/infer-arg-test.rs:18:10 + --> $DIR/infer-arg-test.rs:16:10 | LL | let a: All<_, _, _>; | ^^^ --- help: remove the unnecessary generic argument @@ -28,7 +28,7 @@ LL | let a: All<_, _, _>; | expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `T`, `N` - --> $DIR/infer-arg-test.rs:3:8 + --> $DIR/infer-arg-test.rs:1:8 | LL | struct All<'a, T, const N: usize> { | ^^^ - -------------- diff --git a/tests/ui/const-generics/generic_arg_infer/infer_arg_and_const_arg.rs b/tests/ui/const-generics/generic_arg_infer/infer_arg_and_const_arg.rs index 35b3fe4f4359b..e82250444d93f 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer_arg_and_const_arg.rs +++ b/tests/ui/const-generics/generic_arg_infer/infer_arg_and_const_arg.rs @@ -1,5 +1,4 @@ //@ check-pass -#![feature(generic_arg_infer)] struct Foo; struct Bar; diff --git a/tests/ui/const-generics/generic_arg_infer/issue-91614.rs b/tests/ui/const-generics/generic_arg_infer/issue-91614.rs index a386b1e5c2bf5..4a3d85499da81 100644 --- a/tests/ui/const-generics/generic_arg_infer/issue-91614.rs +++ b/tests/ui/const-generics/generic_arg_infer/issue-91614.rs @@ -1,5 +1,4 @@ #![feature(portable_simd)] -#![feature(generic_arg_infer)] use std::simd::Mask; fn main() { diff --git a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr index b07e1f29d0d90..164bcc7111ca6 100644 --- a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -1,5 +1,5 @@ error[E0284]: type annotations needed for `Mask<_, _>` - --> $DIR/issue-91614.rs:6:9 + --> $DIR/issue-91614.rs:5:9 | LL | let y = Mask::<_, _>::splat(false); | ^ ------------ type must be known at this point @@ -12,7 +12,7 @@ LL | let y: Mask<_, N> = Mask::<_, _>::splat(false); | ++++++++++++ error[E0284]: type annotations needed for `Mask<_, _>` - --> $DIR/issue-91614.rs:6:9 + --> $DIR/issue-91614.rs:5:9 | LL | let y = Mask::<_, _>::splat(false); | ^ -------------------------- type must be known at this point diff --git a/tests/ui/const-generics/generic_arg_infer/parend_infer.nogate.stderr b/tests/ui/const-generics/generic_arg_infer/parend_infer.nogate.stderr deleted file mode 100644 index d0a5da9676df4..0000000000000 --- a/tests/ui/const-generics/generic_arg_infer/parend_infer.nogate.stderr +++ /dev/null @@ -1,53 +0,0 @@ -error[E0658]: const arguments cannot yet be inferred with `_` - --> $DIR/parend_infer.rs:24:16 - | -LL | let c: Foo<_> = Foo::<1>; - | ^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: const arguments cannot yet be inferred with `_` - --> $DIR/parend_infer.rs:26:16 - | -LL | let c: Foo<(_)> = Foo::<1>; - | ^^^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: const arguments cannot yet be inferred with `_` - --> $DIR/parend_infer.rs:28:16 - | -LL | let c: Foo<(((_)))> = Foo::<1>; - | ^^^^^^^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/parend_infer.rs:17:17 - | -LL | let b: [u8; (_)] = [1; (((((_)))))]; - | ^^^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/parend_infer.rs:17:28 - | -LL | let b: [u8; (_)] = [1; (((((_)))))]; - | ^^^^^^^^^^^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/const-generics/generic_arg_infer/parend_infer.rs b/tests/ui/const-generics/generic_arg_infer/parend_infer.rs index 3dc27a702de40..9d7df8016cb1e 100644 --- a/tests/ui/const-generics/generic_arg_infer/parend_infer.rs +++ b/tests/ui/const-generics/generic_arg_infer/parend_infer.rs @@ -1,6 +1,4 @@ -//@[gate] check-pass -//@ revisions: gate nogate -#![cfg_attr(gate, feature(generic_arg_infer))] +//@ check-pass struct Foo; @@ -15,16 +13,11 @@ fn main() { // AST Exprs similarly preserve parens for pretty printing reasons. #[rustfmt::skip] let b: [u8; (_)] = [1; (((((_)))))]; - //[nogate]~^ error: using `_` for array lengths is unstable - //[nogate]~| error: using `_` for array lengths is unstable let b: [u8; 2] = b; // This is the same case as AST types as the parser doesn't distinguish between const // and type args when they share syntax let c: Foo<_> = Foo::<1>; - //[nogate]~^ error: const arguments cannot yet be inferred with `_` let c: Foo<(_)> = Foo::<1>; - //[nogate]~^ error: const arguments cannot yet be inferred with `_` let c: Foo<(((_)))> = Foo::<1>; - //[nogate]~^ error: const arguments cannot yet be inferred with `_` } diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs index 6093fc70b1696..a82ea45b1232c 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs @@ -1,4 +1,4 @@ -#![feature(generic_const_exprs, generic_arg_infer)] +#![feature(generic_const_exprs)] #![allow(incomplete_features)] // minimized repro for #105205 diff --git a/tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs b/tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs index ed5ba32b62105..eca0404fcd01b 100644 --- a/tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs +++ b/tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs @@ -3,7 +3,7 @@ //@ edition:2021 //@ check-pass -#![feature(generic_const_exprs, generic_arg_infer)] +#![feature(generic_const_exprs)] #![allow(incomplete_features)] #![allow(unused)] @@ -41,17 +41,13 @@ where DigitalFilter::Ba(zpk) } -pub fn zpk2tf_st( - _z: &Arr, - _p: &Arr, -) -> BaFormatFilter<{ N + 1 }> +pub fn zpk2tf_st(_z: &Arr, _p: &Arr) -> BaFormatFilter<{ N + 1 }> where [(); N + 1]: Sized, { BaFormatFilter {} } - fn main() { - iirfilter_st_copy::<4, 2>([10., 50.,]); + iirfilter_st_copy::<4, 2>([10., 50.]); } diff --git a/tests/ui/const-generics/generic_const_parameter_types/bad_inference.rs b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.rs index de2e687e870c4..9748c14d655df 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/bad_inference.rs +++ b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.rs @@ -1,9 +1,4 @@ -#![feature( - adt_const_params, - unsized_const_params, - generic_const_parameter_types, - generic_arg_infer -)] +#![feature(adt_const_params, unsized_const_params, generic_const_parameter_types)] #![allow(incomplete_features)] use std::marker::ConstParamTy_; diff --git a/tests/ui/const-generics/generic_const_parameter_types/bad_inference.stderr b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.stderr index 1ac67fe622b55..4652187b9ce18 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/bad_inference.stderr +++ b/tests/ui/const-generics/generic_const_parameter_types/bad_inference.stderr @@ -1,11 +1,11 @@ error: anonymous constants with inferred types are not yet supported - --> $DIR/bad_inference.rs:17:25 + --> $DIR/bad_inference.rs:12:25 | LL | let a = foo::<_, _, { [12_u8; 2] }>(); | ^^^^^^^^^^^^^^ error: anonymous constants with inferred types are not yet supported - --> $DIR/bad_inference.rs:21:34 + --> $DIR/bad_inference.rs:16:34 | LL | let b: [u8; 2] = foo::<_, _, { [12; _] }>(); | ^^^^^^^^^^^ diff --git a/tests/ui/const-generics/generic_const_parameter_types/evaluate_const_parameter_in_mir.rs b/tests/ui/const-generics/generic_const_parameter_types/evaluate_const_parameter_in_mir.rs index 910deb6632d73..9f3ab1be2502e 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/evaluate_const_parameter_in_mir.rs +++ b/tests/ui/const-generics/generic_const_parameter_types/evaluate_const_parameter_in_mir.rs @@ -1,11 +1,6 @@ //@ check-pass -#![feature( - adt_const_params, - unsized_const_params, - generic_const_parameter_types, - generic_arg_infer -)] +#![feature(adt_const_params, unsized_const_params, generic_const_parameter_types)] #![allow(incomplete_features)] use std::marker::ConstParamTy_; diff --git a/tests/ui/const-generics/generic_const_parameter_types/inferred_from_arg.rs b/tests/ui/const-generics/generic_const_parameter_types/inferred_from_arg.rs index d655fc174ee5c..a4e9aa54c01bb 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/inferred_from_arg.rs +++ b/tests/ui/const-generics/generic_const_parameter_types/inferred_from_arg.rs @@ -1,6 +1,6 @@ //@ check-pass -#![feature(adt_const_params, generic_arg_infer, generic_const_parameter_types)] +#![feature(adt_const_params, generic_const_parameter_types)] #![expect(incomplete_features)] struct Bar; diff --git a/tests/ui/const-generics/generic_const_parameter_types/unrelated_inferred_arg.rs b/tests/ui/const-generics/generic_const_parameter_types/unrelated_inferred_arg.rs index b389e12884ea5..80117a27a23d2 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/unrelated_inferred_arg.rs +++ b/tests/ui/const-generics/generic_const_parameter_types/unrelated_inferred_arg.rs @@ -1,11 +1,6 @@ //@ check-pass -#![feature( - adt_const_params, - unsized_const_params, - generic_const_parameter_types, - generic_arg_infer -)] +#![feature(adt_const_params, unsized_const_params, generic_const_parameter_types)] #![allow(incomplete_features)] use std::marker::ConstParamTy_; diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr index d3d4fa4387109..d7ca0e1e2db59 100644 --- a/tests/ui/const-generics/issues/issue-62878.min.stderr +++ b/tests/ui/const-generics/issues/issue-62878.min.stderr @@ -16,17 +16,6 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | -error[E0658]: const arguments cannot yet be inferred with `_` - --> $DIR/issue-62878.rs:10:11 - | -LL | foo::<_, { [1] }>(); - | ^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0658, E0770. -For more information about an error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0770`. diff --git a/tests/ui/const-generics/issues/issue-62878.rs b/tests/ui/const-generics/issues/issue-62878.rs index c80b46ddbc440..0c143b34ce91e 100644 --- a/tests/ui/const-generics/issues/issue-62878.rs +++ b/tests/ui/const-generics/issues/issue-62878.rs @@ -1,5 +1,5 @@ //@ revisions: full min -#![cfg_attr(full, feature(adt_const_params, generic_arg_infer))] +#![cfg_attr(full, feature(adt_const_params))] #![cfg_attr(full, allow(incomplete_features))] fn foo() {} @@ -8,5 +8,4 @@ fn foo() {} fn main() { foo::<_, { [1] }>(); - //[min]~^ ERROR: const arguments cannot yet be inferred with `_` } diff --git a/tests/ui/const-generics/min_const_generics/inferred_const.rs b/tests/ui/const-generics/min_const_generics/inferred_const.rs index 0256ef732a346..4a4fb417ab1dd 100644 --- a/tests/ui/const-generics/min_const_generics/inferred_const.rs +++ b/tests/ui/const-generics/min_const_generics/inferred_const.rs @@ -1,4 +1,3 @@ -#![feature(generic_arg_infer)] //@ run-pass fn foo(_data: [u32; N]) -> [u32; K] { diff --git a/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr b/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr deleted file mode 100644 index 73e6988b09cc8..0000000000000 --- a/tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0658]: using `_` for array lengths is unstable - --> $DIR/feature-gate-generic_arg_infer.rs:13:18 - | -LL | let _y: [u8; _] = [0; 3]; - | ^ help: consider specifying the array length: `3` - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: const arguments cannot yet be inferred with `_` - --> $DIR/feature-gate-generic_arg_infer.rs:18:20 - | -LL | let _x = foo::<_>([1, 2]); - | ^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/feature-gate-generic_arg_infer.rs:11:27 - | -LL | let _x: [u8; 3] = [0; _]; - | ^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-generic_arg_infer.rs b/tests/ui/feature-gates/feature-gate-generic_arg_infer.rs deleted file mode 100644 index 147978b0557a6..0000000000000 --- a/tests/ui/feature-gates/feature-gate-generic_arg_infer.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ [feature] run-pass -//@ revisions: normal feature - -#![cfg_attr(feature, feature(generic_arg_infer))] - -fn foo(_: [u8; N]) -> [u8; N] { - [0; N] -} - -fn bar() { - let _x: [u8; 3] = [0; _]; - //[normal]~^ ERROR: using `_` for array lengths is unstable - let _y: [u8; _] = [0; 3]; - //[normal]~^ ERROR: using `_` for array lengths is unstable -} - -fn main() { - let _x = foo::<_>([1, 2]); - //[normal]~^ ERROR: const arguments cannot yet be inferred with `_` - bar(); -} diff --git a/tests/ui/lang-items/lang-item-generic-requirements.rs b/tests/ui/lang-items/lang-item-generic-requirements.rs index 25a4ff283ba6a..602c7f534288e 100644 --- a/tests/ui/lang-items/lang-item-generic-requirements.rs +++ b/tests/ui/lang-items/lang-item-generic-requirements.rs @@ -50,14 +50,14 @@ fn ice() { let arr = [0; 5]; //~^ ERROR requires `copy` lang_item let _ = arr[2]; - //~^ ERROR cannot index into a value of type `[{integer}; 5]` + //~^ ERROR: cannot index into a value of type `[{integer}; 5]` // Use phantomdata let _ = MyPhantomData::<(), i32>; // Use Foo let _: () = Foo; - //~^ ERROR mismatched types + //~^ ERROR: mismatched types } // use `start` diff --git a/tests/ui/object-lifetime/object-lifetime-default-inferred.rs b/tests/ui/object-lifetime/object-lifetime-default-inferred.rs index 5abe09e272920..1ab821764de08 100644 --- a/tests/ui/object-lifetime/object-lifetime-default-inferred.rs +++ b/tests/ui/object-lifetime/object-lifetime-default-inferred.rs @@ -4,7 +4,6 @@ #![allow(dead_code)] -#![feature(generic_arg_infer)] trait Test { fn foo(&self) { } diff --git a/tests/ui/parser/issues/issue-14303-fncall.rs b/tests/ui/parser/issues/issue-14303-fncall.rs index 8f7fbec947067..1e8ef6af3fa93 100644 --- a/tests/ui/parser/issues/issue-14303-fncall.rs +++ b/tests/ui/parser/issues/issue-14303-fncall.rs @@ -1,7 +1,5 @@ -//@ revisions: full generic_arg // can't run rustfix because it doesn't handle multipart suggestions correctly // we need the above to avoid ast borrowck failure in recovered code -#![cfg_attr(generic_arg, feature(generic_arg_infer))] struct S<'a, T> { a: &'a T, @@ -10,8 +8,7 @@ struct S<'a, T> { fn foo<'a, 'b>(start: &'a usize, end: &'a usize) { let _x = (*start..*end).map(|x| S { a: start, b: end }).collect::>>(); - //[generic_arg]~^ ERROR placeholder provided when a lifetime was expected - //[full]~^^ ERROR placeholder provided when a lifetime was expected + //~^ ERROR placeholder provided when a lifetime was expected } fn main() {} diff --git a/tests/ui/parser/issues/issue-14303-fncall.stderr b/tests/ui/parser/issues/issue-14303-fncall.stderr new file mode 100644 index 0000000000000..c42a23fa9d3e9 --- /dev/null +++ b/tests/ui/parser/issues/issue-14303-fncall.stderr @@ -0,0 +1,9 @@ +error[E0747]: placeholder provided when a lifetime was expected + --> $DIR/issue-14303-fncall.rs:10:77 + | +LL | let _x = (*start..*end).map(|x| S { a: start, b: end }).collect::>>(); + | ^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/pattern/slice-array-infer.rs b/tests/ui/pattern/slice-array-infer.rs index fdead488ea11d..8d471b31beaf6 100644 --- a/tests/ui/pattern/slice-array-infer.rs +++ b/tests/ui/pattern/slice-array-infer.rs @@ -1,7 +1,6 @@ //@ check-pass #![allow(unused_variables)] -#![feature(generic_arg_infer)] struct Zeroes; impl Into<&'static [usize; 3]> for Zeroes { diff --git a/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs index 6115146539c19..722fdae6c99a2 100644 --- a/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs +++ b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs @@ -1,5 +1,3 @@ -#![feature(generic_arg_infer)] - // Test when deferring repeat expr copy checks to end of typechecking whether elements // that are const items allow for repeat counts to go uninferred without an error being // emitted if they would later wind up inferred by integer fallback. diff --git a/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr index 2f52537fa9407..9c9cfefd66383 100644 --- a/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr +++ b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr @@ -1,5 +1,5 @@ error[E0284]: type annotations needed for `[String; _]` - --> $DIR/copy-check-const-element-uninferred-count.rs:64:9 + --> $DIR/copy-check-const-element-uninferred-count.rs:62:9 | LL | let a = [const { String::new() }; _]; | ^ ---------------------------- type must be known at this point diff --git a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs index 3f310f07de0fe..a6bd5b299c96a 100644 --- a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs +++ b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs @@ -1,5 +1,3 @@ -#![feature(generic_arg_infer)] - // Test when deferring repeat expr copy checks to end of typechecking whether they're // checked before integer fallback occurs or not. We accomplish this by having a repeat // count that can only be inferred after integer fallback has occured. This test will diff --git a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr index 103b074dda7c8..0cd7ebe7494ff 100644 --- a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr +++ b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed for `[Foo<{integer}>; _]` - --> $DIR/copy-check-deferred-after-fallback.rs:39:9 + --> $DIR/copy-check-deferred-after-fallback.rs:37:9 | LL | let b = [Foo(PhantomData); _]; | ^ ---------------- type must be known at this point diff --git a/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs b/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs index 4fbb8f0a00caf..23b13348f5a67 100644 --- a/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs +++ b/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs @@ -1,5 +1,4 @@ //@ check-pass -#![feature(generic_arg_infer)] // Test when deferring repeat expr checks to end of typechecking whether they're // checked before integer fallback occurs. We accomplish this by having the repeat diff --git a/tests/ui/repeat-expr/copy-check-inference-side-effects.rs b/tests/ui/repeat-expr/copy-check-inference-side-effects.rs index 4e3bfdead26b4..8587f1f9ce91c 100644 --- a/tests/ui/repeat-expr/copy-check-inference-side-effects.rs +++ b/tests/ui/repeat-expr/copy-check-inference-side-effects.rs @@ -1,5 +1,3 @@ -#![feature(generic_arg_infer)] - struct Foo; impl Clone for Foo<1> { diff --git a/tests/ui/repeat-expr/copy-check-inference-side-effects.stderr b/tests/ui/repeat-expr/copy-check-inference-side-effects.stderr index 505beff0f6b2e..bf4ae9b60bb31 100644 --- a/tests/ui/repeat-expr/copy-check-inference-side-effects.stderr +++ b/tests/ui/repeat-expr/copy-check-inference-side-effects.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed for `[Foo<_>; 2]` - --> $DIR/copy-check-inference-side-effects.rs:17:9 + --> $DIR/copy-check-inference-side-effects.rs:15:9 | LL | let a /* : [Foo; 2] */ = [Foo::<_>; 2]; | ^ @@ -13,7 +13,7 @@ LL | let a: [Foo; 2] /* : [Foo; 2] */ = [Foo::<_>; 2]; | +++++++++++++ error[E0282]: type annotations needed for `[String; _]` - --> $DIR/copy-check-inference-side-effects.rs:27:9 + --> $DIR/copy-check-inference-side-effects.rs:25:9 | LL | let b /* : [String; ?x] */ = ["string".to_string(); _]; | ^ -------------------- type must be known at this point diff --git a/tests/ui/repeat-expr/copy-check-when-count-inferred-later.rs b/tests/ui/repeat-expr/copy-check-when-count-inferred-later.rs index b9d123cbefae6..72467e6f32e24 100644 --- a/tests/ui/repeat-expr/copy-check-when-count-inferred-later.rs +++ b/tests/ui/repeat-expr/copy-check-when-count-inferred-later.rs @@ -1,5 +1,3 @@ -#![feature(generic_arg_infer)] - // Test that we enforce repeat expr element types are `Copy` even // when the repeat count is only inferred at a later point in type // checking. diff --git a/tests/ui/repeat-expr/copy-check-when-count-inferred-later.stderr b/tests/ui/repeat-expr/copy-check-when-count-inferred-later.stderr index 1c862f2b606a8..6b8049e77cc51 100644 --- a/tests/ui/repeat-expr/copy-check-when-count-inferred-later.stderr +++ b/tests/ui/repeat-expr/copy-check-when-count-inferred-later.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/copy-check-when-count-inferred-later.rs:8:14 + --> $DIR/copy-check-when-count-inferred-later.rs:6:14 | LL | let a = [String::new(); _]; | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` diff --git a/tests/ui/repeat-expr/dont-require-copy-on-infer.rs b/tests/ui/repeat-expr/dont-require-copy-on-infer.rs index e81bf1595be1f..ad0e4bd2be0ce 100644 --- a/tests/ui/repeat-expr/dont-require-copy-on-infer.rs +++ b/tests/ui/repeat-expr/dont-require-copy-on-infer.rs @@ -1,5 +1,4 @@ //@ check-pass -#![feature(generic_arg_infer)] fn main() { let a: [_; 1] = [String::new(); _]; diff --git a/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.rs b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.rs index eb70df62996fb..df79ad51b4215 100644 --- a/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.rs +++ b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.rs @@ -1,5 +1,3 @@ -#![feature(generic_arg_infer)] - struct Foo; impl Clone for Foo<1> { diff --git a/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.stderr b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.stderr index 04f8ff33fdab3..bf1e46e4ef829 100644 --- a/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.stderr +++ b/tests/ui/repeat-expr/no-conservative-copy-impl-requirement.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed for `&[Foo<_>; _]` - --> $DIR/no-conservative-copy-impl-requirement.rs:17:9 + --> $DIR/no-conservative-copy-impl-requirement.rs:15:9 | LL | let x = &[Foo::<_>; _]; | ^ -------- type must be known at this point diff --git a/tests/ui/simd/const-err-trumps-simd-err.rs b/tests/ui/simd/const-err-trumps-simd-err.rs index 8d9870855f807..33f0abb06f3ea 100644 --- a/tests/ui/simd/const-err-trumps-simd-err.rs +++ b/tests/ui/simd/const-err-trumps-simd-err.rs @@ -4,7 +4,6 @@ //! Make sure that monomorphization-time const errors from `static_assert` take priority over the //! error from simd_extract. Basically this checks that if a const fails to evaluate in some //! function, we don't bother codegen'ing the function. -#![feature(generic_arg_infer)] #![feature(core_intrinsics)] #![feature(repr_simd)] diff --git a/tests/ui/simd/const-err-trumps-simd-err.stderr b/tests/ui/simd/const-err-trumps-simd-err.stderr index d4ba54a28da7e..93d1fce637f2f 100644 --- a/tests/ui/simd/const-err-trumps-simd-err.stderr +++ b/tests/ui/simd/const-err-trumps-simd-err.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation panicked: assertion failed: LANE < 4 - --> $DIR/const-err-trumps-simd-err.rs:18:13 + --> $DIR/const-err-trumps-simd-err.rs:17:13 | LL | const { assert!(LANE < 4); } // the error should be here... | ^^^^^^^^^^^^^^^^^ evaluation of `get_elem::<4>::{constant#0}` failed here note: erroneous constant encountered - --> $DIR/const-err-trumps-simd-err.rs:18:5 + --> $DIR/const-err-trumps-simd-err.rs:17:5 | LL | const { assert!(LANE < 4); } // the error should be here... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the above error was encountered while instantiating `fn get_elem::<4>` - --> $DIR/const-err-trumps-simd-err.rs:24:5 + --> $DIR/const-err-trumps-simd-err.rs:23:5 | LL | get_elem::<4>(int8x4_t([0, 0, 0, 0])); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/span/issue-42234-unknown-receiver-type.rs b/tests/ui/span/issue-42234-unknown-receiver-type.rs index 53d1e3eed820e..8f7bbf0fe5e09 100644 --- a/tests/ui/span/issue-42234-unknown-receiver-type.rs +++ b/tests/ui/span/issue-42234-unknown-receiver-type.rs @@ -1,6 +1,3 @@ -//@ revisions: full generic_arg -#![cfg_attr(generic_arg, feature(generic_arg_infer))] - // When the type of a method call's receiver is unknown, the span should point // to the receiver (and not the entire call, as was previously the case before // the fix of which this tests). diff --git a/tests/ui/span/issue-42234-unknown-receiver-type.stderr b/tests/ui/span/issue-42234-unknown-receiver-type.stderr new file mode 100644 index 0000000000000..10308ec07da5a --- /dev/null +++ b/tests/ui/span/issue-42234-unknown-receiver-type.stderr @@ -0,0 +1,23 @@ +error[E0282]: type annotations needed + --> $DIR/issue-42234-unknown-receiver-type.rs:6:24 + | +LL | let x: Option<_> = None; + | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` +LL | x.unwrap().method_that_could_exist_on_some_type(); + | ---------- type must be known at this point + | +help: consider specifying the generic argument + | +LL | let x: Option<_> = None::; + | +++++ + +error[E0282]: type annotations needed + --> $DIR/issue-42234-unknown-receiver-type.rs:12:10 + | +LL | .sum::<_>() + | ^^^ cannot infer type of the type parameter `S` declared on the method `sum` + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/const-traits/tilde-const-and-const-params.rs b/tests/ui/traits/const-traits/tilde-const-and-const-params.rs index 706c77b6200a8..428223d92c01e 100644 --- a/tests/ui/traits/const-traits/tilde-const-and-const-params.rs +++ b/tests/ui/traits/const-traits/tilde-const-and-const-params.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![feature(generic_arg_infer)] #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr b/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr index f77d63db054a0..95e684bd0c47d 100644 --- a/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr +++ b/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr @@ -1,35 +1,35 @@ error: `~const` is not allowed here - --> $DIR/tilde-const-and-const-params.rs:9:15 + --> $DIR/tilde-const-and-const-params.rs:8:15 | LL | fn add(self) -> Foo<{ A::add(N) }> { | ^^^^^^ | note: this function is not `const`, so it cannot have `~const` trait bounds - --> $DIR/tilde-const-and-const-params.rs:9:8 + --> $DIR/tilde-const-and-const-params.rs:8:8 | LL | fn add(self) -> Foo<{ A::add(N) }> { | ^^^ error: `~const` is not allowed here - --> $DIR/tilde-const-and-const-params.rs:27:11 + --> $DIR/tilde-const-and-const-params.rs:26:11 | LL | fn bar(_: Foo) -> Foo<{ A::add(N) }> { | ^^^^^^ | note: this function is not `const`, so it cannot have `~const` trait bounds - --> $DIR/tilde-const-and-const-params.rs:27:4 + --> $DIR/tilde-const-and-const-params.rs:26:4 | LL | fn bar(_: Foo) -> Foo<{ A::add(N) }> { | ^^^ error[E0277]: the trait bound `A: const Add42` is not satisfied - --> $DIR/tilde-const-and-const-params.rs:27:61 + --> $DIR/tilde-const-and-const-params.rs:26:61 | LL | fn bar(_: Foo) -> Foo<{ A::add(N) }> { | ^ error[E0277]: the trait bound `A: const Add42` is not satisfied - --> $DIR/tilde-const-and-const-params.rs:9:44 + --> $DIR/tilde-const-and-const-params.rs:8:44 | LL | fn add(self) -> Foo<{ A::add(N) }> { | ^