1
Fork 0

Auto merge of #97000 - matthiaskrgr:rollup-qh3lhu8, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #96932 (Clarify what values `BorrowedHandle`, `OwnedHandle` etc. can hold.)
 - #96948 (Add test of matches macro for trailing commas)
 - #96988 (Fix platform support links.)
 - #96989 (Be more precise than DefPathData::Misc.)
 - #96993 (rustdoc: fix GUI crash when searching for magic JS property values)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-05-13 03:40:37 +00:00
commit f001f9301c
18 changed files with 171 additions and 56 deletions

View file

@ -261,14 +261,16 @@ pub enum DefPathData {
// they are treated specially by the `def_path` function. // they are treated specially by the `def_path` function.
/// The crate root (marker). /// The crate root (marker).
CrateRoot, CrateRoot,
// Catch-all for random `DefId` things like `DUMMY_NODE_ID`.
Misc,
// Different kinds of items and item-like things: // Different kinds of items and item-like things:
/// An impl. /// An impl.
Impl, Impl,
/// An `extern` block. /// An `extern` block.
ForeignMod, ForeignMod,
/// A `use` item.
Use,
/// A global asm item.
GlobalAsm,
/// Something in the type namespace. /// Something in the type namespace.
TypeNs(Symbol), TypeNs(Symbol),
/// Something in the value namespace. /// Something in the value namespace.
@ -443,9 +445,8 @@ impl DefPathData {
match *self { match *self {
TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name), TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name),
Impl | ForeignMod | CrateRoot | Misc | ClosureExpr | Ctor | AnonConst | ImplTrait => { Impl | ForeignMod | CrateRoot | Use | GlobalAsm | ClosureExpr | Ctor | AnonConst
None | ImplTrait => None,
}
} }
} }
@ -459,7 +460,8 @@ impl DefPathData {
CrateRoot => DefPathDataName::Anon { namespace: kw::Crate }, CrateRoot => DefPathDataName::Anon { namespace: kw::Crate },
Impl => DefPathDataName::Anon { namespace: kw::Impl }, Impl => DefPathDataName::Anon { namespace: kw::Impl },
ForeignMod => DefPathDataName::Anon { namespace: kw::Extern }, ForeignMod => DefPathDataName::Anon { namespace: kw::Extern },
Misc => DefPathDataName::Anon { namespace: sym::misc }, Use => DefPathDataName::Anon { namespace: kw::Use },
GlobalAsm => DefPathDataName::Anon { namespace: sym::global_asm },
ClosureExpr => DefPathDataName::Anon { namespace: sym::closure }, ClosureExpr => DefPathDataName::Anon { namespace: sym::closure },
Ctor => DefPathDataName::Anon { namespace: sym::constructor }, Ctor => DefPathDataName::Anon { namespace: sym::constructor },
AnonConst => DefPathDataName::Anon { namespace: sym::constant }, AnonConst => DefPathDataName::Anon { namespace: sym::constant },

View file

@ -1994,6 +1994,7 @@ impl<'tcx> TyCtxt<'tcx> {
.filter(|item| item.kind == AssocKind::Fn && item.defaultness.has_value()) .filter(|item| item.kind == AssocKind::Fn && item.defaultness.has_value())
} }
/// Look up the name of a definition across crates. This does not look at HIR.
fn opt_item_name(self, def_id: DefId) -> Option<Symbol> { fn opt_item_name(self, def_id: DefId) -> Option<Symbol> {
if let Some(cnum) = def_id.as_crate_root() { if let Some(cnum) = def_id.as_crate_root() {
Some(self.crate_name(cnum)) Some(self.crate_name(cnum))
@ -2014,16 +2015,11 @@ impl<'tcx> TyCtxt<'tcx> {
/// Look up the name of a definition across crates. This does not look at HIR. /// Look up the name of a definition across crates. This does not look at HIR.
/// ///
/// When possible, this function should be used for cross-crate lookups over /// This method will ICE if the corresponding item does not have a name. In these cases, use
/// [`opt_item_name`] to avoid invalidating the incremental cache. If you
/// need to handle items without a name, or HIR items that will not be
/// serialized cross-crate, or if you need the span of the item, use
/// [`opt_item_name`] instead. /// [`opt_item_name`] instead.
/// ///
/// [`opt_item_name`]: Self::opt_item_name /// [`opt_item_name`]: Self::opt_item_name
pub fn item_name(self, id: DefId) -> Symbol { pub fn item_name(self, id: DefId) -> Symbol {
// Look at cross-crate items first to avoid invalidating the incremental cache
// unless we have to.
self.opt_item_name(id).unwrap_or_else(|| { self.opt_item_name(id).unwrap_or_else(|| {
bug!("item_name: no name for {:?}", self.def_path(id)); bug!("item_name: no name for {:?}", self.def_path(id));
}) })

View file

@ -109,7 +109,7 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
visit::walk_item(self, i); visit::walk_item(self, i);
return self.visit_macro_invoc(i.id); return self.visit_macro_invoc(i.id);
} }
ItemKind::GlobalAsm(..) => DefPathData::Misc, ItemKind::GlobalAsm(..) => DefPathData::GlobalAsm,
ItemKind::Use(..) => { ItemKind::Use(..) => {
return visit::walk_item(self, i); return visit::walk_item(self, i);
} }
@ -160,11 +160,11 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
} }
fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) { fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {
self.create_def(id, DefPathData::Misc, use_tree.span); self.create_def(id, DefPathData::Use, use_tree.span);
match use_tree.kind { match use_tree.kind {
UseTreeKind::Simple(_, id1, id2) => { UseTreeKind::Simple(_, id1, id2) => {
self.create_def(id1, DefPathData::Misc, use_tree.prefix.span); self.create_def(id1, DefPathData::Use, use_tree.prefix.span);
self.create_def(id2, DefPathData::Misc, use_tree.prefix.span); self.create_def(id2, DefPathData::Use, use_tree.prefix.span);
} }
UseTreeKind::Glob => (), UseTreeKind::Glob => (),
UseTreeKind::Nested(..) => {} UseTreeKind::Nested(..) => {}

View file

@ -788,7 +788,8 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
// These should never show up as `path_append` arguments. // These should never show up as `path_append` arguments.
DefPathData::CrateRoot DefPathData::CrateRoot
| DefPathData::Misc | DefPathData::Use
| DefPathData::GlobalAsm
| DefPathData::Impl | DefPathData::Impl
| DefPathData::MacroNs(_) | DefPathData::MacroNs(_)
| DefPathData::LifetimeNs(_) => { | DefPathData::LifetimeNs(_) => {

View file

@ -22,8 +22,10 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
/// so it can be used in FFI in places where a handle is passed as an argument, /// so it can be used in FFI in places where a handle is passed as an argument,
/// it is not captured or consumed. /// it is not captured or consumed.
/// ///
/// Note that it *may* have the value `INVALID_HANDLE_VALUE` (-1), which is /// Note that it *may* have the value `-1`, which in `BorrowedHandle` always
/// sometimes a valid handle value. See [here] for the full story. /// represents a valid handle value, such as [the current process handle], and
/// not `INVALID_HANDLE_VALUE`, despite the two having the same value. See
/// [here] for the full story.
/// ///
/// And, it *may* have the value `NULL` (0), which can occur when consoles are /// And, it *may* have the value `NULL` (0), which can occur when consoles are
/// detached from processes, or when `windows_subsystem` is used. /// detached from processes, or when `windows_subsystem` is used.
@ -33,6 +35,7 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
/// handle, which is then borrowed under the same lifetime. /// handle, which is then borrowed under the same lifetime.
/// ///
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443 /// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
/// [the current process handle]: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocess#remarks
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
#[unstable(feature = "io_safety", issue = "87074")] #[unstable(feature = "io_safety", issue = "87074")]
@ -45,8 +48,10 @@ pub struct BorrowedHandle<'handle> {
/// ///
/// This closes the handle on drop. /// This closes the handle on drop.
/// ///
/// Note that it *may* have the value `INVALID_HANDLE_VALUE` (-1), which is /// Note that it *may* have the value `-1`, which in `OwnedHandle` always
/// sometimes a valid handle value. See [here] for the full story. /// represents a valid handle value, such as [the current process handle], and
/// not `INVALID_HANDLE_VALUE`, despite the two having the same value. See
/// [here] for the full story.
/// ///
/// And, it *may* have the value `NULL` (0), which can occur when consoles are /// And, it *may* have the value `NULL` (0), which can occur when consoles are
/// detached from processes, or when `windows_subsystem` is used. /// detached from processes, or when `windows_subsystem` is used.
@ -59,6 +64,7 @@ pub struct BorrowedHandle<'handle> {
/// [`RegCloseKey`]: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regclosekey /// [`RegCloseKey`]: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regclosekey
/// ///
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443 /// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
/// [the current process handle]: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocess#remarks
#[repr(transparent)] #[repr(transparent)]
#[unstable(feature = "io_safety", issue = "87074")] #[unstable(feature = "io_safety", issue = "87074")]
pub struct OwnedHandle { pub struct OwnedHandle {
@ -75,11 +81,13 @@ pub struct OwnedHandle {
/// `NULL`. This ensures that such FFI calls cannot start using the handle without /// `NULL`. This ensures that such FFI calls cannot start using the handle without
/// checking for `NULL` first. /// checking for `NULL` first.
/// ///
/// This type considers any value other than `NULL` to be valid, including `INVALID_HANDLE_VALUE`. /// This type may hold any handle value that [`OwnedHandle`] may hold. As with `OwnedHandle`, when
/// This is because APIs that use `NULL` as their sentry value don't treat `INVALID_HANDLE_VALUE` /// it holds `-1`, that value is interpreted as a valid handle value, such as
/// as special. /// [the current process handle], and not `INVALID_HANDLE_VALUE`.
/// ///
/// If this holds a valid handle, it will close the handle on drop. /// If this holds a non-null handle, it will close the handle on drop.
///
/// [the current process handle]: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocess#remarks
#[repr(transparent)] #[repr(transparent)]
#[unstable(feature = "io_safety", issue = "87074")] #[unstable(feature = "io_safety", issue = "87074")]
#[derive(Debug)] #[derive(Debug)]
@ -95,11 +103,10 @@ pub struct HandleOrNull(OwnedHandle);
/// `INVALID_HANDLE_VALUE`. This ensures that such FFI calls cannot start using the handle without /// `INVALID_HANDLE_VALUE`. This ensures that such FFI calls cannot start using the handle without
/// checking for `INVALID_HANDLE_VALUE` first. /// checking for `INVALID_HANDLE_VALUE` first.
/// ///
/// This type considers any value other than `INVALID_HANDLE_VALUE` to be valid, including `NULL`. /// This type may hold any handle value that [`OwnedHandle`] may hold, except that when it holds
/// This is because APIs that use `INVALID_HANDLE_VALUE` as their sentry value may return `NULL` /// `-1`, that value is interpreted to mean `INVALID_HANDLE_VALUE`.
/// under `windows_subsystem = "windows"` or other situations where I/O devices are detached.
/// ///
/// If this holds a valid handle, it will close the handle on drop. /// If holds a handle other than `INVALID_HANDLE_VALUE`, it will close the handle on drop.
#[repr(transparent)] #[repr(transparent)]
#[unstable(feature = "io_safety", issue = "87074")] #[unstable(feature = "io_safety", issue = "87074")]
#[derive(Debug)] #[derive(Debug)]

View file

@ -32,8 +32,15 @@ pub trait AsRawHandle {
/// raw handle to the caller, and the handle is only guaranteed /// raw handle to the caller, and the handle is only guaranteed
/// to be valid while the original object has not yet been destroyed. /// to be valid while the original object has not yet been destroyed.
/// ///
/// This function may return null, such as when called on [`Stdin`],
/// [`Stdout`], or [`Stderr`] when the console is detached.
///
/// However, borrowing is not strictly required. See [`AsHandle::as_handle`] /// However, borrowing is not strictly required. See [`AsHandle::as_handle`]
/// for an API which strictly borrows a handle. /// for an API which strictly borrows a handle.
///
/// [`Stdin`]: io::Stdin
/// [`Stdout`]: io::Stdout
/// [`Stderr`]: io::Stderr
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_raw_handle(&self) -> RawHandle; fn as_raw_handle(&self) -> RawHandle;
} }

View file

@ -15,12 +15,12 @@
- [Platform Support](platform-support.md) - [Platform Support](platform-support.md)
- [Template for target-specific documentation](platform-support/TEMPLATE.md) - [Template for target-specific documentation](platform-support/TEMPLATE.md)
- [aarch64-apple-ios-sim](platform-support/aarch64-apple-ios-sim.md) - [aarch64-apple-ios-sim](platform-support/aarch64-apple-ios-sim.md)
- [aarch64-unknown-none-hermitkernel](platform-support/aarch64-unknown-none-hermitkernel.md)
- [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md) - [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md)
- [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md) - [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md)
- [\*-kmc-solid_\*](platform-support/kmc-solid.md) - [\*-kmc-solid_\*](platform-support/kmc-solid.md)
- [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md) - [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md)
- [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md) - [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md)
- [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md)
- [*-unknown-openbsd](platform-support/openbsd.md) - [*-unknown-openbsd](platform-support/openbsd.md)
- [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md) - [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md)
- [x86_64-unknown-none](platform-support/x86_64-unknown-none.md) - [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)

View file

@ -119,7 +119,7 @@ window.initSearch = rawSearchIndex => {
*/ */
let searchIndex; let searchIndex;
let currentResults; let currentResults;
const ALIASES = {}; const ALIASES = Object.create(null);
const params = searchState.getQueryStringParams(); const params = searchState.getQueryStringParams();
// Populate search bar with query string search term when provided, // Populate search bar with query string search term when provided,
@ -1953,7 +1953,7 @@ window.initSearch = rawSearchIndex => {
} }
if (aliases) { if (aliases) {
ALIASES[crate] = {}; ALIASES[crate] = Object.create(null);
for (const alias_name in aliases) { for (const alias_name in aliases) {
if (!hasOwnPropertyRustdoc(aliases, alias_name)) { if (!hasOwnPropertyRustdoc(aliases, alias_name)) {
continue; continue;

View file

@ -4,22 +4,55 @@
fn g() -> () { fn g() -> () {
let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:11:8: 11:8 let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:11:8: 11:8
let _1: (); // in scope 0 at $DIR/cycle.rs:12:5: 12:12 let _1: (); // in scope 0 at $DIR/cycle.rs:12:5: 12:12
+ let mut _2: fn() {main}; // in scope 0 at $DIR/cycle.rs:12:5: 12:12
+ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8
+ scope 1 (inlined f::<fn() {main}>) { // at $DIR/cycle.rs:12:5: 12:12
+ debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7
+ let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8
+ let mut _4: &fn() {main}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6
+ scope 2 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8
+ }
+ }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/cycle.rs:12:5: 12:12 StorageLive(_1); // scope 0 at $DIR/cycle.rs:12:5: 12:12
_1 = f::<fn() {main}>(main) -> bb1; // scope 0 at $DIR/cycle.rs:12:5: 12:12 - _1 = f::<fn() {main}>(main) -> bb1; // scope 0 at $DIR/cycle.rs:12:5: 12:12
// mir::Constant + StorageLive(_2); // scope 0 at $DIR/cycle.rs:12:5: 12:12
// + span: $DIR/cycle.rs:12:5: 12:6 + _2 = main; // scope 0 at $DIR/cycle.rs:12:5: 12:12
// + literal: Const { ty: fn(fn() {main}) {f::<fn() {main}>}, val: Value(Scalar(<ZST>)) }
// mir::Constant // mir::Constant
- // + span: $DIR/cycle.rs:12:5: 12:6
- // + literal: Const { ty: fn(fn() {main}) {f::<fn() {main}>}, val: Value(Scalar(<ZST>)) }
- // mir::Constant
// + span: $DIR/cycle.rs:12:7: 12:11 // + span: $DIR/cycle.rs:12:7: 12:11
// + literal: Const { ty: fn() {main}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn() {main}, val: Value(Scalar(<ZST>)) }
+ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6
+ _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6
+ StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL
} }
bb1: { bb1: {
+ StorageDead(_2); // scope 0 at $DIR/cycle.rs:12:5: 12:12
StorageDead(_1); // scope 0 at $DIR/cycle.rs:12:12: 12:13 StorageDead(_1); // scope 0 at $DIR/cycle.rs:12:12: 12:13
_0 = const (); // scope 0 at $DIR/cycle.rs:11:8: 13:2 _0 = const (); // scope 0 at $DIR/cycle.rs:11:8: 13:2
return; // scope 0 at $DIR/cycle.rs:13:2: 13:2 return; // scope 0 at $DIR/cycle.rs:13:2: 13:2
+ }
+
+ bb2 (cleanup): {
+ drop(_2) -> bb3; // scope 1 at $DIR/cycle.rs:7:1: 7:2
+ }
+
+ bb3 (cleanup): {
+ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2
+ }
+
+ bb4: {
+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8
+ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9
+ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2
} }
} }

View file

@ -4,22 +4,72 @@
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:16:11: 16:11 let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:16:11: 16:11
let _1: (); // in scope 0 at $DIR/cycle.rs:17:5: 17:9 let _1: (); // in scope 0 at $DIR/cycle.rs:17:5: 17:9
+ let mut _2: fn() {g}; // in scope 0 at $DIR/cycle.rs:17:5: 17:9
+ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8
+ scope 1 (inlined f::<fn() {g}>) { // at $DIR/cycle.rs:17:5: 17:9
+ debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7
+ let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8
+ let mut _4: &fn() {g}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6
+ scope 2 (inlined <fn() {g} as Fn<()>>::call - shim(fn() {g})) { // at $DIR/cycle.rs:6:5: 6:8
+ scope 3 (inlined g) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL
+ let mut _6: fn() {main}; // in scope 3 at $DIR/cycle.rs:12:5: 12:12
+ scope 4 (inlined f::<fn() {main}>) { // at $DIR/cycle.rs:12:5: 12:12
+ debug g => _6; // in scope 4 at $DIR/cycle.rs:5:6: 5:7
+ let _7: (); // in scope 4 at $DIR/cycle.rs:6:5: 6:8
+ let mut _8: &fn() {main}; // in scope 4 at $DIR/cycle.rs:6:5: 6:6
+ scope 5 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8
+ }
+ }
+ }
+ }
+ }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/cycle.rs:17:5: 17:9 StorageLive(_1); // scope 0 at $DIR/cycle.rs:17:5: 17:9
_1 = f::<fn() {g}>(g) -> bb1; // scope 0 at $DIR/cycle.rs:17:5: 17:9 - _1 = f::<fn() {g}>(g) -> bb1; // scope 0 at $DIR/cycle.rs:17:5: 17:9
// mir::Constant + StorageLive(_2); // scope 0 at $DIR/cycle.rs:17:5: 17:9
// + span: $DIR/cycle.rs:17:5: 17:6 + _2 = g; // scope 0 at $DIR/cycle.rs:17:5: 17:9
// + literal: Const { ty: fn(fn() {g}) {f::<fn() {g}>}, val: Value(Scalar(<ZST>)) }
// mir::Constant // mir::Constant
- // + span: $DIR/cycle.rs:17:5: 17:6
- // + literal: Const { ty: fn(fn() {g}) {f::<fn() {g}>}, val: Value(Scalar(<ZST>)) }
- // mir::Constant
// + span: $DIR/cycle.rs:17:7: 17:8 // + span: $DIR/cycle.rs:17:7: 17:8
// + literal: Const { ty: fn() {g}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn() {g}, val: Value(Scalar(<ZST>)) }
+ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6
+ _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6
+ StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ StorageLive(_6); // scope 3 at $DIR/cycle.rs:12:5: 12:12
+ StorageLive(_7); // scope 4 at $DIR/cycle.rs:6:5: 6:8
+ StorageLive(_8); // scope 4 at $DIR/cycle.rs:6:5: 6:6
+ _8 = &_6; // scope 4 at $DIR/cycle.rs:6:5: 6:6
+ _7 = move (*_8)() -> [return: bb4, unwind: bb2]; // scope 5 at $SRC_DIR/core/src/ops/function.rs:LL:COL
} }
bb1: { bb1: {
+ StorageDead(_2); // scope 0 at $DIR/cycle.rs:17:5: 17:9
StorageDead(_1); // scope 0 at $DIR/cycle.rs:17:9: 17:10 StorageDead(_1); // scope 0 at $DIR/cycle.rs:17:9: 17:10
_0 = const (); // scope 0 at $DIR/cycle.rs:16:11: 18:2 _0 = const (); // scope 0 at $DIR/cycle.rs:16:11: 18:2
return; // scope 0 at $DIR/cycle.rs:18:2: 18:2 return; // scope 0 at $DIR/cycle.rs:18:2: 18:2
+ }
+
+ bb2 (cleanup): {
+ drop(_2) -> bb3; // scope 1 at $DIR/cycle.rs:7:1: 7:2
+ }
+
+ bb3 (cleanup): {
+ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2
+ }
+
+ bb4: {
+ StorageDead(_8); // scope 4 at $DIR/cycle.rs:6:7: 6:8
+ StorageDead(_7); // scope 4 at $DIR/cycle.rs:6:8: 6:9
+ StorageDead(_6); // scope 3 at $DIR/cycle.rs:12:5: 12:12
+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8
+ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9
+ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2
} }
} }

View file

@ -4,20 +4,13 @@
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/inline-cycle-generic.rs:8:11: 8:11 let mut _0: (); // return place in scope 0 at $DIR/inline-cycle-generic.rs:8:11: 8:11
let _1: (); // in scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24 let _1: (); // in scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24
+ scope 1 (inlined <C as Call>::call) { // at $DIR/inline-cycle-generic.rs:9:5: 9:24
+ scope 2 (inlined <B<A> as Call>::call) { // at $DIR/inline-cycle-generic.rs:38:9: 38:31
+ }
+ }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24 StorageLive(_1); // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24
- _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24 _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24
+ _1 = <A as Call>::call() -> bb1; // scope 2 at $DIR/inline-cycle-generic.rs:31:9: 31:28
// mir::Constant // mir::Constant
- // + span: $DIR/inline-cycle-generic.rs:9:5: 9:22 // + span: $DIR/inline-cycle-generic.rs:9:5: 9:22
- // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) }
+ // + span: $DIR/inline-cycle-generic.rs:31:9: 31:26
+ // + literal: Const { ty: fn() {<A as Call>::call}, val: Value(Scalar(<ZST>)) }
} }
bb1: { bb1: {

16
src/test/rustdoc-js/prototype.js vendored Normal file
View file

@ -0,0 +1,16 @@
// exact-check
const QUERY = ['constructor', '__proto__'];
const EXPECTED = [
{
'others': [],
'returned': [],
'in_args': [],
},
{
'others': [],
'returned': [],
'in_args': [],
},
];

View file

@ -0,0 +1,4 @@
// The alias needed to be there to reproduce the bug
// that used to be here.
#[doc(alias="other_alias")]
pub fn something_else() {}

View file

@ -192,6 +192,12 @@ fn line() {
let _ = line!(); let _ = line!();
} }
#[test]
fn matches() {
let _ = matches!(1, x if x > 0);
let _ = matches!(1, x if x > 0,);
}
#[test] #[test]
fn module_path() { fn module_path() {
let _ = module_path!(); let _ = module_path!();

View file

@ -1,10 +1,10 @@
error: symbol-name(_ZN5basic4main17h87acd86b3a6f1754E) error: symbol-name(_ZN5basic4main17hcbad207c0eeb0b3bE)
--> $DIR/basic.rs:8:1 --> $DIR/basic.rs:8:1
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: demangling(basic::main::h87acd86b3a6f1754) error: demangling(basic::main::hcbad207c0eeb0b3b)
--> $DIR/basic.rs:8:1 --> $DIR/basic.rs:8:1
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]

View file

@ -1,10 +1,10 @@
error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h8d22952c45e20d65E) error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h2f2efcf580c9b1eeE)
--> $DIR/issue-60925.rs:21:9 --> $DIR/issue-60925.rs:21:9
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h8d22952c45e20d65) error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h2f2efcf580c9b1ee)
--> $DIR/issue-60925.rs:21:9 --> $DIR/issue-60925.rs:21:9
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]

View file

@ -7,7 +7,7 @@ trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {}
fn transmute<A, B>(x: A) -> B { fn transmute<A, B>(x: A) -> B {
foo::<A, B, dyn Trait<A = A, B = B>>(x) foo::<A, B, dyn Trait<A = A, B = B>>(x)
//~^ ERROR type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B` //~^ ERROR type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
} }
fn foo<A, B, T: ?Sized>(x: T::A) -> B fn foo<A, B, T: ?Sized>(x: T::A) -> B

View file

@ -1,4 +1,4 @@
error[E0271]: type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B` error[E0271]: type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
--> $DIR/enforce-supertrait-projection.rs:9:5 --> $DIR/enforce-supertrait-projection.rs:9:5
| |
LL | fn transmute<A, B>(x: A) -> B { LL | fn transmute<A, B>(x: A) -> B {