Skip to content

Commit 4fd4de7

Browse files
committed
Auto merge of #101238 - RalfJung:rollup-bzcmobj, r=RalfJung
Rollup of 7 pull requests Successful merges: - #90946 (Ignore `reference`s in "Type::inner_def_id") - #100730 (Migrate rustc_monomorphize to use SessionDiagnostic) - #100753 (translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1) - #100831 (Migrate `symbol_mangling` module to new diagnostics structs) - #101204 (rustdoc: Resugar async fn return type in `clean`, not `html`) - #101216 (Use in-page links for sanitizer docs.) - #101237 (fix into_iter on ZST) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 12e4fd0 + 2a02882 commit 4fd4de7

File tree

36 files changed

+672
-221
lines changed

36 files changed

+672
-221
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3905,8 +3905,10 @@ name = "rustc_monomorphize"
39053905
version = "0.0.0"
39063906
dependencies = [
39073907
"rustc_data_structures",
3908+
"rustc_errors",
39083909
"rustc_hir",
39093910
"rustc_index",
3911+
"rustc_macros",
39103912
"rustc_middle",
39113913
"rustc_session",
39123914
"rustc_span",
@@ -4154,7 +4156,9 @@ dependencies = [
41544156
"punycode",
41554157
"rustc-demangle",
41564158
"rustc_data_structures",
4159+
"rustc_errors",
41574160
"rustc_hir",
4161+
"rustc_macros",
41584162
"rustc_middle",
41594163
"rustc_session",
41604164
"rustc_span",

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,11 @@ pub(crate) fn codegen_panic_inner<'tcx>(
925925
args: &[Value],
926926
span: Span,
927927
) {
928-
let def_id =
929-
fx.tcx.lang_items().require(lang_item).unwrap_or_else(|s| fx.tcx.sess.span_fatal(span, &s));
928+
let def_id = fx
929+
.tcx
930+
.lang_items()
931+
.require(lang_item)
932+
.unwrap_or_else(|e| fx.tcx.sess.span_fatal(span, e.to_string()));
930933

931934
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
932935
let symbol_name = fx.tcx.symbol_name(instance).name;

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
18921892
}
18931893
});
18941894

1895-
sess.cgu_reuse_tracker.check_expected_reuse(sess.diagnostic());
1895+
sess.cgu_reuse_tracker.check_expected_reuse(sess);
18961896

18971897
sess.abort_if_errors();
18981898

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
monomorphize_recursion_limit =
2+
reached the recursion limit while instantiating `{$shrunk}`
3+
.note = `{$def_path_str}` defined here
4+
5+
monomorphize_written_to_path = the full type name has been written to '{$path}'
6+
7+
monomorphize_type_length_limit = reached the type-length limit while instantiating `{$shrunk}`
8+
9+
monomorphize_consider_type_length_limit =
10+
consider adding a `#![type_length_limit="{$type_length}"]` attribute to your crate
11+
12+
monomorphize_fatal_error = {$error_message}
13+
14+
monomorphize_unknown_partition_strategy = unknown partitioning strategy
15+
16+
monomorphize_symbol_already_defined = symbol `{$symbol}` is already defined
17+
18+
monomorphize_unused_generic_params = item has unused generic parameters
19+
20+
monomorphize_large_assignments =
21+
moving {$size} bytes
22+
.label = value moved from here
23+
.note = The current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
24+
25+
monomorphize_requires_lang_item =
26+
requires `{$lang_item}` lang_item
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
session_incorrect_cgu_reuse_type =
2+
CGU-reuse for `{$cgu_user_name}` is `{$actual_reuse}` but should be {$at_least ->
3+
[one] {"at least "}
4+
*[other] {""}
5+
}`{$expected_reuse}`
6+
7+
session_cgu_not_recorded =
8+
CGU-reuse for `{$cgu_user_name}` is (mangled: `{$cgu_name}`) was not recorded`
9+
10+
session_feature_gate_error = {$explain}
11+
12+
session_feature_diagnostic_for_issue =
13+
see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information
14+
15+
session_feature_diagnostic_help =
16+
add `#![feature({$feature})]` to the crate attributes to enable
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
symbol_mangling_invalid_symbol_name = symbol-name({$mangled_formatted})
2+
3+
symbol_mangling_invalid_trait_item = demangling({$demangling_formatted})
4+
5+
symbol_mangling_alt_invalid_trait_item = demangling-alt({$alt_demangling_formatted})
6+
7+
symbol_mangling_invalid_def_path = def-path({$def_path})

compiler/rustc_error_messages/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ fluent_messages! {
4141
const_eval => "../locales/en-US/const_eval.ftl",
4242
driver => "../locales/en-US/driver.ftl",
4343
expand => "../locales/en-US/expand.ftl",
44+
session => "../locales/en-US/session.ftl",
4445
interface => "../locales/en-US/interface.ftl",
4546
infer => "../locales/en-US/infer.ftl",
4647
lint => "../locales/en-US/lint.ftl",
48+
monomorphize => "../locales/en-US/monomorphize.ftl",
4749
parser => "../locales/en-US/parser.ftl",
4850
passes => "../locales/en-US/passes.ftl",
4951
plugin_impl => "../locales/en-US/plugin_impl.ftl",
@@ -52,6 +54,7 @@ fluent_messages! {
5254
ty_utils => "../locales/en-US/ty_utils.ftl",
5355
typeck => "../locales/en-US/typeck.ftl",
5456
mir_dataflow => "../locales/en-US/mir_dataflow.ftl",
57+
symbol_mangling => "../locales/en-US/symbol_mangling.ftl",
5558
}
5659

5760
pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES};

compiler/rustc_hir/src/errors.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use crate::LangItem;
2+
3+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
4+
pub struct LangItemError(pub LangItem);
5+
6+
impl ToString for LangItemError {
7+
fn to_string(&self) -> String {
8+
format!("requires `{}` lang_item", self.0.name())
9+
}
10+
}

compiler/rustc_hir/src/lang_items.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//! * Functions called by the compiler itself.
99
1010
use crate::def_id::DefId;
11+
use crate::errors::LangItemError;
1112
use crate::{MethodKind, Target};
1213

1314
use rustc_ast as ast;
@@ -115,9 +116,9 @@ macro_rules! language_item_table {
115116

116117
/// Requires that a given `LangItem` was bound and returns the corresponding `DefId`.
117118
/// If it wasn't bound, e.g. due to a missing `#[lang = "<it.name()>"]`,
118-
/// returns an error message as a string.
119-
pub fn require(&self, it: LangItem) -> Result<DefId, String> {
120-
self.items[it as usize].ok_or_else(|| format!("requires `{}` lang_item", it.name()))
119+
/// returns an error encapsulating the `LangItem`.
120+
pub fn require(&self, it: LangItem) -> Result<DefId, LangItemError> {
121+
self.items[it as usize].ok_or_else(|| LangItemError(it))
121122
}
122123

123124
/// Returns the [`DefId`]s of all lang items in a group.

compiler/rustc_hir/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub mod def;
2727
pub mod def_path_hash_map;
2828
pub mod definitions;
2929
pub mod diagnostic_items;
30+
pub mod errors;
3031
pub use rustc_span::def_id;
3132
mod hir;
3233
pub mod hir_id;

0 commit comments

Comments
 (0)