Uh oh!
There was an error while loading. Please reload this page.
Handle stability of struct fields - #22803
Conversation
rust-highfive
commented
Feb 25, 2015
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
huonw
commented
Feb 25, 2015
r? @brson, @aturon, @alexcrichton NB. I've had to add 3 stability attributes. |
alexcrichton
commented
Feb 25, 2015
This looks good to me, nice work! Could this also be expanded to cover fields mentioned in patterns as well for structs? Other than that I think it covers everything. |
There was a problem hiding this comment.
I wonder if this sort of lookup would be candidate for a good helper in middle::ty
There was a problem hiding this comment.
I think how we handle structs in the compiler will be changing with #22564, so I'll leave it for now.
There was a problem hiding this comment.
Ah ok, this can wait then. r=me with patterns handled as well
We were recording stability attributes applied to fields in the compiler, and even annotating it in the libs, but the compiler didn't actually do the checks to give errors/warnings in user crates.
The stability check checks the `PublicItems` map when giving errors if
there is a #[stable] item with a public contents that doesn't not have
its own stability. Without recording this, struct fields and enum
variants will not get errors for e.g. stable modules with unmarked
functions internally.
This is just improving the compiler's precision to give the standard
library developers more information earlier.
E.g.
#![staged_api]
#![feature(staged_api)]
#![crate_type = "lib"]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Foo {
pub x: i32
}
#[stable(feature = "rust1", since = "1.0.0")]
pub mod bar {
pub fn baz() {}
}
Without the patch it gives:
test.rs:12:5: 12:20 error: This node does not have a stability attribute
test.rs:12 pub fn baz() {}
^~~~~~~~~~~~~~~
error: aborting due to previous error
With the patch it gives:
test.rs:7:9: 7:15 error: This node does not have a stability attribute
test.rs:7 pub x: i32
^~~~~~
test.rs:12:5: 12:20 error: This node does not have a stability attribute
test.rs:12 pub fn baz() {}
^~~~~~~~~~~~~~~
error: aborting due to 2 previous errors8819038 to
1494196Comparehuonw
commented
Feb 26, 2015
@bors r=alexcrichton 1494 |
bors
commented
Feb 26, 2015
⌛ Testing commit 1494196 with merge 31c85cb... |
bors
commented
Feb 26, 2015
💔 Test failed - auto-linux-64-nopt-t |
alexcrichton
commented
Feb 26, 2015
(cancelled build as we discovered some interesting tidbits on IRC) |
alexcrichton
commented
Feb 26, 2015
@bors: retry nevermind |
bors
commented
Feb 26, 2015
⌛ Testing commit 1494196 with merge 50e209d... |
bors
commented
Feb 26, 2015
💔 Test failed - auto-mac-64-opt |
huonw
commented
Feb 27, 2015
@bors r=alexcrichton 0606 |
bors
commented
Feb 27, 2015
⌛ Testing commit 060661d with merge 73d4eb5... |
bors
commented
Feb 27, 2015
💔 Test failed - auto-linux-64-x-android-t |
Manishearth
commented
Feb 27, 2015
(Manual cancel due to rollup) |
We were recording stability attributes applied to fields in the compiler, and even annotating it in the libs, but the compiler didn't actually do the checks to give errors/warnings in user crates. Details in the commit messages.
alexcrichton
commented
Feb 27, 2015
@bors: retry |
We were recording stability attributes applied to fields in the
compiler, and even annotating it in the libs, but the compiler didn't
actually do the checks to give errors/warnings in user crates.
Details in the commit messages.