Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0a6b941

Browse files
committedOct 26, 2022
Auto merge of rust-lang#103572 - Dylan-DPC:rollup-a8bnxrw, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - rust-lang#95710 (Stabilize arbitrary_enum_discriminant, take 2) - rust-lang#102706 (Support excluding the generation of the standalone docs) - rust-lang#103428 (Removed verbose printing from the `PrettyPrinter` when printing constants) - rust-lang#103543 (Update books) - rust-lang#103546 (interpret: a bit of cast cleanup) - rust-lang#103554 (rustdoc: add visible focus outline to rustdoc-toggle) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 43dd3d5 + 74a4c67 commit 0a6b941

37 files changed

+131
-285
lines changed
 

‎compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_ast as ast;
22
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
33
use rustc_ast::{AssocConstraint, AssocConstraintKind, NodeId};
4-
use rustc_ast::{PatKind, RangeEnd, VariantData};
4+
use rustc_ast::{PatKind, RangeEnd};
55
use rustc_errors::{struct_span_err, Applicability, StashKey};
66
use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP};
77
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
@@ -116,46 +116,6 @@ impl<'a> PostExpansionVisitor<'a> {
116116
}
117117
}
118118

119-
fn maybe_report_invalid_custom_discriminants(&self, variants: &[ast::Variant]) {
120-
let has_fields = variants.iter().any(|variant| match variant.data {
121-
VariantData::Tuple(..) | VariantData::Struct(..) => true,
122-
VariantData::Unit(..) => false,
123-
});
124-
125-
let discriminant_spans = variants
126-
.iter()
127-
.filter(|variant| match variant.data {
128-
VariantData::Tuple(..) | VariantData::Struct(..) => false,
129-
VariantData::Unit(..) => true,
130-
})
131-
.filter_map(|variant| variant.disr_expr.as_ref().map(|c| c.value.span))
132-
.collect::<Vec<_>>();
133-
134-
if !discriminant_spans.is_empty() && has_fields {
135-
let mut err = feature_err(
136-
&self.sess.parse_sess,
137-
sym::arbitrary_enum_discriminant,
138-
discriminant_spans.clone(),
139-
"custom discriminant values are not allowed in enums with tuple or struct variants",
140-
);
141-
for sp in discriminant_spans {
142-
err.span_label(sp, "disallowed custom discriminant");
143-
}
144-
for variant in variants.iter() {
145-
match &variant.data {
146-
VariantData::Struct(..) => {
147-
err.span_label(variant.span, "struct variant defined here");
148-
}
149-
VariantData::Tuple(..) => {
150-
err.span_label(variant.span, "tuple variant defined here");
151-
}
152-
VariantData::Unit(..) => {}
153-
}
154-
}
155-
err.emit();
156-
}
157-
}
158-
159119
/// Feature gate `impl Trait` inside `type Alias = $type_expr;`.
160120
fn check_impl_trait(&self, ty: &ast::Ty) {
161121
struct ImplTraitVisitor<'a> {
@@ -273,26 +233,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
273233
}
274234
}
275235

276-
ast::ItemKind::Enum(ast::EnumDef { ref variants, .. }, ..) => {
277-
for variant in variants {
278-
match (&variant.data, &variant.disr_expr) {
279-
(ast::VariantData::Unit(..), _) => {}
280-
(_, Some(disr_expr)) => gate_feature_post!(
281-
&self,
282-
arbitrary_enum_discriminant,
283-
disr_expr.value.span,
284-
"discriminants on non-unit variants are experimental"
285-
),
286-
_ => {}
287-
}
288-
}
289-
290-
let has_feature = self.features.arbitrary_enum_discriminant;
291-
if !has_feature && !i.span.allows_unstable(sym::arbitrary_enum_discriminant) {
292-
self.maybe_report_invalid_custom_discriminants(&variants);
293-
}
294-
}
295-
296236
ast::ItemKind::Impl(box ast::Impl { polarity, defaultness, ref of_trait, .. }) => {
297237
if let ast::ImplPolarity::Negative(span) = polarity {
298238
gate_feature_post!(

‎compiler/rustc_const_eval/src/interpret/cast.rs

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,19 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
138138
Ok(())
139139
}
140140

141+
/// Handles 'IntToInt' and 'IntToFloat' casts.
141142
pub fn int_to_int_or_float(
142143
&self,
143144
src: &ImmTy<'tcx, M::Provenance>,
144145
cast_ty: Ty<'tcx>,
145146
) -> InterpResult<'tcx, Immediate<M::Provenance>> {
146-
if (src.layout.ty.is_integral() || src.layout.ty.is_char() || src.layout.ty.is_bool())
147-
&& (cast_ty.is_floating_point() || cast_ty.is_integral() || cast_ty.is_char())
148-
{
149-
let scalar = src.to_scalar();
150-
Ok(self.cast_from_int_like(scalar, src.layout, cast_ty)?.into())
151-
} else {
152-
bug!("Unexpected cast from type {:?}", src.layout.ty)
153-
}
147+
assert!(src.layout.ty.is_integral() || src.layout.ty.is_char() || src.layout.ty.is_bool());
148+
assert!(cast_ty.is_floating_point() || cast_ty.is_integral() || cast_ty.is_char());
149+
150+
Ok(self.cast_from_int_like(src.to_scalar(), src.layout, cast_ty)?.into())
154151
}
155152

153+
/// Handles 'FloatToFloat' and 'FloatToInt' casts.
156154
pub fn float_to_float_or_int(
157155
&self,
158156
src: &ImmTy<'tcx, M::Provenance>,
@@ -180,31 +178,29 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
180178
src: &ImmTy<'tcx, M::Provenance>,
181179
cast_ty: Ty<'tcx>,
182180
) -> InterpResult<'tcx, Immediate<M::Provenance>> {
181+
assert!(src.layout.ty.is_any_ptr());
182+
assert!(cast_ty.is_unsafe_ptr());
183183
// Handle casting any ptr to raw ptr (might be a fat ptr).
184-
if src.layout.ty.is_any_ptr() && cast_ty.is_unsafe_ptr() {
185-
let dest_layout = self.layout_of(cast_ty)?;
186-
if dest_layout.size == src.layout.size {
187-
// Thin or fat pointer that just hast the ptr kind of target type changed.
188-
return Ok(**src);
189-
} else {
190-
// Casting the metadata away from a fat ptr.
191-
assert_eq!(src.layout.size, 2 * self.pointer_size());
192-
assert_eq!(dest_layout.size, self.pointer_size());
193-
assert!(src.layout.ty.is_unsafe_ptr());
194-
return match **src {
195-
Immediate::ScalarPair(data, _) => Ok(data.into()),
196-
Immediate::Scalar(..) => span_bug!(
197-
self.cur_span(),
198-
"{:?} input to a fat-to-thin cast ({:?} -> {:?})",
199-
*src,
200-
src.layout.ty,
201-
cast_ty
202-
),
203-
Immediate::Uninit => throw_ub!(InvalidUninitBytes(None)),
204-
};
205-
}
184+
let dest_layout = self.layout_of(cast_ty)?;
185+
if dest_layout.size == src.layout.size {
186+
// Thin or fat pointer that just hast the ptr kind of target type changed.
187+
return Ok(**src);
206188
} else {
207-
bug!("Can't cast 'Ptr' or 'FnPtr' into {:?}", cast_ty);
189+
// Casting the metadata away from a fat ptr.
190+
assert_eq!(src.layout.size, 2 * self.pointer_size());
191+
assert_eq!(dest_layout.size, self.pointer_size());
192+
assert!(src.layout.ty.is_unsafe_ptr());
193+
return match **src {
194+
Immediate::ScalarPair(data, _) => Ok(data.into()),
195+
Immediate::Scalar(..) => span_bug!(
196+
self.cur_span(),
197+
"{:?} input to a fat-to-thin cast ({:?} -> {:?})",
198+
*src,
199+
src.layout.ty,
200+
cast_ty
201+
),
202+
Immediate::Uninit => throw_ub!(InvalidUninitBytes(None)),
203+
};
208204
}
209205
}
210206

@@ -243,6 +239,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
243239
Ok(Scalar::from_maybe_pointer(ptr, self).into())
244240
}
245241

242+
/// Low-level cast helper function. This works directly on scalars and can take 'int-like' input
243+
/// type (basically everything with a scalar layout) to int/float/char types.
246244
pub fn cast_from_int_like(
247245
&self,
248246
scalar: Scalar<M::Provenance>, // input value (there is no ScalarTy so we separate data+layout)
@@ -282,6 +280,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
282280
})
283281
}
284282

283+
/// Low-level cast helper function. Converts an apfloat `f` into int or float types.
285284
fn cast_from_float<F>(&self, f: F, dest_ty: Ty<'tcx>) -> Scalar<M::Provenance>
286285
where
287286
F: Float + Into<Scalar<M::Provenance>> + FloatConvert<Single> + FloatConvert<Double>,

‎compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_hir::definitions::DisambiguatedDefPathData;
44
use rustc_middle::mir::interpret::{Allocation, ConstAllocation};
55
use rustc_middle::ty::{
66
self,
7-
print::{PrettyPrinter, Print, Printer},
7+
print::{with_no_verbose_constants, PrettyPrinter, Print, Printer},
88
subst::{GenericArg, GenericArgKind},
99
Ty, TyCtxt,
1010
};
@@ -190,7 +190,9 @@ impl Write for AbsolutePathPrinter<'_> {
190190

191191
/// Directly returns an `Allocation` containing an absolute path representation of the given type.
192192
pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ConstAllocation<'tcx> {
193-
let path = AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path;
193+
let path = with_no_verbose_constants!(
194+
AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path
195+
);
194196
let alloc = Allocation::from_bytes_byte_aligned_immutable(path.into_bytes());
195197
tcx.intern_const_alloc(alloc)
196198
}

‎compiler/rustc_error_codes/src/error_codes/E0732.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ An `enum` with a discriminant must specify a `#[repr(inttype)]`.
33
Erroneous code example:
44

55
```compile_fail,E0732
6-
#![feature(arbitrary_enum_discriminant)]
7-
86
enum Enum { // error!
97
Unit = 1,
108
Tuple() = 2,
@@ -20,8 +18,6 @@ is a well-defined way to extract a variant's discriminant from a value;
2018
for instance:
2119

2220
```
23-
#![feature(arbitrary_enum_discriminant)]
24-
2521
#[repr(u8)]
2622
enum Enum {
2723
Unit = 3,

‎compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ declare_features! (
5353
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
5454
/// Allows using ADX intrinsics from `core::arch::{x86, x86_64}`.
5555
(accepted, adx_target_feature, "1.61.0", Some(44839), None),
56+
/// Allows explicit discriminants on non-unit enum variants.
57+
(accepted, arbitrary_enum_discriminant, "CURRENT_RUSTC_VERSION", Some(60553), None),
5658
/// Allows using `sym` operands in inline assembly.
5759
(accepted, asm_sym, "CURRENT_RUSTC_VERSION", Some(93333), None),
5860
/// Allows the definition of associated constants in `trait` or `impl` blocks.

‎compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ declare_features! (
292292
(incomplete, adt_const_params, "1.56.0", Some(95174), None),
293293
/// Allows defining an `#[alloc_error_handler]`.
294294
(active, alloc_error_handler, "1.29.0", Some(51540), None),
295-
/// Allows explicit discriminants on non-unit enum variants.
296-
(active, arbitrary_enum_discriminant, "1.37.0", Some(60553), None),
297295
/// Allows trait methods with arbitrary self types.
298296
(active, arbitrary_self_types, "1.23.0", Some(44874), None),
299297
/// Allows using `const` operands in inline assembly.

‎compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, vs: &'tcx [hir::Variant<'tcx>], def_id: L
11801180
}
11811181
}
11821182

1183-
if tcx.adt_def(def_id).repr().int.is_none() && tcx.features().arbitrary_enum_discriminant {
1183+
if tcx.adt_def(def_id).repr().int.is_none() {
11841184
let is_unit = |var: &hir::Variant<'_>| matches!(var.data, hir::VariantData::Unit(..));
11851185

11861186
let has_disr = |var: &hir::Variant<'_>| var.disr_expr.is_some();

‎compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ thread_local! {
6363
static NO_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) };
6464
static NO_QUERIES: Cell<bool> = const { Cell::new(false) };
6565
static NO_VISIBLE_PATH: Cell<bool> = const { Cell::new(false) };
66+
static NO_VERBOSE_CONSTANTS: Cell<bool> = const { Cell::new(false) };
6667
}
6768

6869
macro_rules! define_helper {
@@ -117,6 +118,9 @@ define_helper!(
117118
/// Prevent selection of visible paths. `Display` impl of DefId will prefer
118119
/// visible (public) reexports of types as paths.
119120
fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH);
121+
/// Prevent verbose printing of constants. Verbose printing of constants is
122+
/// never desirable in some contexts like `std::any::type_name`.
123+
fn with_no_verbose_constants(NoVerboseConstantsGuard, NO_VERBOSE_CONSTANTS);
120124
);
121125

122126
/// The "region highlights" are used to control region printing during
@@ -759,7 +763,7 @@ pub trait PrettyPrinter<'tcx>:
759763
}
760764
ty::Array(ty, sz) => {
761765
p!("[", print(ty), "; ");
762-
if self.tcx().sess.verbose() {
766+
if !NO_VERBOSE_CONSTANTS.with(|flag| flag.get()) && self.tcx().sess.verbose() {
763767
p!(write("{:?}", sz));
764768
} else if let ty::ConstKind::Unevaluated(..) = sz.kind() {
765769
// Do not try to evaluate unevaluated constants. If we are const evaluating an
@@ -1181,7 +1185,7 @@ pub trait PrettyPrinter<'tcx>:
11811185
) -> Result<Self::Const, Self::Error> {
11821186
define_scoped_cx!(self);
11831187

1184-
if self.tcx().sess.verbose() {
1188+
if !NO_VERBOSE_CONSTANTS.with(|flag| flag.get()) && self.tcx().sess.verbose() {
11851189
p!(write("Const({:?}: {:?})", ct.kind(), ct.ty()));
11861190
return Ok(self);
11871191
}
@@ -1416,7 +1420,7 @@ pub trait PrettyPrinter<'tcx>:
14161420
) -> Result<Self::Const, Self::Error> {
14171421
define_scoped_cx!(self);
14181422

1419-
if self.tcx().sess.verbose() {
1423+
if !NO_VERBOSE_CONSTANTS.with(|flag| flag.get()) && self.tcx().sess.verbose() {
14201424
p!(write("ValTree({:?}: ", valtree), print(ty), ")");
14211425
return Ok(self);
14221426
}

‎src/bootstrap/doc.rs

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl Step for TheBook {
228228
}
229229

230230
// build the version info page and CSS
231-
builder.ensure(Standalone { compiler, target });
231+
let shared_assets = builder.ensure(SharedAssets { target });
232232

233233
// build the redirect pages
234234
builder.info(&format!("Documenting book redirect pages ({})", target));
@@ -237,7 +237,7 @@ impl Step for TheBook {
237237
let path = file.path();
238238
let path = path.to_str().unwrap();
239239

240-
invoke_rustdoc(builder, compiler, target, path);
240+
invoke_rustdoc(builder, compiler, &shared_assets, target, path);
241241
}
242242

243243
if builder.was_invoked_explicitly::<Self>(Kind::Doc) {
@@ -251,6 +251,7 @@ impl Step for TheBook {
251251
fn invoke_rustdoc(
252252
builder: &Builder<'_>,
253253
compiler: Compiler,
254+
shared_assets: &SharedAssetsPaths,
254255
target: TargetSelection,
255256
markdown: &str,
256257
) {
@@ -260,7 +261,6 @@ fn invoke_rustdoc(
260261

261262
let header = builder.src.join("src/doc/redirect.inc");
262263
let footer = builder.src.join("src/doc/footer.inc");
263-
let version_info = out.join("version_info.html");
264264

265265
let mut cmd = builder.rustdoc_cmd(compiler);
266266

@@ -269,7 +269,7 @@ fn invoke_rustdoc(
269269
cmd.arg("--html-after-content")
270270
.arg(&footer)
271271
.arg("--html-before-content")
272-
.arg(&version_info)
272+
.arg(&shared_assets.version_info)
273273
.arg("--html-in-header")
274274
.arg(&header)
275275
.arg("--markdown-no-toc")
@@ -300,7 +300,7 @@ impl Step for Standalone {
300300

301301
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
302302
let builder = run.builder;
303-
run.path("src/doc").default_condition(builder.config.docs)
303+
run.path("src/doc").alias("standalone").default_condition(builder.config.docs)
304304
}
305305

306306
fn make_run(run: RunConfig<'_>) {
@@ -325,21 +325,11 @@ impl Step for Standalone {
325325
let out = builder.doc_out(target);
326326
t!(fs::create_dir_all(&out));
327327

328+
let version_info = builder.ensure(SharedAssets { target: self.target }).version_info;
329+
328330
let favicon = builder.src.join("src/doc/favicon.inc");
329331
let footer = builder.src.join("src/doc/footer.inc");
330332
let full_toc = builder.src.join("src/doc/full-toc.inc");
331-
t!(fs::copy(builder.src.join("src/doc/rust.css"), out.join("rust.css")));
332-
333-
let version_input = builder.src.join("src/doc/version_info.html.template");
334-
let version_info = out.join("version_info.html");
335-
336-
if !builder.config.dry_run && !up_to_date(&version_input, &version_info) {
337-
let info = t!(fs::read_to_string(&version_input))
338-
.replace("VERSION", &builder.rust_release())
339-
.replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or(""))
340-
.replace("STAMP", builder.rust_info.sha().unwrap_or(""));
341-
t!(fs::write(&version_info, &info));
342-
}
343333

344334
for file in t!(fs::read_dir(builder.src.join("src/doc"))) {
345335
let file = t!(file);
@@ -401,6 +391,45 @@ impl Step for Standalone {
401391
}
402392
}
403393

394+
#[derive(Debug, Clone)]
395+
pub struct SharedAssetsPaths {
396+
pub version_info: PathBuf,
397+
}
398+
399+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
400+
pub struct SharedAssets {
401+
target: TargetSelection,
402+
}
403+
404+
impl Step for SharedAssets {
405+
type Output = SharedAssetsPaths;
406+
const DEFAULT: bool = false;
407+
408+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
409+
// Other tasks depend on this, no need to execute it on its own
410+
run.never()
411+
}
412+
413+
// Generate shared resources used by other pieces of documentation.
414+
fn run(self, builder: &Builder<'_>) -> Self::Output {
415+
let out = builder.doc_out(self.target);
416+
417+
let version_input = builder.src.join("src").join("doc").join("version_info.html.template");
418+
let version_info = out.join("version_info.html");
419+
if !builder.config.dry_run && !up_to_date(&version_input, &version_info) {
420+
let info = t!(fs::read_to_string(&version_input))
421+
.replace("VERSION", &builder.rust_release())
422+
.replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or(""))
423+
.replace("STAMP", builder.rust_info.sha().unwrap_or(""));
424+
t!(fs::write(&version_info, &info));
425+
}
426+
427+
builder.copy(&builder.src.join("src").join("doc").join("rust.css"), &out.join("rust.css"));
428+
429+
SharedAssetsPaths { version_info }
430+
}
431+
}
432+
404433
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
405434
pub struct Std {
406435
pub stage: u32,
@@ -429,7 +458,8 @@ impl Step for Std {
429458
let target = self.target;
430459
let out = builder.doc_out(target);
431460
t!(fs::create_dir_all(&out));
432-
t!(fs::copy(builder.src.join("src/doc/rust.css"), out.join("rust.css")));
461+
462+
builder.ensure(SharedAssets { target: self.target });
433463

434464
let index_page = builder.src.join("src/doc/index.md").into_os_string();
435465
let mut extra_args = vec![

‎src/doc/book

Submodule book updated 133 files

‎src/doc/unstable-book/src/language-features/arbitrary-enum-discriminant.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎src/librustdoc/html/static/css/rustdoc.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,6 +1585,15 @@ details.rustdoc-toggle > summary:hover::before {
15851585
opacity: 1;
15861586
}
15871587

1588+
details.rustdoc-toggle > summary:focus-visible::before {
1589+
/* The SVG is black, and gets turned white using a filter in the dark themes.
1590+
Do the same with the outline.
1591+
The dotted 1px style is copied from Firefox's focus ring style.
1592+
*/
1593+
outline: 1px dotted #000;
1594+
outline-offset: 1px;
1595+
}
1596+
15881597
details.rustdoc-toggle.top-doc > summary,
15891598
details.rustdoc-toggle.top-doc > summary::before,
15901599
details.rustdoc-toggle.non-exhaustive > summary,

‎src/test/ui/cast/issue-88621.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(arbitrary_enum_discriminant)]
2-
31
#[repr(u8)]
42
enum Kind2 {
53
Foo() = 1,

‎src/test/ui/cast/issue-88621.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0605]: non-primitive cast: `Kind2` as `u8`
2-
--> $DIR/issue-88621.rs:11:13
2+
--> $DIR/issue-88621.rs:9:13
33
|
44
LL | let _ = Kind2::Foo() as u8;
55
| ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object

‎src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![crate_type="lib"]
2-
#![feature(arbitrary_enum_discriminant)]
32

43
enum Enum {
54
//~^ ERROR `#[repr(inttype)]` must be specified

‎src/test/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0732]: `#[repr(inttype)]` must be specified
2-
--> $DIR/arbitrary_enum_discriminant-no-repr.rs:4:1
2+
--> $DIR/arbitrary_enum_discriminant-no-repr.rs:3:1
33
|
44
LL | enum Enum {
55
| ^^^^^^^^^

‎src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
#![feature(arbitrary_enum_discriminant, test)]
2+
#![feature(test)]
33

44
extern crate test;
55

‎src/test/ui/enum-discriminant/discriminant_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-pass
22
#![allow(stable_features)]
3-
#![feature(arbitrary_enum_discriminant, core, core_intrinsics)]
3+
#![feature(core, core_intrinsics)]
44

55
extern crate core;
66
use core::intrinsics::discriminant_value;

‎src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎src/test/ui/enum-discriminant/feature-gate-arbitrary_enum_discriminant.stderr

Lines changed: 0 additions & 36 deletions
This file was deleted.

‎src/test/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(arbitrary_enum_discriminant, core_intrinsics)]
1+
#![feature(core_intrinsics)]
22

33
extern crate core;
44
use core::intrinsics::discriminant_value;

‎src/test/ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(arbitrary_enum_discriminant, core_intrinsics)]
1+
#![feature(core_intrinsics)]
22

33
extern crate core;
44
use core::intrinsics::discriminant_value;

‎src/test/ui/enum-discriminant/issue-70509-partial_eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
#![feature(repr128, arbitrary_enum_discriminant)]
2+
#![feature(repr128)]
33
//~^ WARN the feature `repr128` is incomplete
44

55
#[derive(PartialEq, Debug)]

‎src/test/ui/enum-discriminant/issue-70509-partial_eq.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
warning: the feature `repr128` is incomplete and may not be safe to use and/or cause compiler crashes
22
--> $DIR/issue-70509-partial_eq.rs:2:12
33
|
4-
LL | #![feature(repr128, arbitrary_enum_discriminant)]
4+
LL | #![feature(repr128)]
55
| ^^^^^^^
66
|
77
= note: see issue #56071 <https://github.com/rust-lang/rust/issues/56071> for more information

‎src/test/ui/intrinsics/panic-uninitialized-zeroed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// This test checks panic emitted from `mem::{uninitialized,zeroed}`.
99

10-
#![feature(never_type, arbitrary_enum_discriminant)]
10+
#![feature(never_type)]
1111
#![allow(deprecated, invalid_value)]
1212

1313
use std::{

‎src/test/ui/macros/macros-nonfatal-errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// immediately, so that we get more errors listed at a time.
55

66
#![feature(trace_macros, concat_idents)]
7-
#![feature(stmt_expr_attributes, arbitrary_enum_discriminant)]
7+
#![feature(stmt_expr_attributes)]
88

99
use std::arch::asm;
1010

‎src/test/ui/parser/issues/issue-17383.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎src/test/ui/parser/issues/issue-17383.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎src/test/ui/parser/tag-variant-disr-non-nullary.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/test/ui/parser/tag-variant-disr-non-nullary.stderr

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎src/test/ui/transmutability/enums/should_order_correctly.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//! The payloads of an enum variant should be ordered after its tag.
33
44
#![crate_type = "lib"]
5-
#![feature(arbitrary_enum_discriminant)]
65
#![feature(transmutability)]
76
#![allow(dead_code)]
87

‎src/test/ui/transmutability/enums/should_respect_endianness.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//! an enum with a multi-byte tag.
33
44
#![crate_type = "lib"]
5-
#![feature(arbitrary_enum_discriminant)]
65
#![feature(transmutability)]
76
#![allow(dead_code)]
87

‎src/test/ui/transmutability/enums/should_respect_endianness.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0277]: `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`.
2-
--> $DIR/should_respect_endianness.rs:37:36
2+
--> $DIR/should_respect_endianness.rs:36:36
33
|
44
LL | assert::is_transmutable::<Src, Unexpected>();
55
| ^^^^^^^^^^ `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`.
66
|
77
= help: the trait `BikeshedIntrinsicFrom<Src, assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `Unexpected`
88
note: required by a bound in `is_transmutable`
9-
--> $DIR/should_respect_endianness.rs:15:14
9+
--> $DIR/should_respect_endianness.rs:14:14
1010
|
1111
LL | pub fn is_transmutable<Src, Dst>()
1212
| --------------- required by a bound in this
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Check to insure that the output of `std::any::type_name` does not change based on -Zverbose
2+
// when printing constants
3+
// run-pass
4+
// edition: 2018
5+
// revisions: normal verbose
6+
// [verbose]compile-flags:-Zverbose
7+
8+
struct Wrapper<const VALUE: usize>;
9+
10+
fn main() {
11+
assert_eq!(std::any::type_name::<[u32; 0]>(), "[u32; 0]");
12+
assert_eq!(std::any::type_name::<Wrapper<0>>(), "issue_94187_verbose_type_name::Wrapper<0>");
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.