Skip to content
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

Fix status bar message not being marked markdown #18366

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion crates/hir-def/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'a> OuterImplTraitGuard<'a> {
}
}

impl<'a> Drop for OuterImplTraitGuard<'a> {
impl Drop for OuterImplTraitGuard<'_> {
fn drop(&mut self) {
self.ctx.outer_impl_trait.replace(self.old);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-expand/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub(crate) fn dump_syntax_contexts(db: &dyn ExpandDatabase) -> String {
&'a SyntaxContextData,
);

impl<'a> std::fmt::Debug for SyntaxContextDebug<'a> {
impl std::fmt::Debug for SyntaxContextDebug<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fancy_debug(self.2, self.1, self.0, f)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/autoderef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'table, 'db> Autoderef<'table, 'db, usize> {
}

#[allow(private_bounds)]
impl<'table, 'db, T: TrackAutoderefSteps> Autoderef<'table, 'db, T> {
impl<T: TrackAutoderefSteps> Autoderef<'_, '_, T> {
pub(crate) fn step_count(&self) -> usize {
self.steps.len()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/chalk_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
}
}

impl<'a> ChalkContext<'a> {
impl ChalkContext<'_> {
fn edition(&self) -> Edition {
self.db.crate_graph()[self.krate].edition
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ impl<'db> PatCx for MatchCheckCtx<'db> {
}
}

impl<'db> fmt::Debug for MatchCheckCtx<'db> {
impl fmt::Debug for MatchCheckCtx<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("MatchCheckCtx").finish()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/dyn_compatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ fn contains_illegal_self_type_reference<T: TypeVisitable<Interner>>(
trait_self_param_idx: usize,
allow_self_projection: AllowSelfProjection,
}
impl<'a> TypeVisitor<Interner> for IllegalSelfTypeVisitor<'a> {
impl TypeVisitor<Interner> for IllegalSelfTypeVisitor<'_> {
type BreakTy = ();

fn as_dyn(&mut self) -> &mut dyn TypeVisitor<Interner, BreakTy = Self::BreakTy> {
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ impl<'a> InferenceContext<'a> {
non_assocs: FxHashMap<OpaqueTyId, Ty>,
}

impl<'a, 'b> TypeVisitor<Interner> for TypeAliasImplTraitCollector<'a, 'b> {
impl TypeVisitor<Interner> for TypeAliasImplTraitCollector<'_, '_> {
type BreakTy = ();

fn as_dyn(&mut self) -> &mut dyn TypeVisitor<Interner, BreakTy = Self::BreakTy> {
Expand Down
37 changes: 23 additions & 14 deletions crates/hir-ty/src/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,8 @@ pub enum Rvalue {
///
/// **Needs clarification**: Are there weird additional semantics here related to the runtime
/// nature of this operation?
//ThreadLocalRef(DefId),
// ThreadLocalRef(DefId),
ThreadLocalRef(std::convert::Infallible),

/// Creates a pointer with the indicated mutability to the place.
///
Expand All @@ -888,7 +889,8 @@ pub enum Rvalue {
///
/// Like with references, the semantics of this operation are heavily dependent on the aliasing
/// model.
//AddressOf(Mutability, Place),
// AddressOf(Mutability, Place),
AddressOf(std::convert::Infallible),

/// Yields the length of the place, as a `usize`.
///
Expand All @@ -906,19 +908,21 @@ pub enum Rvalue {
Cast(CastKind, Operand, Ty),

// FIXME link to `pointer::offset` when it hits stable.
// /// * `Offset` has the same semantics as `pointer::offset`, except that the second
// /// parameter may be a `usize` as well.
// /// * The comparison operations accept `bool`s, `char`s, signed or unsigned integers, floats,
// /// raw pointers, or function pointers and return a `bool`. The types of the operands must be
// /// matching, up to the usual caveat of the lifetimes in function pointers.
// /// * Left and right shift operations accept signed or unsigned integers not necessarily of the
// /// same type and return a value of the same type as their LHS. Like in Rust, the RHS is
// /// truncated as needed.
// /// * The `Bit*` operations accept signed integers, unsigned integers, or bools with matching
// /// types and return a value of that type.
// /// * The remaining operations accept signed integers, unsigned integers, or floats with
// /// matching types and return a value of that type.
/// * `Offset` has the same semantics as `pointer::offset`, except that the second
/// parameter may be a `usize` as well.
/// * The comparison operations accept `bool`s, `char`s, signed or unsigned integers, floats,
/// raw pointers, or function pointers and return a `bool`. The types of the operands must be
/// matching, up to the usual caveat of the lifetimes in function pointers.
/// * Left and right shift operations accept signed or unsigned integers not necessarily of the
/// same type and return a value of the same type as their LHS. Like in Rust, the RHS is
/// truncated as needed.
/// * The `Bit*` operations accept signed integers, unsigned integers, or bools with matching
/// types and return a value of that type.
/// * The remaining operations accept signed integers, unsigned integers, or floats with
/// matching types and return a value of that type.
//BinaryOp(BinOp, Box<(Operand, Operand)>),
BinaryOp(std::convert::Infallible),

/// Same as `BinaryOp`, but yields `(T, bool)` with a `bool` indicating an error condition.
///
/// When overflow checking is disabled and we are generating run-time code, the error condition
Expand All @@ -937,6 +941,7 @@ pub enum Rvalue {

/// Computes a value as described by the operation.
//NullaryOp(NullOp, Ty),
NullaryOp(std::convert::Infallible),

/// Exactly like `BinaryOp`, but less operands.
///
Expand Down Expand Up @@ -1095,6 +1100,10 @@ impl MirBody {
for_operand(op, &mut f, &mut self.projection_store);
}
}
Rvalue::ThreadLocalRef(n)
| Rvalue::AddressOf(n)
| Rvalue::BinaryOp(n)
| Rvalue::NullaryOp(n) => match *n {},
}
}
StatementKind::FakeRead(p) | StatementKind::Deinit(p) => {
Expand Down
12 changes: 12 additions & 0 deletions crates/hir-ty/src/mir/borrowck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ fn moved_out_of_ref(db: &dyn HirDatabase, body: &MirBody) -> Vec<MovedOutOfRef>
for_operand(op, statement.span);
}
}
Rvalue::ThreadLocalRef(n)
| Rvalue::AddressOf(n)
| Rvalue::BinaryOp(n)
| Rvalue::NullaryOp(n) => match *n {},
},
StatementKind::FakeRead(_)
| StatementKind::Deinit(_)
Expand Down Expand Up @@ -253,6 +257,10 @@ fn partially_moved(db: &dyn HirDatabase, body: &MirBody) -> Vec<PartiallyMoved>
for_operand(op, statement.span);
}
}
Rvalue::ThreadLocalRef(n)
| Rvalue::AddressOf(n)
| Rvalue::BinaryOp(n)
| Rvalue::NullaryOp(n) => match *n {},
},
StatementKind::FakeRead(_)
| StatementKind::Deinit(_)
Expand Down Expand Up @@ -548,6 +556,10 @@ fn mutability_of_locals(
}
}
Rvalue::ShallowInitBox(_, _) | Rvalue::ShallowInitBoxWithAlloc(_) => (),
Rvalue::ThreadLocalRef(n)
| Rvalue::AddressOf(n)
| Rvalue::BinaryOp(n)
| Rvalue::NullaryOp(n) => match *n {},
}
if let Rvalue::Ref(
BorrowKind::Mut {
Expand Down
24 changes: 13 additions & 11 deletions crates/hir-ty/src/mir/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,10 @@ impl Evaluator<'_> {
}
CastKind::FnPtrToPtr => not_supported!("fn ptr to ptr cast"),
},
Rvalue::ThreadLocalRef(n)
| Rvalue::AddressOf(n)
| Rvalue::BinaryOp(n)
| Rvalue::NullaryOp(n) => match *n {},
})
}

Expand Down Expand Up @@ -2703,17 +2707,15 @@ impl Evaluator<'_> {
TyKind::Function(_) => {
self.exec_fn_pointer(func_data, destination, &args[1..], locals, target_bb, span)
}
TyKind::Closure(closure, subst) => {
return self.exec_closure(
*closure,
func_data,
&Substitution::from_iter(Interner, ClosureSubst(subst).parent_subst()),
destination,
&args[1..],
locals,
span,
);
}
TyKind::Closure(closure, subst) => self.exec_closure(
*closure,
func_data,
&Substitution::from_iter(Interner, ClosureSubst(subst).parent_subst()),
destination,
&args[1..],
locals,
span,
),
_ => {
// try to execute the manual impl of `FnTrait` for structs (nightly feature used in std)
let arg0 = func;
Expand Down
4 changes: 4 additions & 0 deletions crates/hir-ty/src/mir/monomorphization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ impl Filler<'_> {
| Rvalue::UnaryOp(_, _)
| Rvalue::Discriminant(_)
| Rvalue::CopyForDeref(_) => (),
Rvalue::ThreadLocalRef(n)
| Rvalue::AddressOf(n)
| Rvalue::BinaryOp(n)
| Rvalue::NullaryOp(n) => match *n {},
},
StatementKind::Deinit(_)
| StatementKind::FakeRead(_)
Expand Down
4 changes: 4 additions & 0 deletions crates/hir-ty/src/mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ impl<'a> MirPrettyCtx<'a> {
self.place(p);
w!(self, ")");
}
Rvalue::ThreadLocalRef(n)
| Rvalue::AddressOf(n)
| Rvalue::BinaryOp(n)
| Rvalue::NullaryOp(n) => match *n {},
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub(super) struct ClauseElaborator<'a> {
seen: FxHashSet<WhereClause>,
}

impl<'a> ClauseElaborator<'a> {
impl ClauseElaborator<'_> {
fn extend_deduped(&mut self, clauses: impl IntoIterator<Item = WhereClause>) {
self.stack.extend(clauses.into_iter().filter(|c| self.seen.insert(c.clone())))
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir/src/semantics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl<'db, DB> ops::Deref for Semantics<'db, DB> {
}
}

impl<'db, DB: HirDatabase> Semantics<'db, DB> {
impl<DB: HirDatabase> Semantics<'_, DB> {
pub fn new(db: &DB) -> Semantics<'_, DB> {
let impl_ = SemanticsImpl::new(db);
Semantics { db, imp: impl_ }
Expand Down
5 changes: 2 additions & 3 deletions crates/parser/src/grammar/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ pub(super) fn pattern_top_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
pattern_r(p, recovery_set);
}

/// Parses a pattern list separated by pipes `|`, with no leading `|`,using the
/// given `recovery_set`.

// test or_pattern
// fn main() {
// match () {
Expand All @@ -52,6 +49,8 @@ pub(super) fn pattern_top_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
// [_ | _,] => (),
// }
// }
/// Parses a pattern list separated by pipes `|`, with no leading `|`,using the
/// given `recovery_set`.
fn pattern_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
let m = p.start();
pattern_single_r(p, recovery_set);
Expand Down
4 changes: 2 additions & 2 deletions crates/proc-macro-api/src/msg/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ struct Writer<'a, 'span, S: InternableSpan> {
text: Vec<String>,
}

impl<'a, 'span, S: InternableSpan> Writer<'a, 'span, S> {
impl<'a, S: InternableSpan> Writer<'a, '_, S> {
fn write(&mut self, root: &'a tt::Subtree<S>) {
self.enqueue(root);
while let Some((idx, subtree)) = self.work.pop_front() {
Expand Down Expand Up @@ -524,7 +524,7 @@ struct Reader<'span, S: InternableSpan> {
span_data_table: &'span S::Table,
}

impl<'span, S: InternableSpan> Reader<'span, S> {
impl<S: InternableSpan> Reader<'_, S> {
pub(crate) fn read(self) -> tt::Subtree<S> {
let mut res: Vec<Option<tt::Subtree<S>>> = vec![None; self.subtree.len()];
let read_span = |id| S::span_for_token_id(self.span_data_table, id);
Expand Down
2 changes: 1 addition & 1 deletion crates/ra-salsa/src/derived/slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ Please report this bug to https://github.com/salsa-rs/salsa/issues."
}
}

impl<'me, Q> Drop for PanicGuard<'me, Q>
impl<Q> Drop for PanicGuard<'_, Q>
where
Q: QueryFunction,
Q::Value: Eq,
Expand Down
2 changes: 1 addition & 1 deletion crates/ra-salsa/src/derived_lru/slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ Please report this bug to https://github.com/salsa-rs/salsa/issues."
}
}

impl<'me, Q, MP> Drop for PanicGuard<'me, Q, MP>
impl<Q, MP> Drop for PanicGuard<'_, Q, MP>
where
Q: QueryFunction,
MP: MemoizationPolicy<Q>,
Expand Down
2 changes: 1 addition & 1 deletion crates/ra-salsa/src/interned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ where
is_static::<Slot<K>>();
}

impl<'me, Q> QueryTable<'me, Q>
impl<Q> QueryTable<'_, Q>
where
Q: Query<Storage = InternedStorage<Q>>,
Q::Key: InternValue,
Expand Down
6 changes: 3 additions & 3 deletions crates/ra-salsa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where
db: &'me D,
}

impl<'me, D: ?Sized> fmt::Debug for EventDebug<'me, D>
impl<D: ?Sized> fmt::Debug for EventDebug<'_, D>
where
D: plumbing::DatabaseOps,
{
Expand Down Expand Up @@ -242,7 +242,7 @@ where
db: &'me D,
}

impl<'me, D: ?Sized> fmt::Debug for EventKindDebug<'me, D>
impl<D: ?Sized> fmt::Debug for EventKindDebug<'_, D>
where
D: plumbing::DatabaseOps,
{
Expand Down Expand Up @@ -729,7 +729,7 @@ impl Cycle {
db: &'me dyn Database,
}

impl<'me> std::fmt::Debug for UnexpectedCycleDebug<'me> {
impl std::fmt::Debug for UnexpectedCycleDebug<'_> {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fmt.debug_struct("UnexpectedCycle")
.field("all_participants", &self.c.all_participants(self.db))
Expand Down
9 changes: 1 addition & 8 deletions crates/rust-analyzer/src/handlers/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,18 +539,11 @@ pub(crate) fn handle_document_symbol(
url: &Url,
res: &mut Vec<SymbolInformation>,
) {
let mut tags = Vec::new();

#[allow(deprecated)]
if let Some(true) = symbol.deprecated {
tags.push(SymbolTag::DEPRECATED)
}

#[allow(deprecated)]
res.push(SymbolInformation {
name: symbol.name.clone(),
kind: symbol.kind,
tags: Some(tags),
tags: symbol.tags.clone(),
deprecated: symbol.deprecated,
location: Location::new(url.clone(), symbol.range),
container_name,
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/tracing/hprof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub struct DataVisitor<'a> {
string: &'a mut String,
}

impl<'a> Visit for DataVisitor<'a> {
impl Visit for DataVisitor<'_> {
fn record_debug(&mut self, field: &Field, value: &dyn std::fmt::Debug) {
write!(self.string, "{} = {:?} ", field.name(), value).unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/tt/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub enum TokenTreeRef<'a, Span> {
Leaf(&'a Leaf<Span>, &'a TokenTree<Span>),
}

impl<'a, Span: Copy> TokenTreeRef<'a, Span> {
impl<Span: Copy> TokenTreeRef<'_, Span> {
pub fn span(&self) -> Span {
match self {
TokenTreeRef::Subtree(subtree, _) => subtree.delimiter.open,
Expand Down
2 changes: 1 addition & 1 deletion editors/code/src/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
return;
}
if (status.message) {
statusBar.tooltip.appendText(status.message);
statusBar.tooltip.appendMarkdown(status.message);
}
if (statusBar.tooltip.value) {
statusBar.tooltip.appendMarkdown("\n\n---\n\n");
Expand Down
Loading