Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default_free_fn feature #113469

Merged
merged 1 commit into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions library/core/src/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,51 +133,6 @@ pub trait Default: Sized {
fn default() -> Self;
}

/// Return the default value of a type according to the `Default` trait.
///
/// The type to return is inferred from context; this is equivalent to
/// `Default::default()` but shorter to type.
///
/// For example:
/// ```
/// #![feature(default_free_fn)]
///
/// use std::default::default;
///
/// #[derive(Default)]
/// struct AppConfig {
/// foo: FooConfig,
/// bar: BarConfig,
/// }
///
/// #[derive(Default)]
/// struct FooConfig {
/// foo: i32,
/// }
///
/// #[derive(Default)]
/// struct BarConfig {
/// bar: f32,
/// baz: u8,
/// }
///
/// fn main() {
/// let options = AppConfig {
/// foo: default(),
/// bar: BarConfig {
/// bar: 10.1,
/// ..default()
/// },
/// };
/// }
/// ```
#[unstable(feature = "default_free_fn", issue = "73014")]
#[must_use]
#[inline]
pub fn default<T: Default>() -> T {
Default::default()
}

/// Derive macro generating an impl of the trait `Default`.
#[rustc_builtin_macro(Default, attributes(default))]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
Expand Down
47 changes: 0 additions & 47 deletions src/doc/unstable-book/src/library-features/default-free-fn.md

This file was deleted.

21 changes: 6 additions & 15 deletions tests/ui/resolve/issue-2356.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
error[E0425]: cannot find function `default` in this scope
--> $DIR/issue-2356.rs:31:5
|
LL | default();
| ^^^^^^^
|
help: you might have meant to call the associated function
|
LL | Self::default();
| ~~~~~~~~~~~~~
help: consider importing this function
|
LL + use std::default::default;
|

error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:39:5
|
Expand Down Expand Up @@ -64,6 +49,12 @@ error[E0425]: cannot find function `clone` in this scope
LL | clone();
| ^^^^^ help: you might have meant to call the method: `self.clone`

error[E0425]: cannot find function `default` in this scope
--> $DIR/issue-2356.rs:31:5
|
LL | default();
| ^^^^^^^ help: you might have meant to call the associated function: `Self::default`

error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:41:5
|
Expand Down