Skip to content

Rollup of 4 pull requests #74518

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

Merged
merged 30 commits into from
Jul 19, 2020
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c38230e
Deny unsafe op in unsafe functions in libstd/alloc.rs
poliorcetics Jul 14, 2020
afbfe60
Remove combine function
tesuji Jul 15, 2020
48ec236
start GBA file.
Lokathor Jul 16, 2020
e190bdf
fill in all those options.
Lokathor Jul 16, 2020
9c4ac73
Docs clarifications.
Lokathor Jul 16, 2020
72fa7f8
Add to supported_targets list.
Lokathor Jul 16, 2020
66a3d68
fix the imports.
Lokathor Jul 16, 2020
7cbff84
Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r4561…
Lokathor Jul 17, 2020
888077b
Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r4561…
Lokathor Jul 17, 2020
dbfe8fc
resolve https://github.com/rust-lang/rust/pull/74419#discussion_r4561…
Lokathor Jul 17, 2020
fba90f9
Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r4561…
Lokathor Jul 17, 2020
5c63bff
Make the new target a general thumbv4t target.
Lokathor Jul 18, 2020
a594603
More links in std::str
Manishearth Jul 18, 2020
d6d48b4
Use intra-doc links in alloc::String
Manishearth Jul 18, 2020
3168b7d
Use more intra-doc links in BTreeSet
Manishearth Jul 18, 2020
4c48ac3
Use intra-doc links in BTreeMap
Manishearth Jul 18, 2020
26ba0e1
Use intra-doc links in std::io
Manishearth Jul 18, 2020
e53fea7
Use intra-doc links on HashMap
Manishearth Jul 18, 2020
9392a5e
Use intra-doc links on HashSet
Manishearth Jul 18, 2020
a968093
Add explicit exception list to linkchecker
Manishearth Jul 18, 2020
4c8e62b
Resolve https://github.com/rust-lang/rust/pull/74419#issuecomment-660…
Lokathor Jul 19, 2020
ec9c8d8
remove unused imports
Lokathor Jul 19, 2020
4a324b8
Update src/tools/linkchecker/main.rs
Manishearth Jul 19, 2020
8d470b5
Update src/libstd/io/mod.rs
Manishearth Jul 19, 2020
ea70cc0
Clarify the literal string
Manishearth Jul 19, 2020
ec966ae
primitive impls are weird
Manishearth Jul 19, 2020
2f3d64f
Rollup merge of #74333 - poliorcetics:std-alloc-unsafe-op-in-unsafe-f…
Manishearth Jul 19, 2020
cc4e880
Rollup merge of #74356 - lzutao:rm_combine, r=LukasKalbertodt
Manishearth Jul 19, 2020
9016458
Rollup merge of #74419 - Lokathor:gba-target, r=jonas-schievink
Manishearth Jul 19, 2020
1636961
Rollup merge of #74485 - Manishearth:more-intra-doc, r=jyn514
Manishearth Jul 19, 2020
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
Prev Previous commit
Next Next commit
Add explicit exception list to linkchecker
  • Loading branch information
Manishearth committed Jul 18, 2020
commit a9680938d0840066cb79a50248fb8a099e61389e
62 changes: 40 additions & 22 deletions src/tools/linkchecker/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ use std::rc::Rc;

use crate::Redirect::*;

// Add linkcheck exceptions here
// If at all possible you should use intra-doc links to avoid linkcheck issues. These
// are cases where that does not work
const LINKCHECK_EXCEPTIONS: &[(&str, &[&str])] = &[
// These are methods on slice, and `Self` does not work on primitive impls
// in intra-doc links (intra-doc links are weird)
// https://github.com/rust-lang/rust/issues/62834 is necessary to be
// able to link to slices
(
"std/io/struct.IoSlice.html",
&[
"#method.as_mut_ptr",
"#method.sort_by_key",
"#method.make_ascii_uppercase",
"#method.make_ascii_lowercase",
],
),
// These try to link to std::collections, but are defined in alloc
// https://github.com/rust-lang/rust/issues/74481
("std/collections/btree_map/struct.BTreeMap.html", &["#insert-and-complex-keys"]),
("std/collections/btree_set/struct.BTreeSet.html", &["#insert-and-complex-keys"]),
("alloc/collections/btree_map/struct.BTreeMap.html", &["#insert-and-complex-keys"]),
("alloc/collections/btree_set/struct.BTreeSet.html", &["#insert-and-complex-keys"]),
];

macro_rules! t {
($e:expr) => {
match $e {
Expand Down Expand Up @@ -111,30 +136,20 @@ fn walk(cache: &mut Cache, root: &Path, dir: &Path, errors: &mut bool) {
}
}

fn is_exception(file: &Path, link: &str) -> bool {
if let Some(entry) = LINKCHECK_EXCEPTIONS.iter().find(|&(f, _)| file.ends_with(f)) {
entry.1.contains(&link)
} else {
false
}
}

fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Option<PathBuf> {
// Ignore non-HTML files.
if file.extension().and_then(|s| s.to_str()) != Some("html") {
return None;
}

// Unfortunately we're not 100% full of valid links today to we need a few
// exceptions to get this past `make check` today.
// FIXME(#32129)
if file.ends_with("std/io/struct.IoSlice.html")
{
return None;
}

// FIXME(#32130)
if file.ends_with("alloc/collections/btree_map/struct.BTreeMap.html")
|| file.ends_with("alloc/collections/btree_set/struct.BTreeSet.html")
|| file.ends_with("std/collections/btree_map/struct.BTreeMap.html")
|| file.ends_with("std/collections/btree_set/struct.BTreeSet.html")
|| file.ends_with("std/collections/hash_set/struct.HashSet.html")
{
return None;
}

let res = load_file(cache, root, file, SkipRedirect);
let (pretty_file, contents) = match res {
Ok(res) => res,
Expand Down Expand Up @@ -249,17 +264,20 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti
let entry = &mut cache.get_mut(&pretty_path).unwrap();
entry.parse_ids(&pretty_path, &contents, errors);

if !entry.ids.contains(*fragment) {
if !entry.ids.contains(*fragment) && !is_exception(file, &format!("#{}", fragment))
{
*errors = true;
print!("{}:{}: broken link fragment ", pretty_file.display(), i + 1);
println!("`#{}` pointing to `{}`", fragment, pretty_path.display());
};
}
} else {
*errors = true;
print!("{}:{}: broken link - ", pretty_file.display(), i + 1);
let pretty_path = path.strip_prefix(root).unwrap_or(&path);
println!("{}", pretty_path.display());
if !is_exception(file, pretty_path.to_str().unwrap()) {
*errors = true;
print!("{}:{}: broken link - ", pretty_file.display(), i + 1);
println!("{}", pretty_path.display());
}
}
});
Some(pretty_file)
Expand Down