Skip to content

Commit d8c0fbd

Browse files
authored
Unrolled build for rust-lang#116474
Rollup merge of rust-lang#116474 - nnethercote:rustc_assorted, r=spastorino Assorted small cleanups r? `@spastorino`
2 parents 94bc9c7 + e7dabc9 commit d8c0fbd

File tree

8 files changed

+28
-81
lines changed

8 files changed

+28
-81
lines changed

Cargo.lock

-2
Original file line numberDiff line numberDiff line change
@@ -4335,7 +4335,6 @@ dependencies = [
43354335
"rustc_errors",
43364336
"rustc_hir",
43374337
"rustc_index",
4338-
"rustc_macros",
43394338
"rustc_middle",
43404339
"rustc_query_system",
43414340
"rustc_serialize",
@@ -4441,7 +4440,6 @@ dependencies = [
44414440
"rustc_hir",
44424441
"rustc_interface",
44434442
"rustc_middle",
4444-
"rustc_session",
44454443
"rustc_span",
44464444
"rustc_target",
44474445
"stable_mir",

compiler/rustc_attr/src/builtin.rs

+23-62
Original file line numberDiff line numberDiff line change
@@ -353,28 +353,28 @@ pub fn find_body_stability(
353353
body_stab
354354
}
355355

356+
fn insert_or_error(sess: &Session, meta: &MetaItem, item: &mut Option<Symbol>) -> Option<()> {
357+
if item.is_some() {
358+
handle_errors(
359+
&sess.parse_sess,
360+
meta.span,
361+
AttrError::MultipleItem(pprust::path_to_string(&meta.path)),
362+
);
363+
None
364+
} else if let Some(v) = meta.value_str() {
365+
*item = Some(v);
366+
Some(())
367+
} else {
368+
sess.emit_err(session_diagnostics::IncorrectMetaItem { span: meta.span });
369+
None
370+
}
371+
}
372+
356373
/// Read the content of a `stable`/`rustc_const_stable` attribute, and return the feature name and
357374
/// its stability information.
358375
fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, StabilityLevel)> {
359376
let meta = attr.meta()?;
360377
let MetaItem { kind: MetaItemKind::List(ref metas), .. } = meta else { return None };
361-
let insert_or_error = |meta: &MetaItem, item: &mut Option<Symbol>| {
362-
if item.is_some() {
363-
handle_errors(
364-
&sess.parse_sess,
365-
meta.span,
366-
AttrError::MultipleItem(pprust::path_to_string(&meta.path)),
367-
);
368-
return false;
369-
}
370-
if let Some(v) = meta.value_str() {
371-
*item = Some(v);
372-
true
373-
} else {
374-
sess.emit_err(session_diagnostics::IncorrectMetaItem { span: meta.span });
375-
false
376-
}
377-
};
378378

379379
let mut feature = None;
380380
let mut since = None;
@@ -389,16 +389,8 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
389389
};
390390

391391
match mi.name_or_empty() {
392-
sym::feature => {
393-
if !insert_or_error(mi, &mut feature) {
394-
return None;
395-
}
396-
}
397-
sym::since => {
398-
if !insert_or_error(mi, &mut since) {
399-
return None;
400-
}
401-
}
392+
sym::feature => insert_or_error(sess, mi, &mut feature)?,
393+
sym::since => insert_or_error(sess, mi, &mut since)?,
402394
_ => {
403395
handle_errors(
404396
&sess.parse_sess,
@@ -438,23 +430,6 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
438430
fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, StabilityLevel)> {
439431
let meta = attr.meta()?;
440432
let MetaItem { kind: MetaItemKind::List(ref metas), .. } = meta else { return None };
441-
let insert_or_error = |meta: &MetaItem, item: &mut Option<Symbol>| {
442-
if item.is_some() {
443-
handle_errors(
444-
&sess.parse_sess,
445-
meta.span,
446-
AttrError::MultipleItem(pprust::path_to_string(&meta.path)),
447-
);
448-
return false;
449-
}
450-
if let Some(v) = meta.value_str() {
451-
*item = Some(v);
452-
true
453-
} else {
454-
sess.emit_err(session_diagnostics::IncorrectMetaItem { span: meta.span });
455-
false
456-
}
457-
};
458433

459434
let mut feature = None;
460435
let mut reason = None;
@@ -473,20 +448,10 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
473448
};
474449

475450
match mi.name_or_empty() {
476-
sym::feature => {
477-
if !insert_or_error(mi, &mut feature) {
478-
return None;
479-
}
480-
}
481-
sym::reason => {
482-
if !insert_or_error(mi, &mut reason) {
483-
return None;
484-
}
485-
}
451+
sym::feature => insert_or_error(sess, mi, &mut feature)?,
452+
sym::reason => insert_or_error(sess, mi, &mut reason)?,
486453
sym::issue => {
487-
if !insert_or_error(mi, &mut issue) {
488-
return None;
489-
}
454+
insert_or_error(sess, mi, &mut issue)?;
490455

491456
// These unwraps are safe because `insert_or_error` ensures the meta item
492457
// is a name/value pair string literal.
@@ -515,11 +480,7 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
515480
}
516481
is_soft = true;
517482
}
518-
sym::implied_by => {
519-
if !insert_or_error(mi, &mut implied_by) {
520-
return None;
521-
}
522-
}
483+
sym::implied_by => insert_or_error(sess, mi, &mut implied_by)?,
523484
_ => {
524485
handle_errors(
525486
&sess.parse_sess,

compiler/rustc_query_impl/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ rustc_data_structures = { path = "../rustc_data_structures" }
1313
rustc_errors = { path = "../rustc_errors" }
1414
rustc_hir = { path = "../rustc_hir" }
1515
rustc_index = { path = "../rustc_index" }
16-
rustc_macros = { path = "../rustc_macros" }
1716
rustc_middle = { path = "../rustc_middle" }
1817
rustc_query_system = { path = "../rustc_query_system" }
1918
rustc-rayon-core = { version = "0.5.0", optional = true }

compiler/rustc_session/src/config.rs

-1
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ impl Input {
813813
FileName::Anon(_) => None,
814814
FileName::MacroExpansion(_) => None,
815815
FileName::ProcMacroSourceCode(_) => None,
816-
FileName::CfgSpec(_) => None,
817816
FileName::CliCrateAttr(_) => None,
818817
FileName::Custom(_) => None,
819818
FileName::DocTest(path, _) => Some(path),

compiler/rustc_smir/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ version = "0.0.0"
44
edition = "2021"
55

66
[dependencies]
7+
rustc_driver = { path = "../rustc_driver" }
78
rustc_hir = { path = "../rustc_hir" }
9+
rustc_interface = { path = "../rustc_interface" }
810
rustc_middle = { path = "../rustc_middle" }
911
rustc_span = { path = "../rustc_span" }
1012
rustc_target = { path = "../rustc_target" }
11-
rustc_driver = { path = "../rustc_driver" }
12-
rustc_interface = { path = "../rustc_interface" }
13-
rustc_session = {path = "../rustc_session" }
14-
tracing = "0.1"
1513
stable_mir = {path = "../stable_mir" }
14+
tracing = "0.1"
1615

1716
[features]

compiler/rustc_smir/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1111
test(attr(allow(unused_variables), deny(warnings)))
1212
)]
13-
#![feature(rustc_private)]
14-
#![feature(ptr_metadata)]
15-
#![feature(type_alias_impl_trait)] // Used to define opaque types.
16-
#![feature(intra_doc_pointers)]
1713

1814
pub mod rustc_internal;
1915

compiler/rustc_smir/src/rustc_internal/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_driver::{Callbacks, Compilation, RunCompiler};
1111
use rustc_interface::{interface, Queries};
1212
use rustc_middle::mir::interpret::AllocId;
1313
use rustc_middle::ty::TyCtxt;
14-
pub use rustc_span::def_id::{CrateNum, DefId};
14+
use rustc_span::def_id::{CrateNum, DefId};
1515
use rustc_span::Span;
1616
use stable_mir::CompilerError;
1717

compiler/rustc_span/src/lib.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ impl RealFileName {
280280
}
281281

282282
/// Differentiates between real files and common virtual files.
283-
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)]
284-
#[derive(Decodable, Encodable)]
283+
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, Decodable, Encodable)]
285284
pub enum FileName {
286285
Real(RealFileName),
287286
/// Call to `quote!`.
@@ -292,8 +291,6 @@ pub enum FileName {
292291
// FIXME(jseyfried)
293292
MacroExpansion(Hash64),
294293
ProcMacroSourceCode(Hash64),
295-
/// Strings provided as `--cfg [cfgspec]` stored in a `crate_cfg`.
296-
CfgSpec(Hash64),
297294
/// Strings provided as crate attributes in the CLI.
298295
CliCrateAttr(Hash64),
299296
/// Custom sources for explicit parser calls from plugins and drivers.
@@ -338,7 +335,6 @@ impl fmt::Display for FileNameDisplay<'_> {
338335
MacroExpansion(_) => write!(fmt, "<macro expansion>"),
339336
Anon(_) => write!(fmt, "<anon>"),
340337
ProcMacroSourceCode(_) => write!(fmt, "<proc-macro source code>"),
341-
CfgSpec(_) => write!(fmt, "<cfgspec>"),
342338
CliCrateAttr(_) => write!(fmt, "<crate attribute>"),
343339
Custom(ref s) => write!(fmt, "<{s}>"),
344340
DocTest(ref path, _) => write!(fmt, "{}", path.display()),
@@ -364,7 +360,6 @@ impl FileName {
364360
Anon(_)
365361
| MacroExpansion(_)
366362
| ProcMacroSourceCode(_)
367-
| CfgSpec(_)
368363
| CliCrateAttr(_)
369364
| Custom(_)
370365
| QuoteExpansion(_)

0 commit comments

Comments
 (0)