Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9d9b55c

Browse files
committed
make invalid_type_param_default lint show up in cargo future-compat reports
and remove the feature gate that silenced the lint
1 parent b286722 commit 9d9b55c

File tree

12 files changed

+115
-30
lines changed

12 files changed

+115
-30
lines changed

‎compiler/rustc_feature/src/removed.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ declare_features! (
7575
/// Allows the use of `#[derive(Anything)]` as sugar for `#[derive_Anything]`.
7676
(removed, custom_derive, "1.32.0", Some(29644),
7777
Some("subsumed by `#[proc_macro_derive]`")),
78+
/// Allows default type parameters to influence type inference.
79+
(removed, default_type_parameter_fallback, "CURRENT_RUSTC_VERSION", Some(27336),
80+
Some("never properly implemented; requires significant design work")),
7881
/// Allows using `#[doc(keyword = "...")]`.
7982
(removed, doc_keyword, "1.28.0", Some(51315),
8083
Some("merged into `#![feature(rustdoc_internals)]`")),

‎compiler/rustc_feature/src/unstable.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,6 @@ declare_features! (
428428
(unstable, custom_test_frameworks, "1.30.0", Some(50297)),
429429
/// Allows declarative macros 2.0 (`macro`).
430430
(unstable, decl_macro, "1.17.0", Some(39412)),
431-
/// Allows default type parameters to influence type inference.
432-
(unstable, default_type_parameter_fallback, "1.3.0", Some(27336)),
433431
/// Allows using `#[deprecated_safe]` to deprecate the safeness of a function or trait
434432
(unstable, deprecated_safe, "1.61.0", Some(94978)),
435433
/// Allows having using `suggestion` in the `#[deprecated]` attribute.

‎compiler/rustc_hir_analysis/src/collect/generics_of.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
323323
if default.is_some() {
324324
match allow_defaults {
325325
Defaults::Allowed => {}
326-
Defaults::FutureCompatDisallowed
327-
if tcx.features().default_type_parameter_fallback => {}
328326
Defaults::FutureCompatDisallowed => {
329327
tcx.node_span_lint(
330328
lint::builtin::INVALID_TYPE_PARAM_DEFAULT,

‎compiler/rustc_lint_defs/src/builtin.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ declare_lint! {
12411241
Deny,
12421242
"type parameter default erroneously allowed in invalid location",
12431243
@future_incompatible = FutureIncompatibleInfo {
1244-
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
1244+
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
12451245
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
12461246
};
12471247
}

‎tests/ui/feature-gates/feature-gate-default_type_parameter_fallback.stderr‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎tests/ui/impl-trait/where-allowed.stderr‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,25 @@ error: aborting due to 50 previous errors
433433

434434
Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0599, E0658, E0666.
435435
For more information about an error, try `rustc --explain E0053`.
436+
Future incompatibility report: Future breakage diagnostic:
437+
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
438+
--> $DIR/where-allowed.rs:239:7
439+
|
440+
LL | impl <T = impl Debug> T {}
441+
| ^^^^^^^^^^^^^^
442+
|
443+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
444+
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
445+
= note: `#[deny(invalid_type_param_default)]` on by default
446+
447+
Future breakage diagnostic:
448+
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
449+
--> $DIR/where-allowed.rs:246:36
450+
|
451+
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
452+
| ^^^^^^^^^^^^^^
453+
|
454+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
455+
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
456+
= note: `#[deny(invalid_type_param_default)]` on by default
457+

‎tests/ui/issues/issue-26812.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#![feature(default_type_parameter_fallback)]
2-
31
fn avg<T=T::Item>(_: T) {}
42
//~^ ERROR generic parameters with a default cannot use forward declared identifiers
3+
//~| ERROR defaults for type parameters
4+
//~| WARN previously accepted
55

66
fn main() {}

‎tests/ui/issues/issue-26812.stderr‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
error[E0128]: generic parameters with a default cannot use forward declared identifiers
2-
--> $DIR/issue-26812.rs:3:10
2+
--> $DIR/issue-26812.rs:1:10
33
|
44
LL | fn avg<T=T::Item>(_: T) {}
55
| ^^^^^^^ defaulted generic parameters cannot be forward declared
66

7-
error: aborting due to 1 previous error
7+
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
8+
--> $DIR/issue-26812.rs:1:8
9+
|
10+
LL | fn avg<T=T::Item>(_: T) {}
11+
| ^^^^^^^^^
12+
|
13+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14+
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
15+
= note: `#[deny(invalid_type_param_default)]` on by default
16+
17+
error: aborting due to 2 previous errors
818

919
For more information about this error, try `rustc --explain E0128`.
20+
Future incompatibility report: Future breakage diagnostic:
21+
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
22+
--> $DIR/issue-26812.rs:1:8
23+
|
24+
LL | fn avg<T=T::Item>(_: T) {}
25+
| ^^^^^^^^^
26+
|
27+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
28+
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
29+
= note: `#[deny(invalid_type_param_default)]` on by default
30+

‎tests/ui/lifetimes/unusual-rib-combinations.stderr‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,14 @@ error: aborting due to 8 previous errors
6868

6969
Some errors have detailed explanations: E0106, E0214, E0308, E0770.
7070
For more information about an error, try `rustc --explain E0106`.
71+
Future incompatibility report: Future breakage diagnostic:
72+
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
73+
--> $DIR/unusual-rib-combinations.rs:15:6
74+
|
75+
LL | fn c<T = u8()>() {}
76+
| ^^^^^^^^
77+
|
78+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
79+
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
80+
= note: `#[deny(invalid_type_param_default)]` on by default
81+

‎tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,13 @@ LL | foo::<T, U>();
1212
error: aborting due to 1 previous error
1313

1414
For more information about this error, try `rustc --explain E0282`.
15+
Future incompatibility report: Future breakage diagnostic:
16+
warning: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
17+
--> $DIR/unbounded-type-param-in-fn-with-assoc-type.rs:3:11
18+
|
19+
LL | fn foo<T, U = u64>() -> (T, U) {
20+
| ^^^^^^^
21+
|
22+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
23+
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
24+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /