Skip to content

Commit

Permalink
Auto merge of #101508 - JohnTitor:rollup-i5i2vqc, r=JohnTitor
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - #101451 (Add incremental test for changing struct name in assoc type.)
 - #101468 (fix RPIT ICE for implicit HRTB when missing dyn)
 - #101481 (Fix compile errors for uwp-windows-msvc targets)
 - #101484 (Remove dead broken code from const zst handling in backends)
 - #101486 (Add list of recognized repr attributes to the unrecognized repr error)
 - #101488 (rustdoc: remove unused CSS `#results > table`)
 - #101491 (rustdoc: remove outdated CSS `.sub-variant > div > .item-info`)
 - #101497 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Sep 7, 2022
2 parents 699bfa8 + 6903a84 commit 8c41305
Show file tree
Hide file tree
Showing 72 changed files with 3,112 additions and 949 deletions.
3 changes: 1 addition & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,8 +1561,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

LifetimeRes::Fresh { param, binder: _ } => {
debug_assert_eq!(lifetime.ident.name, kw::UnderscoreLifetime);
let old_def_id = self.local_def_id(param);
if remapping.get(&old_def_id).is_none() {
if let Some(old_def_id) = self.opt_local_def_id(param) && remapping.get(&old_def_id).is_none() {
let node_id = self.next_node_id();

let new_def_id = self.create_def(
Expand Down
22 changes: 10 additions & 12 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,18 +1045,16 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
&name,
),
});
} else {
if matches!(
meta_item.name_or_empty(),
sym::C | sym::simd | sym::transparent
) || int_type_of_word(meta_item.name_or_empty()).is_some()
{
recognised = true;
sess.emit_err(session_diagnostics::InvalidReprHintNoValue {
span: meta_item.span,
name: meta_item.name_or_empty().to_ident_string(),
});
}
} else if matches!(
meta_item.name_or_empty(),
sym::C | sym::simd | sym::transparent
) || int_type_of_word(meta_item.name_or_empty()).is_some()
{
recognised = true;
sess.emit_err(session_diagnostics::InvalidReprHintNoValue {
span: meta_item.span,
name: meta_item.name_or_empty().to_ident_string(),
});
}
} else if let MetaItemKind::List(_) = meta_item.kind {
if meta_item.has_name(sym::align) {
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_codegen_gcc/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
None
}

fn zst_to_backend(&self, _ty: Type<'gcc>) -> RValue<'gcc> {
self.const_undef(self.type_ix(0))
}

fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, ty: Type<'gcc>) -> RValue<'gcc> {
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
match cv {
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
})
}

fn zst_to_backend(&self, _llty: &'ll Type) -> &'ll Value {
self.const_undef(self.type_ix(0))
}

fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: &'ll Type) -> &'ll Value {
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
match cv {
Expand Down
9 changes: 1 addition & 8 deletions compiler/rustc_codegen_ssa/src/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
) -> Self {
let layout = bx.layout_of(ty);

if layout.is_zst() {
return OperandRef::new_zst(bx, layout);
}

let val = match val {
ConstValue::Scalar(x) => {
let Abi::Scalar(scalar) = layout.abi else {
Expand All @@ -84,10 +80,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
let llval = bx.scalar_to_backend(x, scalar, bx.immediate_backend_type(layout));
OperandValue::Immediate(llval)
}
ConstValue::ZeroSized => {
let llval = bx.zst_to_backend(bx.immediate_backend_type(layout));
OperandValue::Immediate(llval)
}
ConstValue::ZeroSized => return OperandRef::new_zst(bx, layout),
ConstValue::Slice { data, start, end } => {
let Abi::ScalarPair(a_scalar, _) = layout.abi else {
bug!("from_const: invalid ScalarPair layout: {:#?}", layout);
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_ssa/src/traits/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub trait ConstMethods<'tcx>: BackendTypes {
fn const_data_from_alloc(&self, alloc: ConstAllocation<'tcx>) -> Self::Value;

fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: Self::Type) -> Self::Value;
fn zst_to_backend(&self, llty: Self::Type) -> Self::Value;
fn from_const_alloc(
&self,
layout: TyAndLayout<'tcx>,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,7 @@ impl CheckAttrVisitor<'_> {
E0552,
"unrecognized representation hint"
)
.help("valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`")
.emit();

continue;
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl File {
mem::size_of::<c::FILE_ATTRIBUTE_TAG_INFO>().try_into().unwrap(),
))?;
if attr_tag.FileAttributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0 {
reparse_tag = attr_tag.ReparseTag;
attr.reparse_tag = attr_tag.ReparseTag;
}
}
Ok(attr)
Expand Down
9 changes: 0 additions & 9 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,6 @@ h2.location a {
text-align: center;
}

#results > table {
width: 100%;
table-layout: fixed;
}

.content > .example-wrap pre.line-numbers {
position: relative;
-webkit-user-select: none;
Expand Down Expand Up @@ -770,10 +765,6 @@ pre, .rustdoc.source .example-wrap {
margin-left: 24px;
}

.sub-variant > div > .item-info {
margin-top: initial;
}

.content .impl-items .docblock, .content .impl-items .item-info {
margin-bottom: .6em;
}
Expand Down
65 changes: 65 additions & 0 deletions src/test/incremental/issue-100521-change-struct-name-assocty.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// revisions: rpass1 rpass2

pub fn foo() {
bar();
baz::<()>();
}

fn bar()
where
<() as Table>::AllColumns:,
{
}

fn baz<W>()
where
W: AsQuery,
<W as AsQuery>::Query:,
{
}

trait AsQuery {
type Query;
}

trait UnimplementedTrait {}

impl<T> AsQuery for T
where
T: UnimplementedTrait,
{
type Query = ();
}

struct Wrapper<Expr>(Expr);

impl<Ret> AsQuery for Wrapper<Ret> {
type Query = ();
}

impl AsQuery for ()
where
Wrapper<<() as Table>::AllColumns>: AsQuery,
{
type Query = ();
}

trait Table {
type AllColumns;
}

#[cfg(rpass1)]
impl Table for () {
type AllColumns = Checksum1;
}
#[cfg(rpass1)]
struct Checksum1;

#[cfg(rpass2)]
impl Table for () {
type AllColumns = Checksum2;
}
#[cfg(rpass2)]
struct Checksum2;

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0277]: the trait bound `(): AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not satisfied
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:13
|
LL | fn ice() -> impl AsRef<Fn(&())> {
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not implemented for `()`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
error[E0782]: trait objects must include the `dyn` keyword
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:24
|
LL | fn ice() -> impl AsRef<Fn(&())> {
| ^^^^^^^
|
help: add `dyn` keyword before this trait
|
LL - fn ice() -> impl AsRef<Fn(&())> {
LL + fn ice() -> impl AsRef<dyn Fn(&())> {
|

error[E0277]: the trait bound `(): AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not satisfied
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:13
|
LL | fn ice() -> impl AsRef<Fn(&())> {
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not implemented for `()`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0782.
For more information about an error, try `rustc --explain E0277`.
12 changes: 12 additions & 0 deletions src/test/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// revisions: edition2015 edition2021
//[edition2021]edition:2021

#![allow(warnings)]

fn ice() -> impl AsRef<Fn(&())> {
//~^ ERROR: the trait bound `(): AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not satisfied [E0277]
//[edition2021]~| ERROR: trait objects must include the `dyn` keyword [E0782]
todo!()
}

fn main() {}
4 changes: 4 additions & 0 deletions src/test/ui/issues/issue-43988.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ error[E0552]: unrecognized representation hint
|
LL | #[repr(nothing)]
| ^^^^^^^
|
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

error[E0552]: unrecognized representation hint
--> $DIR/issue-43988.rs:18:12
|
LL | #[repr(something_not_real)]
| ^^^^^^^^^^^^^^^^^^
|
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43988.rs:30:5
Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/repr/invalid_repr_list_help.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![crate_type = "lib"]

#[repr(uwu)] //~ERROR: unrecognized representation hint
pub struct OwO;

#[repr(uwu = "a")] //~ERROR: unrecognized representation hint
pub struct OwO2(i32);

#[repr(uwu(4))] //~ERROR: unrecognized representation hint
pub struct OwO3 {
x: i32,
}

#[repr(uwu, u8)] //~ERROR: unrecognized representation hint
pub enum OwO4 {
UwU = 1,
}
35 changes: 35 additions & 0 deletions src/test/ui/repr/invalid_repr_list_help.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:3:8
|
LL | #[repr(uwu)]
| ^^^
|
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:6:8
|
LL | #[repr(uwu = "a")]
| ^^^^^^^^^
|
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:9:8
|
LL | #[repr(uwu(4))]
| ^^^^^^
|
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:14:8
|
LL | #[repr(uwu, u8)]
| ^^^
|
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0552`.
Loading

0 comments on commit 8c41305

Please sign in to comment.