-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Check crate root for docs in missing_doc lint. #10665
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
Conversation
if !cx.tcx.sess.opts.test { | ||
// `#[doc(hidden)]` disables missing_doc check. | ||
if !cx.is_doc_hidden { | ||
if !crate.attrs.iter().any(|a| a.node.is_sugared_doc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, does this detect #[doc="foo"]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno. Does it detect it in check_missing_doc_attrs
?
On Tue, Nov 26, 2013 at 1:20 AM, Huon Wilson notifications@github.comwrote:
In src/librustc/middle/lint.rs:
@@ -1256,6 +1256,21 @@ pub fn check_crate(tcx: ty::ctxt,
v.visited_outermost = true;
visit::walk_crate(v, crate, ());
}
+
// this basically duplicates check_missing_doc_attrs from above, minus the visibility test.
// If we're building a test harness, then warning about
// documentation is probably not really relevant right now.
if !cx.tcx.sess.opts.test {
// `#[doc(hidden)]` disables missing_doc check.
if !cx.is_doc_hidden {
if !crate.attrs.iter().any(|a| a.node.is_sugared_doc) {
Hm, does this detect #[doc="foo"]?
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/10665/files#r7916305
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know; that may be wrong too. (I would check but I'm rustc-less at the moment.)
Corey Richardson notifications@github.com wrote:
@@ -1256,6 +1256,21 @@ pub fn check_crate(tcx: ty::ctxt,
v.visited_outermost = true;
visit::walk_crate(v, crate, ());
}
+
above, minus the visibility test.// this basically duplicates check_missing_doc_attrs from
+// If we're building a test harness, then warning about
// documentation is probably not really relevant right now.
if !cx.tcx.sess.opts.test {
// `#[doc(hidden)]` disables missing_doc check.
if !cx.is_doc_hidden {
a.node.is_sugared_doc) {if !crate.attrs.iter().any(|a|
Dunno. Does it detect it in
check_missing_doc_attrs
?On Tue, Nov 26, 2013 at 1:20 AM, Huon Wilson
notifications@github.comwrote:In src/librustc/middle/lint.rs:
@@ -1256,6 +1256,21 @@ pub fn check_crate(tcx: ty::ctxt,
v.visited_outermost = true;
visit::walk_crate(v, crate, ());
}
+
above, minus the visibility test.// this basically duplicates check_missing_doc_attrs from
+// If we're building a test harness, then warning about
now.// documentation is probably not really relevant right
if !cx.tcx.sess.opts.test {
// `#[doc(hidden)]` disables missing_doc check.
if !cx.is_doc_hidden {
a.node.is_sugared_doc) {if !crate.attrs.iter().any(|a|
Hm, does this detect #[doc="foo"]?
—
Reply to this email directly or view it on
GitHubhttps://github.com//pull/10665/files#r7916305
.
Reply to this email directly or view it on GitHub:
https://github.com/mozilla/rust/pull/10665/files#r7916311
Because the root module isn't actually an item, we need to do some hackish handling of it. Closes #10656.
Because the root module isn't actually an item, we need to do some hackish handling of it. Closes #10656.
…r=giraffate Don't apply `string_lit_as_bytes` if in macro expansion The following code will emit a warning on both w! and h!, despite there being nothing the user (or library author) could do about it: ```rust #![warn(clippy::string_lit_as_bytes)] use windows::w; use windows::h; fn main() { let _w = w!("example"); let _h = h!("example"); } ``` This is because windows-rs will create a binding `const INPUT: &[u8] = $s.as_bytes()`, and changing this to b"$s" is, well, suboptimal. I don't know enough about Rust to know if this is something that can be detected though if it can be I'm happy with closing this in favor of implementing that. I'm not sure whether this is how it should be done though, as this simply tells clippy to not invoke this even if it's applicable (this also affects the other string lints, but didn't cause any tests to fail). changelog: [`string_lit_as_bytes`]: Don't lint if in external macro
Because the root module isn't actually an item, we need to do some hackish
handling of it.
Closes #10656.