Skip to content

Commit

Permalink
Re-sync with internal repository (#81)
Browse files Browse the repository at this point in the history
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.
  • Loading branch information
facebook-github-bot authored Feb 5, 2025
1 parent 4d52d4a commit ede9aa2
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[alias]
xtask = "run --package xtask --"

# @fb-only:
# @fb-only:
# @fb-only
# @fb-only

[profile.release]
lto = "thin"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ threadpool = "1.8.1"
timeout-readwrite = "0.3.3"
toml = "0.5"
tree-sitter = "0.23.2"
# @fb-only:
# @fb-only
tree-sitter-erlang = "0.11.0" # @oss-only
url = "2.5.4"
vfs = { git = "https://github.com/rust-lang/rust-analyzer", rev = "2024-07-29" }
Expand Down
4 changes: 2 additions & 2 deletions crates/base_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod module_index;
// Public API

pub mod fixture;
// @fb-only:
// @fb-only
pub mod test_utils;
pub use change::Change;
pub use elp_project_model::AppType;
Expand Down Expand Up @@ -414,7 +414,7 @@ lazy_static! {
static ref IGNORED_SOURCES: Vec<Regex> = {
let regexes: Vec<Vec<Regex>> = vec![
//ignore sources goes here
// @fb-only:
// @fb-only
];
regexes.into_iter().flatten().collect::<Vec<Regex>>()
};
Expand Down
8 changes: 4 additions & 4 deletions crates/elp/src/bin/glean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use elp_ide::elp_ide_db::elp_base_db::VfsPath;
use elp_ide::elp_ide_db::EqwalizerDatabase;
use elp_ide::elp_ide_db::LineIndexDatabase;
use elp_ide::elp_ide_db::RootDatabase;
// @fb-only:
// @fb-only
use elp_ide::Analysis;
use elp_ide::TextRange;
use elp_project_model::buck::BuckQueryConfig;
Expand Down Expand Up @@ -1604,8 +1604,8 @@ impl GleanIndexer {
expansion,
ods_url: None,
};
// @fb-only:
// @fb-only:
// @fb-only
// @fb-only
Some(XRef {
source: range.into(),
target: XRefTarget::Macro(target.into()),
Expand Down Expand Up @@ -2459,7 +2459,7 @@ mod tests {
%% ^^^^^^^^^^^ macro.erl/macro/COUNT_INFRA/70/has_ods/'atom'
"#;
// @fb-only:
// @fb-only
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/elp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod handlers;
pub mod line_endings;
pub mod lsp_ext;
mod mem_docs;
// @fb-only:
// @fb-only
mod op_queue;
mod project_loader;
pub mod reload;
Expand Down Expand Up @@ -106,7 +106,7 @@ pub fn otp_file_to_ignore(db: &Analysis, file_id: FileId) -> bool {
"redbug_dtop",
]
.iter()
// @fb-only:
// @fb-only
.map(SmolStr::new)
.collect();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub use module_data::TypeAliasDef;
pub use module_data::TypeAliasSource;
pub use module_data::VarDef;
pub use name::known;
// @fb-only:
// @fb-only
pub use name::AsName;
pub use name::MacroName;
pub use name::Name;
Expand Down
2 changes: 1 addition & 1 deletion crates/hir/src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

//! See [`Name`].
// @fb-only:
// @fb-only

use std::borrow::Cow;
use std::collections::HashSet;
Expand Down
4 changes: 2 additions & 2 deletions crates/ide/src/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use elp_syntax::TextRange;
use fxhash::FxHashMap;
use fxhash::FxHashSet;

// @fb-only:
// @fb-only
use crate::runnables::runnables;
use crate::runnables::Runnable;

Expand Down Expand Up @@ -46,7 +46,7 @@ pub struct Link {

pub(crate) fn annotations(db: &RootDatabase, file_id: FileId) -> Vec<Annotation> {
let mut annotations = Vec::default();
// @fb-only:
// @fb-only
annotations
}

Expand Down
6 changes: 3 additions & 3 deletions crates/ide/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod inefficient_last;
mod map_find_to_syntax;
mod map_insertion_to_syntax;
mod meck;
// @fb-only:
// @fb-only
mod missing_compile_warn_missing_spec;
mod missing_separator;
mod misspelled_attribute;
Expand Down Expand Up @@ -804,7 +804,7 @@ pub fn native_diagnostics(
config
.lints_from_config
.get_diagnostics(&mut res, &sema, file_id);
// @fb-only:
// @fb-only
syntax_diagnostics(&sema, &parse, &mut res, file_id);
diagnostics_from_descriptors(
&mut res,
Expand Down Expand Up @@ -1515,7 +1515,7 @@ pub fn ct_diagnostics(
let testcases =
common_test::runnable_names(&sema, file_id, all.clone(), groups.clone()).ok();
common_test::unreachable_test(&mut res, &sema, file_id, &testcases);
// @fb-only:
// @fb-only
}
CommonTestInfo::EvalError(_error) => {
// The error currently does not contain anything useful, so we ignore it
Expand Down
4 changes: 2 additions & 2 deletions crates/ide/src/diagnostics/application_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::codemod_helpers::find_call_in_function;
use crate::codemod_helpers::CheckCallCtx;
use crate::codemod_helpers::FunctionMatch;
use crate::codemod_helpers::MakeDiagCtx;
// @fb-only:
// @fb-only
use crate::diagnostics::DiagnosticCode;
use crate::diagnostics::Severity;

Expand Down Expand Up @@ -106,7 +106,7 @@ fn check_function(diags: &mut Vec<Diagnostic>, sema: &Semantic, def: &FunctionDe
vec![2, 3],
BadEnvCallAction::AppArg(0),
),
// @fb-only:
// @fb-only
]
.into_iter()
.flatten()
Expand Down
8 changes: 4 additions & 4 deletions crates/ide/src/diagnostics/atoms_exhaustion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::DiagnosticDescriptor;
use crate::codemod_helpers::find_call_in_function;
use crate::codemod_helpers::CheckCallCtx;
use crate::codemod_helpers::MakeDiagCtx;
// @fb-only:
// @fb-only
use crate::diagnostics::Diagnostic;
use crate::diagnostics::DiagnosticCode;
use crate::diagnostics::Severity;
Expand Down Expand Up @@ -47,7 +47,7 @@ fn atoms_exhaustion(diagnostics: &mut Vec<Diagnostic>, sema: &Semantic, file_id:
// FunctionMatch::mfa("erlang", "binary_to_term", 2),
]
.into_iter()
// @fb-only:
// @fb-only
.collect();

static ref BAD_CALLS_MFAS: Vec<(&'static FunctionMatch, ())> = BAD_CALLS
Expand All @@ -61,7 +61,7 @@ fn atoms_exhaustion(diagnostics: &mut Vec<Diagnostic>, sema: &Semantic, file_id:
.for_each(|(_arity, def)| {
if def.file.file_id == file_id {
let is_relevant;
// @fb-only:
// @fb-only
is_relevant = true; // @oss-only
if is_relevant {
check_function(diagnostics, sema, def, &BAD_CALLS_MFAS);
Expand All @@ -88,7 +88,7 @@ fn check_function(
..
}: CheckCallCtx<'_, ()>| {
let is_safe;
// @fb-only:
// @fb-only
is_safe = false; // @oss-only
if !is_safe {
match args.as_vec()[..] {
Expand Down
4 changes: 2 additions & 2 deletions crates/ide/src/diagnostics/cross_node_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::DiagnosticDescriptor;
use crate::codemod_helpers::find_call_in_function;
use crate::codemod_helpers::FunctionMatch;
use crate::codemod_helpers::MakeDiagCtx;
// @fb-only:
// @fb-only
use crate::diagnostics::DiagnosticCode;
use crate::diagnostics::Severity;

Expand Down Expand Up @@ -58,7 +58,7 @@ fn check_function(diags: &mut Vec<Diagnostic>, sema: &Semantic, def: &FunctionDe
FunctionMatch::mfas("erlang", "spawn_monitor", vec![2, 4]).into_iter().map(|fm| (fm,None)).collect(),
FunctionMatch::mfas("erlang", "spawn_opt", vec![3, 5]).into_iter().map(|fm| (fm,None)).collect(),
FunctionMatch::mfas("sys", "install", vec![2, 3]).into_iter().map(|fm| (fm,None)).collect(),
// @fb-only:
// @fb-only
]
.into_iter()
.flatten()
Expand Down
4 changes: 2 additions & 2 deletions crates/ide/src/diagnostics/deprecated_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use super::DiagnosticDescriptor;
use super::Severity;
use crate::codemod_helpers::FunctionMatch;
use crate::codemod_helpers::FunctionMatcher;
// @fb-only:
// @fb-only
use crate::fix;

pub(crate) static DESCRIPTOR: DiagnosticDescriptor = DiagnosticDescriptor {
Expand Down Expand Up @@ -87,7 +87,7 @@ fn deprecated_function(diagnostics: &mut Vec<Diagnostic>, sema: &Semantic, file_
lazy_static! {
static ref DEPRECATED_FUNCTIONS: Vec<(FunctionMatch, DeprecationDetails)> = {
let matches: Vec<Vec<(FunctionMatch, DeprecationDetails)>> = vec![
// @fb-only:
// @fb-only
];
matches.into_iter()
.flatten()
Expand Down
4 changes: 2 additions & 2 deletions crates/ide/src/diagnostics/slow_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ See https://www.erlang.org/doc/man/sets.html
diagnostic_template: DiagnosticTemplate {
code: DiagnosticCode::SlowFunction,
message: format!("The dict module is very slow in Erlang.\nIt is recommend to use maps instead of the dict module.\n\n{}\n",
// @fb-only:
// @fb-only
"" // @oss-only
)
.to_string(),
Expand Down Expand Up @@ -120,7 +120,7 @@ mod tests {
)
}

// @fb-only:
// @fb-only
// @oss-only #[allow(dead_code)]
fn slow_function_dict() {
check_diagnostics(
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 @@ -14,7 +14,7 @@ use elp_syntax::AstNode;
use hir::InFile;
use hir::Semantic;

// @fb-only:
// @fb-only
mod otp_links;

#[derive(Debug, Clone, PartialEq, Eq)]
Expand All @@ -39,7 +39,7 @@ pub(crate) fn external_docs(db: &RootDatabase, position: &FilePosition) -> Optio
.iter()
.for_each(|def| otp_links::links(&mut doc_links, &sema, &def));
}
// @fb-only:
// @fb-only
Some(doc_links)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub mod diagnostics;
pub mod diagnostics_collection;
pub mod diff;
mod highlight_related;
// @fb-only:
// @fb-only

pub use annotations::Annotation;
pub use annotations::AnnotationKind;
Expand Down
4 changes: 2 additions & 2 deletions crates/ide_completion/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod helpers;
mod keywords;
mod macros;
mod maps;
// @fb-only:
// @fb-only
mod modules;
mod records;
mod spec;
Expand Down Expand Up @@ -164,7 +164,7 @@ pub fn completions(
}
CtxKind::Other => {
let _ = attributes::add_completions(&mut acc, ctx)
// @fb-only:
// @fb-only
|| vars::add_completions(&mut acc, ctx)
|| maps::add_completions(&mut acc, ctx)
|| records::add_completions(&mut acc, ctx);
Expand Down
16 changes: 8 additions & 8 deletions crates/ide_db/src/diagnostic_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ use serde::Deserializer;
use strum::IntoEnumIterator;
use strum_macros::EnumIter;

// @fb-only:
// @fb-only

// @fb-only:
// @fb-only
pub const BASE_URL: &str = "https://whatsapp.github.io/erlang-language-platform/docs"; // @oss-only

#[derive(Clone, Debug, PartialEq, Eq, Hash, EnumIter)]
Expand Down Expand Up @@ -72,7 +72,7 @@ pub enum DiagnosticCode {
Eqwalizer(String),
// Used for ad-hoc diagnostics via lints/codemods
AdHoc(String),
// @fb-only:
// @fb-only
}

// These namespaces map the error codes returned by the Erlang Service.
Expand Down Expand Up @@ -200,7 +200,7 @@ impl DiagnosticCode {
DiagnosticCode::ErlangService(c) => c.to_string(),
DiagnosticCode::Eqwalizer(c) => format!("eqwalizer: {c}"),
DiagnosticCode::AdHoc(c) => format!("ad-hoc: {c}"),
// @fb-only:
// @fb-only
}
}

Expand Down Expand Up @@ -267,7 +267,7 @@ impl DiagnosticCode {
DiagnosticCode::ErlangService(c) => c.to_string(),
DiagnosticCode::Eqwalizer(c) => c.to_string(),
DiagnosticCode::AdHoc(c) => format!("ad-hoc: {c}"),
// @fb-only:
// @fb-only
}
}

Expand All @@ -278,7 +278,7 @@ impl DiagnosticCode {
pub fn maybe_from_string(s: &str) -> Option<DiagnosticCode> {
DIAGNOSTIC_CODE_LOOKUPS
.get(s).cloned()
// @fb-only:
// @fb-only
.or_else( ||
// Look for ErlangService and AdHoc
if let Some(code) = Self::is_adhoc(s) {
Expand All @@ -295,7 +295,7 @@ impl DiagnosticCode {
match self {
DiagnosticCode::DefaultCodeForEnumIter => None,
DiagnosticCode::AdHoc(_) => None,
// @fb-only:
// @fb-only
DiagnosticCode::ErlangService(code) => Namespace::from_str(code).ok(),
_ => Namespace::from_str(&self.as_code()).ok(),
}
Expand Down Expand Up @@ -393,7 +393,7 @@ impl DiagnosticCode {
DiagnosticCode::ErlangService(_) => false,
DiagnosticCode::Eqwalizer(_) => false,
DiagnosticCode::AdHoc(_) => false,
// @fb-only:
// @fb-only
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ide_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub mod docs;
pub mod eqwalizer;
mod erl_ast;
mod line_index;
// @fb-only:
// @fb-only
pub mod metadata;
mod search;

Expand Down
2 changes: 1 addition & 1 deletion crates/project_model/src/buck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ mod tests {
}

// TODO: enable when buck is properly set up on github project
// @fb-only:
// @fb-only
const BUCK_TESTS_ENABLED: bool = false; // @oss-only

fn get_prelude_cell(buck_config: &BuckConfig) -> Result<String> {
Expand Down
Loading

0 comments on commit ede9aa2

Please sign in to comment.