Auto merge of #151234 - Zalathar:rollup-mtOIaDC, r=Zalathar

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151092 (Generate macro expansion for rust compiler crates docs)
 - rust-lang/rust#151120 (Fix deprecated attribute intra-doc link not resolved in the right location on reexported item)
 - rust-lang/rust#151207 (Preliminary match/capture test cleanup for PR 150681)
 - rust-lang/rust#151221 (Reorganizing `tests/ui/issues` 5 tests [1/N])
 - rust-lang/rust#151222 (feat: Support references in reflection type info)

r? @ghost
This commit is contained in:
bors 2026-01-17 03:10:02 +00:00
commit defdb83d4b
28 changed files with 325 additions and 140 deletions

View file

@ -1,4 +1,5 @@
use rustc_abi::FieldIdx;
use rustc_ast::Mutability;
use rustc_hir::LangItem;
use rustc_middle::mir::interpret::{CtfeProvenance, Scalar};
use rustc_middle::span_bug;
@ -103,12 +104,19 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
let (variant, _variant_place) = downcast(sym::Str)?;
variant
}
ty::Ref(_, ty, mutability) => {
let (variant, variant_place) = downcast(sym::Reference)?;
let reference_place =
self.project_field(&variant_place, FieldIdx::ZERO)?;
self.write_reference_type_info(reference_place, *ty, *mutability)?;
variant
}
ty::Adt(_, _)
| ty::Foreign(_)
| ty::Pat(_, _)
| ty::Slice(_)
| ty::RawPtr(..)
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(..)
| ty::UnsafeBinder(..)
@ -279,4 +287,29 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
}
interp_ok(())
}
pub(crate) fn write_reference_type_info(
&mut self,
place: impl Writeable<'tcx, CtfeProvenance>,
ty: Ty<'tcx>,
mutability: Mutability,
) -> InterpResult<'tcx> {
// Iterate over all fields of `type_info::Reference`.
for (field_idx, field) in
place.layout().ty.ty_adt_def().unwrap().non_enum_variant().fields.iter_enumerated()
{
let field_place = self.project_field(&place, field_idx)?;
match field.name {
// Write the `TypeId` of the reference's inner type to the `ty` field.
sym::pointee => self.write_type_id(ty, &field_place)?,
// Write the boolean representing the reference's mutability to the `mutable` field.
sym::mutable => {
self.write_scalar(Scalar::from_bool(mutability.is_mut()), &field_place)?
}
other => span_bug!(self.tcx.def_span(field.did), "unimplemented field {other}"),
}
}
interp_ok(())
}
}

View file

@ -343,6 +343,7 @@ symbols! {
RefCell,
RefCellRef,
RefCellRefMut,
Reference,
Relaxed,
Release,
Result,
@ -1521,6 +1522,7 @@ symbols! {
must_use,
mut_preserve_binding_mode_2024,
mut_ref,
mutable,
naked,
naked_asm,
naked_functions,

View file

@ -55,6 +55,8 @@ pub enum TypeKind {
Float(Float),
/// String slice type.
Str(Str),
/// References.
Reference(Reference),
/// FIXME(#146922): add all the common types
Other,
}
@ -133,3 +135,14 @@ pub struct Float {
pub struct Str {
// No additional information to provide for now.
}
/// Compile-time type information about references.
#[derive(Debug)]
#[non_exhaustive]
#[unstable(feature = "type_info", issue = "146922")]
pub struct Reference {
/// The type of the value being referred to.
pub pointee: TypeId,
/// Whether this reference is mutable or not.
pub mutable: bool,
}

View file

@ -1,4 +1,4 @@
use std::any::TypeId;
use std::any::{Any, TypeId};
use std::mem::type_info::{Type, TypeKind};
#[test]
@ -95,3 +95,33 @@ fn test_primitives() {
let Type { kind: Str(_ty), size, .. } = (const { Type::of::<str>() }) else { panic!() };
assert_eq!(size, None);
}
#[test]
fn test_references() {
// Immutable reference.
match const { Type::of::<&u8>() }.kind {
TypeKind::Reference(reference) => {
assert_eq!(reference.pointee, TypeId::of::<u8>());
assert!(!reference.mutable);
}
_ => unreachable!(),
}
// Mutable pointer.
match const { Type::of::<&mut u64>() }.kind {
TypeKind::Reference(reference) => {
assert_eq!(reference.pointee, TypeId::of::<u64>());
assert!(reference.mutable);
}
_ => unreachable!(),
}
// Wide pointer.
match const { Type::of::<&dyn Any>() }.kind {
TypeKind::Reference(reference) => {
assert_eq!(reference.pointee, TypeId::of::<dyn Any>());
assert!(!reference.mutable);
}
_ => unreachable!(),
}
}

View file

@ -932,6 +932,13 @@ impl Step for Rustc {
// see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222
// If there is any bug, please comment out the next line.
cargo.rustdocflag("--generate-link-to-definition");
// FIXME: Currently, `--generate-macro-expansion` option is buggy in `beta` rustdoc. To
// allow CI to pass, we only enable the option in stage 2 and higher.
// cfg(bootstrap)
// ^ Adding this so it's not forgotten when the new release is done.
if builder.top_stage > 1 {
cargo.rustdocflag("--generate-macro-expansion");
}
compile::rustc_cargo(builder, &mut cargo, target, &build_compiler, &self.crates);
cargo.arg("-Zskip-rustdoc-fingerprint");

View file

@ -7,7 +7,6 @@ use std::fmt::Display;
use std::mem;
use std::ops::Range;
use rustc_ast::attr::AttributeExt;
use rustc_ast::util::comments::may_have_doc_links;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
use rustc_data_structures::intern::Interned;
@ -1062,10 +1061,11 @@ fn preprocessed_markdown_links(s: &str) -> Vec<PreprocessedMarkdownLink> {
impl LinkCollector<'_, '_> {
#[instrument(level = "debug", skip_all)]
fn resolve_links(&mut self, item: &Item) {
let tcx = self.cx.tcx;
if !self.cx.document_private()
&& let Some(def_id) = item.item_id.as_def_id()
&& let Some(def_id) = def_id.as_local()
&& !self.cx.tcx.effective_visibilities(()).is_exported(def_id)
&& !tcx.effective_visibilities(()).is_exported(def_id)
&& !has_primitive_or_keyword_or_attribute_docs(&item.attrs.other_attrs)
{
// Skip link resolution for non-exported items.
@ -1073,9 +1073,9 @@ impl LinkCollector<'_, '_> {
}
let mut insert_links = |item_id, doc: &str| {
let module_id = match self.cx.tcx.def_kind(item_id) {
DefKind::Mod if item.inner_docs(self.cx.tcx) => item_id,
_ => find_nearest_parent_module(self.cx.tcx, item_id).unwrap(),
let module_id = match tcx.def_kind(item_id) {
DefKind::Mod if item.inner_docs(tcx) => item_id,
_ => find_nearest_parent_module(tcx, item_id).unwrap(),
};
for md_link in preprocessed_markdown_links(&doc) {
let link = self.resolve_link(&doc, item, item_id, module_id, &md_link);
@ -1108,7 +1108,14 @@ impl LinkCollector<'_, '_> {
// Also resolve links in the note text of `#[deprecated]`.
for attr in &item.attrs.other_attrs {
let Some(note_sym) = attr.deprecation_note() else { continue };
let rustc_hir::Attribute::Parsed(rustc_hir::attrs::AttributeKind::Deprecation {
span,
deprecation,
}) = attr
else {
continue;
};
let Some(note_sym) = deprecation.note else { continue };
let note = note_sym.as_str();
if !may_have_doc_links(note) {
@ -1116,7 +1123,18 @@ impl LinkCollector<'_, '_> {
}
debug!("deprecated_note={note}");
insert_links(item.item_id.expect_def_id(), note)
// When resolving an intra-doc link inside a deprecation note that is on an inlined
// `use` statement, we need to use the `def_id` of the `use` statement, not the
// inlined item.
// <https://github.com/rust-lang/rust/pull/151120>
let item_id = if let Some(inline_stmt_id) = item.inline_stmt_id
&& item.span(tcx).is_none_or(|item_span| !item_span.inner().contains(*span))
{
inline_stmt_id.to_def_id()
} else {
item.item_id.expect_def_id()
};
insert_links(item_id, note)
}
}

View file

@ -47,10 +47,11 @@ fn as_match() {
// CHECK: bb1: {
// CHECK: [[eq:_.*]] = Ne({{.*}}, const 1_isize);
// CHECK-NEXT: assume(move [[eq]]);
// CHECK-NEXT: goto -> bb2;
// CHECK: bb2: {
// CHECK-NEXT: goto -> [[return:bb.*]];
// CHECK: [[return]]: {
// CHECK-NOT: {{bb.*}}: {
// CHECK: return;
// CHECK: bb3: {
// CHECK: {{bb.*}}: {
// CHECK-NEXT: unreachable;
match empty() {
Some(_x) => match _x {},

View file

@ -49,7 +49,7 @@ struct Plop {
fn simple() {
// CHECK-LABEL: fn simple(
// CHECK: [[discr:_.*]] = discriminant(
// CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]];
// CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: {{bb.*}}, otherwise: [[unreachable]]];
// CHECK: [[unreachable]]: {
// CHECK-NEXT: unreachable;
match Test1::C {
@ -63,7 +63,7 @@ fn simple() {
fn custom_discriminant() {
// CHECK-LABEL: fn custom_discriminant(
// CHECK: [[discr:_.*]] = discriminant(
// CHECK: switchInt(move [[discr]]) -> [4: bb3, 5: bb2, otherwise: [[unreachable:bb.*]]];
// CHECK: switchInt(move [[discr]]) -> [4: {{bb.*}}, 5: {{bb.*}}, otherwise: [[unreachable:bb.*]]];
// CHECK: [[unreachable]]: {
// CHECK-NEXT: unreachable;
match Test2::D {
@ -76,7 +76,7 @@ fn custom_discriminant() {
fn otherwise_t1() {
// CHECK-LABEL: fn otherwise_t1(
// CHECK: [[discr:_.*]] = discriminant(
// CHECK: switchInt(move [[discr]]) -> [0: bb5, 1: bb5, 2: bb1, otherwise: [[unreachable:bb.*]]];
// CHECK: switchInt(move [[discr]]) -> [0: {{bb.*}}, 1: {{bb.*}}, 2: {{bb.*}}, otherwise: [[unreachable:bb.*]]];
// CHECK: [[unreachable]]: {
// CHECK-NEXT: unreachable;
match Test1::C {
@ -90,7 +90,7 @@ fn otherwise_t1() {
fn otherwise_t2() {
// CHECK-LABEL: fn otherwise_t2(
// CHECK: [[discr:_.*]] = discriminant(
// CHECK: switchInt(move [[discr]]) -> [4: bb2, 5: bb1, otherwise: [[unreachable:bb.*]]];
// CHECK: switchInt(move [[discr]]) -> [4: {{bb.*}}, 5: {{bb.*}}, otherwise: [[unreachable:bb.*]]];
// CHECK: [[unreachable]]: {
// CHECK-NEXT: unreachable;
match Test2::D {

View file

@ -0,0 +1,11 @@
// This test ensures that the intra-doc link in `deprecated` note is resolved at the correct
// location (ie in the current crate and not in the reexported item's location/crate) and
// therefore doesn't crash.
//
// This is a regression test for <https://github.com/rust-lang/rust/issues/151028>.
#![crate_name = "foo"]
#[deprecated(note = "use [`std::mem::forget`]")]
#[doc(inline)]
pub use std::mem::drop;

View file

@ -1,6 +1,7 @@
//@ edition:2021
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
enum Info {
Point(i32, i32, String),
@ -14,9 +15,6 @@ fn multi_variant_enum() {
let meta = Info::Meta("meta".into(), vec);
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
@ -48,9 +46,6 @@ fn single_variant_enum() {
let point = SingleVariant::Point(10, -10, "1".into());
let c = #[rustc_capture_analysis]
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:

View file

@ -1,25 +1,5 @@
error[E0658]: attributes on expressions are experimental
--> $DIR/capture-enums.rs:16:13
|
LL | let c = #[rustc_capture_analysis]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: attributes on expressions are experimental
--> $DIR/capture-enums.rs:50:13
|
LL | let c = #[rustc_capture_analysis]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: First Pass analysis includes:
--> $DIR/capture-enums.rs:20:5
--> $DIR/capture-enums.rs:18:5
|
LL | / || {
LL | |
@ -30,38 +10,38 @@ LL | | };
| |_____^
|
note: Capturing point[] -> Immutable
--> $DIR/capture-enums.rs:23:41
--> $DIR/capture-enums.rs:21:41
|
LL | if let Info::Point(_, _, str) = point {
| ^^^^^
note: Capturing point[] -> Immutable
--> $DIR/capture-enums.rs:23:41
--> $DIR/capture-enums.rs:21:41
|
LL | if let Info::Point(_, _, str) = point {
| ^^^^^
note: Capturing point[(2, 0)] -> ByValue
--> $DIR/capture-enums.rs:23:41
--> $DIR/capture-enums.rs:21:41
|
LL | if let Info::Point(_, _, str) = point {
| ^^^^^
note: Capturing meta[] -> Immutable
--> $DIR/capture-enums.rs:31:35
--> $DIR/capture-enums.rs:29:35
|
LL | if let Info::Meta(_, v) = meta {
| ^^^^
note: Capturing meta[] -> Immutable
--> $DIR/capture-enums.rs:31:35
--> $DIR/capture-enums.rs:29:35
|
LL | if let Info::Meta(_, v) = meta {
| ^^^^
note: Capturing meta[(1, 1)] -> ByValue
--> $DIR/capture-enums.rs:31:35
--> $DIR/capture-enums.rs:29:35
|
LL | if let Info::Meta(_, v) = meta {
| ^^^^
error: Min Capture analysis includes:
--> $DIR/capture-enums.rs:20:5
--> $DIR/capture-enums.rs:18:5
|
LL | / || {
LL | |
@ -72,18 +52,18 @@ LL | | };
| |_____^
|
note: Min Capture point[] -> ByValue
--> $DIR/capture-enums.rs:23:41
--> $DIR/capture-enums.rs:21:41
|
LL | if let Info::Point(_, _, str) = point {
| ^^^^^
note: Min Capture meta[] -> ByValue
--> $DIR/capture-enums.rs:31:35
--> $DIR/capture-enums.rs:29:35
|
LL | if let Info::Meta(_, v) = meta {
| ^^^^
error: First Pass analysis includes:
--> $DIR/capture-enums.rs:54:5
--> $DIR/capture-enums.rs:49:5
|
LL | / || {
LL | |
@ -95,13 +75,13 @@ LL | | };
| |_____^
|
note: Capturing point[(2, 0)] -> ByValue
--> $DIR/capture-enums.rs:57:47
--> $DIR/capture-enums.rs:52:47
|
LL | let SingleVariant::Point(_, _, str) = point;
| ^^^^^
error: Min Capture analysis includes:
--> $DIR/capture-enums.rs:54:5
--> $DIR/capture-enums.rs:49:5
|
LL | / || {
LL | |
@ -113,11 +93,10 @@ LL | | };
| |_____^
|
note: Min Capture point[(2, 0)] -> ByValue
--> $DIR/capture-enums.rs:57:47
--> $DIR/capture-enums.rs:52:47
|
LL | let SingleVariant::Point(_, _, str) = point;
| ^^^^^
error: aborting due to 6 previous errors
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -34,4 +34,82 @@ fn edge_case_if() {
_b();
}
struct Unit;
enum TSingle {
A(u32, u32),
}
enum SSingle {
A { a: u32, b: u32 },
}
struct TStruct(u32, u32);
struct SStruct { a: u32, b: u32 }
// Destructuring a unit struct should not capture it
fn match_unit_struct(mut x: (Unit, u32)) {
let r = &mut x.0;
let _ = || {
let (Unit, a) = x;
a
};
let _ = *r;
}
// The same is true for an equivalent enum
fn match_unit_enum(mut x: (SingleVariant, u32)) {
let r = &mut x.0;
let _ = || {
let (SingleVariant::A, a) = x;
a
};
let _ = *r;
}
// More generally, destructuring a struct should only capture the fields being touched
fn match_struct(mut x: SStruct) {
let r = &mut x.a;
let _ = || {
let SStruct { b, .. } = x;
b
};
let _ = *r;
}
fn match_tuple_struct(mut x: TStruct) {
let r = &mut x.0;
let _ = || {
let TStruct(_, a) = x;
a
};
let _ = *r;
}
// The same is true for an equivalent enum as well
fn match_singleton(mut x: SSingle) {
let SSingle::A { a: ref mut r, .. } = x;
let _ = || {
let SSingle::A { b, .. } = x;
b
};
let _ = *r;
}
fn match_tuple_singleton(mut x: TSingle) {
let TSingle::A(ref mut r, _) = x;
let _ = || {
let TSingle::A(_, a) = x;
a
};
let _ = *r;
}
fn main() {}

View file

@ -10,6 +10,8 @@
// Ignore non_exhaustive in the same crate
#[non_exhaustive]
enum L1 { A, B }
#[non_exhaustive]
enum L2 { C }
extern crate match_non_exhaustive_lib;

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `L1::B` not covered
--> $DIR/non-exhaustive-match.rs:26:25
--> $DIR/non-exhaustive-match.rs:28:25
|
LL | let _b = || { match l1 { L1::A => () } };
| ^^ pattern `L1::B` not covered
@ -16,7 +16,7 @@ LL | let _b = || { match l1 { L1::A => (), L1::B => todo!() } };
| ++++++++++++++++++
error[E0004]: non-exhaustive patterns: type `E1` is non-empty
--> $DIR/non-exhaustive-match.rs:37:25
--> $DIR/non-exhaustive-match.rs:39:25
|
LL | let _d = || { match e1 {} };
| ^^
@ -35,7 +35,7 @@ LL ~ } };
|
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/non-exhaustive-match.rs:39:25
--> $DIR/non-exhaustive-match.rs:41:25
|
LL | let _e = || { match e2 { E2::A => (), E2::B => () } };
| ^^ pattern `_` not covered
@ -53,7 +53,7 @@ LL | let _e = || { match e2 { E2::A => (), E2::B => (), _ => todo!() } };
| ++++++++++++++
error[E0505]: cannot move out of `e3` because it is borrowed
--> $DIR/non-exhaustive-match.rs:46:22
--> $DIR/non-exhaustive-match.rs:48:22
|
LL | let _g = || { match e3 { E3::C => (), _ => () } };
| -- -- borrow occurs due to use in closure

View file

@ -40,30 +40,6 @@ fn match_unit_variant(x: (Choice, u32, u32)) {
};
}
struct Unit;
fn match_unit_struct(mut x: (Unit, u32)) {
let r = &mut x.0;
let _ = || {
let (Unit, a) = x;
a
};
let _ = *r;
}
enum Also { Unit }
fn match_unit_enum(mut x: (Also, u32)) {
let r = &mut x.0;
let _ = || {
let (Also::Unit, a) = x;
a
};
let _ = *r;
}
enum TEnum {
A(u32),
B(u32),
@ -99,46 +75,6 @@ enum SSingle {
struct TStruct(u32, u32);
struct SStruct { a: u32, b: u32 }
fn match_struct(mut x: SStruct) {
let r = &mut x.a;
let _ = || {
let SStruct { b, .. } = x;
b
};
let _ = *r;
}
fn match_tuple_struct(mut x: TStruct) {
let r = &mut x.0;
let _ = || {
let TStruct(_, a) = x;
a
};
let _ = *r;
}
fn match_singleton(mut x: SSingle) {
let SSingle::A { a: ref mut r, .. } = x;
let _ = || {
let SSingle::A { b, .. } = x;
b
};
let _ = *r;
}
fn match_tuple_singleton(mut x: TSingle) {
let TSingle::A(ref mut r, _) = x;
let _ = || {
let TSingle::A(_, a) = x;
a
};
let _ = *r;
}
fn match_slice(x: (&[u32], u32, u32)) {
let _ = || {
let (([], a, _) | ([_, ..], _, a)) = x;

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/16683>
trait T<'a> {
fn a(&'a self) -> &'a bool;
fn b(&self) {

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-16683.rs:4:9
--> $DIR/elided-self-lifetime-in-trait-fn.rs:5:9
|
LL | trait T<'a> {
| -- lifetime `'a` defined here

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/17405>
enum Foo {
Bar(isize)
}

View file

@ -1,5 +1,5 @@
error[E0574]: expected struct, variant or union type, found enum `Foo`
--> $DIR/issue-17405.rs:7:9
--> $DIR/struct_pattern_on_tuple_enum.rs:8:9
|
LL | Foo { i } => ()
| ^^^ not a struct, variant or union type

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/18389>
//@ check-pass
use std::any::Any;

View file

@ -1,5 +1,5 @@
warning: trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
--> $DIR/issue-18389.rs:9:1
--> $DIR/trait_more_private_than_item.rs:10:1
|
LL | / pub trait Public: Private<
LL | |
@ -9,7 +9,7 @@ LL | | > {
| |_^ trait `Public` is reachable at visibility `pub`
|
note: but trait `Private<<Self as Public>::P, <Self as Public>::R>` is only usable at visibility `pub(crate)`
--> $DIR/issue-18389.rs:6:1
--> $DIR/trait_more_private_than_item.rs:7:1
|
LL | trait Private<P, R> {
| ^^^^^^^^^^^^^^^^^^^

View file

@ -155,19 +155,34 @@ Type {
),
}
Type {
kind: Other,
kind: Reference(
Reference {
pointee: TypeId(0xda1b6da9bd297bb2900de9303aadea79),
mutable: false,
},
),
size: Some(
8,
),
}
Type {
kind: Other,
kind: Reference(
Reference {
pointee: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c),
mutable: false,
},
),
size: Some(
8,
),
}
Type {
kind: Other,
kind: Reference(
Reference {
pointee: TypeId(0x641e3def269c37acc6dcb92bf8c5f196),
mutable: false,
},
),
size: Some(
8,
),
@ -182,3 +197,25 @@ Type {
kind: Other,
size: None,
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
mutable: false,
},
),
size: Some(
4,
),
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
mutable: true,
},
),
size: Some(
4,
),
}

View file

@ -155,19 +155,34 @@ Type {
),
}
Type {
kind: Other,
kind: Reference(
Reference {
pointee: TypeId(0xda1b6da9bd297bb2900de9303aadea79),
mutable: false,
},
),
size: Some(
16,
),
}
Type {
kind: Other,
kind: Reference(
Reference {
pointee: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c),
mutable: false,
},
),
size: Some(
16,
),
}
Type {
kind: Other,
kind: Reference(
Reference {
pointee: TypeId(0x641e3def269c37acc6dcb92bf8c5f196),
mutable: false,
},
),
size: Some(
16,
),
@ -182,3 +197,25 @@ Type {
kind: Other,
size: None,
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
mutable: false,
},
),
size: Some(
8,
),
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
mutable: true,
},
),
size: Some(
8,
),
}

View file

@ -40,5 +40,6 @@ fn main() {
Foo, Bar,
&Unsized, &str, &[u8],
str, [u8],
&u8, &mut u8,
}
}

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/18119>
const X: u8 = 1;
static Y: u8 = 1;
fn foo() {}

View file

@ -1,17 +1,17 @@
error[E0573]: expected type, found constant `X`
--> $DIR/issue-18119.rs:5:6
--> $DIR/impl-on-non-type.rs:6:6
|
LL | impl X {}
| ^ not a type
error[E0573]: expected type, found static `Y`
--> $DIR/issue-18119.rs:7:6
--> $DIR/impl-on-non-type.rs:8:6
|
LL | impl Y {}
| ^ not a type
error[E0573]: expected type, found function `foo`
--> $DIR/issue-18119.rs:9:6
--> $DIR/impl-on-non-type.rs:10:6
|
LL | impl foo {}
| ^^^ not a type

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/17994>
trait Tr {}
type Huh<T> where T: Tr = isize; //~ ERROR type parameter `T` is never used
fn main() {}

View file

@ -1,5 +1,5 @@
error[E0091]: type parameter `T` is never used
--> $DIR/issue-17994.rs:2:10
--> $DIR/unused_type_parameter.rs:3:10
|
LL | type Huh<T> where T: Tr = isize;
| ^ unused type parameter