Skip to content

Commit 4a5b913

Browse files
committed
Auto merge of #70053 - Centril:rollup-lumng3d, r=Centril
Rollup of 7 pull requests Successful merges: - #69870 (expand: Implement something similar to `#[cfg(accessible(path))]`) - #69881 (VariantSizeDifferences: bail on SizeOverflow) - #70000 (resolve: Fix regression in resolution of raw keywords in paths) - #70029 (Bump the bootstrap compiler) - #70046 (Use sublice patterns to avoid computing the len) - #70049 (Fiddle `ParamEnv` through to a place that used to use `ParamEnv::empty` in a buggy manner) - #70051 (Allow `hir().find` to return `None`) Failed merges: r? @ghost
2 parents dd67187 + 9d325cf commit 4a5b913

Some content is hidden

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

51 files changed

+596
-244
lines changed

src/bootstrap/builder.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ impl<'a> Builder<'a> {
725725
self.clear_if_dirty(&my_out, &rustdoc);
726726
}
727727

728-
cargo.env("CARGO_TARGET_DIR", &out_dir).arg(cmd).arg("-Zconfig-profile");
728+
cargo.env("CARGO_TARGET_DIR", &out_dir).arg(cmd);
729729

730730
let profile_var = |name: &str| {
731731
let profile = if self.config.rust_optimize { "RELEASE" } else { "DEV" };
@@ -847,13 +847,7 @@ impl<'a> Builder<'a> {
847847
rustflags.arg("-Zforce-unstable-if-unmarked");
848848
}
849849

850-
// cfg(bootstrap): the flag was renamed from `-Zexternal-macro-backtrace`
851-
// to `-Zmacro-backtrace`, keep only the latter after beta promotion.
852-
if stage == 0 {
853-
rustflags.arg("-Zexternal-macro-backtrace");
854-
} else {
855-
rustflags.arg("-Zmacro-backtrace");
856-
}
850+
rustflags.arg("-Zmacro-backtrace");
857851

858852
let want_rustdoc = self.doc_tests != DocTests::No;
859853

src/bootstrap/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use build_helper::output;
1313
use crate::Build;
1414

1515
// The version number
16-
pub const CFG_RELEASE_NUM: &str = "1.43.0";
16+
pub const CFG_RELEASE_NUM: &str = "1.44.0";
1717

1818
pub struct GitInfo {
1919
inner: Option<Info>,

src/liballoc/boxed.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,29 +1105,6 @@ impl<T: ?Sized> AsMut<T> for Box<T> {
11051105
#[stable(feature = "pin", since = "1.33.0")]
11061106
impl<T: ?Sized> Unpin for Box<T> {}
11071107

1108-
#[cfg(bootstrap)]
1109-
#[unstable(feature = "generator_trait", issue = "43122")]
1110-
impl<G: ?Sized + Generator + Unpin> Generator for Box<G> {
1111-
type Yield = G::Yield;
1112-
type Return = G::Return;
1113-
1114-
fn resume(mut self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return> {
1115-
G::resume(Pin::new(&mut *self))
1116-
}
1117-
}
1118-
1119-
#[cfg(bootstrap)]
1120-
#[unstable(feature = "generator_trait", issue = "43122")]
1121-
impl<G: ?Sized + Generator> Generator for Pin<Box<G>> {
1122-
type Yield = G::Yield;
1123-
type Return = G::Return;
1124-
1125-
fn resume(mut self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return> {
1126-
G::resume((*self).as_mut())
1127-
}
1128-
}
1129-
1130-
#[cfg(not(bootstrap))]
11311108
#[unstable(feature = "generator_trait", issue = "43122")]
11321109
impl<G: ?Sized + Generator<R> + Unpin, R> Generator<R> for Box<G> {
11331110
type Yield = G::Yield;
@@ -1138,7 +1115,6 @@ impl<G: ?Sized + Generator<R> + Unpin, R> Generator<R> for Box<G> {
11381115
}
11391116
}
11401117

1141-
#[cfg(not(bootstrap))]
11421118
#[unstable(feature = "generator_trait", issue = "43122")]
11431119
impl<G: ?Sized + Generator<R>, R> Generator<R> for Pin<Box<G>> {
11441120
type Yield = G::Yield;

src/libcore/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
15691569
#[lang = "unsafe_cell"]
15701570
#[stable(feature = "rust1", since = "1.0.0")]
15711571
#[repr(transparent)]
1572-
#[cfg_attr(not(bootstrap), repr(no_niche))] // rust-lang/rust#68303.
1572+
#[repr(no_niche)] // rust-lang/rust#68303.
15731573
pub struct UnsafeCell<T: ?Sized> {
15741574
value: T,
15751575
}

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
#![feature(associated_type_bounds)]
141141
#![feature(const_type_id)]
142142
#![feature(const_caller_location)]
143-
#![cfg_attr(not(bootstrap), feature(no_niche))] // rust-lang/rust#68303
143+
#![feature(no_niche)] // rust-lang/rust#68303
144144

145145
#[prelude_import]
146146
#[allow(unused)]

src/libcore/macros/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,18 @@ pub(crate) mod builtin {
14041404
/* compiler built-in */
14051405
}
14061406

1407+
/// Keeps the item it's applied to if the passed path is accessible, and removes it otherwise.
1408+
#[cfg(not(bootstrap))]
1409+
#[unstable(
1410+
feature = "cfg_accessible",
1411+
issue = "64797",
1412+
reason = "`cfg_accessible` is not fully implemented"
1413+
)]
1414+
#[rustc_builtin_macro]
1415+
pub macro cfg_accessible($item:item) {
1416+
/* compiler built-in */
1417+
}
1418+
14071419
/// Unstable implementation detail of the `rustc` compiler, do not use.
14081420
#[rustc_builtin_macro]
14091421
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/ops/generator.rs

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub enum GeneratorState<Y, R> {
6767
#[lang = "generator"]
6868
#[unstable(feature = "generator_trait", issue = "43122")]
6969
#[fundamental]
70-
pub trait Generator<#[cfg(not(bootstrap))] R = ()> {
70+
pub trait Generator<R = ()> {
7171
/// The type of value this generator yields.
7272
///
7373
/// This associated type corresponds to the `yield` expression and the
@@ -110,35 +110,9 @@ pub trait Generator<#[cfg(not(bootstrap))] R = ()> {
110110
/// been returned previously. While generator literals in the language are
111111
/// guaranteed to panic on resuming after `Complete`, this is not guaranteed
112112
/// for all implementations of the `Generator` trait.
113-
fn resume(
114-
self: Pin<&mut Self>,
115-
#[cfg(not(bootstrap))] arg: R,
116-
) -> GeneratorState<Self::Yield, Self::Return>;
113+
fn resume(self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return>;
117114
}
118115

119-
#[cfg(bootstrap)]
120-
#[unstable(feature = "generator_trait", issue = "43122")]
121-
impl<G: ?Sized + Generator> Generator for Pin<&mut G> {
122-
type Yield = G::Yield;
123-
type Return = G::Return;
124-
125-
fn resume(mut self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return> {
126-
G::resume((*self).as_mut())
127-
}
128-
}
129-
130-
#[cfg(bootstrap)]
131-
#[unstable(feature = "generator_trait", issue = "43122")]
132-
impl<G: ?Sized + Generator + Unpin> Generator for &mut G {
133-
type Yield = G::Yield;
134-
type Return = G::Return;
135-
136-
fn resume(mut self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return> {
137-
G::resume(Pin::new(&mut *self))
138-
}
139-
}
140-
141-
#[cfg(not(bootstrap))]
142116
#[unstable(feature = "generator_trait", issue = "43122")]
143117
impl<G: ?Sized + Generator<R>, R> Generator<R> for Pin<&mut G> {
144118
type Yield = G::Yield;
@@ -149,7 +123,6 @@ impl<G: ?Sized + Generator<R>, R> Generator<R> for Pin<&mut G> {
149123
}
150124
}
151125

152-
#[cfg(not(bootstrap))]
153126
#[unstable(feature = "generator_trait", issue = "43122")]
154127
impl<G: ?Sized + Generator<R> + Unpin, R> Generator<R> for &mut G {
155128
type Yield = G::Yield;

src/libcore/prelude/v1.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,12 @@ pub use crate::{
6767
pub use crate::macros::builtin::{
6868
bench, global_allocator, test, test_case, RustcDecodable, RustcEncodable,
6969
};
70+
71+
#[cfg(not(bootstrap))]
72+
#[unstable(
73+
feature = "cfg_accessible",
74+
issue = "64797",
75+
reason = "`cfg_accessible` is not fully implemented"
76+
)]
77+
#[doc(no_inline)]
78+
pub use crate::macros::builtin::cfg_accessible;

src/librustc/hir/map/mod.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -342,20 +342,25 @@ impl<'hir> Map<'hir> {
342342
}
343343

344344
fn find_entry(&self, id: HirId) -> Option<Entry<'hir>> {
345-
Some(self.get_entry(id))
346-
}
347-
348-
fn get_entry(&self, id: HirId) -> Entry<'hir> {
349345
if id.local_id == ItemLocalId::from_u32_const(0) {
350346
let owner = self.tcx.hir_owner(id.owner_def_id());
351-
Entry { parent: owner.parent, node: owner.node }
347+
owner.map(|owner| Entry { parent: owner.parent, node: owner.node })
352348
} else {
353349
let owner = self.tcx.hir_owner_items(id.owner_def_id());
354-
let item = owner.items[id.local_id].as_ref().unwrap();
355-
Entry { parent: HirId { owner: id.owner, local_id: item.parent }, node: item.node }
350+
owner.and_then(|owner| {
351+
let item = owner.items[id.local_id].as_ref();
352+
item.map(|item| Entry {
353+
parent: HirId { owner: id.owner, local_id: item.parent },
354+
node: item.node,
355+
})
356+
})
356357
}
357358
}
358359

360+
fn get_entry(&self, id: HirId) -> Entry<'hir> {
361+
self.find_entry(id).unwrap()
362+
}
363+
359364
pub fn item(&self, id: HirId) -> &'hir Item<'hir> {
360365
match self.find(id).unwrap() {
361366
Node::Item(item) => item,
@@ -380,6 +385,7 @@ impl<'hir> Map<'hir> {
380385
pub fn body(&self, id: BodyId) -> &'hir Body<'hir> {
381386
self.tcx
382387
.hir_owner_items(DefId::local(id.hir_id.owner))
388+
.unwrap()
383389
.bodies
384390
.get(&id.hir_id.local_id)
385391
.unwrap()
@@ -541,8 +547,9 @@ impl<'hir> Map<'hir> {
541547

542548
/// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
543549
pub fn find(&self, hir_id: HirId) -> Option<Node<'hir>> {
544-
let node = self.get_entry(hir_id).node;
545-
if let Node::Crate(..) = node { None } else { Some(node) }
550+
self.find_entry(hir_id).and_then(|entry| {
551+
if let Node::Crate(..) = entry.node { None } else { Some(entry.node) }
552+
})
546553
}
547554

548555
/// Similar to `get_parent`; returns the parent HIR Id, or just `hir_id` if there

src/librustc/hir/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ pub fn provide(providers: &mut Providers<'_>) {
7878
let module = hir.as_local_hir_id(id).unwrap();
7979
&tcx.untracked_crate.modules[&module]
8080
};
81-
providers.hir_owner = |tcx, id| tcx.index_hir(id.krate).map[id.index].signature.unwrap();
82-
providers.hir_owner_items = |tcx, id| {
83-
tcx.index_hir(id.krate).map[id.index].with_bodies.as_ref().map(|items| &**items).unwrap()
84-
};
81+
providers.hir_owner = |tcx, id| tcx.index_hir(id.krate).map[id.index].signature;
82+
providers.hir_owner_items =
83+
|tcx, id| tcx.index_hir(id.krate).map[id.index].with_bodies.as_ref().map(|items| &**items);
8584
map::provide(providers);
8685
}

0 commit comments

Comments
 (0)