Skip to content

#[stable], #[unstable], #[deprecated] are not errors when used non-#[staged_api] crates #22830

Closed
@huonw

Description

@huonw
Member

They are ignored, but silently. It is probably better if we make them errors to give us room to build some future system with those nice names.

This compiles without a peep from rustc:

#![allow(dead_code)]

#[stable]
fn foo() {}
#[deprecated] 
struct Bar;
#[unstable]
type X = i8;

fn main() {}

Activity

nagisa

nagisa commented on Feb 26, 2015

@nagisa
Member

Willing to pick this up.

One thing to note, that it will 100% cause breakage outside the compiler, and possibly inside as well.

brson

brson commented on Feb 26, 2015

@brson
Contributor

I did it this way to avoid breakage for people who were using them. We might put in deprecation warnings for a few weeks.

huonw

huonw commented on Feb 26, 2015

@huonw
MemberAuthor

I'm in favour of a smooth deprecation path via warnings! :)

pnkfelix

pnkfelix commented on Feb 26, 2015

@pnkfelix
Member

@alexcrichton asks whether the unused-attribute lint would catch these, or if they are unconditonally marked as used.

Either way, some sort of warning sounds good.

pnkfelix

pnkfelix commented on Feb 26, 2015

@pnkfelix
Member

1.0 polish, P-high.

added this to the 1.0 milestone on Feb 26, 2015
sfackler

sfackler commented on Feb 26, 2015

@sfackler
Member

@pnkfelix they are unconditionally marked as used.

self-assigned this
on Apr 9, 2015
brson

brson commented on Apr 13, 2015

@brson
Contributor

Ugh, I'm wishing I had done this a lot sooner. Working on a patch for this now, but it's probably going to cause some breakage. I'll see if I can guess how much.

brson

brson commented on Apr 13, 2015

@brson
Contributor

Here's the list of current out-of-tree usage of stability attributes https://gist.github.com/brson/1dd62761ee8dff6cdcaa

alexcrichton

alexcrichton commented on Apr 24, 2015

@alexcrichton
Member

This was fixed and backported to beta recently, yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @alexcrichton@brson@pnkfelix@nagisa@huonw

      Issue actions

        #[stable], #[unstable], #[deprecated] are not errors when used non-#[staged_api] crates · Issue #22830 · rust-lang/rust