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 8 pull requests #102212

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8ca6a27
Remove `RtlGenRandom` (take two)
ChrisDenton Sep 8, 2022
055522f
errors: add `emit_note`/`create_note`
davidtwco Sep 1, 2022
6d22d4c
errors: implement `IntoDiagnosticArg` for `&T`
davidtwco Aug 30, 2022
904c18c
session: impl `IntoDiagnosticArg` for `CrateType`
davidtwco Aug 30, 2022
3f1bed0
errors: impl `IntoDiagnosticArg` for `TargetTriple`
davidtwco Aug 30, 2022
37ba250
session: diagnostic migration lint on more fns
davidtwco Aug 19, 2022
c65e3e3
incremental: migrate diagnostics
davidtwco Aug 19, 2022
79c665b
Calculate ProjectionTy::trait_def_id correctly
compiler-errors Sep 22, 2022
7ed999b
Also require other subtrees to always build successfully
oli-obk Sep 23, 2022
cb8a9c4
Add `llvm-dis` to the set of tools in `ci-llvm`
ojeda Sep 22, 2022
8eeeac6
Update doc after renaming fn is_zero
flba-eb Sep 23, 2022
ee8e0bd
rustdoc: CSS prevent sidebar width change jank
notriddle Sep 22, 2022
e3cb0a8
rustdoc: add regression test for sidebar width jank
notriddle Sep 22, 2022
a4046e9
Update browser-ui-test version to 0.11.0
GuillaumeGomez Sep 23, 2022
d30cb5b
Improve GUI tests by using variables
GuillaumeGomez Sep 23, 2022
cd48154
rustdoc: fix GUI tests to deal with slightly changed width
notriddle Sep 22, 2022
3618ccf
Rollup merge of #100754 - davidtwco:translation-incremental, r=compil…
matthiaskrgr Sep 23, 2022
48a309a
Rollup merge of #102044 - ChrisDenton:BCrypt-system-rand, r=thomcc
matthiaskrgr Sep 23, 2022
1333c49
Rollup merge of #102146 - notriddle:notriddle/sidebar-jank, r=Guillau…
matthiaskrgr Sep 23, 2022
e17541b
Rollup merge of #102152 - compiler-errors:issue-102140, r=fee1-dead
matthiaskrgr Sep 23, 2022
ee2e709
Rollup merge of #102175 - oli-obk:miri_subtree_cleanup, r=jyn514
matthiaskrgr Sep 23, 2022
53925e6
Rollup merge of #102176 - ojeda:add-llvm-dis-to-ci-llvm, r=Mark-Simul…
matthiaskrgr Sep 23, 2022
b55a6ba
Rollup merge of #102188 - flba-eb:doc_missed_at_rename, r=jyn514
matthiaskrgr Sep 23, 2022
3566166
Rollup merge of #102199 - GuillaumeGomez:improve-rustdoc-gui-tests, r…
matthiaskrgr Sep 23, 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
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::{Diagnostic, LintDiagnostic, Subdiagnostic};
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(Subdiagnostic)]
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 @@ -1210,6 +1210,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: 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 @@ -242,6 +242,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
8 changes: 7 additions & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub use diagnostic::{
AddToDiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgFromDisplay,
DiagnosticArgValue, DiagnosticId, DiagnosticStyledString, IntoDiagnosticArg, SubDiagnostic,
};
pub use diagnostic_builder::{DiagnosticBuilder, EmissionGuarantee, LintDiagnosticBuilder};
pub use diagnostic_builder::{DiagnosticBuilder, EmissionGuarantee, LintDiagnosticBuilder, Noted};
use std::backtrace::Backtrace;

/// A handler deals with errors and other compiler output.
Expand Down Expand Up @@ -941,6 +941,7 @@ impl Handler {
self.emit_diag_at_span(Diagnostic::new(Bug, msg), span);
}

#[rustc_lint_diagnostics]
pub fn span_note_without_error(
&self,
span: impl Into<MultiSpan>,
Expand All @@ -949,6 +950,7 @@ impl Handler {
self.emit_diag_at_span(Diagnostic::new(Note, msg), span);
}

#[rustc_lint_diagnostics]
pub fn span_note_diag(
&self,
span: Span,
Expand All @@ -960,19 +962,23 @@ impl Handler {
}

// NOTE: intentionally doesn't raise an error so rustc_codegen_ssa only reports fatal errors in the main thread
#[rustc_lint_diagnostics]
pub fn fatal(&self, msg: impl Into<DiagnosticMessage>) -> FatalError {
self.inner.borrow_mut().fatal(msg)
}

#[rustc_lint_diagnostics]
pub fn err(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed {
self.inner.borrow_mut().err(msg)
}

#[rustc_lint_diagnostics]
pub fn warn(&self, msg: impl Into<DiagnosticMessage>) {
let mut db = DiagnosticBuilder::new(self, Warning(None), msg);
db.emit();
}

#[rustc_lint_diagnostics]
pub fn note_without_error(&self, msg: impl Into<DiagnosticMessage>) {
DiagnosticBuilder::new(self, Note, msg).emit();
}
Expand Down
Loading