Skip to content

Commit fcad918

Browse files
committed
Auto merge of rust-lang#99652 - GuillaumeGomez:rollup-38v0x7y, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - rust-lang#99298 (Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only) - rust-lang#99396 (Add some additional double-adjustment regression tests) - rust-lang#99449 (Do not resolve associated const when there is no provided value) - rust-lang#99595 (Mark atomics as unsupported on thumbv6m) - rust-lang#99627 (Lock stdout once when listing tests) - rust-lang#99638 (Remove Clean trait implementation for hir::Ty and middle::Ty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 93ffde6 + d87a13f commit fcad918

File tree

24 files changed

+258
-185
lines changed

24 files changed

+258
-185
lines changed

compiler/rustc_target/src/spec/thumbv6m_none_eabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ pub fn target() -> Target {
1414
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
1515
// with +strict-align.
1616
features: "+strict-align".into(),
17-
// There are no atomic CAS instructions available in the instruction set of the ARMv6-M
17+
// There are no atomic instructions available in the instruction set of the ARMv6-M
1818
// architecture
19+
max_atomic_width: Some(0),
1920
atomic_cas: false,
2021
..super::thumb_base::opts()
2122
},

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,20 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
185185
}
186186
let concrete = infcx.const_eval_resolve(param_env, uv.expand(), Some(span));
187187
match concrete {
188-
Err(ErrorHandled::TooGeneric) => Err(if !uv.has_infer_types_or_consts() {
188+
Err(ErrorHandled::TooGeneric) => Err(if uv.has_infer_types_or_consts() {
189+
NotConstEvaluatable::MentionsInfer
190+
} else if uv.has_param_types_or_consts() {
189191
infcx
190192
.tcx
191193
.sess
192194
.delay_span_bug(span, &format!("unexpected `TooGeneric` for {:?}", uv));
193195
NotConstEvaluatable::MentionsParam
194196
} else {
195-
NotConstEvaluatable::MentionsInfer
197+
let guar = infcx.tcx.sess.delay_span_bug(
198+
span,
199+
format!("Missing value for constant, but no error reported?"),
200+
);
201+
NotConstEvaluatable::Error(guar)
196202
}),
197203
Err(ErrorHandled::Linted) => {
198204
let reported = infcx
@@ -240,8 +246,11 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
240246

241247
Err(ErrorHandled::TooGeneric) => Err(if uv.has_infer_types_or_consts() {
242248
NotConstEvaluatable::MentionsInfer
243-
} else {
249+
} else if uv.has_param_types_or_consts() {
244250
NotConstEvaluatable::MentionsParam
251+
} else {
252+
let guar = infcx.tcx.sess.delay_span_bug(span, format!("Missing value for constant, but no error reported?"));
253+
NotConstEvaluatable::Error(guar)
245254
}),
246255
Err(ErrorHandled::Linted) => {
247256
let reported =

compiler/rustc_ty_utils/src/instance.rs

+5
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ fn resolve_associated_item<'tcx>(
280280
return Ok(None);
281281
}
282282

283+
// If the item does not have a value, then we cannot return an instance.
284+
if !leaf_def.item.defaultness.has_value() {
285+
return Ok(None);
286+
}
287+
283288
let substs = tcx.erase_regions(substs);
284289

285290
// Check if we just resolved an associated `const` declaration from

library/test/src/console.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl ConsoleTestState {
137137
// List the tests to console, and optionally to logfile. Filters are honored.
138138
pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Result<()> {
139139
let mut output = match term::stdout() {
140-
None => OutputLocation::Raw(io::stdout()),
140+
None => OutputLocation::Raw(io::stdout().lock()),
141141
Some(t) => OutputLocation::Pretty(t),
142142
};
143143

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
121121
unsafety: hir::Unsafety::Normal,
122122
generics: new_generics,
123123
trait_: Some(trait_ref.clean(self.cx)),
124-
for_: ty.clean(self.cx),
124+
for_: clean_middle_ty(ty, self.cx, None),
125125
items: Vec::new(),
126126
polarity,
127127
kind: ImplKind::Auto,

src/librustdoc/clean/blanket_impl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
116116
// FIXME(eddyb) compute both `trait_` and `for_` from
117117
// the post-inference `trait_ref`, as it's more accurate.
118118
trait_: Some(trait_ref.0.clean(cx)),
119-
for_: ty.0.clean(cx),
119+
for_: clean_middle_ty(ty.0, cx, None),
120120
items: cx.tcx
121121
.associated_items(impl_def_id)
122122
.in_definition_order()
123123
.map(|x| x.clean(cx))
124124
.collect::<Vec<_>>(),
125125
polarity: ty::ImplPolarity::Positive,
126-
kind: ImplKind::Blanket(Box::new(trait_ref.0.self_ty().clean(cx))),
126+
kind: ImplKind::Blanket(Box::new(clean_middle_ty(trait_ref.0.self_ty(), cx, None))),
127127
})),
128128
cfg: None,
129129
});

src/librustdoc/clean/inline.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_span::hygiene::MacroKind;
1616
use rustc_span::symbol::{kw, sym, Symbol};
1717

1818
use crate::clean::{
19-
self, clean_fn_decl_from_did_and_sig, clean_ty_generics, utils, Attributes, AttributesExt,
20-
Clean, ImplKind, ItemId, Type, Visibility,
19+
self, clean_fn_decl_from_did_and_sig, clean_middle_ty, clean_ty, clean_ty_generics, utils,
20+
Attributes, AttributesExt, Clean, ImplKind, ItemId, Type, Visibility,
2121
};
2222
use crate::core::DocContext;
2323
use crate::formats::item_type::ItemType;
@@ -261,7 +261,7 @@ fn build_union(cx: &mut DocContext<'_>, did: DefId) -> clean::Union {
261261

262262
fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> clean::Typedef {
263263
let predicates = cx.tcx.explicit_predicates_of(did);
264-
let type_ = cx.tcx.type_of(did).clean(cx);
264+
let type_ = clean_middle_ty(cx.tcx.type_of(did), cx, Some(did));
265265

266266
clean::Typedef {
267267
type_,
@@ -357,8 +357,8 @@ pub(crate) fn build_impl(
357357
};
358358

359359
let for_ = match &impl_item {
360-
Some(impl_) => impl_.self_ty.clean(cx),
361-
None => tcx.type_of(did).clean(cx),
360+
Some(impl_) => clean_ty(impl_.self_ty, cx),
361+
None => clean_middle_ty(tcx.type_of(did), cx, Some(did)),
362362
};
363363

364364
// Only inline impl if the implementing type is
@@ -577,14 +577,14 @@ pub(crate) fn print_inlined_const(tcx: TyCtxt<'_>, did: DefId) -> String {
577577

578578
fn build_const(cx: &mut DocContext<'_>, def_id: DefId) -> clean::Constant {
579579
clean::Constant {
580-
type_: cx.tcx.type_of(def_id).clean(cx),
580+
type_: clean_middle_ty(cx.tcx.type_of(def_id), cx, Some(def_id)),
581581
kind: clean::ConstantKind::Extern { def_id },
582582
}
583583
}
584584

585585
fn build_static(cx: &mut DocContext<'_>, did: DefId, mutable: bool) -> clean::Static {
586586
clean::Static {
587-
type_: cx.tcx.type_of(did).clean(cx),
587+
type_: clean_middle_ty(cx.tcx.type_of(did), cx, Some(did)),
588588
mutability: if mutable { Mutability::Mut } else { Mutability::Not },
589589
expr: None,
590590
}

0 commit comments

Comments
 (0)