Skip to content

Commit 88d7150

Browse files
committed
Use tcx.require_lang_item
1 parent 1c8e658 commit 88d7150

File tree

3 files changed

+2
-18
lines changed

3 files changed

+2
-18
lines changed

compiler/rustc_error_messages/locales/en-US/monomorphize.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,3 @@ monomorphize_large_assignments =
2121
moving {$size} bytes
2222
.label = value moved from here
2323
.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

compiler/rustc_monomorphize/src/collector.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ use std::iter;
201201
use std::ops::Range;
202202
use std::path::PathBuf;
203203

204-
use crate::errors::{LargeAssignmentsLint, RecursionLimit, RequiresLangItem, TypeLengthLimit};
204+
use crate::errors::{LargeAssignmentsLint, RecursionLimit, TypeLengthLimit};
205205

206206
#[derive(PartialEq)]
207207
pub enum MonoItemCollectionMode {
@@ -1298,14 +1298,7 @@ impl<'v> RootCollector<'_, 'v> {
12981298
return;
12991299
};
13001300

1301-
let start_def_id = match self.tcx.lang_items().require(LangItem::Start) {
1302-
Ok(s) => s,
1303-
Err(lang_item_err) => {
1304-
self.tcx
1305-
.sess
1306-
.emit_fatal(RequiresLangItem { lang_item: lang_item_err.0.name().to_string() });
1307-
}
1308-
};
1301+
let start_def_id = self.tcx.require_lang_item(LangItem::Start, None);
13091302
let main_ret_ty = self.tcx.fn_sig(main_def_id).output();
13101303

13111304
// Given that `main()` has no arguments,

compiler/rustc_monomorphize/src/errors.rs

-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ pub struct TypeLengthLimit {
3232
pub type_length: usize,
3333
}
3434

35-
#[derive(Diagnostic)]
36-
#[diag(monomorphize_requires_lang_item)]
37-
pub struct RequiresLangItem {
38-
pub lang_item: String,
39-
}
40-
4135
pub struct UnusedGenericParams {
4236
pub span: Span,
4337
pub param_spans: Vec<Span>,

0 commit comments

Comments
 (0)