Skip to content

Commit

Permalink
Rollup merge of rust-lang#113469 - JohnTitor:rm-default-free-fn, r=Am…
Browse files Browse the repository at this point in the history
…anieu

Remove `default_free_fn` feature

Closes rust-lang#73014
r? `@Amanieu`
  • Loading branch information
matthiaskrgr committed Jul 9, 2023
2 parents 733611d + a088e79 commit 28ed0ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 107 deletions.
45 changes: 0 additions & 45 deletions library/core/src/default.rs
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
@@ -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

0 comments on commit 28ed0ec

Please sign in to comment.