Skip to content

Clean out deprecated functions and syntax #14360

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

Merged
merged 2 commits into from
May 23, 2014

Conversation

alexcrichton
Copy link
Member

These have all been deprecated for awhile now, so it's likely time to start removing them.

@lilyball
Copy link
Contributor

How long should functions remain deprecated before it's ok to remove them? I didn't realize it was so recent, but all the rev-iter stuff was only deprecated 1 month ago.

fn choose_option<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
self.choose(values)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too early to remove this, it just got deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I thought this was deprecated in the same batch as shuffle, reverted.

@lilyball
Copy link
Contributor

When did we release rust 0.10? We shouldn't remove anything deprecated since then (unless it's something that was added since then as well).

@alexcrichton
Copy link
Member Author

There is currently no hard deadline before which something cannot be removed.

@lilyball
Copy link
Contributor

As for the syntax stuff, I'm all for removing all the obsolete syntax. 2 questions about it though:

  1. If we're removing the obsolete warning for const, are we still intentionally keeping it around as a keyword? If so, could we move it into the 'reserved section of the keywords list? I'm unclear as to whether we have any flexibility in reordering that list.
  2. In the parser, right after the obsolete code you removed for token::AT, there's the stuff for token::TILDE. I haven't checked, we don't literally transform box foo into ~foo, do we? Assuming we don't, then we should probably officially obsolete the ~[1,2,3] syntax (which we currently still accept, but which should be replaced with box [1,2,3]).

@Sawyer47
Copy link
Contributor

Wasn't libdebug added by mistake to the first commit?

@alexcrichton
Copy link
Member Author

We shouldn't remove anything deprecated since then

That's one way to approach this, but we also barely place any meaning on releases right now.

If we're removing the obsolete warning for const, are we still intentionally keeping it around as a keyword?

Looks like it can move to the reserved category

In the parser, right after the obsolete code you removed for token::AT, there's the stuff for token::TILDE.

The tilde parts are still obsolete (just a week or so old).

@alexcrichton
Copy link
Member Author

Oops, thanks for pointing that out @Sawyer47

@lilyball
Copy link
Contributor

The tilde parts are still obsolete (just a week or so old).

Right, but we didn't obsolete ~[1,2,3]. I'm saying we should do that. We only obsoleted everything else to do with ~.

@lilyball
Copy link
Contributor

I guess we didn't start actually using #[deprecated] until very recently, so we have a bunch of post-0.10 changes that don't have nice deprecations anyway.

Given that, I suppose it's ok to go ahead and remove this stuff. We're also going to have to remove all deprecations before minting 1.0 anyway, so it's not like people can expect to go from point-release to point-release and get proper deprecations (which is to say, anyone moving from whatever our final point-release is to 1.0 will not get any deprecations anyway).

And since your goal here is to remove warnings, while I'd like to see ~[1,2,3] made obsolete, that is perhaps more suitable for a separate PR.

@lilyball
Copy link
Contributor

Unless you think we have reason to keep it, we can probably remove token::DARROW entirely.

@alexcrichton
Copy link
Member Author

Removed DARROW, and I believe that @pcwalton is churning away on obliterating ~ vectors and patterns.

All of these features have been obsolete since February 2014, where most have
been obsolete since 2013. There shouldn't be any more need to keep around the
parser hacks after this length of time.
bors added a commit that referenced this pull request May 23, 2014
These have all been deprecated for awhile now, so it's likely time to start removing them.
@bors bors closed this May 23, 2014
@bors bors merged commit 33573bc into rust-lang:master May 23, 2014
@alexcrichton alexcrichton deleted the remove-deprecated branch May 28, 2014 02:31
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 15, 2025
)

Adds an internal lint to check for `#[derive(serde::Deserialize)]`
without
[`#[serde(deny_unknown_fields)]`](https://serde.rs/container-attrs.html#deny_unknown_fields).

Today, if you run Clippy with the following clippy.toml, Clippy will
produce a warning, but there will be no accompanying note:
```toml
# In the following configuration, "recommendation" should be "reason" or "replacement".
disallowed-macros = [
    { path = "std::panic", recommendation = "return a `std::result::Result::Error` instead" },
]
```
```sh
$ cargo clippy
    Checking a v0.1.0 (/home/smoelius/tmp/a)
warning: use of a disallowed macro `std::panic`
 --> src/lib.rs:2:5
  |
2 |     panic!();
  |     ^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_macros
  = note: `#[warn(clippy::disallowed_macros)]` on by default
```
The underlying problem is: the enum that derives `serde::Deserialize`
([`DisallowedPathEnum`](https://github.com/rust-lang/rust-clippy/blob/81643e297cf44ce3c7648b8443fc4d6592fa81eb/clippy_config/src/types.rs#L47))
does not have the attribute `#[serde(deny_unknown_fields)]`.

This lint identifies such problems by checking trait `impl`s. An
alternative I considered was to walk `clippy_config::conf::Conf`
directly. However, that would not catch the `DisallowedPathEnum` case
because it [is not used in `Conf`
directly](https://github.com/rust-lang/rust-clippy/blob/81643e297cf44ce3c7648b8443fc4d6592fa81eb/clippy_config/src/types.rs#L31).

Just to be clear, no one asked for this. So I hope the maintainers do
not mind.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants