Auto merge of #76955 - jyn514:refactor-diagnostics, r=euclio
Refactor and fix intra-doc link diagnostics, and fix links to primitives Closes https://github.com/rust-lang/rust/issues/76925, closes https://github.com/rust-lang/rust/issues/76693, closes https://github.com/rust-lang/rust/issues/76692. Originally I only meant to fix #76925. But the hack with `has_primitive` was so bad it was easier to fix the primitive issues than to try and work around it. Note that this still has one bug: `std::primitive::i32::MAX` does not resolve. However, this fixes the ICE so I'm fine with fixing the link in a later PR. This is part of a series of refactors to make #76467 possible. This is best reviewed commit-by-commit; it has detailed commit messages. r? `@euclio`
This commit is contained in:
commit
71bdb84817
11 changed files with 329 additions and 279 deletions
|
@ -2004,6 +2004,30 @@ pub enum PrimTy {
|
|||
Char,
|
||||
}
|
||||
|
||||
impl PrimTy {
|
||||
pub fn name_str(self) -> &'static str {
|
||||
match self {
|
||||
PrimTy::Int(i) => i.name_str(),
|
||||
PrimTy::Uint(u) => u.name_str(),
|
||||
PrimTy::Float(f) => f.name_str(),
|
||||
PrimTy::Str => "str",
|
||||
PrimTy::Bool => "bool",
|
||||
PrimTy::Char => "char",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(self) -> Symbol {
|
||||
match self {
|
||||
PrimTy::Int(i) => i.name(),
|
||||
PrimTy::Uint(u) => u.name(),
|
||||
PrimTy::Float(f) => f.name(),
|
||||
PrimTy::Str => sym::str,
|
||||
PrimTy::Bool => sym::bool,
|
||||
PrimTy::Char => sym::char,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, HashStable_Generic)]
|
||||
pub struct BareFnTy<'hir> {
|
||||
pub unsafety: Unsafety,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue