Skip to content

Rollup of 6 pull requests #110868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ jobs:
os: ubuntu-20.04-8core-32gb
env: {}
- name: i686-gnu
os: ubuntu-20.04-16core-64gb
os: ubuntu-20.04-8core-32gb
env: {}
- name: i686-gnu-nopt
os: ubuntu-20.04-16core-64gb
os: ubuntu-20.04-8core-32gb
env: {}
- name: mingw-check
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: test-various
os: ubuntu-20.04-8core-32gb
Expand All @@ -275,16 +275,16 @@ jobs:
os: ubuntu-20.04-8core-32gb
env: {}
- name: x86_64-gnu
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: x86_64-gnu-stable
env:
IMAGE: x86_64-gnu
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
CI_ONLY_WHEN_CHANNEL: nightly
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
- name: x86_64-gnu-aux
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: x86_64-gnu-debug
os: ubuntu-20.04-8core-32gb
Expand All @@ -309,7 +309,7 @@ jobs:
RUST_BACKTRACE: 1
os: ubuntu-20.04-8core-32gb
- name: x86_64-gnu-nopt
os: ubuntu-20.04-8core-32gb
os: ubuntu-20.04-4core-16gb
env: {}
- name: x86_64-gnu-tools
env:
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_data_structures/src/tagged_ptr/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ where
/// drop, use [`TaggedPtr`] instead.
///
/// [`TaggedPtr`]: crate::tagged_ptr::TaggedPtr
#[inline]
pub fn new(pointer: P, tag: T) -> Self {
Self { packed: Self::pack(P::into_ptr(pointer), tag), tag_ghost: PhantomData }
}

/// Retrieves the pointer.
#[inline]
pub fn pointer(self) -> P
where
P: Copy,
Expand Down Expand Up @@ -123,6 +125,7 @@ where
/// according to `self.packed` encoding scheme.
///
/// [`P::into_ptr`]: Pointer::into_ptr
#[inline]
fn pack(ptr: NonNull<P::Target>, tag: T) -> NonNull<P::Target> {
// Trigger assert!
let () = Self::ASSERTION;
Expand All @@ -145,6 +148,7 @@ where
}

/// Retrieves the original raw pointer from `self.packed`.
#[inline]
pub(super) fn pointer_raw(&self) -> NonNull<P::Target> {
self.packed.map_addr(|addr| unsafe { NonZeroUsize::new_unchecked(addr.get() << T::BITS) })
}
Expand Down Expand Up @@ -184,6 +188,7 @@ where
P: Pointer + Copy,
T: Tag,
{
#[inline]
fn clone(&self) -> Self {
*self
}
Expand All @@ -196,6 +201,7 @@ where
{
type Target = P::Target;

#[inline]
fn deref(&self) -> &Self::Target {
// Safety:
// `pointer_raw` returns the original pointer from `P::into_ptr` which,
Expand All @@ -209,6 +215,7 @@ where
P: Pointer + DerefMut,
T: Tag,
{
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
// Safety:
// `pointer_raw` returns the original pointer from `P::into_ptr` which,
Expand All @@ -235,6 +242,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
self.packed == other.packed
}
Expand All @@ -252,6 +260,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
self.packed.hash(state);
}
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_data_structures/src/tagged_ptr/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ where
T: Tag,
{
/// Tags `pointer` with `tag`.
#[inline]
pub fn new(pointer: P, tag: T) -> Self {
TaggedPtr { raw: CopyTaggedPtr::new(pointer, tag) }
}

/// Retrieves the tag.
#[inline]
pub fn tag(&self) -> T {
self.raw.tag()
}

/// Sets the tag to a new value.
#[inline]
pub fn set_tag(&mut self, tag: T) {
self.raw.set_tag(tag)
}
Expand All @@ -63,6 +66,8 @@ where
T: Tag,
{
type Target = P::Target;

#[inline]
fn deref(&self) -> &Self::Target {
self.raw.deref()
}
Expand All @@ -73,6 +78,7 @@ where
P: Pointer + DerefMut,
T: Tag,
{
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.raw.deref_mut()
}
Expand Down Expand Up @@ -108,6 +114,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
self.raw.eq(&other.raw)
}
Expand All @@ -125,6 +132,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
self.raw.hash(state);
}
Expand Down
43 changes: 42 additions & 1 deletion compiler/rustc_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ passes_doc_attr_not_crate_level =
passes_attr_crate_level =
this attribute can only be applied at the crate level
.suggestion = to apply to the crate, use an inner attribute
.help = to apply to the crate, use an inner attribute
.note = read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information

passes_doc_test_unknown =
Expand Down Expand Up @@ -724,3 +723,45 @@ passes_skipping_const_checks = skipping const checks
passes_invalid_macro_export_arguments = `{$name}` isn't a valid `#[macro_export]` argument

passes_invalid_macro_export_arguments_too_many_items = `#[macro_export]` can only take 1 or 0 arguments

passes_unreachable_due_to_uninhabited = unreachable {$descr}
.label = unreachable {$descr}
.label_orig = any code following this expression is unreachable
.note = this expression has type `{$ty}`, which is uninhabited

passes_unused_var_maybe_capture_ref = unused variable: `{$name}`
.help = did you mean to capture by reference instead?

passes_unused_capture_maybe_capture_ref = value captured by `{$name}` is never read
.help = did you mean to capture by reference instead?

passes_unused_var_remove_field = unused variable: `{$name}`
passes_unused_var_remove_field_suggestion = try removing the field

passes_unused_var_assigned_only = variable `{$name}` is assigned to, but never used
.note = consider using `_{$name}` instead

passes_unnecessary_stable_feature = the feature `{$feature}` has been stable since {$since} and no longer requires an attribute to enable

passes_unnecessary_partial_stable_feature = the feature `{$feature}` has been partially stabilized since {$since} and is succeeded by the feature `{$implies}`
.suggestion = if you are using features which are still unstable, change to using `{$implies}`
.suggestion_remove = if you are using features which are now stable, remove this line

passes_ineffective_unstable_impl = an `#[unstable]` annotation here has no effect
.note = see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information

passes_unused_assign = value assigned to `{$name}` is never read
.help = maybe it is overwritten before being read?

passes_unused_assign_passed = value passed to `{$name}` is never read
.help = maybe it is overwritten before being read?

passes_maybe_string_interpolation = you might have meant to use string interpolation in this string literal
passes_string_interpolation_only_works = string interpolation only works in `format!` invocations

passes_unused_variable_try_prefix = unused variable: `{$name}`
.label = unused variable
.suggestion = if this is intentional, prefix it with an underscore

passes_unused_variable_try_ignore = unused variable: `{$name}`
.suggestion = try ignoring the field
32 changes: 10 additions & 22 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use rustc_session::lint::builtin::{
};
use rustc_session::parse::feature_err;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::{Span, DUMMY_SP};
use rustc_span::{BytePos, Span, DUMMY_SP};
use rustc_target::spec::abi::Abi;
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt;
Expand Down Expand Up @@ -927,30 +927,18 @@ impl CheckAttrVisitor<'_> {
hir_id: HirId,
) -> bool {
if hir_id != CRATE_HIR_ID {
self.tcx.struct_span_lint_hir(
// insert a bang between `#` and `[...`
let bang_span = attr.span.lo() + BytePos(1);
let sugg = (attr.style == AttrStyle::Outer
&& self.tcx.hir().get_parent_item(hir_id) == CRATE_OWNER_ID)
.then_some(errors::AttrCrateLevelOnlySugg {
attr: attr.span.with_lo(bang_span).with_hi(bang_span),
});
self.tcx.emit_spanned_lint(
INVALID_DOC_ATTRIBUTES,
hir_id,
meta.span(),
fluent::passes_attr_crate_level,
|err| {
if attr.style == AttrStyle::Outer
&& self.tcx.hir().get_parent_item(hir_id) == CRATE_OWNER_ID
{
if let Ok(mut src) = self.tcx.sess.source_map().span_to_snippet(attr.span) {
src.insert(1, '!');
err.span_suggestion_verbose(
attr.span,
fluent::passes_suggestion,
src,
Applicability::MaybeIncorrect,
);
} else {
err.span_help(attr.span, fluent::passes_help);
}
}
err.note(fluent::passes_note);
err
},
errors::AttrCrateLevelOnly { sugg },
);
return false;
}
Expand Down
Loading