-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Turn constants in modules core::[i/u][8/16/32/64/size] into associated constants #28656
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -533,12 +533,13 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result<String> { | |
try!(write!(&mut w, r#"],"paths":["#)); | ||
|
||
for (i, &did) in pathid_to_nodeid.iter().enumerate() { | ||
let &(ref fqp, short) = cache.paths.get(&did).unwrap(); | ||
if i > 0 { | ||
try!(write!(&mut w, ",")); | ||
if let Some(&(ref fqp, short)) = cache.paths.get(&did) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come this was necessary? It seems like this may indicate a bug in rustdoc rather than something that should be ignored? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's certainly a rustdoc bug, I spent may be a couple of hours trying to fix it, but haven't found out what's wrong. |
||
if i > 0 { | ||
try!(write!(&mut w, ",")); | ||
} | ||
try!(write!(&mut w, r#"[{},"{}"]"#, | ||
short as usize, *fqp.last().unwrap())); | ||
} | ||
try!(write!(&mut w, r#"[{},"{}"]"#, | ||
short as usize, *fqp.last().unwrap())); | ||
} | ||
|
||
try!(write!(&mut w, "]}};")); | ||
|
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.
reason needs update
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.
Why? It still may want to be an associated function, just like
std::usize::BYTES
.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.
I believe this reason was written down long before we even had associated constants, but with those I don't think we'd want both a constant and a function, and in today's Rust these are definitely most appropriate as a constant.