Skip to content

Commit 9730283

Browse files
committed
Auto merge of #152736 - jhpratt:rollup-eJsGhqJ, r=jhpratt
Rollup of 6 pull requests Successful merges: - #145399 (Unify wording of resolve error) - #152512 (core: Implement feature `float_exact_integer_constants`) - #152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver) - #152703 (Remove `rustc_query_system`) - #152727 (`probe_op` silence ambiguity errors if tainted) - #152728 (Port #![default_lib_allocator] to the new attribute parser)
2 parents 3c9faa0 + 4e77499 commit 9730283

318 files changed

Lines changed: 1359 additions & 948 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,7 +3640,6 @@ dependencies = [
36403640
"rustc_macros",
36413641
"rustc_metadata",
36423642
"rustc_middle",
3643-
"rustc_query_system",
36443643
"rustc_sanitizers",
36453644
"rustc_session",
36463645
"rustc_span",
@@ -4243,7 +4242,6 @@ dependencies = [
42434242
"rustc_index",
42444243
"rustc_lint_defs",
42454244
"rustc_macros",
4246-
"rustc_query_system",
42474245
"rustc_serialize",
42484246
"rustc_session",
42494247
"rustc_span",
@@ -4507,23 +4505,6 @@ dependencies = [
45074505
"tracing",
45084506
]
45094507

4510-
[[package]]
4511-
name = "rustc_query_system"
4512-
version = "0.0.0"
4513-
dependencies = [
4514-
"rustc_abi",
4515-
"rustc_ast",
4516-
"rustc_data_structures",
4517-
"rustc_errors",
4518-
"rustc_feature",
4519-
"rustc_hir",
4520-
"rustc_macros",
4521-
"rustc_serialize",
4522-
"rustc_session",
4523-
"rustc_span",
4524-
"smallvec",
4525-
]
4526-
45274508
[[package]]
45284509
name = "rustc_resolve"
45294510
version = "0.0.0"

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,12 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcNoImplicitBoundsParser {
292292
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
293293
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNoImplicitBounds;
294294
}
295+
296+
pub(crate) struct DefaultLibAllocatorParser;
297+
298+
impl<S: Stage> NoArgsAttributeParser<S> for DefaultLibAllocatorParser {
299+
const PATH: &[Symbol] = &[sym::default_lib_allocator];
300+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
301+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
302+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::DefaultLibAllocator;
303+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ attribute_parsers!(
235235
Single<WithoutArgs<ConstContinueParser>>,
236236
Single<WithoutArgs<ConstStabilityIndirectParser>>,
237237
Single<WithoutArgs<CoroutineParser>>,
238+
Single<WithoutArgs<DefaultLibAllocatorParser>>,
238239
Single<WithoutArgs<DenyExplicitImplParser>>,
239240
Single<WithoutArgs<DynIncompatibleTraitParser>>,
240241
Single<WithoutArgs<EiiForeignItemParser>>,

compiler/rustc_codegen_cranelift/src/codegen_f16_f128.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub(crate) fn codegen_cast(
208208
let ret_ty = if to_ty.bits() < 32 { types::I32 } else { to_ty };
209209
let name = format!(
210210
"__fix{sign}tf{size}i",
211-
sign = if from_signed { "" } else { "un" },
211+
sign = if to_signed { "" } else { "uns" },
212212
size = match ret_ty {
213213
types::I32 => 's',
214214
types::I64 => 'd',

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ rustc_llvm = { path = "../rustc_llvm" }
3131
rustc_macros = { path = "../rustc_macros" }
3232
rustc_metadata = { path = "../rustc_metadata" }
3333
rustc_middle = { path = "../rustc_middle" }
34-
rustc_query_system = { path = "../rustc_query_system" }
3534
rustc_sanitizers = { path = "../rustc_sanitizers" }
3635
rustc_session = { path = "../rustc_session" }
3736
rustc_span = { path = "../rustc_span" }

compiler/rustc_hir/src/attrs/data_structures.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,9 @@ pub enum AttributeKind {
897897
/// Represents `#[debugger_visualizer]`.
898898
DebuggerVisualizer(ThinVec<DebugVisualizer>),
899899

900+
/// Represents `#![default_lib_allocator]`
901+
DefaultLibAllocator,
902+
900903
/// Represents [`#[deprecated]`](https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html#the-deprecated-attribute).
901904
Deprecation { deprecation: Deprecation, span: Span },
902905

compiler/rustc_hir/src/attrs/encode_cross_crate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl AttributeKind {
3535
CrateType(_) => No,
3636
CustomMir(_, _, _) => Yes,
3737
DebuggerVisualizer(..) => No,
38+
DefaultLibAllocator => No,
3839
Deprecation { .. } => Yes,
3940
DoNotRecommend { .. } => Yes,
4041
Doc(_) => Yes,

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
490490
.unwrap_or_else(|_| span_bug!(span, "instantiating {:?} failed?", ty));
491491
let ty = self.resolve_vars_if_possible(ty.value);
492492
let guar = match *ty.kind() {
493+
_ if let Some(guar) = self.tainted_by_errors() => guar,
493494
ty::Infer(ty::TyVar(_)) => {
494495
// We want to get the variable name that the method
495496
// is being called on. If it is a method call.

compiler/rustc_interface/src/callbacks.rs

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
1212
use std::fmt;
1313

14-
use rustc_errors::{DiagInner, TRACK_DIAGNOSTIC};
15-
use rustc_middle::dep_graph::dep_node::default_dep_kind_debug;
16-
use rustc_middle::dep_graph::{DepKind, DepNode, TaskDepsRef};
14+
use rustc_errors::DiagInner;
15+
use rustc_middle::dep_graph::TaskDepsRef;
1716
use rustc_middle::ty::tls;
1817

1918
fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) {
@@ -65,49 +64,10 @@ fn def_id_debug(def_id: rustc_hir::def_id::DefId, f: &mut fmt::Formatter<'_>) ->
6564
write!(f, ")")
6665
}
6766

68-
/// This is a callback from `rustc_query_system` as it cannot access the implicit state
69-
/// in `rustc_middle` otherwise.
70-
pub fn dep_kind_debug(kind: DepKind, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
71-
tls::with_opt(|opt_tcx| {
72-
if let Some(tcx) = opt_tcx {
73-
write!(f, "{}", tcx.dep_kind_vtable(kind).name)
74-
} else {
75-
default_dep_kind_debug(kind, f)
76-
}
77-
})
78-
}
79-
80-
/// This is a callback from `rustc_query_system` as it cannot access the implicit state
81-
/// in `rustc_middle` otherwise.
82-
pub fn dep_node_debug(node: DepNode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
83-
write!(f, "{:?}(", node.kind)?;
84-
85-
tls::with_opt(|opt_tcx| {
86-
if let Some(tcx) = opt_tcx {
87-
if let Some(def_id) = node.extract_def_id(tcx) {
88-
write!(f, "{}", tcx.def_path_debug_str(def_id))?;
89-
} else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(node) {
90-
write!(f, "{s}")?;
91-
} else {
92-
write!(f, "{}", node.hash)?;
93-
}
94-
} else {
95-
write!(f, "{}", node.hash)?;
96-
}
97-
Ok(())
98-
})?;
99-
100-
write!(f, ")")
101-
}
102-
10367
/// Sets up the callbacks in prior crates which we want to refer to the
10468
/// TyCtxt in.
10569
pub fn setup_callbacks() {
10670
rustc_span::SPAN_TRACK.swap(&(track_span_parent as fn(_)));
10771
rustc_hir::def_id::DEF_ID_DEBUG.swap(&(def_id_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
108-
rustc_middle::dep_graph::dep_node::DEP_KIND_DEBUG
109-
.swap(&(dep_kind_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
110-
rustc_middle::dep_graph::dep_node::DEP_NODE_DEBUG
111-
.swap(&(dep_node_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
112-
TRACK_DIAGNOSTIC.swap(&(track_diagnostic as _));
72+
rustc_errors::TRACK_DIAGNOSTIC.swap(&(track_diagnostic as _));
11373
}

compiler/rustc_macros/src/hash_stable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn hash_stable_derive_with_mode(
9696

9797
let context: syn::Type = match mode {
9898
HashStableMode::Normal => {
99-
parse_quote!(::rustc_query_system::ich::StableHashingContext<'__ctx>)
99+
parse_quote!(::rustc_middle::ich::StableHashingContext<'__ctx>)
100100
}
101101
HashStableMode::Generic | HashStableMode::NoContext => parse_quote!(__CTX),
102102
};

0 commit comments

Comments
 (0)