Skip to content

Commit 72da0a3

Browse files
committed
---
yaml --- r: 127775 b: refs/heads/master c: 0b5204f h: refs/heads/master i: 127773: e4407d4 127771: 2cca17e 127767: 6ca0d92 127759: ff4c843 127743: 205cd49 v: v3
1 parent b677f65 commit 72da0a3

File tree

5 files changed

+29
-56
lines changed

5 files changed

+29
-56
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 4bb4a43917bf702fb2c6a614786aa1abe6c1014c
2+
refs/heads/master: 0b5204f55efd9e25425055264d44f28501c0439b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: aa98b25c4f0c10729dff37c699904ad57b8fbda8
55
refs/heads/try: d9c23fcbaea89871667272a67ecb8d3a512162f3

trunk/src/librustc/lint/builtin.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,20 +1479,20 @@ impl LintPass for Stability {
14791479
_ => return
14801480
};
14811481

1482-
// stability attributes are promises made across crates; do not
1483-
// check anything for crate-local usage.
1484-
if ast_util::is_local(id) { return }
1485-
14861482
let stability = stability::lookup(cx.tcx, id);
1483+
let cross_crate = !ast_util::is_local(id);
1484+
1485+
// stability attributes are promises made across crates; only
1486+
// check DEPRECATED for crate-local usage.
14871487
let (lint, label) = match stability {
14881488
// no stability attributes == Unstable
1489-
None => (UNSTABLE, "unmarked"),
1490-
Some(attr::Stability { level: attr::Unstable, .. }) =>
1491-
(UNSTABLE, "unstable"),
1492-
Some(attr::Stability { level: attr::Experimental, .. }) =>
1493-
(EXPERIMENTAL, "experimental"),
1489+
None if cross_crate => (UNSTABLE, "unmarked"),
1490+
Some(attr::Stability { level: attr::Unstable, .. }) if cross_crate =>
1491+
(UNSTABLE, "unstable"),
1492+
Some(attr::Stability { level: attr::Experimental, .. }) if cross_crate =>
1493+
(EXPERIMENTAL, "experimental"),
14941494
Some(attr::Stability { level: attr::Deprecated, .. }) =>
1495-
(DEPRECATED, "deprecated"),
1495+
(DEPRECATED, "deprecated"),
14961496
_ => return
14971497
};
14981498

trunk/src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,16 +3157,7 @@ impl<'a> Parser<'a> {
31573157
}
31583158
},
31593159
_ => {
3160-
if !enum_path.global &&
3161-
enum_path.segments.len() == 1 &&
3162-
enum_path.segments
3163-
.get(0)
3164-
.lifetimes
3165-
.len() == 0 &&
3166-
enum_path.segments
3167-
.get(0)
3168-
.types
3169-
.len() == 0 {
3160+
if !enum_path.global && enum_path.segments.len() == 1 {
31703161
// it could still be either an enum
31713162
// or an identifier pattern, resolve
31723163
// will sort it out:

trunk/src/test/compile-fail/lint-stability.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -329,19 +329,19 @@ mod this_crate {
329329
pub struct LockedTupleStruct(int);
330330

331331
fn test() {
332-
// None of the following should generate errors, because
333-
// stability attributes now have meaning only *across* crates,
334-
// not within a single crate.
332+
// Only the deprecated cases of the following should generate
333+
// errors, because other stability attributes now have meaning
334+
// only *across* crates, not within a single crate.
335335

336336
let foo = MethodTester;
337337

338-
deprecated();
339-
foo.method_deprecated();
340-
foo.trait_deprecated();
338+
deprecated(); //~ ERROR use of deprecated item
339+
foo.method_deprecated(); //~ ERROR use of deprecated item
340+
foo.trait_deprecated(); //~ ERROR use of deprecated item
341341

342-
deprecated_text();
343-
foo.method_deprecated_text();
344-
foo.trait_deprecated_text();
342+
deprecated_text(); //~ ERROR use of deprecated item: text
343+
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
344+
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
345345

346346
experimental();
347347
foo.method_experimental();
@@ -387,32 +387,31 @@ mod this_crate {
387387
foo.method_locked_text();
388388
foo.trait_locked_text();
389389

390-
391-
let _ = DeprecatedStruct { i: 0 };
390+
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
392391
let _ = ExperimentalStruct { i: 0 };
393392
let _ = UnstableStruct { i: 0 };
394393
let _ = UnmarkedStruct { i: 0 };
395394
let _ = StableStruct { i: 0 };
396395
let _ = FrozenStruct { i: 0 };
397396
let _ = LockedStruct { i: 0 };
398397

399-
let _ = DeprecatedUnitStruct;
398+
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
400399
let _ = ExperimentalUnitStruct;
401400
let _ = UnstableUnitStruct;
402401
let _ = UnmarkedUnitStruct;
403402
let _ = StableUnitStruct;
404403
let _ = FrozenUnitStruct;
405404
let _ = LockedUnitStruct;
406405

407-
let _ = DeprecatedVariant;
406+
let _ = DeprecatedVariant; //~ ERROR use of deprecated item
408407
let _ = ExperimentalVariant;
409408
let _ = UnstableVariant;
410409
let _ = UnmarkedVariant;
411410
let _ = StableVariant;
412411
let _ = FrozenVariant;
413412
let _ = LockedVariant;
414413

415-
let _ = DeprecatedTupleStruct (1);
414+
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
416415
let _ = ExperimentalTupleStruct (1);
417416
let _ = UnstableTupleStruct (1);
418417
let _ = UnmarkedTupleStruct (1);
@@ -422,8 +421,8 @@ mod this_crate {
422421
}
423422

424423
fn test_method_param<F: Trait>(foo: F) {
425-
foo.trait_deprecated();
426-
foo.trait_deprecated_text();
424+
foo.trait_deprecated(); //~ ERROR use of deprecated item
425+
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
427426
foo.trait_experimental();
428427
foo.trait_experimental_text();
429428
foo.trait_unstable();
@@ -433,8 +432,8 @@ mod this_crate {
433432
}
434433

435434
fn test_method_object(foo: &Trait) {
436-
foo.trait_deprecated();
437-
foo.trait_deprecated_text();
435+
foo.trait_deprecated(); //~ ERROR use of deprecated item
436+
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
438437
foo.trait_experimental();
439438
foo.trait_experimental_text();
440439
foo.trait_unstable();

trunk/src/test/compile-fail/pattern-ident-path-generics.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)