Skip to content

Commit 901fdb3

Browse files
committed
Auto merge of #110896 - matthiaskrgr:rollup-h8fetzd, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #110426 (docs(style): add more let-else examples) - #110804 (Remove repeated definite articles) - #110814 (Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`) - #110816 (Migrate `rustc_passes` to translatable diagnostics) - #110864 (`IntoFuture::into_future` is no longer unstable) - #110866 (Make `method-not-found-generic-arg-elision.rs` error message not path dependent) - #110872 (Nicer ICE for #67981) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6ce2273 + 52d550b commit 901fdb3

File tree

23 files changed

+375
-209
lines changed

23 files changed

+375
-209
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
858858
let awaitee_arm = self.arm(awaitee_pat, loop_expr);
859859

860860
// `match ::std::future::IntoFuture::into_future(<expr>) { ... }`
861-
let into_future_span = self.mark_span_with_reason(
862-
DesugaringKind::Await,
863-
dot_await_span,
864-
self.allow_into_future.clone(),
865-
);
866861
let into_future_expr = self.expr_call_lang_item_fn(
867-
into_future_span,
862+
span,
868863
hir::LangItem::IntoFutureIntoFuture,
869864
arena_vec![self; expr],
870865
Some(expr_hir_id),

compiler/rustc_ast_lowering/src/item.rs

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
8383
impl_trait_bounds: Vec::new(),
8484
allow_try_trait: Some([sym::try_trait_v2, sym::yeet_desugar_details][..].into()),
8585
allow_gen_future: Some([sym::gen_future, sym::closure_track_caller][..].into()),
86-
allow_into_future: Some([sym::into_future][..].into()),
8786
generics_def_id_map: Default::default(),
8887
};
8988
lctx.with_hir_id_owner(owner, |lctx| f(lctx));

compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ struct LoweringContext<'a, 'hir> {
136136

137137
allow_try_trait: Option<Lrc<[Symbol]>>,
138138
allow_gen_future: Option<Lrc<[Symbol]>>,
139-
allow_into_future: Option<Lrc<[Symbol]>>,
140139

141140
/// Mapping from generics `def_id`s to TAIT generics `def_id`s.
142141
/// For each captured lifetime (e.g., 'a), we create a new lifetime parameter that is a generic

compiler/rustc_codegen_ssa/src/mir/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,17 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
304304
bug!("spread argument isn't a tuple?!");
305305
};
306306

307-
let place = PlaceRef::alloca(bx, bx.layout_of(arg_ty));
307+
let layout = bx.layout_of(arg_ty);
308+
309+
// FIXME: support unsized params in "rust-call" ABI
310+
if layout.is_unsized() {
311+
span_bug!(
312+
arg_decl.source_info.span,
313+
"\"rust-call\" ABI does not support unsized params",
314+
);
315+
}
316+
317+
let place = PlaceRef::alloca(bx, layout);
308318
for i in 0..tupled_arg_tys.len() {
309319
let arg = &fx.fn_abi.args[idx];
310320
idx += 1;

compiler/rustc_data_structures/src/tagged_ptr/copy.rs

+9
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ where
8282
/// drop, use [`TaggedPtr`] instead.
8383
///
8484
/// [`TaggedPtr`]: crate::tagged_ptr::TaggedPtr
85+
#[inline]
8586
pub fn new(pointer: P, tag: T) -> Self {
8687
Self { packed: Self::pack(P::into_ptr(pointer), tag), tag_ghost: PhantomData }
8788
}
8889

8990
/// Retrieves the pointer.
91+
#[inline]
9092
pub fn pointer(self) -> P
9193
where
9294
P: Copy,
@@ -123,6 +125,7 @@ where
123125
/// according to `self.packed` encoding scheme.
124126
///
125127
/// [`P::into_ptr`]: Pointer::into_ptr
128+
#[inline]
126129
fn pack(ptr: NonNull<P::Target>, tag: T) -> NonNull<P::Target> {
127130
// Trigger assert!
128131
let () = Self::ASSERTION;
@@ -145,6 +148,7 @@ where
145148
}
146149

147150
/// Retrieves the original raw pointer from `self.packed`.
151+
#[inline]
148152
pub(super) fn pointer_raw(&self) -> NonNull<P::Target> {
149153
self.packed.map_addr(|addr| unsafe { NonZeroUsize::new_unchecked(addr.get() << T::BITS) })
150154
}
@@ -184,6 +188,7 @@ where
184188
P: Pointer + Copy,
185189
T: Tag,
186190
{
191+
#[inline]
187192
fn clone(&self) -> Self {
188193
*self
189194
}
@@ -196,6 +201,7 @@ where
196201
{
197202
type Target = P::Target;
198203

204+
#[inline]
199205
fn deref(&self) -> &Self::Target {
200206
// Safety:
201207
// `pointer_raw` returns the original pointer from `P::into_ptr` which,
@@ -209,6 +215,7 @@ where
209215
P: Pointer + DerefMut,
210216
T: Tag,
211217
{
218+
#[inline]
212219
fn deref_mut(&mut self) -> &mut Self::Target {
213220
// Safety:
214221
// `pointer_raw` returns the original pointer from `P::into_ptr` which,
@@ -235,6 +242,7 @@ where
235242
P: Pointer,
236243
T: Tag,
237244
{
245+
#[inline]
238246
fn eq(&self, other: &Self) -> bool {
239247
self.packed == other.packed
240248
}
@@ -252,6 +260,7 @@ where
252260
P: Pointer,
253261
T: Tag,
254262
{
263+
#[inline]
255264
fn hash<H: Hasher>(&self, state: &mut H) {
256265
self.packed.hash(state);
257266
}

compiler/rustc_data_structures/src/tagged_ptr/drop.rs

+8
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,19 @@ where
3030
T: Tag,
3131
{
3232
/// Tags `pointer` with `tag`.
33+
#[inline]
3334
pub fn new(pointer: P, tag: T) -> Self {
3435
TaggedPtr { raw: CopyTaggedPtr::new(pointer, tag) }
3536
}
3637

3738
/// Retrieves the tag.
39+
#[inline]
3840
pub fn tag(&self) -> T {
3941
self.raw.tag()
4042
}
4143

4244
/// Sets the tag to a new value.
45+
#[inline]
4346
pub fn set_tag(&mut self, tag: T) {
4447
self.raw.set_tag(tag)
4548
}
@@ -63,6 +66,8 @@ where
6366
T: Tag,
6467
{
6568
type Target = P::Target;
69+
70+
#[inline]
6671
fn deref(&self) -> &Self::Target {
6772
self.raw.deref()
6873
}
@@ -73,6 +78,7 @@ where
7378
P: Pointer + DerefMut,
7479
T: Tag,
7580
{
81+
#[inline]
7682
fn deref_mut(&mut self) -> &mut Self::Target {
7783
self.raw.deref_mut()
7884
}
@@ -108,6 +114,7 @@ where
108114
P: Pointer,
109115
T: Tag,
110116
{
117+
#[inline]
111118
fn eq(&self, other: &Self) -> bool {
112119
self.raw.eq(&other.raw)
113120
}
@@ -125,6 +132,7 @@ where
125132
P: Pointer,
126133
T: Tag,
127134
{
135+
#[inline]
128136
fn hash<H: Hasher>(&self, state: &mut H) {
129137
self.raw.hash(state);
130138
}

compiler/rustc_passes/messages.ftl

+42-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ passes_doc_attr_not_crate_level =
139139
passes_attr_crate_level =
140140
this attribute can only be applied at the crate level
141141
.suggestion = to apply to the crate, use an inner attribute
142-
.help = to apply to the crate, use an inner attribute
143142
.note = read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
144143
145144
passes_doc_test_unknown =
@@ -724,3 +723,45 @@ passes_skipping_const_checks = skipping const checks
724723
passes_invalid_macro_export_arguments = `{$name}` isn't a valid `#[macro_export]` argument
725724
726725
passes_invalid_macro_export_arguments_too_many_items = `#[macro_export]` can only take 1 or 0 arguments
726+
727+
passes_unreachable_due_to_uninhabited = unreachable {$descr}
728+
.label = unreachable {$descr}
729+
.label_orig = any code following this expression is unreachable
730+
.note = this expression has type `{$ty}`, which is uninhabited
731+
732+
passes_unused_var_maybe_capture_ref = unused variable: `{$name}`
733+
.help = did you mean to capture by reference instead?
734+
735+
passes_unused_capture_maybe_capture_ref = value captured by `{$name}` is never read
736+
.help = did you mean to capture by reference instead?
737+
738+
passes_unused_var_remove_field = unused variable: `{$name}`
739+
passes_unused_var_remove_field_suggestion = try removing the field
740+
741+
passes_unused_var_assigned_only = variable `{$name}` is assigned to, but never used
742+
.note = consider using `_{$name}` instead
743+
744+
passes_unnecessary_stable_feature = the feature `{$feature}` has been stable since {$since} and no longer requires an attribute to enable
745+
746+
passes_unnecessary_partial_stable_feature = the feature `{$feature}` has been partially stabilized since {$since} and is succeeded by the feature `{$implies}`
747+
.suggestion = if you are using features which are still unstable, change to using `{$implies}`
748+
.suggestion_remove = if you are using features which are now stable, remove this line
749+
750+
passes_ineffective_unstable_impl = an `#[unstable]` annotation here has no effect
751+
.note = see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information
752+
753+
passes_unused_assign = value assigned to `{$name}` is never read
754+
.help = maybe it is overwritten before being read?
755+
756+
passes_unused_assign_passed = value passed to `{$name}` is never read
757+
.help = maybe it is overwritten before being read?
758+
759+
passes_maybe_string_interpolation = you might have meant to use string interpolation in this string literal
760+
passes_string_interpolation_only_works = string interpolation only works in `format!` invocations
761+
762+
passes_unused_variable_try_prefix = unused variable: `{$name}`
763+
.label = unused variable
764+
.suggestion = if this is intentional, prefix it with an underscore
765+
766+
passes_unused_variable_try_ignore = unused variable: `{$name}`
767+
.suggestion = try ignoring the field

compiler/rustc_passes/src/check_attr.rs

+10-22
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_session::lint::builtin::{
2929
};
3030
use rustc_session::parse::feature_err;
3131
use rustc_span::symbol::{kw, sym, Symbol};
32-
use rustc_span::{Span, DUMMY_SP};
32+
use rustc_span::{BytePos, Span, DUMMY_SP};
3333
use rustc_target::spec::abi::Abi;
3434
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
3535
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt;
@@ -927,30 +927,18 @@ impl CheckAttrVisitor<'_> {
927927
hir_id: HirId,
928928
) -> bool {
929929
if hir_id != CRATE_HIR_ID {
930-
self.tcx.struct_span_lint_hir(
930+
// insert a bang between `#` and `[...`
931+
let bang_span = attr.span.lo() + BytePos(1);
932+
let sugg = (attr.style == AttrStyle::Outer
933+
&& self.tcx.hir().get_parent_item(hir_id) == CRATE_OWNER_ID)
934+
.then_some(errors::AttrCrateLevelOnlySugg {
935+
attr: attr.span.with_lo(bang_span).with_hi(bang_span),
936+
});
937+
self.tcx.emit_spanned_lint(
931938
INVALID_DOC_ATTRIBUTES,
932939
hir_id,
933940
meta.span(),
934-
fluent::passes_attr_crate_level,
935-
|err| {
936-
if attr.style == AttrStyle::Outer
937-
&& self.tcx.hir().get_parent_item(hir_id) == CRATE_OWNER_ID
938-
{
939-
if let Ok(mut src) = self.tcx.sess.source_map().span_to_snippet(attr.span) {
940-
src.insert(1, '!');
941-
err.span_suggestion_verbose(
942-
attr.span,
943-
fluent::passes_suggestion,
944-
src,
945-
Applicability::MaybeIncorrect,
946-
);
947-
} else {
948-
err.span_help(attr.span, fluent::passes_help);
949-
}
950-
}
951-
err.note(fluent::passes_note);
952-
err
953-
},
941+
errors::AttrCrateLevelOnly { sugg },
954942
);
955943
return false;
956944
}

0 commit comments

Comments
 (0)