Skip to content
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

Rollup of 11 pull requests #64168

Closed
wants to merge 36 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5a446c1
Fix `window.hashchange is not a function`
fmckeogh Aug 21, 2019
b2b9b81
Account for doc comments coming from proc macros without spans
estebank Aug 27, 2019
7ed542d
add regression test
estebank Aug 27, 2019
3c4d157
Fix unlock ordering in SGX synchronization primitives
Aug 31, 2019
5e933b4
Add x86_64-linux-kernel target
alex Aug 31, 2019
35c9e5f
Fix const_err with `-(-0.0)`
JohnTitor Sep 1, 2019
3a6aada
Add `opt-level` check
JohnTitor Sep 1, 2019
4a0872b
Add `overflow_check` check
JohnTitor Sep 1, 2019
8e9825a
Fix overflow_check
JohnTitor Sep 1, 2019
0cd9c16
Fix condition and tests' flags
JohnTitor Sep 1, 2019
a937d8c
Fix tests again
JohnTitor Sep 1, 2019
334d465
Point at appropriate arm on type error on if/else/match with one non-…
estebank Sep 2, 2019
dd870d7
fix typo
estebank Sep 2, 2019
46877e2
Fix const eval bug breaking run-pass tests in Miri
wesleywiser Aug 29, 2019
c430d74
Add match test cases
estebank Sep 3, 2019
fa893a3
use TokenStream rather than &[TokenTree] for built-in macros
matklad Aug 31, 2019
6136495
use consistent naming for buildin expansion functions
matklad Sep 3, 2019
41deb83
Add compile flag
JohnTitor Sep 4, 2019
a0c186c
remove XID and Pattern_White_Space unicode tables from libcore
matklad Jul 21, 2019
206fe8e
flatten rustc_lexer::character_properties module
matklad Sep 4, 2019
c86ea34
Ensure all warnings are emitted even on warnings=warn
Mark-Simulacrum Sep 2, 2019
fda251b
Rename --warnings=allow to --warnings=warn
Mark-Simulacrum Sep 2, 2019
669c3e3
Thread in-tree information through Mode
Mark-Simulacrum Sep 4, 2019
a2384cb
Move warnings out of rustc wrapper
Mark-Simulacrum Sep 4, 2019
9483db5
Opaque type locations in error message for clarity.
gilescope Sep 4, 2019
4c268ca
Rollup merge of #62848 - matklad:xid-unicode, r=petrochenkov
Centril Sep 5, 2019
e56fe69
Rollup merge of #63774 - chocol4te:fix_63707, r=GuillaumeGomez
Centril Sep 5, 2019
bdcc539
Rollup merge of #63930 - estebank:rustdoc-ice, r=GuillaumeGomez
Centril Sep 5, 2019
32cff1b
Rollup merge of #64030 - jethrogb:jb/sgx-sync-issues, r=alexcrichton
Centril Sep 5, 2019
437e98f
Rollup merge of #64041 - matklad:token-stream-tt, r=petrochenkov
Centril Sep 5, 2019
05c6868
Rollup merge of #64051 - alex:linux-kernel-module-target, r=joshtriplett
Centril Sep 5, 2019
49bc3f5
Rollup merge of #64063 - JohnTitor:fix-const-err, r=oli-obk
Centril Sep 5, 2019
1893c61
Rollup merge of #64083 - estebank:tweak-e0308, r=oli-obk
Centril Sep 5, 2019
4f27dd2
Rollup merge of #64098 - Mark-Simulacrum:always-warn, r=alexcrichton
Centril Sep 5, 2019
15aeb27
Rollup merge of #64100 - wesleywiser:fix_miri_const_eval, r=oli-obk
Centril Sep 5, 2019
44a6e39
Rollup merge of #64157 - gilescope:opaque-type-location, r=cramertj,C…
Centril Sep 5, 2019
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
2 changes: 1 addition & 1 deletion src/librustdoc/passes/check_code_block_syntax.rs
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> {
// We couldn't calculate the span of the markdown block that had the error, so our
// diagnostics are going to be a bit lacking.
let mut diag = self.cx.sess().struct_span_warn(
super::span_of_attrs(&item.attrs),
super::span_of_attrs(&item.attrs).unwrap_or(item.source.span()),
"doc comment contains an invalid Rust code block",
);

4 changes: 2 additions & 2 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
@@ -465,7 +465,7 @@ fn resolution_failure(
}
};
let attrs = &item.attrs;
let sp = span_of_attrs(attrs);
let sp = span_of_attrs(attrs).unwrap_or(item.source.span());

let mut diag = cx.tcx.struct_span_lint_hir(
lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE,
@@ -517,7 +517,7 @@ fn ambiguity_error(
}
};
let attrs = &item.attrs;
let sp = span_of_attrs(attrs);
let sp = span_of_attrs(attrs).unwrap_or(item.source.span());

let mut msg = format!("`{}` is ", path_str);

21 changes: 11 additions & 10 deletions src/librustdoc/passes/mod.rs
Original file line number Diff line number Diff line change
@@ -339,7 +339,7 @@ pub fn look_for_tests<'tcx>(
find_testable_code(&dox, &mut tests, ErrorCodes::No);

if check_missing_code == true && tests.found_tests == 0 {
let sp = span_of_attrs(&item.attrs).substitute_dummy(item.source.span());
let sp = span_of_attrs(&item.attrs).unwrap_or(item.source.span());
let mut diag = cx.tcx.struct_span_lint_hir(
lint::builtin::MISSING_DOC_CODE_EXAMPLES,
hir_id,
@@ -352,20 +352,23 @@ pub fn look_for_tests<'tcx>(
let mut diag = cx.tcx.struct_span_lint_hir(
lint::builtin::PRIVATE_DOC_TESTS,
hir_id,
span_of_attrs(&item.attrs),
span_of_attrs(&item.attrs).unwrap_or(item.source.span()),
"Documentation test in private item");
diag.emit();
}
}

/// Returns a span encompassing all the given attributes.
crate fn span_of_attrs(attrs: &clean::Attributes) -> Span {
crate fn span_of_attrs(attrs: &clean::Attributes) -> Option<Span> {
if attrs.doc_strings.is_empty() {
return DUMMY_SP;
return None;
}
let start = attrs.doc_strings[0].span();
if start == DUMMY_SP {
return None;
}
let end = attrs.doc_strings.last().expect("No doc strings provided").span();
start.to(end)
Some(start.to(end))
}

/// Attempts to match a range of bytes from parsed markdown to a `Span` in the source code.
@@ -391,7 +394,7 @@ crate fn source_span_for_markdown_range(
let snippet = cx
.sess()
.source_map()
.span_to_snippet(span_of_attrs(attrs))
.span_to_snippet(span_of_attrs(attrs)?)
.ok()?;

let starting_line = markdown[..md_range.start].matches('\n').count();
@@ -441,10 +444,8 @@ crate fn source_span_for_markdown_range(
}
}

let sp = span_of_attrs(attrs).from_inner(InnerSpan::new(
Some(span_of_attrs(attrs)?.from_inner(InnerSpan::new(
md_range.start + start_bytes,
md_range.end + start_bytes + end_bytes,
));

Some(sp)
)))
}
20 changes: 20 additions & 0 deletions src/test/rustdoc/auxiliary/through-proc-macro-aux.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
#![crate_name="some_macros"]

extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_attribute]
pub fn first(_attr: TokenStream, item: TokenStream) -> TokenStream {
item // This doesn't erase the spans.
}

#[proc_macro_attribute]
pub fn second(_attr: TokenStream, item: TokenStream) -> TokenStream {
// Make a new `TokenStream` to erase the spans:
let mut out: TokenStream = TokenStream::new();
out.extend(item);
out
}
12 changes: 12 additions & 0 deletions src/test/rustdoc/through-proc-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// aux-build:through-proc-macro-aux.rs
// build-aux-docs
#![warn(intra_doc_link_resolution_failure)]
extern crate some_macros;

#[some_macros::second]
pub enum Boom {
/// [Oooops]
Bam,
}

fn main() {}