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

Rollup of 6 pull requests #101850

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2506aa0
jsondoclint: New Tool
aDotInTheVoid Aug 23, 2022
404b60b
Constify impl Fn* &(mut) Fn*
onestacked Sep 13, 2022
478c471
Added Tracking Issue number.
onestacked Sep 14, 2022
c5b9cb4
errors: add `emit_note`/`create_note`
davidtwco Sep 1, 2022
8a2f9c3
errors: implement `IntoDiagnosticArg` for `&T`
davidtwco Aug 30, 2022
ae51741
session: impl `IntoDiagnosticArg` for `CrateType`
davidtwco Aug 30, 2022
7d7cd17
errors: impl `IntoDiagnosticArg` for `TargetTriple`
davidtwco Aug 30, 2022
677d4d0
session: diagnostic migration lint on more fns
davidtwco Aug 19, 2022
b058e41
incremental: migrate diagnostics
davidtwco Aug 19, 2022
d7b9221
change AccessLevels representation
Bryanskiy Sep 12, 2022
a7a4fe9
jsondoclint: Tree Walk Validator
aDotInTheVoid Aug 24, 2022
bb1911d
jsondoclint: Add `Kind` abstraction
aDotInTheVoid Aug 24, 2022
5f1bc6f
jsondocck: Better errors
aDotInTheVoid Aug 24, 2022
41d35a9
jsondocck: Find path to Id's not in index
aDotInTheVoid Aug 24, 2022
c98c7cb
Primitives can appear in modules.
aDotInTheVoid Aug 30, 2022
5956b56
jsondoclint: Document validator
aDotInTheVoid Sep 14, 2022
393792d
Remove check_missing_items.py
aDotInTheVoid Sep 14, 2022
24c751b
Rustdoc-Json: Add test for extern_types
aDotInTheVoid Sep 14, 2022
6e21a28
jsondoclint: More precise `Path` checks
aDotInTheVoid Sep 14, 2022
f69a6c2
jsondoclint: Fix TODO's
aDotInTheVoid Sep 14, 2022
8df181d
Improve handing of env vars during bootstrap process
chriswailes Sep 13, 2022
4cdf264
cache collect_trait_impl_trait_tys
compiler-errors Sep 9, 2022
11e35f0
Rollup merge of #100754 - davidtwco:translation-incremental, r=compil…
Dylan-DPC Sep 15, 2022
8b283b9
Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkov
Dylan-DPC Sep 15, 2022
3e7f24d
Rollup merge of #101783 - chriswailes:env-vars, r=jyn514
Dylan-DPC Sep 15, 2022
0ab8474
Rollup merge of #101787 - compiler-errors:cache-rpitit, r=petrochenkov
Dylan-DPC Sep 15, 2022
6e23b26
Rollup merge of #101802 - chriss0612:const_fn_trait_ref_impls, r=fee1…
Dylan-DPC Sep 15, 2022
a581bb7
Rollup merge of #101809 - aDotInTheVoid:jsondoclint, r=GuillaumeGomez
Dylan-DPC Sep 15, 2022
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
22 changes: 16 additions & 6 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ dependencies = [

[[package]]
name = "anyhow"
version = "1.0.60"
version = "1.0.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c794e162a5eff65c72ef524dfe393eb923c354e350bb78b9c7383df13f3bc142"
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"

[[package]]
name = "array_tool"
Expand Down Expand Up @@ -1362,9 +1362,9 @@ dependencies = [

[[package]]
name = "fs-err"
version = "2.5.0"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcd1163ae48bda72a20ae26d66a04d3094135cadab911cff418ae5e33f253431"
checksum = "64db3e262960f0662f43a6366788d5f10f7f244b8f7d7d987f560baf5ded5c50"

[[package]]
name = "fs_extra"
Expand Down Expand Up @@ -1891,6 +1891,16 @@ dependencies = [
"shlex",
]

[[package]]
name = "jsondoclint"
version = "0.1.0"
dependencies = [
"anyhow",
"fs-err",
"rustdoc-json-types",
"serde_json",
]

[[package]]
name = "jsonpath_lib"
version = "0.2.6"
Expand Down Expand Up @@ -4445,9 +4455,9 @@ dependencies = [

[[package]]
name = "serde_json"
version = "1.0.83"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
dependencies = [
"indexmap",
"itoa",
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ members = [
"src/tools/unicode-table-generator",
"src/tools/expand-yaml-anchors",
"src/tools/jsondocck",
"src/tools/jsondoclint",
"src/tools/html-checker",
"src/tools/bump-stage0",
"src/tools/replace-version-placeholder",
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_borrowck/src/diagnostics/region_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ impl Display for RegionName {
}
}

impl rustc_errors::IntoDiagnosticArg for RegionName {
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
self.to_string().into_diagnostic_arg()
}
}

impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
pub(crate) fn mir_def_id(&self) -> hir::def_id::LocalDefId {
self.body.source.def_id().expect_local()
Expand Down
14 changes: 1 addition & 13 deletions compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_errors::{IntoDiagnosticArg, MultiSpan};
use rustc_errors::MultiSpan;
use rustc_macros::{LintDiagnostic, SessionDiagnostic, SessionSubdiagnostic};
use rustc_middle::ty::Ty;
use rustc_span::Span;
Expand Down Expand Up @@ -137,18 +137,6 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> {
},
}

impl IntoDiagnosticArg for &RegionName {
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
format!("{}", self).into_diagnostic_arg()
}
}

impl IntoDiagnosticArg for RegionName {
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
format!("{}", self).into_diagnostic_arg()
}
}

#[derive(SessionSubdiagnostic)]
pub(crate) enum RequireStaticErr {
#[note(borrowck::used_impl_require_static)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,9 @@ static DEFAULT_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send +
///
/// When `install_ice_hook` is called, this function will be called as the panic
/// hook.
// FIXME(translation): need struct diagnostics implemented on `Handler`
#[allow(rustc::untranslatable_diagnostic)]
#[allow(rustc::diagnostic_outside_of_impl)]
pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
let fallback_bundle =
rustc_errors::fallback_fluent_bundle(rustc_errors::DEFAULT_LOCALE_RESOURCES, false);
Expand Down
106 changes: 106 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/incremental.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
incremental_unrecognized_depnode = unrecognized `DepNode` variant: {$name}

incremental_missing_depnode = missing `DepNode` variant

incremental_missing_if_this_changed = no `#[rustc_if_this_changed]` annotation detected

incremental_no_path = no path from `{$source}` to `{$target}`

incremental_ok = OK

incremental_unknown_reuse_kind = unknown cgu-reuse-kind `{$kind}` specified

incremental_missing_query_depgraph = found CGU-reuse attribute but `-Zquery-dep-graph` was not specified

incremental_malformed_cgu_name =
found malformed codegen unit name `{$user_path}`. codegen units names must always start with the name of the crate (`{$crate_name}` in this case).

incremental_no_module_named = no module named `{$user_path}` (mangled: {$cgu_name}). available modules: {$cgu_names}

incremental_field_associated_value_expected = associated value expected for `{$name}`

incremental_no_field = no field `{$name}`

incremental_assertion_auto = `except` specified DepNodes that can not be affected for \"{$name}\": \"{$e}\"

incremental_undefined_clean_dirty_assertions_item = clean/dirty auto-assertions not yet defined for Node::Item.node={$kind}

incremental_undefined_clean_dirty_assertions = clean/dirty auto-assertions not yet defined for {$kind}

incremental_repeated_depnode_label = dep-node label `{$label}` is repeated

incremental_unrecognized_depnode_label = dep-node label `{$label}` not recognized

incremental_not_dirty = `{$dep_node_str}` should be dirty but is not

incremental_not_clean = `{$dep_node_str}` should be clean but is not

incremental_not_loaded = `{$dep_node_str}` should have been loaded from disk but it was not

incremental_unknown_item = unknown item `{$name}`

incremental_no_cfg = no cfg attribute

incremental_associated_value_expected_for = associated value expected for `{$ident}`

incremental_associated_value_expected = expected an associated value

incremental_unchecked_clean = found unchecked `#[rustc_clean]` attribute

incremental_delete_old = unable to delete old {$name} at `{$path}`: {$err}

incremental_create_new = failed to create {$name} at `{$path}`: {$err}

incremental_write_new = failed to write {$name} to `{$path}`: {$err}

incremental_canonicalize_path = incremental compilation: error canonicalizing path `{$path}`: {$err}

incremental_create_incr_comp_dir = could not create incremental compilation {$tag} directory `{$path}`: {$err}

incremental_create_lock = incremental compilation: could not create session directory lock file: {$lock_err}
.lock_unsupported = the filesystem for the incremental path at {$session_dir} does not appear to support locking, consider changing the incremental path to a filesystem that supports locking or disable incremental compilation
.cargo_help_1 = incremental compilation can be disabled by setting the environment variable CARGO_INCREMENTAL=0 (see https://doc.rust-lang.org/cargo/reference/profiles.html#incremental)
.cargo_help_2 = the entire build directory can be changed to a different filesystem by setting the environment variable CARGO_TARGET_DIR to a different path (see https://doc.rust-lang.org/cargo/reference/config.html#buildtarget-dir)

incremental_delete_lock = error deleting lock file for incremental compilation session directory `{$path}`: {$err}

incremental_hard_link_failed =
hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `{$path}`

incremental_delete_partial = failed to delete partly initialized session dir `{$path}`: {$err}

incremental_delete_full = error deleting incremental compilation session directory `{$path}`: {$err}

incremental_finalize = error finalizing incremental compilation session directory `{$path}`: {$err}

incremental_invalid_gc_failed =
failed to garbage collect invalid incremental compilation session directory `{$path}`: {$err}

incremental_finalized_gc_failed =
failed to garbage collect finalized incremental compilation session directory `{$path}`: {$err}

incremental_session_gc_failed =
failed to garbage collect incremental compilation session directory `{$path}`: {$err}

incremental_assert_not_loaded =
we asserted that the incremental cache should not be loaded, but it was loaded

incremental_assert_loaded =
we asserted that an existing incremental cache directory should be successfully loaded, but it was not

incremental_delete_incompatible =
failed to delete invalidated or incompatible incremental compilation session directory contents `{$path}`: {$err}

incremental_load_dep_graph = could not load dep-graph from `{$path}`: {$err}

incremental_decode_incr_cache = could not decode incremental cache: {$err}

incremental_write_dep_graph = failed to write dependency graph to `{$path}`: {$err}

incremental_move_dep_graph = failed to move dependency graph from `{$from}` to `{$to}`: {$err}

incremental_create_dep_graph = failed to create dependency graph at `{$path}`: {$err}

incremental_copy_workproduct_to_cache = error copying object file `{$from}` to incremental directory as `{$to}`: {$err}

incremental_delete_workproduct = file-system error deleting outdated file `{$path}`: {$err}
10 changes: 10 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/interface.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ interface_rustc_error_unexpected_annotation =

interface_failed_writing_file =
failed to write file {$path}: {$error}"

interface_unsupported_crate_type_for_target =
dropping unsupported crate type `{$crate_type}` for target `{$target_triple}`

interface_multiple_output_types_adaption =
due to multiple output types requested, the explicitly specified output file name will be adapted for each output type

interface_ignoring_extra_filename = ignoring -C extra-filename flag due to -o flag

interface_ignoring_out_dir = ignoring --out-dir flag due to -o flag
6 changes: 6 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/monomorphize.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ monomorphize_large_assignments =

monomorphize_requires_lang_item =
requires `{$lang_item}` lang_item

monomorphize_encountered_error_while_instantiating =
the above error was encountered while instantiating `{$formatted_item}`

monomorphize_unknown_cgu_collection_mode =
unknown codegen-item collection mode '{$mode}', falling back to 'lazy' mode
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/locales/en-US/privacy.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ privacy_in_public_interface = {$vis_descr} {$kind} `{$descr}` in public interfac
.label = can't leak {$vis_descr} {$kind}
.visibility_label = `{$descr}` declared as {$vis_descr}

privacy_report_access_level = {$descr}
privacy_report_effective_visibility = {$descr}

privacy_from_private_dep_in_public_interface =
{$kind} `{$descr}` from private dependency '{$krate}' in public interface
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/session.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ session_crate_name_invalid = crate names cannot start with a `-`, but `{$s}` has
session_crate_name_empty = crate name must not be empty

session_invalid_character_in_create_name = invalid character `{$character}` in crate name: `{$crate_name}`

session_optimization_fuel_exhausted = optimization-fuel-exhausted: {$msg}
13 changes: 7 additions & 6 deletions compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,25 @@ fluent_messages! {
const_eval => "../locales/en-US/const_eval.ftl",
driver => "../locales/en-US/driver.ftl",
expand => "../locales/en-US/expand.ftl",
session => "../locales/en-US/session.ftl",
interface => "../locales/en-US/interface.ftl",
incremental => "../locales/en-US/incremental.ftl",
infer => "../locales/en-US/infer.ftl",
interface => "../locales/en-US/interface.ftl",
lint => "../locales/en-US/lint.ftl",
metadata => "../locales/en-US/metadata.ftl",
middle => "../locales/en-US/middle.ftl",
mir_dataflow => "../locales/en-US/mir_dataflow.ftl",
monomorphize => "../locales/en-US/monomorphize.ftl",
metadata => "../locales/en-US/metadata.ftl",
parser => "../locales/en-US/parser.ftl",
passes => "../locales/en-US/passes.ftl",
plugin_impl => "../locales/en-US/plugin_impl.ftl",
privacy => "../locales/en-US/privacy.ftl",
query_system => "../locales/en-US/query_system.ftl",
trait_selection => "../locales/en-US/trait_selection.ftl",
save_analysis => "../locales/en-US/save_analysis.ftl",
session => "../locales/en-US/session.ftl",
symbol_mangling => "../locales/en-US/symbol_mangling.ftl",
trait_selection => "../locales/en-US/trait_selection.ftl",
ty_utils => "../locales/en-US/ty_utils.ftl",
typeck => "../locales/en-US/typeck.ftl",
mir_dataflow => "../locales/en-US/mir_dataflow.ftl",
symbol_mangling => "../locales/en-US/symbol_mangling.ftl",
}

pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES};
Expand Down
20 changes: 10 additions & 10 deletions compiler/rustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ edition = "2021"
doctest = false

[dependencies]
tracing = "0.1"
annotate-snippets = "0.9"
atty = "0.2"
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_error_messages = { path = "../rustc_error_messages" }
rustc_hir = { path = "../rustc_hir" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
rustc_macros = { path = "../rustc_macros" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_target = { path = "../rustc_target" }
rustc_hir = { path = "../rustc_hir" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
unicode-width = "0.1.4"
atty = "0.2"
termcolor = "1.0"
annotate-snippets = "0.9"
termize = "0.1.1"
serde = { version = "1.0.125", features = [ "derive" ] }
serde_json = "1.0.59"
termcolor = "1.0"
termize = "0.1.1"
tracing = "0.1"
unicode-width = "0.1.4"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = [ "handleapi", "synchapi", "winbase" ] }
8 changes: 7 additions & 1 deletion compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ pub trait IntoDiagnosticArg {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static>;
}

impl<'a, T: Clone + IntoDiagnosticArg> IntoDiagnosticArg for &'a T {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
self.clone().into_diagnostic_arg()
}
}

pub struct DiagnosticArgFromDisplay<'a>(pub &'a dyn fmt::Display);

impl IntoDiagnosticArg for DiagnosticArgFromDisplay<'_> {
Expand Down Expand Up @@ -94,7 +100,7 @@ into_diagnostic_arg_using_display!(
MacroRulesNormalizedIdent,
ParseIntError,
StackProtector,
&TargetTriple,
TargetTriple,
SplitDebuginfo
);

Expand Down
50 changes: 50 additions & 0 deletions compiler/rustc_errors/src/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,56 @@ impl EmissionGuarantee for () {
}
}

/// Marker type which enables implementation of `create_note` and `emit_note` functions for
/// note-without-error struct diagnostics.
#[derive(Copy, Clone)]
pub struct Noted;

impl<'a> DiagnosticBuilder<'a, Noted> {
/// Convenience function for internal use, clients should use one of the
/// `struct_*` methods on [`Handler`].
pub(crate) fn new_note(handler: &'a Handler, message: impl Into<DiagnosticMessage>) -> Self {
let diagnostic = Diagnostic::new_with_code(Level::Note, None, message);
Self::new_diagnostic_note(handler, diagnostic)
}

/// Creates a new `DiagnosticBuilder` with an already constructed
/// diagnostic.
pub(crate) fn new_diagnostic_note(handler: &'a Handler, diagnostic: Diagnostic) -> Self {
debug!("Created new diagnostic");
Self {
inner: DiagnosticBuilderInner {
state: DiagnosticBuilderState::Emittable(handler),
diagnostic: Box::new(diagnostic),
},
_marker: PhantomData,
}
}
}

impl EmissionGuarantee for Noted {
fn diagnostic_builder_emit_producing_guarantee(db: &mut DiagnosticBuilder<'_, Self>) -> Self {
match db.inner.state {
// First `.emit()` call, the `&Handler` is still available.
DiagnosticBuilderState::Emittable(handler) => {
db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation;
handler.emit_diagnostic(&mut db.inner.diagnostic);
}
// `.emit()` was previously called, disallowed from repeating it.
DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {}
}

Noted
}

fn make_diagnostic_builder(
handler: &Handler,
msg: impl Into<DiagnosticMessage>,
) -> DiagnosticBuilder<'_, Self> {
DiagnosticBuilder::new_note(handler, msg)
}
}

impl<'a> DiagnosticBuilder<'a, !> {
/// Convenience function for internal use, clients should use one of the
/// `struct_*` methods on [`Handler`].
Expand Down
Loading