Skip to content

Commit ec479ba

Browse files
authored
Rollup merge of rust-lang#113469 - JohnTitor:rm-default-free-fn, r=Amanieu
Remove `default_free_fn` feature Closes rust-lang#73014 r? ``@Amanieu``
2 parents a46589f + a088e79 commit ec479ba

File tree

3 files changed

+6
-107
lines changed

3 files changed

+6
-107
lines changed

library/core/src/default.rs

-45
Original file line numberDiff line numberDiff line change
@@ -133,51 +133,6 @@ pub trait Default: Sized {
133133
fn default() -> Self;
134134
}
135135

136-
/// Return the default value of a type according to the `Default` trait.
137-
///
138-
/// The type to return is inferred from context; this is equivalent to
139-
/// `Default::default()` but shorter to type.
140-
///
141-
/// For example:
142-
/// ```
143-
/// #![feature(default_free_fn)]
144-
///
145-
/// use std::default::default;
146-
///
147-
/// #[derive(Default)]
148-
/// struct AppConfig {
149-
/// foo: FooConfig,
150-
/// bar: BarConfig,
151-
/// }
152-
///
153-
/// #[derive(Default)]
154-
/// struct FooConfig {
155-
/// foo: i32,
156-
/// }
157-
///
158-
/// #[derive(Default)]
159-
/// struct BarConfig {
160-
/// bar: f32,
161-
/// baz: u8,
162-
/// }
163-
///
164-
/// fn main() {
165-
/// let options = AppConfig {
166-
/// foo: default(),
167-
/// bar: BarConfig {
168-
/// bar: 10.1,
169-
/// ..default()
170-
/// },
171-
/// };
172-
/// }
173-
/// ```
174-
#[unstable(feature = "default_free_fn", issue = "73014")]
175-
#[must_use]
176-
#[inline]
177-
pub fn default<T: Default>() -> T {
178-
Default::default()
179-
}
180-
181136
/// Derive macro generating an impl of the trait `Default`.
182137
#[rustc_builtin_macro(Default, attributes(default))]
183138
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]

src/doc/unstable-book/src/library-features/default-free-fn.md

-47
This file was deleted.

tests/ui/resolve/issue-2356.stderr

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
error[E0425]: cannot find function `default` in this scope
2-
--> $DIR/issue-2356.rs:31:5
3-
|
4-
LL | default();
5-
| ^^^^^^^
6-
|
7-
help: you might have meant to call the associated function
8-
|
9-
LL | Self::default();
10-
| ~~~~~~~~~~~~~
11-
help: consider importing this function
12-
|
13-
LL + use std::default::default;
14-
|
15-
161
error[E0425]: cannot find value `whiskers` in this scope
172
--> $DIR/issue-2356.rs:39:5
183
|
@@ -64,6 +49,12 @@ error[E0425]: cannot find function `clone` in this scope
6449
LL | clone();
6550
| ^^^^^ help: you might have meant to call the method: `self.clone`
6651

52+
error[E0425]: cannot find function `default` in this scope
53+
--> $DIR/issue-2356.rs:31:5
54+
|
55+
LL | default();
56+
| ^^^^^^^ help: you might have meant to call the associated function: `Self::default`
57+
6758
error[E0425]: cannot find function `shave` in this scope
6859
--> $DIR/issue-2356.rs:41:5
6960
|

0 commit comments

Comments
 (0)