You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #30724 - nikomatsakis:feature-gate-defaulted-type-parameters, r=pnkfelix
It was recently realized that we accept defaulted type parameters everywhere, without feature gate, even though the only place that we really *intended* to accept them were on types. This PR adds a lint warning unless the "type-parameter-defaults" feature is enabled. This should eventually become a hard error.
This is a [breaking-change] in that new feature gates are required (or simply removing the defaults, which is probably a better choice as they have little effect at this time). Results of a [crater run][crater] suggest that approximately 5-15 crates are affected. I didn't do the measurement quite right so that run cannot distinguish "true" regressions from "non-root" regressions, but even the upper bound of 15 affected crates seems relatively minimal.
[crater]: https://gist.github.com/nikomatsakis/760c6a67698bd24253bf
cc @rust-lang/lang
r? @pnkfelix
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+
// option. This file may not be copied, modified, or distributed
9
+
// except according to those terms.
10
+
11
+
#![deny(future_incompatible)]
12
+
#![allow(dead_code)]
13
+
14
+
fnavg<T=i32>(_:T){}
15
+
//~^ ERROR defaults for type parameters are only allowed
0 commit comments