Skip to content

Rollup of 10 pull requests #127046

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

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
356027b
ast_passes/validation: update module docs
jieyouxu Apr 17, 2024
0e35216
ast_passes/validation: update attribute macro example
jieyouxu Apr 17, 2024
9aec5c5
Add test for fn pointer duplication.
cjgillot Apr 9, 2024
d223ba6
Document test.
cjgillot Apr 10, 2024
4c779d7
Mark `foo` as explicitly inline.
cjgillot May 4, 2024
ea29d6a
We can traverse bindings before `lower_match_tree` now
Nadrieril Jun 17, 2024
012626b
Only one caller of `lower_match_tree` was using the fake borrows
Nadrieril Jun 17, 2024
cef49f7
Small dedup
Nadrieril Jun 17, 2024
878ccd2
There's nothing to bind for a wildcard
Nadrieril Jun 17, 2024
c0c6c32
Move `lower_match_tree`
Nadrieril Jun 17, 2024
e9ea578
Move vcall_visibility_metadata optimization hint out of a debuginfo g…
bjorn3 Mar 30, 2024
7f44532
Remove PrintBackendInfo trait
bjorn3 Mar 30, 2024
98e8601
Remove const_bitcast from ConstMethods
bjorn3 Mar 30, 2024
e32eb4c
Dedup some intrinsic handling code for caller_location
bjorn3 Mar 30, 2024
22b3243
Move all intrinsic handling code in codegen_call_terminators together
bjorn3 Mar 30, 2024
aacdce3
Remove check_overflow method from MiscMethods
bjorn3 Mar 30, 2024
887f57f
Remove type_i1 and type_struct from cg_ssa
bjorn3 Mar 30, 2024
84f45bb
Fix doc comment
bjorn3 Mar 30, 2024
7b150a1
Don't use fake wildcards when we can get the failure block directly
Nadrieril Jun 17, 2024
ff49c37
Reuse `lower_let_expr` for `let .. else` lowering
Nadrieril Jun 17, 2024
beb1d35
Change comment to reflect switch to THIR unsafeck
Nadrieril Jun 22, 2024
414ebea
add serde derive Serialize to stable_mir
Jun 17, 2024
315be7d
Update browser-ui-test version to `0.18.0`
GuillaumeGomez Jun 26, 2024
0c0dfb8
Switch back `non_local_definitions` lint to allow-by-default
Urgau Jun 27, 2024
648cb16
Enable const casting for `f16` and `f128`
tgross35 Jun 13, 2024
4a11ab0
Fix Markdown tables in platform-support.md
xen0n Jun 27, 2024
94ca674
docs: check if the disambiguator matches its suffix
bvanjoi Jun 27, 2024
6400a4f
add test for #126986
bvanjoi Jun 27, 2024
0c08062
Rollup merge of #123237 - bjorn3:debuginfo_refactor, r=compiler-errors
GuillaumeGomez Jun 27, 2024
f5506ec
Rollup merge of #123714 - cjgillot:static-fnptr, r=wesleywiser
GuillaumeGomez Jun 27, 2024
7c48309
Rollup merge of #124091 - jieyouxu:ast-validation-top-level-docs, r=w…
GuillaumeGomez Jun 27, 2024
ff924e5
Rollup merge of #126835 - Nadrieril:reify-decision-tree, r=matthewjasper
GuillaumeGomez Jun 27, 2024
df92945
Rollup merge of #126963 - runtimeverification:smir_serde_derive, r=ol…
GuillaumeGomez Jun 27, 2024
0df1058
Rollup merge of #127010 - GuillaumeGomez:update-puppeteer, r=notriddle
GuillaumeGomez Jun 27, 2024
077207d
Rollup merge of #127015 - Urgau:non_local_def-tmp-allow, r=lqd
GuillaumeGomez Jun 27, 2024
fd8a181
Rollup merge of #127016 - bvanjoi:fix-126986, r=GuillaumeGomez,notriddle
GuillaumeGomez Jun 27, 2024
ce8a424
Rollup merge of #127029 - xen0n:fix-platform-support-table, r=lqd
GuillaumeGomez Jun 27, 2024
e23f6b0
Rollup merge of #127032 - tgross35:f16-f128-const-eval-cast, r=oli-obk
GuillaumeGomez Jun 27, 2024
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
32 changes: 24 additions & 8 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,15 @@ impl Disambiguator {
fn from_str(link: &str) -> Result<Option<(Self, &str, &str)>, (String, Range<usize>)> {
use Disambiguator::{Kind, Namespace as NS, Primitive};

let suffixes = [
// If you update this list, please also update the relevant rustdoc book section!
("!()", DefKind::Macro(MacroKind::Bang)),
("!{}", DefKind::Macro(MacroKind::Bang)),
("![]", DefKind::Macro(MacroKind::Bang)),
("()", DefKind::Fn),
("!", DefKind::Macro(MacroKind::Bang)),
];

if let Some(idx) = link.find('@') {
let (prefix, rest) = link.split_at(idx);
let d = match prefix {
Expand All @@ -1530,16 +1539,23 @@ impl Disambiguator {
"prim" | "primitive" => Primitive,
_ => return Err((format!("unknown disambiguator `{prefix}`"), 0..idx)),
};

for (suffix, kind) in suffixes {
if let Some(path_str) = rest.strip_suffix(suffix) {
if d.ns() != Kind(kind).ns() {
return Err((
format!("unmatched disambiguator `{prefix}` and suffix `{suffix}`"),
0..idx,
));
} else if path_str.len() > 1 {
// path_str != "@"
return Ok(Some((d, &path_str[1..], &rest[1..])));
}
}
}

Ok(Some((d, &rest[1..], &rest[1..])))
} else {
let suffixes = [
// If you update this list, please also update the relevant rustdoc book section!
("!()", DefKind::Macro(MacroKind::Bang)),
("!{}", DefKind::Macro(MacroKind::Bang)),
("![]", DefKind::Macro(MacroKind::Bang)),
("()", DefKind::Fn),
("!", DefKind::Macro(MacroKind::Bang)),
];
for (suffix, kind) in suffixes {
if let Some(path_str) = link.strip_suffix(suffix) {
// Avoid turning `!` or `()` into an empty string
Expand Down
110 changes: 110 additions & 0 deletions tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//@ check-pass

//! [struct@m!()] //~ WARN: unmatched disambiguator `struct` and suffix `!()`
//! [struct@m!{}]
//! [struct@m![]]
//! [struct@f()] //~ WARN: unmatched disambiguator `struct` and suffix `()`
//! [struct@m!] //~ WARN: unmatched disambiguator `struct` and suffix `!`
//!
//! [enum@m!()] //~ WARN: unmatched disambiguator `enum` and suffix `!()`
//! [enum@m!{}]
//! [enum@m![]]
//! [enum@f()] //~ WARN: unmatched disambiguator `enum` and suffix `()`
//! [enum@m!] //~ WARN: unmatched disambiguator `enum` and suffix `!`
//!
//! [trait@m!()] //~ WARN: unmatched disambiguator `trait` and suffix `!()`
//! [trait@m!{}]
//! [trait@m![]]
//! [trait@f()] //~ WARN: unmatched disambiguator `trait` and suffix `()`
//! [trait@m!] //~ WARN: unmatched disambiguator `trait` and suffix `!`
//!
//! [module@m!()] //~ WARN: unmatched disambiguator `module` and suffix `!()`
//! [module@m!{}]
//! [module@m![]]
//! [module@f()] //~ WARN: unmatched disambiguator `module` and suffix `()`
//! [module@m!] //~ WARN: unmatched disambiguator `module` and suffix `!`
//!
//! [mod@m!()] //~ WARN: unmatched disambiguator `mod` and suffix `!()`
//! [mod@m!{}]
//! [mod@m![]]
//! [mod@f()] //~ WARN: unmatched disambiguator `mod` and suffix `()`
//! [mod@m!] //~ WARN: unmatched disambiguator `mod` and suffix `!`
//!
//! [const@m!()] //~ WARN: unmatched disambiguator `const` and suffix `!()`
//! [const@m!{}]
//! [const@m![]]
//! [const@f()] //~ WARN: incompatible link kind for `f`
//! [const@m!] //~ WARN: unmatched disambiguator `const` and suffix `!`
//!
//! [constant@m!()] //~ WARN: unmatched disambiguator `constant` and suffix `!()`
//! [constant@m!{}]
//! [constant@m![]]
//! [constant@f()] //~ WARN: incompatible link kind for `f`
//! [constant@m!] //~ WARN: unmatched disambiguator `constant` and suffix `!`
//!
//! [static@m!()] //~ WARN: unmatched disambiguator `static` and suffix `!()`
//! [static@m!{}]
//! [static@m![]]
//! [static@f()] //~ WARN: incompatible link kind for `f`
//! [static@m!] //~ WARN: unmatched disambiguator `static` and suffix `!`
//!
//! [function@m!()] //~ WARN: unmatched disambiguator `function` and suffix `!()`
//! [function@m!{}]
//! [function@m![]]
//! [function@f()]
//! [function@m!] //~ WARN: unmatched disambiguator `function` and suffix `!`
//!
//! [fn@m!()] //~ WARN: unmatched disambiguator `fn` and suffix `!()`
//! [fn@m!{}]
//! [fn@m![]]
//! [fn@f()]
//! [fn@m!] //~ WARN: unmatched disambiguator `fn` and suffix `!`
//!
//! [method@m!()] //~ WARN: unmatched disambiguator `method` and suffix `!()`
//! [method@m!{}]
//! [method@m![]]
//! [method@f()]
//! [method@m!] //~ WARN: unmatched disambiguator `method` and suffix `!`
//!
//! [derive@m!()] //~ WARN: incompatible link kind for `m`
//! [derive@m!{}] //~ WARN: incompatible link kind for `m`
//! [derive@m![]]
//! [derive@f()] //~ WARN: unmatched disambiguator `derive` and suffix `()`
//! [derive@m!] //~ WARN: incompatible link kind for `m`
//!
//! [type@m!()] //~ WARN: unmatched disambiguator `type` and suffix `!()`
//! [type@m!{}]
//! [type@m![]]
//! [type@f()] //~ WARN: unmatched disambiguator `type` and suffix `()`
//! [type@m!] //~ WARN: unmatched disambiguator `type` and suffix `!`
//!
//! [value@m!()] //~ WARN: unmatched disambiguator `value` and suffix `!()`
//! [value@m!{}]
//! [value@m![]]
//! [value@f()]
//! [value@m!] //~ WARN: unmatched disambiguator `value` and suffix `!`
//!
//! [macro@m!()]
//! [macro@m!{}]
//! [macro@m![]]
//! [macro@f()] //~ WARN: unmatched disambiguator `macro` and suffix `()`
//! [macro@m!]
//!
//! [prim@m!()] //~ WARN: unmatched disambiguator `prim` and suffix `!()`
//! [prim@m!{}]
//! [prim@m![]]
//! [prim@f()] //~ WARN: unmatched disambiguator `prim` and suffix `()`
//! [prim@m!] //~ WARN: unmatched disambiguator `prim` and suffix `!`
//!
//! [primitive@m!()] //~ WARN: unmatched disambiguator `primitive` and suffix `!()`
//! [primitive@m!{}]
//! [primitive@m![]]
//! [primitive@f()] //~ WARN: unmatched disambiguator `primitive` and suffix `()`
//! [primitive@m!] //~ WARN: unmatched disambiguator `primitive` and suffix `!`

#[macro_export]
macro_rules! m {
() => {};
}

pub fn f() {}
Loading