Skip to content

Commit

Permalink
Auto merge of rust-lang#108682 - est31:simplify_dirs, r=davidtwco
Browse files Browse the repository at this point in the history
Simplify message paths

This makes it easier to open the messages file. Right now I have to first click on the `locales` dir to open it, and then on the `en-US.ftl` file. `Cargo.toml` and `build.rs` files are also in the top level, and I think there should not be more than one file, so a directory isn't really needed. The [chosen strategy for pontoon adoption](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/pontoon.20and.20next.20steps) is out of tree. Even if this descision is changed in the future, the `messages.ftl` approach is also compatible with non-english translations living in-tree, as long as the non-english translations don't live in the `compiler/rustc_foo/` directories but in different ones. That would also be helpful for grepability purposes.

The commit was the result of automated changes:

```
for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done

for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
```

r? `@davidtwco`
  • Loading branch information
bors committed Mar 12, 2023
2 parents 9455a55 + 7e2ecb3 commit 501ad02
Show file tree
Hide file tree
Showing 68 changed files with 34 additions and 34 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ mod lifetime_collector;
mod pat;
mod path;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

struct LoweringContext<'a, 'hir> {
tcx: TyCtxt<'hir>,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ pub mod feature_gate;
pub mod node_count;
pub mod show_span;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_attr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ pub use rustc_ast::attr::*;

pub(crate) use rustc_ast::HashStableContext;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ use places_conflict::{places_conflict, PlaceConflictBias};
use region_infer::RegionInferenceContext;
use renumber::RegionCtxt;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

// FIXME(eddyb) perhaps move this somewhere more centrally.
#[derive(Debug)]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub mod proc_macro_harness;
pub mod standard_library_imports;
pub mod test_harness;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
let mut register = |name, kind| resolver.register_builtin_macro(name, kind);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ use rustc_span::Symbol;
use rustc_span::fatal_error::FatalError;
use tempfile::TempDir;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub struct PrintOnPanic<F: Fn() -> String>(pub F);

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mod type_of;
mod va_arg;
mod value;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

#[derive(Clone)]
pub struct LlvmCodegenBackend(());
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub mod mono_item;
pub mod target_features;
pub mod traits;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub struct ModuleCodegen<M> {
/// The name of the module. When the crate may be saved between
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use rustc_macros::fluent_messages;
use rustc_middle::ty;
use rustc_middle::ty::query::Providers;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub fn provide(providers: &mut Providers) {
const_eval::provide(providers);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use crate::session_diagnostics::{
RLinkWrongFileType, RlinkNotAFile, RlinkUnableToRead,
};

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
// tidy-alphabetical-start
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use intl_memoizer::IntlLangMemoizer;
pub use fluent_bundle::{self, types::FluentType, FluentArgs, FluentError, FluentValue};
pub use unic_langid::{langid, LanguageIdentifier};

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub type FluentBundle = fluent_bundle::bundle::FluentBundle<FluentResource, IntlLangMemoizer>;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub use snippet::Style;
pub type PErr<'a> = DiagnosticBuilder<'a, ErrorGuaranteed>;
pub type PResult<'a, T> = Result<T, PErr<'a>>;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

// `PResult` is used a lot. Make sure it doesn't unintentionally get bigger.
// (See also the comment on `DiagnosticBuilderInner`'s `diagnostic` field.)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ mod mut_visit {
mod tests;
}

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ use std::ops::Not;
use astconv::AstConv;
use bounds::Bounds;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `win64`, `sysv64` or `efiapi`";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ use rustc_session::Session;
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::{sym, Span};

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

#[macro_export]
macro_rules! type_error_struct {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ pub use persist::{build_dep_graph, load_dep_graph, DepGraphFuture};
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ mod errors;
pub mod infer;
pub mod traits;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ pub use queries::Queries;
#[cfg(test)]
mod tests;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub use rustc_session::lint::Level::{self, *};
pub use rustc_session::lint::{BufferedEarlyLint, FutureIncompatibleInfo, Lint, LintId};
pub use rustc_session::lint::{LintArray, LintPass};

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub fn provide(providers: &mut Providers) {
levels::provide(providers);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ pub use fs::{emit_wrapper_file, METADATA_FILENAME};
pub use native_libs::find_native_static_library;
pub use rmeta::{encode_metadata, EncodedMetadata, METADATA_HEADER};

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ pub mod util {
// Allows macros to refer to this crate as `::rustc_middle`
extern crate self as rustc_middle;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use rustc_middle::ty::query::Providers;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub fn provide(providers: &mut Providers) {
providers.check_match = thir::pattern::check_match;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub mod storage;
pub mod un_derefer;
pub mod value_analysis;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub(crate) mod indexes {
pub(crate) use super::move_paths::MovePathIndex;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_monomorphize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod partitioning;
mod polymorphize;
mod util;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

fn custom_coerce_unsize_info<'tcx>(
tcx: TyCtxtAt<'tcx>,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub mod validate_attr;

mod errors;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

// A bunch of utility functions of the form `parse_<thing>_from_<source>`
// where <thing> includes crate, expr, item, stmt, tts, and one that
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub mod stability;
mod upvars;
mod weak_lang_items;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub fn provide(providers: &mut Providers) {
check_attr::provide(providers);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_plugin_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rustc_macros::fluent_messages;
mod errors;
pub mod load;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

/// Structure used to register plugins.
///
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use errors::{
UnnamedItemIsPrivate,
};

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

////////////////////////////////////////////////////////////////////////////////
/// Generic infrastructure used to implement specific visitors below.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_query_system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ pub use error::LayoutOfDepth;
pub use error::QueryOverflow;
pub use values::Value;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ mod late;
mod macros;
pub mod rustdoc;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

enum Weak {
Yes,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub mod output;

pub use getopts;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

/// Requirements for a `StableHashingContext` to be used in this crate.
/// This is a hack to allow using the `HashStable_Generic` derive macro
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_symbol_mangling/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub mod errors;
pub mod test;
pub mod typeid;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

/// This function computes the symbol name for the given `instance` and the
/// given instantiating crate. That is, if you know that instance X is
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ pub mod infer;
pub mod solve;
pub mod traits;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_ty_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub mod representability;
mod structural_match;
mod ty;

fluent_messages! { "../locales/en-US.ftl" }
fluent_messages! { "../messages.ftl" }

pub fn provide(providers: &mut Providers) {
abi::provide(providers);
Expand Down

0 comments on commit 501ad02

Please sign in to comment.