Skip to content

Commit 54a50fe

Browse files
committed
give a hard error temporarily
1 parent 206904c commit 54a50fe

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/librustdoc/html/render/context.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::rc::Rc;
66
use std::sync::mpsc::{channel, Receiver};
77

88
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
9-
use rustc_hir::HirId;
9+
// use rustc_hir::HirId;
1010
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
1111
use rustc_middle::ty::TyCtxt;
1212
use rustc_session::Session;
@@ -34,7 +34,7 @@ use crate::html::format::{join_with_double_colon, Buffer};
3434
use crate::html::markdown::{self, plain_text_summary, ErrorCodes, IdMap};
3535
use crate::html::url_parts_builder::UrlPartsBuilder;
3636
use crate::html::{layout, sources, static_files};
37-
use crate::lint::BROKEN_HTML_LINKS;
37+
// use crate::lint::BROKEN_HTML_LINKS;
3838
use crate::scrape_examples::AllCallLocations;
3939
use crate::try_err;
4040

@@ -176,14 +176,14 @@ impl<'tcx> Context<'tcx> {
176176

177177
let path = self.dst.canonicalize().unwrap();
178178
let errors: Vec<_> = unavailable_urls(&path, &CheckContext::default()).collect();
179-
let tcx = self.tcx();
179+
// let tcx = self.tcx();
180180
for err in errors {
181-
// self.sess().struct_warn(&err.to_string().replace('\t', " ")).emit();
182-
let msg = err.to_string().replace('\t', " ");
183-
// TODO: map files back to items
184-
let hir_id: HirId = todo!();
185-
let span = tcx.def_span(tcx.hir().local_def_id(hir_id));
186-
self.tcx().struct_span_lint_hir(BROKEN_HTML_LINKS, hir_id, span, msg, |err| err);
181+
self.sess().struct_err(&err.to_string().replace('\t', " ")).emit();
182+
// let msg = err.to_string().replace('\t', " ");
183+
// // TODO: map files back to items
184+
// let hir_id: HirId = todo!();
185+
// let span = tcx.def_span(tcx.hir().local_def_id(hir_id));
186+
// self.tcx().struct_span_lint_hir(BROKEN_HTML_LINKS, hir_id, span, msg, |err| err);
187187
}
188188
}
189189

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>(
689689
tcx: TyCtxt<'tcx>,
690690
) -> MainResult {
691691
match formats::run_format::<T>(krate, renderopts, cache, tcx) {
692-
Ok(_) => Ok(()),
692+
Ok(_) => tcx.sess.has_errors().map_or(Ok(()), Err),
693693
Err(e) => {
694694
let mut msg =
695695
tcx.sess.struct_err(&format!("couldn't generate documentation: {}", e.error));
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// error-pattern: invalid urls
12
//! [broken link](./not-here.html)
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: Found invalid urls in $TEST_BUILD_DIR/broken-link/broken_link/index.html:
2+
Linked file at path $TEST_BUILD_DIR/broken-link/broken_link/not-here.html does not exist!
3+
4+
error: aborting due to previous error
5+

0 commit comments

Comments
 (0)