Skip to content

Commit cbb48a5

Browse files
committed
Auto merge of #114756 - matthiaskrgr:rollup-4m7l4p6, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #94455 (Partially stabilize `int_roundings`) - #114132 (Better Debug for Vars and VarsOs) - #114584 (E0277 nolonger points at phantom `.await`) - #114667 (Record binder for bare trait object in LifetimeCollectVisitor) - #114692 (downgrade `internal_features` to warn) - #114703 (Cover ParamConst in smir) - #114734 (Mark oli as "on vacation") r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1e836d1 + cf9081c commit cbb48a5

File tree

24 files changed

+386
-100
lines changed

24 files changed

+386
-100
lines changed

compiler/rustc_ast_lowering/src/lifetime_collector.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::ResolverAstLoweringExt;
22
use rustc_ast::visit::{self, BoundKind, LifetimeCtxt, Visitor};
33
use rustc_ast::{GenericBounds, Lifetime, NodeId, PathSegment, PolyTraitRef, Ty, TyKind};
4-
use rustc_hir::def::LifetimeRes;
4+
use rustc_hir::def::{DefKind, LifetimeRes, Res};
55
use rustc_middle::span_bug;
66
use rustc_middle::ty::ResolverAstLowering;
77
use rustc_span::symbol::{kw, Ident};
@@ -77,7 +77,20 @@ impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast> {
7777
}
7878

7979
fn visit_ty(&mut self, t: &'ast Ty) {
80-
match t.kind {
80+
match &t.kind {
81+
TyKind::Path(None, _) => {
82+
// We can sometimes encounter bare trait objects
83+
// which are represented in AST as paths.
84+
if let Some(partial_res) = self.resolver.get_partial_res(t.id)
85+
&& let Some(Res::Def(DefKind::Trait | DefKind::TraitAlias, _)) = partial_res.full_res()
86+
{
87+
self.current_binders.push(t.id);
88+
visit::walk_ty(self, t);
89+
self.current_binders.pop();
90+
} else {
91+
visit::walk_ty(self, t);
92+
}
93+
}
8194
TyKind::BareFn(_) => {
8295
self.current_binders.push(t.id);
8396
visit::walk_ty(self, t);

compiler/rustc_codegen_ssa/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![feature(associated_type_bounds)]
33
#![feature(box_patterns)]
44
#![feature(if_let_guard)]
5-
#![feature(int_roundings)]
65
#![feature(let_chains)]
76
#![feature(negative_impls)]
87
#![feature(never_type)]

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ declare_lint! {
22152215
///
22162216
/// ### Example
22172217
///
2218-
/// ```rust,compile_fail
2218+
/// ```rust
22192219
/// #![feature(rustc_attrs)]
22202220
/// ```
22212221
///
@@ -2226,7 +2226,7 @@ declare_lint! {
22262226
/// These features are an implementation detail of the compiler and standard
22272227
/// library and are not supposed to be used in user code.
22282228
pub INTERNAL_FEATURES,
2229-
Deny,
2229+
Warn,
22302230
"internal features are not supposed to be used"
22312231
}
22322232

compiler/rustc_parse/src/parser/diagnostics.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,13 +1717,7 @@ impl<'a> Parser<'a> {
17171717
self.recover_await_prefix(await_sp)?
17181718
};
17191719
let sp = self.error_on_incorrect_await(lo, hi, &expr, is_question);
1720-
let kind = match expr.kind {
1721-
// Avoid knock-down errors as we don't know whether to interpret this as `foo().await?`
1722-
// or `foo()?.await` (the very reason we went with postfix syntax 😅).
1723-
ExprKind::Try(_) => ExprKind::Err,
1724-
_ => ExprKind::Await(expr, await_sp),
1725-
};
1726-
let expr = self.mk_expr(lo.to(sp), kind);
1720+
let expr = self.mk_expr(lo.to(sp), ExprKind::Err);
17271721
self.maybe_recover_from_bad_qpath(expr)
17281722
}
17291723

compiler/rustc_smir/src/rustc_smir/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,9 @@ impl<'tcx> Stable<'tcx> for rustc_middle::mir::ConstantKind<'tcx> {
11651165
let const_val = tables.tcx.valtree_to_const_val((c.ty(), val));
11661166
stable_mir::ty::ConstantKind::Allocated(new_allocation(self, const_val, tables))
11671167
}
1168-
_ => todo!(),
1168+
ty::ParamCt(param) => stable_mir::ty::ConstantKind::ParamCt(opaque(&param)),
1169+
ty::ErrorCt(_) => unreachable!(),
1170+
_ => unimplemented!(),
11691171
},
11701172
ConstantKind::Unevaluated(unev_const, ty) => {
11711173
stable_mir::ty::ConstantKind::Unevaluated(stable_mir::ty::UnevaluatedConst {

compiler/rustc_smir/src/stable_mir/ty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ pub fn allocation_filter<'tcx>(
417417
pub enum ConstantKind {
418418
Allocated(Allocation),
419419
Unevaluated(UnevaluatedConst),
420+
ParamCt(Opaque),
420421
}
421422

422423
#[derive(Clone, Debug)]

library/core/src/num/uint_macros.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,10 +2074,10 @@ macro_rules! uint_impl {
20742074
/// Basic usage:
20752075
///
20762076
/// ```
2077-
/// #![feature(int_roundings)]
20782077
#[doc = concat!("assert_eq!(7_", stringify!($SelfT), ".div_ceil(4), 2);")]
20792078
/// ```
2080-
#[unstable(feature = "int_roundings", issue = "88581")]
2079+
#[stable(feature = "int_roundings1", since = "CURRENT_RUSTC_VERSION")]
2080+
#[rustc_const_stable(feature = "int_roundings1", since = "CURRENT_RUSTC_VERSION")]
20812081
#[must_use = "this returns the result of the operation, \
20822082
without modifying the original"]
20832083
#[inline]
@@ -2109,11 +2109,11 @@ macro_rules! uint_impl {
21092109
/// Basic usage:
21102110
///
21112111
/// ```
2112-
/// #![feature(int_roundings)]
21132112
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".next_multiple_of(8), 16);")]
21142113
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".next_multiple_of(8), 24);")]
21152114
/// ```
2116-
#[unstable(feature = "int_roundings", issue = "88581")]
2115+
#[stable(feature = "int_roundings1", since = "CURRENT_RUSTC_VERSION")]
2116+
#[rustc_const_stable(feature = "int_roundings1", since = "CURRENT_RUSTC_VERSION")]
21172117
#[must_use = "this returns the result of the operation, \
21182118
without modifying the original"]
21192119
#[inline]
@@ -2134,13 +2134,13 @@ macro_rules! uint_impl {
21342134
/// Basic usage:
21352135
///
21362136
/// ```
2137-
/// #![feature(int_roundings)]
21382137
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".checked_next_multiple_of(8), Some(16));")]
21392138
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".checked_next_multiple_of(8), Some(24));")]
21402139
#[doc = concat!("assert_eq!(1_", stringify!($SelfT), ".checked_next_multiple_of(0), None);")]
21412140
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.checked_next_multiple_of(2), None);")]
21422141
/// ```
2143-
#[unstable(feature = "int_roundings", issue = "88581")]
2142+
#[stable(feature = "int_roundings1", since = "CURRENT_RUSTC_VERSION")]
2143+
#[rustc_const_stable(feature = "int_roundings1", since = "CURRENT_RUSTC_VERSION")]
21442144
#[must_use = "this returns the result of the operation, \
21452145
without modifying the original"]
21462146
#[inline]

library/std/src/env.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ impl Iterator for Vars {
178178
#[stable(feature = "std_debug", since = "1.16.0")]
179179
impl fmt::Debug for Vars {
180180
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
181-
f.debug_struct("Vars").finish_non_exhaustive()
181+
let Self { inner: VarsOs { inner } } = self;
182+
f.debug_struct("Vars").field("inner", &inner.str_debug()).finish()
182183
}
183184
}
184185

@@ -196,7 +197,8 @@ impl Iterator for VarsOs {
196197
#[stable(feature = "std_debug", since = "1.16.0")]
197198
impl fmt::Debug for VarsOs {
198199
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
199-
f.debug_struct("VarOs").finish_non_exhaustive()
200+
let Self { inner } = self;
201+
f.debug_struct("VarsOs").field("inner", inner).finish()
200202
}
201203
}
202204

@@ -829,7 +831,8 @@ impl DoubleEndedIterator for Args {
829831
#[stable(feature = "std_debug", since = "1.16.0")]
830832
impl fmt::Debug for Args {
831833
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
832-
f.debug_struct("Args").field("inner", &self.inner.inner).finish()
834+
let Self { inner: ArgsOs { inner } } = self;
835+
f.debug_struct("Args").field("inner", inner).finish()
833836
}
834837
}
835838

@@ -870,7 +873,8 @@ impl DoubleEndedIterator for ArgsOs {
870873
#[stable(feature = "std_debug", since = "1.16.0")]
871874
impl fmt::Debug for ArgsOs {
872875
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
873-
f.debug_struct("ArgsOs").field("inner", &self.inner).finish()
876+
let Self { inner } = self;
877+
f.debug_struct("ArgsOs").field("inner", inner).finish()
874878
}
875879
}
876880

library/std/src/env/tests.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,28 @@ fn args_debug() {
9595
format!("Args {{ inner: {:?} }}", args().collect::<Vec<_>>()),
9696
format!("{:?}", args())
9797
);
98+
}
99+
100+
#[test]
101+
fn args_os_debug() {
98102
assert_eq!(
99103
format!("ArgsOs {{ inner: {:?} }}", args_os().collect::<Vec<_>>()),
100104
format!("{:?}", args_os())
101105
);
102106
}
107+
108+
#[test]
109+
fn vars_debug() {
110+
assert_eq!(
111+
format!("Vars {{ inner: {:?} }}", vars().collect::<Vec<_>>()),
112+
format!("{:?}", vars())
113+
);
114+
}
115+
116+
#[test]
117+
fn vars_os_debug() {
118+
assert_eq!(
119+
format!("VarsOs {{ inner: {:?} }}", vars_os().collect::<Vec<_>>()),
120+
format!("{:?}", vars_os())
121+
);
122+
}

library/std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@
293293
#![feature(float_next_up_down)]
294294
#![feature(hasher_prefixfree_extras)]
295295
#![feature(hashmap_internals)]
296-
#![feature(int_roundings)]
297296
#![feature(ip)]
298297
#![feature(ip_in_core)]
299298
#![feature(maybe_uninit_slice)]

0 commit comments

Comments
 (0)