Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7cae9e8
`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit
maekawatoshiki Jul 31, 2020
3a46cca
Revert "`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit"
maekawatoshiki Aug 21, 2020
d94258e
Add `#![allow(unsafe_op_in_unsafe_fn)]` in sys/hermit
maekawatoshiki Aug 21, 2020
14158f5
Remove #![allow(unsafe_op_in_unsafe_fn)] except for mod.rs
maekawatoshiki Oct 8, 2020
b3246e0
Set the proper sysroot for clippy
jyn514 Sep 29, 2020
51f8076
Add --fix support to `x.py clippy`
jyn514 Sep 30, 2020
bdbb542
x.py fmt
jyn514 Oct 10, 2020
31ecd2a
Allow using clippy with either beta or nightly
jyn514 Oct 10, 2020
e099138
BTreeMap: stop mistaking node for an orderly place
ssomers Oct 26, 2020
b0df3f7
fix some incorrect aliasing in the BTree
RalfJung Oct 28, 2020
1e73724
Allow using 1/2/3/4 for `x.py setup` options
jyn514 Oct 29, 2020
be01d54
BTreeMap: document a curious assumption in test cases
ssomers Oct 29, 2020
d2bc8a9
inliner: Use substs_for_mir_body
tmiasko Nov 3, 2020
2980367
Add new lint for automatic_links improvements
GuillaumeGomez Oct 12, 2020
a54f043
Add documentation for automatic_links lint
GuillaumeGomez Oct 12, 2020
6bc8965
Add tests for automatic_links lint
GuillaumeGomez Oct 12, 2020
f467b8d
Extend automatic_links lint to take into account URLs without link sy…
GuillaumeGomez Oct 13, 2020
7f839b2
Improve automatic_links globally
GuillaumeGomez Oct 14, 2020
55b4d21
Fix automatic_links warnings
GuillaumeGomez Oct 14, 2020
60caf51
Rename automatic_links to url_improvements
GuillaumeGomez Oct 17, 2020
fce2be0
Update URLs used in the lint example
GuillaumeGomez Oct 17, 2020
1fb404b
Don't check for URLs inside codeblocks
GuillaumeGomez Oct 17, 2020
6be97e2
Improve lint even more
GuillaumeGomez Oct 31, 2020
9d11450
Rename lint to non_autolinks
GuillaumeGomez Oct 31, 2020
16ed850
Fix more URLs
GuillaumeGomez Nov 5, 2020
54a0a98
ci: gate on aarch64-gnu passing tests
pietroalbini Oct 22, 2020
1274fae
doc/rustc: promote aarch64-unknown-linux-gnu to tier 1
pietroalbini Oct 22, 2020
874cbb8
ci: build docs for aarch64-unknown-linux-gnu
pietroalbini Oct 22, 2020
eed0ceb
Recognize `private_intra_doc_links` as a lint
jyn514 Oct 19, 2020
47b21b8
Add PRIVATE_INTRA_DOC_LINKS to rustdoc special-casing
jyn514 Nov 5, 2020
99200f7
Fix even more URLs
GuillaumeGomez Nov 5, 2020
3863dee
Infer the default host target from the host toolchain if possible
jyn514 Oct 29, 2020
8d2fa72
Get `--fix` working for everything except rustdoc
jyn514 Oct 27, 2020
4f4ce1c
Rollup merge of #74979 - maekawatoshiki:fix, r=Mark-Simulacrum
Dylan-DPC Nov 6, 2020
3124e79
Rollup merge of #77351 - jyn514:clippy-sysroot, r=Mark-Simulacrum
Dylan-DPC Nov 6, 2020
d6bd33d
Rollup merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn51…
Dylan-DPC Nov 6, 2020
e422bef
Rollup merge of #78114 - jyn514:private, r=oli-obk
Dylan-DPC Nov 6, 2020
a8d4297
Rollup merge of #78228 - pietroalbini:finally, r=Mark-Simulacrum
Dylan-DPC Nov 6, 2020
d22cc21
Rollup merge of #78437 - ssomers:btree_no_ord_at_node_level, r=Mark-S…
Dylan-DPC Nov 6, 2020
e6f601e
Rollup merge of #78476 - RalfJung:btree-alias, r=Mark-Simulacrum
Dylan-DPC Nov 6, 2020
691cfad
Rollup merge of #78513 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Dylan-DPC Nov 6, 2020
03eec1d
Rollup merge of #78514 - jyn514:setup-number, r=Mark-Simulacrum
Dylan-DPC Nov 6, 2020
f926cd3
Rollup merge of #78538 - ssomers:btree_testing_rng, r=Mark-Simulacrum
Dylan-DPC Nov 6, 2020
e71644d
Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obk
Dylan-DPC Nov 6, 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
Rename lint to non_autolinks
  • Loading branch information
GuillaumeGomez committed Nov 5, 2020
commit 9d114506c68ce717503d0fa1eb335db5c80c195f
4 changes: 2 additions & 2 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::{
BARE_TRAIT_OBJECTS, BROKEN_INTRA_DOC_LINKS, ELIDED_LIFETIMES_IN_PATHS,
EXPLICIT_OUTLIVES_REQUIREMENTS, INVALID_CODEBLOCK_ATTRIBUTES, INVALID_HTML_TAGS,
MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, URL_IMPROVEMENTS,
MISSING_DOC_CODE_EXAMPLES, NON_AUTOLINKS, PRIVATE_DOC_TESTS,
};
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::Span;
Expand Down Expand Up @@ -313,7 +313,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {

add_lint_group!(
"rustdoc",
URL_IMPROVEMENTS,
NON_AUTOLINKS,
BROKEN_INTRA_DOC_LINKS,
PRIVATE_INTRA_DOC_LINKS,
INVALID_CODEBLOCK_ATTRIBUTES,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1891,12 +1891,12 @@ declare_lint! {
}

declare_lint! {
/// The `url_improvements` lint detects when a URL could be written using
/// The `non_autolinks` lint detects when a URL could be written using
/// only angle brackets. This is a `rustdoc` only lint, see the
/// documentation in the [rustdoc book].
///
/// [rustdoc book]: ../../../rustdoc/lints.html#url_improvements
pub URL_IMPROVEMENTS,
/// [rustdoc book]: ../../../rustdoc/lints.html#non_autolinks
pub NON_AUTOLINKS,
Warn,
"detects URLs that could be written using only angle brackets"
}
Expand Down Expand Up @@ -2806,7 +2806,7 @@ declare_lint_pass! {
MISSING_DOC_CODE_EXAMPLES,
INVALID_HTML_TAGS,
PRIVATE_DOC_TESTS,
URL_IMPROVEMENTS,
NON_AUTOLINKS,
WHERE_CLAUSES_OBJECT_SAFETY,
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
MACRO_USE_EXTERN_CRATE,
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub mod primitive;
unused_imports,
unsafe_op_in_unsafe_fn
)]
#[cfg_attr(not(bootstrap), allow(url_improvements))]
#[cfg_attr(not(bootstrap), allow(non_autolinks))]
// FIXME: This annotation should be moved into rust-lang/stdarch after clashing_extern_declarations is
// merged. It currently cannot because bootstrap fails as the lint hasn't been defined yet.
#[allow(clashing_extern_declarations)]
Expand Down
4 changes: 2 additions & 2 deletions src/doc/rustdoc/src/lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ warning: unclosed HTML tag `h1`
warning: 2 warnings emitted
```

## url_improvements
## non_autolinks

This lint is **nightly-only** and **warns by default**. It detects links which
could use the "automatic" link syntax. For example:
Expand All @@ -309,7 +309,7 @@ warning: this URL is not a hyperlink
1 | /// http://example.org
| ^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://example.org>`
|
= note: `#[warn(url_improvements)]` on by default
= note: `#[warn(non_autolinks)]` on by default

warning: unneeded long form for URL
--> foo.rs:2:5
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub fn run_core(
let invalid_codeblock_attributes_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name;
let invalid_html_tags = rustc_lint::builtin::INVALID_HTML_TAGS.name;
let renamed_and_removed_lints = rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name;
let url_improvements = rustc_lint::builtin::URL_IMPROVEMENTS.name;
let non_autolinks = rustc_lint::builtin::NON_AUTOLINKS.name;
let unknown_lints = rustc_lint::builtin::UNKNOWN_LINTS.name;

// In addition to those specific lints, we also need to allow those given through
Expand All @@ -345,7 +345,7 @@ pub fn run_core(
invalid_html_tags.to_owned(),
renamed_and_removed_lints.to_owned(),
unknown_lints.to_owned(),
url_improvements.to_owned(),
non_autolinks.to_owned(),
];

let (lint_opts, lint_caps) = init_lints(lints_to_show, lint_opts, |lint| {
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/passes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::core::DocContext;
mod stripper;
pub use stripper::*;

mod url_improvements;
pub use self::url_improvements::CHECK_URL_IMPROVEMENTS;
mod non_autolinks;
pub use self::non_autolinks::CHECK_NON_AUTOLINKS;

mod collapse_docs;
pub use self::collapse_docs::COLLAPSE_DOCS;
Expand Down Expand Up @@ -93,7 +93,7 @@ pub const PASSES: &[Pass] = &[
COLLECT_TRAIT_IMPLS,
CALCULATE_DOC_COVERAGE,
CHECK_INVALID_HTML_TAGS,
CHECK_URL_IMPROVEMENTS,
CHECK_NON_AUTOLINKS,
];

/// The list of passes run by default.
Expand All @@ -109,7 +109,7 @@ pub const DEFAULT_PASSES: &[ConditionalPass] = &[
ConditionalPass::always(CHECK_CODE_BLOCK_SYNTAX),
ConditionalPass::always(CHECK_INVALID_HTML_TAGS),
ConditionalPass::always(PROPAGATE_DOC_CFG),
ConditionalPass::always(CHECK_URL_IMPROVEMENTS),
ConditionalPass::always(CHECK_NON_AUTOLINKS),
];

/// The list of default passes run when `--doc-coverage` is passed to rustdoc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use rustc_errors::Applicability;
use rustc_feature::UnstableFeatures;
use rustc_session::lint;

pub const CHECK_URL_IMPROVEMENTS: Pass = Pass {
name: "check-url-improvements",
run: check_url_improvements,
pub const CHECK_NON_AUTOLINKS: Pass = Pass {
name: "check-non-autolinks",
run: check_non_autolinks,
description: "detects URLS that could be written using angle brackets",
};

Expand All @@ -23,14 +23,14 @@ const URL_REGEX: &str = concat!(
r"\b([-a-zA-Z0-9@:%_\+.~#?&/=]*)" // optional query or url fragments
);

struct UrlImprovementsLinter<'a, 'tcx> {
struct NonAutolinksLinter<'a, 'tcx> {
cx: &'a DocContext<'tcx>,
regex: Regex,
}

impl<'a, 'tcx> UrlImprovementsLinter<'a, 'tcx> {
impl<'a, 'tcx> NonAutolinksLinter<'a, 'tcx> {
fn new(cx: &'a DocContext<'tcx>) -> Self {
UrlImprovementsLinter { cx, regex: Regex::new(URL_REGEX).expect("failed to build regex") }
Self { cx, regex: Regex::new(URL_REGEX).expect("failed to build regex") }
}

fn find_raw_urls(
Expand All @@ -53,17 +53,17 @@ impl<'a, 'tcx> UrlImprovementsLinter<'a, 'tcx> {
}
}

pub fn check_url_improvements(krate: Crate, cx: &DocContext<'_>) -> Crate {
pub fn check_non_autolinks(krate: Crate, cx: &DocContext<'_>) -> Crate {
if !UnstableFeatures::from_environment().is_nightly_build() {
krate
} else {
let mut coll = UrlImprovementsLinter::new(cx);
let mut coll = NonAutolinksLinter::new(cx);

coll.fold_crate(krate)
}
}

impl<'a, 'tcx> DocFolder for UrlImprovementsLinter<'a, 'tcx> {
impl<'a, 'tcx> DocFolder for NonAutolinksLinter<'a, 'tcx> {
fn fold_item(&mut self, item: Item) -> Option<Item> {
let hir_id = match self.cx.as_local_hir_id(item.def_id) {
Some(hir_id) => hir_id,
Expand All @@ -78,7 +78,7 @@ impl<'a, 'tcx> DocFolder for UrlImprovementsLinter<'a, 'tcx> {
let sp = super::source_span_for_markdown_range(cx, &dox, &range, &item.attrs)
.or_else(|| span_of_attrs(&item.attrs))
.unwrap_or(item.source.span());
cx.tcx.struct_span_lint_hir(lint::builtin::URL_IMPROVEMENTS, hir_id, sp, |lint| {
cx.tcx.struct_span_lint_hir(lint::builtin::NON_AUTOLINKS, hir_id, sp, |lint| {
lint.build(msg)
.span_suggestion(
sp,
Expand All @@ -103,7 +103,8 @@ impl<'a, 'tcx> DocFolder for UrlImprovementsLinter<'a, 'tcx> {
Event::End(Tag::Link(_, url, _)) => {
// NOTE: links cannot be nested, so we don't need to
// check `kind`
if url.as_ref() == title && !ignore && self.regex.matches(url) {
if url.as_ref() == title && !ignore && self.regex.is_match(&url)
{
report_diag(
self.cx,
"unneeded long form for URL",
Expand Down
10 changes: 5 additions & 5 deletions src/test/rustdoc-ui/url-improvements.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#![deny(url_improvements)]
#![deny(non_autolinks)]

/// [http://a.com](http://a.com)
/// [http://aa.com](http://aa.com)
//~^ ERROR unneeded long form for URL
/// [http://b.com]
/// [http://bb.com]
//~^ ERROR unneeded long form for URL
///
/// [http://b.com]: http://b.com
/// [http://bb.com]: http://bb.com
///
/// [http://c.com][http://c.com]
pub fn a() {}
Expand Down Expand Up @@ -59,7 +59,7 @@ pub fn c() {}
/// [should_not.lint](should_not.lint)
pub fn everything_is_fine_here() {}

#[allow(url_improvements)]
#[allow(non_autolinks)]
pub mod foo {
/// https://somewhere.com/a?hello=12&bye=11#xyz
pub fn bar() {}
Expand Down
12 changes: 6 additions & 6 deletions src/test/rustdoc-ui/url-improvements.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: unneeded long form for URL
--> $DIR/url-improvements.rs:3:5
|
LL | /// [http://a.com](http://a.com)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://a.com>`
LL | /// [http://aa.com](http://aa.com)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://aa.com>`
|
note: the lint level is defined here
--> $DIR/url-improvements.rs:1:9
|
LL | #![deny(url_improvements)]
| ^^^^^^^^^^^^^^^^
LL | #![deny(non_autolinks)]
| ^^^^^^^^^^^^^

error: unneeded long form for URL
--> $DIR/url-improvements.rs:5:5
|
LL | /// [http://b.com]
| ^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://b.com>`
LL | /// [http://bb.com]
| ^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://bb.com>`

error: this URL is not a hyperlink
--> $DIR/url-improvements.rs:13:5
Expand Down