Skip to content

rustc: Add a lint for the obsolete crate-level link attribute #11091

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 1 commit into from
Dec 24, 2013
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
1 change: 0 additions & 1 deletion src/etc/combine-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def scrub(b):
// AUTO-GENERATED FILE: DO NOT EDIT
#[crate_id=\"run_pass_stage2#0.1\"];
#[pkgid=\"run_pass_stage2#0.1\"];
#[link(name=\"run_pass_stage2\", vers=\"0.1\")];
#[feature(globs, macro_rules, struct_variant, managed_boxes)];
#[allow(warnings)];
"""
Expand Down
6 changes: 6 additions & 0 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,12 @@ fn check_crate_attrs_usage(cx: &Context, attrs: &[ast::Attribute]) {
if !iter.any(|other_attr| { name.equiv(other_attr) }) {
cx.span_lint(attribute_usage, attr.span, "unknown crate attribute");
}
if name.equiv(& &"link") {
cx.tcx.sess.span_err(attr.span,
"obsolete crate `link` attribute");
cx.tcx.sess.note("the link attribute has been superceded by the crate_id \
attribute, which has the format `#[crate_id = \"name#version\"]`");
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/cci_impl_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="cci_impl_lib"];
// NOTE: remove after the next snapshot
#[link(name="cci_impl_lib", vers="0.0")];

trait uint_helpers {
fn to(&self, v: uint, f: |uint|);
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/cci_iter_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="cci_iter_lib"];
// NOTE: remove after the next snapshot
#[link(name="cci_iter_lib", vers="0.0")];

#[inline]
pub fn iter<T>(v: &[T], f: |&T|) {
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/cci_no_inline_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="cci_no_inline_lib"];
// NOTE: remove after the next snapshot
#[link(name="cci_no_inline_lib", vers="0.0")];

// same as cci_iter_lib, more-or-less, but not marked inline
pub fn iter(v: ~[uint], f: |uint|) {
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#[feature(managed_boxes)];
#[crate_id="crate_method_reexport_grrrrrrr2"];
// NOTE: remove after the next snapshot
#[link(name = "crate_method_reexport_grrrrrrr2")];

pub use name_pool::add;

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve1-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve1#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve1",
vers = "0.1")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve1-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve1#0.2"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve1",
vers = "0.2")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve1-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve1#0.3"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve1",
vers = "0.3")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve2-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve2#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve2",
vers = "0.1")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve2-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve2#0.2"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve2",
vers = "0.2")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve2-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve2#0.3"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve2",
vers = "0.3")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve3-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve3#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve3",
vers = "0.1")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve3-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve3#0.2"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve3",
vers = "0.2")];

#[crate_type = "lib"];

Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/crateresolve4a-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve4a#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve4a", vers = "0.1")];
#[crate_type = "lib"];

pub fn f() -> int { 10 }
2 changes: 0 additions & 2 deletions src/test/auxiliary/crateresolve4a-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve4a#0.2"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve4a", vers= "0.2")];
#[crate_type = "lib"];

pub fn g() -> int { 20 }
2 changes: 0 additions & 2 deletions src/test/auxiliary/crateresolve4b-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// aux-build:crateresolve4a-1.rs
// aux-build:crateresolve4a-2.rs
#[crate_id="crateresolve4b#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve4b", vers = "0.1")];
#[crate_type = "lib"];

extern mod crateresolve4a = "crateresolve4a#0.2";
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/crateresolve4b-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// aux-build:crateresolve4a-1.rs
// aux-build:crateresolve4a-2.rs
#[crate_id="crateresolve4b#0.2"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve4b", vers = "0.2")];
#[crate_type = "lib"];

extern mod crateresolve4a = "crateresolve4a#0.1";
Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve5-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve5#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve5",
vers = "0.1")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve5-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="crateresolve5#0.2"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve5",
vers = "0.2")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/crateresolve8-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

// default link meta for 'package_id' will be equal to filestem
#[crate_id="crateresolve8#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "crateresolve8",
vers = "0.1")];

#[crate_type = "lib"];

Expand Down
4 changes: 0 additions & 4 deletions src/test/auxiliary/extern-crosscrate-source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// except according to those terms.

#[crate_id="externcallback#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "externcallback",
vers = "0.1")];

#[crate_type = "lib"];

use std::libc;
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/foreign_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="foreign_lib"];
// NOTE: remove after the next snapshot
#[link(name="foreign_lib", vers="0.0")];

pub mod rustrt {
use std::libc;
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/inline_dtor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="inline_dtor#0.1"];
// NOTE: remove after the next snapshot
#[link(name="inline_dtor", vers="0.1")];

pub struct Foo;

Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/iss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="issue6919_3#0.1"];
// NOTE: remove after the next snapshot
#[link(name="iss6919_3", vers="0.1")];

// part of issue-6919.rs

Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/issue-2380.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#[feature(managed_boxes)];
#[crate_id="a"];
// NOTE: remove after the next snapshot
#[link(name = "a", vers = "0.0")];
#[crate_type = "lib"];

pub trait i<T> { }
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/issue-2414-a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="a#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "a", vers = "0.1")];
#[crate_type = "lib"];

type t1 = uint;
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/issue-2414-b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// xfail-fast

#[crate_id="b#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "b", vers = "0.1")];
#[crate_type = "lib"];

extern mod a;
4 changes: 0 additions & 4 deletions src/test/auxiliary/issue-2526.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// except according to those terms.

#[crate_id="issue_2526#0.2"];
// NOTE: remove after the next snapshot
#[link(name = "issue_2526",
vers = "0.2",
uuid = "54cc1bc9-02b8-447c-a227-75ebc923bc29")];
#[crate_type = "lib"];

extern mod extra;
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/issue-2631-a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#[feature(managed_boxes)];
#[crate_id="req"];
// NOTE: remove after the next snapshot
#[link(name = "req")];
#[crate_type = "lib"];

extern mod extra;
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/issue-3012-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="socketlib"];
// NOTE: remove after the next snapshot
#[link(name="socketlib", vers="0.0")];
#[crate_type = "lib"];

pub mod socket {
Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/issue-4208-cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="numeric#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "numeric",
vers = "0.1")];
#[crate_type = "lib"];

pub trait Trig<T> {
Expand Down
1 change: 0 additions & 1 deletion src/test/auxiliary/issue2378a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[link (name = "issue2378a")];
#[crate_type = "lib"];

pub enum maybe<T> { just(T), nothing }
Expand Down
1 change: 0 additions & 1 deletion src/test/auxiliary/issue2378b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[link (name = "issue2378b")];
#[crate_type = "lib"];

extern mod issue2378a;
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/issue_2242_a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="a#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "a", vers = "0.1")];
#[crate_type = "lib"];

trait to_strz {
Expand Down
2 changes: 0 additions & 2 deletions src/test/auxiliary/issue_2242_c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="c#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "c", vers = "0.1")];
#[crate_type = "lib"];

extern mod a;
Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/issue_3979_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="issue_3979_traits#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "issue_3979_traits",
vers = "0.1")];

#[crate_type = "lib"];

Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/lint_stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[crate_id="lint_stability#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "lint_stability",
vers = "0.1")];
#[crate_type = "lib"];

#[deprecated]
Expand Down
4 changes: 0 additions & 4 deletions src/test/auxiliary/static-methods-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// except according to those terms.

#[crate_id="static_methods_crate#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "static_methods_crate",
vers = "0.1")];

#[crate_type = "lib"];

use std::int;
Expand Down
3 changes: 0 additions & 3 deletions src/test/auxiliary/struct_variant_xc_aux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// except according to those terms.

#[crate_id="struct_variant_xc_aux#0.1"];
// NOTE: remove after the next snapshot
#[link(name = "struct_variant_xc_aux",
vers = "0.1")];
#[crate_type = "lib"];

#[feature(struct_variant)];
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/issue-1251.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#[crate_id="rust_get_test_int"];
// NOTE: remove after the next snapshot
#[link(name = "rust_get_test_int")];

mod rustrt {
use std::libc;
Expand Down
Loading