Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
7218: Fix typos r=Veykril a=regexident

Apart from the very last commit on this PR (which fixes a public type's name) all changes are non-breaking.

Co-authored-by: Vincent Esche <[email protected]>
  • Loading branch information
bors[bot] and regexident authored Jan 10, 2021
2 parents 3e32e39 + d462119 commit 607b9ea
Show file tree
Hide file tree
Showing 32 changed files with 114 additions and 118 deletions.
2 changes: 1 addition & 1 deletion crates/hir/src/from_id.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Utility module for converting between hir_def ids and code_model wrappers.
//!
//! It's unclear if we need this long-term, but it's definitelly useful while we
//! It's unclear if we need this long-term, but it's definitely useful while we
//! are splitting the hir.
use hir_def::{
Expand Down
4 changes: 2 additions & 2 deletions crates/hir_def/src/body/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ impl ExprCollector<'_> {
match res.value {
Some((mark, expansion)) => {
// FIXME: Statements are too complicated to recover from error for now.
// It is because we don't have any hygenine for local variable expansion right now.
// It is because we don't have any hygiene for local variable expansion right now.
if T::can_cast(syntax::SyntaxKind::MACRO_STMTS) && res.err.is_some() {
self.expander.exit(self.db, mark);
collector(self, None);
Expand Down Expand Up @@ -959,7 +959,7 @@ impl ExprCollector<'_> {

fn collect_tuple_pat(&mut self, args: AstChildren<ast::Pat>) -> (Vec<PatId>, Option<usize>) {
// Find the location of the `..`, if there is one. Note that we do not
// consider the possiblity of there being multiple `..` here.
// consider the possibility of there being multiple `..` here.
let ellipsis = args.clone().position(|p| matches!(p, ast::Pat::RestPat(_)));
// We want to skip the `..` pattern here, since we account for it above.
let args = args
Expand Down
2 changes: 1 addition & 1 deletion crates/hir_def/src/expr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module describes hir-level representation of expressions.
//!
//! This representaion is:
//! This representation is:
//!
//! 1. Identity-based. Each expression has an `id`, so we can distinguish
//! between different `1` in `1 + 1`.
Expand Down
8 changes: 4 additions & 4 deletions crates/hir_def/src/nameres/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl DefCollector<'_> {

// Resolve all indeterminate resolved imports again
// As some of the macros will expand newly import shadowing partial resolved imports
// FIXME: We maybe could skip this, if we handle the Indetermine imports in `resolve_imports`
// FIXME: We maybe could skip this, if we handle the indeterminate imports in `resolve_imports`
// correctly
let partial_resolved = self.resolved_imports.iter().filter_map(|directive| {
if let PartialResolvedImport::Indeterminate(_) = directive.status {
Expand Down Expand Up @@ -402,7 +402,7 @@ impl DefCollector<'_> {

/// Define a proc macro
///
/// A proc macro is similar to normal macro scope, but it would not visiable in legacy textual scoped.
/// A proc macro is similar to normal macro scope, but it would not visible in legacy textual scoped.
/// And unconditionally exported.
fn define_proc_macro(&mut self, name: Name, macro_: MacroDefId) {
self.update(
Expand Down Expand Up @@ -592,7 +592,7 @@ impl DefCollector<'_> {
// XXX: urgh, so this works by accident! Here, we look at
// the enum data, and, in theory, this might require us to
// look back at the crate_def_map, creating a cycle. For
// example, `enum E { crate::some_macro!(); }`. Luckely, the
// example, `enum E { crate::some_macro!(); }`. Luckily, the
// only kind of macro that is allowed inside enum is a
// `cfg_macro`, and we don't need to run name resolution for
// it, but this is sheer luck!
Expand Down Expand Up @@ -655,7 +655,7 @@ impl DefCollector<'_> {
&mut self,
module_id: LocalModuleId,
resolutions: &[(Option<Name>, PerNs)],
// All resolutions are imported with this visibility; the visibilies in
// All resolutions are imported with this visibility; the visibilities in
// the `PerNs` values are ignored and overwritten
vis: Visibility,
import_type: ImportType,
Expand Down
2 changes: 1 addition & 1 deletion crates/hir_def/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{

#[derive(Debug, Clone, Default)]
pub struct Resolver {
// FIXME: all usages generally call `.rev`, so maybe reverse once in consturciton?
// FIXME: all usages generally call `.rev`, so maybe reverse once in construction?
scopes: Vec<Scope>,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/hir_expand/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl TokenExpander {
// FIXME switch these to ExpandResult as well
TokenExpander::BuiltinDerive(it) => it.expand(db, id, tt).into(),
TokenExpander::ProcMacro(_) => {
// We store the result in salsa db to prevent non-determinisc behavior in
// We store the result in salsa db to prevent non-deterministic behavior in
// some proc-macro implementation
// See #4315 for details
db.expand_proc_macro(id.into()).into()
Expand Down
4 changes: 2 additions & 2 deletions crates/hir_ty/src/diagnostics/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ pub fn record_literal_missing_fields(
id: ExprId,
expr: &Expr,
) -> Option<(VariantId, Vec<LocalFieldId>, /*exhaustive*/ bool)> {
let (fields, exhausitve) = match expr {
let (fields, exhaustive) = match expr {
Expr::RecordLit { path: _, fields, spread } => (fields, spread.is_none()),
_ => return None,
};
Expand All @@ -400,7 +400,7 @@ pub fn record_literal_missing_fields(
if missed_fields.is_empty() {
return None;
}
Some((variant_def, missed_fields, exhausitve))
Some((variant_def, missed_fields, exhaustive))
}

pub fn record_pattern_missing_fields(
Expand Down
4 changes: 2 additions & 2 deletions crates/hir_ty/src/diagnostics/match_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! The algorithm implemented here is a modified version of the one described in
//! <http://moscova.inria.fr/~maranget/papers/warn/index.html>.
//! However, to save future implementors from reading the original paper, we
//! summarise the algorithm here to hopefully save time and be a little clearer
//! summarize the algorithm here to hopefully save time and be a little clearer
//! (without being so rigorous).
//!
//! The core of the algorithm revolves about a "usefulness" check. In particular, we
Expand Down Expand Up @@ -132,7 +132,7 @@
//! The algorithm is inductive (on the number of columns: i.e., components of tuple patterns).
//! That means we're going to check the components from left-to-right, so the algorithm
//! operates principally on the first component of the matrix and new pattern-stack `p`.
//! This algorithm is realised in the `is_useful` function.
//! This algorithm is realized in the `is_useful` function.
//!
//! Base case (`n = 0`, i.e., an empty tuple pattern):
//! - If `P` already contains an empty pattern (i.e., if the number of patterns `m > 0`), then
Expand Down
6 changes: 3 additions & 3 deletions crates/hir_ty/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,16 +491,16 @@ impl Ty {
fn from_hir_path_inner(
ctx: &TyLoweringContext<'_>,
segment: PathSegment<'_>,
typable: TyDefId,
typeable: TyDefId,
infer_args: bool,
) -> Ty {
let generic_def = match typable {
let generic_def = match typeable {
TyDefId::BuiltinType(_) => None,
TyDefId::AdtId(it) => Some(it.into()),
TyDefId::TypeAliasId(it) => Some(it.into()),
};
let substs = substs_from_path_segment(ctx, segment, generic_def, infer_args);
ctx.db.ty(typable).subst(&substs)
ctx.db.ty(typeable).subst(&substs)
}

/// Collect generic arguments from a path into a `Substs`. See also
Expand Down
4 changes: 2 additions & 2 deletions crates/ide/src/doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Defi
if target.contains("://") {
(target.to_string(), title.to_string())
} else {
// Two posibilities:
// Two possibilities:
// * path-based links: `../../module/struct.MyStruct.html`
// * module-based links (AKA intra-doc links): `super::super::module::MyStruct`
if let Some(rewritten) = rewrite_intra_doc_link(db, *definition, target, title) {
Expand Down Expand Up @@ -442,7 +442,7 @@ fn get_symbol_fragment(db: &dyn HirDatabase, field_or_assoc: &FieldOrAssocItem)
function.as_assoc_item(db).map(|assoc| assoc.container(db)),
Some(AssocItemContainer::Trait(..))
);
// This distinction may get more complicated when specialisation is available.
// This distinction may get more complicated when specialization is available.
// Rustdoc makes this decision based on whether a method 'has defaultness'.
// Currently this is only the case for provided trait methods.
if is_trait_method && !function.has_body(db) {
Expand Down
20 changes: 10 additions & 10 deletions crates/ide/src/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1953,16 +1953,16 @@ struct S {
/// Test cases:
/// case 1. bare URL: https://www.example.com/
/// case 2. inline URL with title: [example](https://www.example.com/)
/// case 3. code refrence: [`Result`]
/// case 4. code refrence but miss footnote: [`String`]
/// case 3. code reference: [`Result`]
/// case 4. code reference but miss footnote: [`String`]
/// case 5. autolink: <http://www.example.com/>
/// case 6. email address: <[email protected]>
/// case 7. refrence: [example][example]
/// case 7. reference: [example][example]
/// case 8. collapsed link: [example][]
/// case 9. shortcut link: [example]
/// case 10. inline without URL: [example]()
/// case 11. refrence: [foo][foo]
/// case 12. refrence: [foo][bar]
/// case 11. reference: [foo][foo]
/// case 12. reference: [foo][bar]
/// case 13. collapsed link: [foo][]
/// case 14. shortcut link: [foo]
/// case 15. inline without URL: [foo]()
Expand All @@ -1989,16 +1989,16 @@ pub fn fo$0o() {}
Test cases:
case 1. bare URL: https://www.example.com/
case 2. inline URL with title: [example](https://www.example.com/)
case 3. code refrence: `Result`
case 4. code refrence but miss footnote: `String`
case 3. code reference: `Result`
case 4. code reference but miss footnote: `String`
case 5. autolink: http://www.example.com/
case 6. email address: [email protected]
case 7. refrence: example
case 7. reference: example
case 8. collapsed link: example
case 9. shortcut link: example
case 10. inline without URL: example
case 11. refrence: foo
case 12. refrence: foo
case 11. reference: foo
case 12. reference: foo
case 13. collapsed link: foo
case 14. shortcut link: foo
case 15. inline without URL: foo
Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! or `ast::NameRef`. If it's a `ast::NameRef`, at the classification step we
//! try to resolve the direct tree parent of this element, otherwise we
//! already have a definition and just need to get its HIR together with
//! some information that is needed for futher steps of searching.
//! some information that is needed for further steps of searching.
//! After that, we collect files that might contain references and look
//! for text occurrences of the identifier. If there's an `ast::NameRef`
//! at the index that the match starts at and its tree parent is
Expand Down
4 changes: 2 additions & 2 deletions crates/ide/src/references/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ use crate::foo$0::FooContent;
//- /lib.rs
mod fo$0o;
//- /foo/mod.rs
// emtpy
// empty
"#,
expect![[r#"
RangeInfo {
Expand Down Expand Up @@ -995,7 +995,7 @@ mod fo$0o;
mod outer { mod fo$0o; }
//- /outer/foo.rs
// emtpy
// empty
"#,
expect![[r#"
RangeInfo {
Expand Down
2 changes: 1 addition & 1 deletion crates/ide_db/src/imports_locator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! This module contains an import search funcionality that is provided to the assists module.
//! This module contains an import search functionality that is provided to the assists module.
//! Later, this should be moved away to a separate crate that is accessible from the assists module.
use hir::{import_map, AsAssocItem, Crate, MacroDef, ModuleDef, Semantics};
Expand Down
4 changes: 2 additions & 2 deletions crates/mbe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
#[derive(Debug, PartialEq, Eq)]
pub enum ParseError {
Expected(String),
RepetitionEmtpyTokenTree,
RepetitionEmptyTokenTree,
}

#[derive(Debug, PartialEq, Eq, Clone)]
Expand Down Expand Up @@ -270,7 +270,7 @@ fn validate(pattern: &MetaTemplate) -> Result<(), ParseError> {
}
false
}) {
return Err(ParseError::RepetitionEmtpyTokenTree);
return Err(ParseError::RepetitionEmptyTokenTree);
}
}
validate(subtree)?
Expand Down
2 changes: 1 addition & 1 deletion crates/mbe/src/mbe_expander/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ pub(super) fn match_repeat(
src: &mut TtIter,
) -> Result<(), ExpandError> {
// Dirty hack to make macro-expansion terminate.
// This should be replaced by a propper macro-by-example implementation
// This should be replaced by a proper macro-by-example implementation
let mut limit = 65536;
let mut counter = 0;

Expand Down
8 changes: 2 additions & 6 deletions crates/mbe/src/mbe_expander/transcriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct NestingState {
/// because there is no variable in use by the current repetition
hit: bool,
/// `at_end` is currently necessary to tell `expand_repeat` if it should stop
/// because there is no more value avaible for the current repetition
/// because there is no more value available for the current repetition
at_end: bool,
}

Expand Down Expand Up @@ -179,11 +179,7 @@ fn expand_repeat(

counter += 1;
if counter == limit {
log::warn!(
"expand_tt excced in repeat pattern exceed limit => {:#?}\n{:#?}",
template,
ctx
);
log::warn!("expand_tt in repeat pattern exceed limit => {:#?}\n{:#?}", template, ctx);
break;
}

Expand Down
12 changes: 6 additions & 6 deletions crates/mbe/src/syntax_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl TokenMap {
}

fn remove_delim(&mut self, idx: usize) {
// FIXME: This could be accidently quadratic
// FIXME: This could be accidentally quadratic
self.entries.remove(idx);
}
}
Expand Down Expand Up @@ -476,14 +476,14 @@ impl Convertor {

#[derive(Debug)]
enum SynToken {
Ordiniary(SyntaxToken),
Ordinary(SyntaxToken),
Punch(SyntaxToken, TextSize),
}

impl SynToken {
fn token(&self) -> &SyntaxToken {
match self {
SynToken::Ordiniary(it) => it,
SynToken::Ordinary(it) => it,
SynToken::Punch(it, _) => it,
}
}
Expand All @@ -495,7 +495,7 @@ impl SrcToken for SynToken {
}
fn to_char(&self) -> Option<char> {
match self {
SynToken::Ordiniary(_) => None,
SynToken::Ordinary(_) => None,
SynToken::Punch(it, i) => it.text().chars().nth((*i).into()),
}
}
Expand Down Expand Up @@ -535,7 +535,7 @@ impl TokenConvertor for Convertor {
} else {
self.punct_offset = None;
let range = curr.text_range();
(SynToken::Ordiniary(curr), range)
(SynToken::Ordinary(curr), range)
};

Some(token)
Expand All @@ -557,7 +557,7 @@ impl TokenConvertor for Convertor {
let token = if curr.kind().is_punct() {
SynToken::Punch(curr, 0.into())
} else {
SynToken::Ordiniary(curr)
SynToken::Ordinary(curr)
};
Some(token)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/mbe/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ fn test_no_space_after_semi_colon() {
#[test]
fn test_rustc_issue_57597() {
fn test_error(fixture: &str) {
assert_eq!(parse_macro_error(fixture), ParseError::RepetitionEmtpyTokenTree);
assert_eq!(parse_macro_error(fixture), ParseError::RepetitionEmptyTokenTree);
}

test_error("macro_rules! foo { ($($($i:ident)?)+) => {}; }");
Expand Down
2 changes: 1 addition & 1 deletion crates/parser/src/grammar/items/use_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn use_tree(p: &mut Parser, top_level: bool) {
// test use_tree_list
// use {crate::path::from::root, or::path::from::crate_name}; // Rust 2018 (with a crate named `or`)
// use {path::from::root}; // Rust 2015
// use ::{some::arbritrary::path}; // Rust 2015
// use ::{some::arbitrary::path}; // Rust 2015
// use ::{{{root::export}}}; // Nonsensical but perfectly legal nesting
T!['{'] => {
use_tree_list(p);
Expand Down
2 changes: 1 addition & 1 deletion crates/proc_macro_api/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Message for Response {}
fn read_json(inp: &mut impl BufRead) -> io::Result<Option<String>> {
let mut buf = String::new();
inp.read_line(&mut buf)?;
buf.pop(); // Remove traling '\n'
buf.pop(); // Remove trailing '\n'
Ok(match buf.len() {
0 => None,
_ => Some(buf),
Expand Down
2 changes: 1 addition & 1 deletion crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl<S> DecodeMut<'_, '_, S> for String {
}
}

/// Simplied version of panic payloads, ignoring
/// Simplified version of panic payloads, ignoring
/// types other than `&'static str` and `String`.
#[derive(Debug)]
pub enum PanicMessage {
Expand Down
2 changes: 1 addition & 1 deletion crates/proc_macro_srv/src/rustc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! The lib-proc-macro server backend is `TokenStream`-agnostic, such that
//! we could provide any TokenStream implementation.
//! The original idea from fedochet is using proc-macro2 as backend,
//! we use tt instead for better intergation with RA.
//! we use tt instead for better integration with RA.
//!
//! FIXME: No span and source file information is implemented yet
Expand Down
Loading

0 comments on commit 607b9ea

Please sign in to comment.