Skip to content

Commit 8c41305

Browse files
committed
Auto merge of rust-lang#101508 - JohnTitor:rollup-i5i2vqc, r=JohnTitor
Rollup of 8 pull requests Successful merges: - rust-lang#101451 (Add incremental test for changing struct name in assoc type.) - rust-lang#101468 (fix RPIT ICE for implicit HRTB when missing dyn) - rust-lang#101481 (Fix compile errors for uwp-windows-msvc targets) - rust-lang#101484 (Remove dead broken code from const zst handling in backends) - rust-lang#101486 (Add list of recognized repr attributes to the unrecognized repr error) - rust-lang#101488 (rustdoc: remove unused CSS `#results > table`) - rust-lang#101491 (rustdoc: remove outdated CSS `.sub-variant > div > .item-info`) - rust-lang#101497 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 699bfa8 + 6903a84 commit 8c41305

File tree

72 files changed

+3112
-949
lines changed

Some content is hidden

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

72 files changed

+3112
-949
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1561,8 +1561,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15611561

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

15681567
let new_def_id = self.create_def(

compiler/rustc_attr/src/builtin.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -1045,18 +1045,16 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
10451045
&name,
10461046
),
10471047
});
1048-
} else {
1049-
if matches!(
1050-
meta_item.name_or_empty(),
1051-
sym::C | sym::simd | sym::transparent
1052-
) || int_type_of_word(meta_item.name_or_empty()).is_some()
1053-
{
1054-
recognised = true;
1055-
sess.emit_err(session_diagnostics::InvalidReprHintNoValue {
1056-
span: meta_item.span,
1057-
name: meta_item.name_or_empty().to_ident_string(),
1058-
});
1059-
}
1048+
} else if matches!(
1049+
meta_item.name_or_empty(),
1050+
sym::C | sym::simd | sym::transparent
1051+
) || int_type_of_word(meta_item.name_or_empty()).is_some()
1052+
{
1053+
recognised = true;
1054+
sess.emit_err(session_diagnostics::InvalidReprHintNoValue {
1055+
span: meta_item.span,
1056+
name: meta_item.name_or_empty().to_ident_string(),
1057+
});
10601058
}
10611059
} else if let MetaItemKind::List(_) = meta_item.kind {
10621060
if meta_item.has_name(sym::align) {

compiler/rustc_codegen_gcc/src/common.rs

-4
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
158158
None
159159
}
160160

161-
fn zst_to_backend(&self, _ty: Type<'gcc>) -> RValue<'gcc> {
162-
self.const_undef(self.type_ix(0))
163-
}
164-
165161
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, ty: Type<'gcc>) -> RValue<'gcc> {
166162
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
167163
match cv {

compiler/rustc_codegen_llvm/src/common.rs

-4
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,6 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
226226
})
227227
}
228228

229-
fn zst_to_backend(&self, _llty: &'ll Type) -> &'ll Value {
230-
self.const_undef(self.type_ix(0))
231-
}
232-
233229
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: &'ll Type) -> &'ll Value {
234230
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
235231
match cv {

compiler/rustc_codegen_ssa/src/mir/operand.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
7272
) -> Self {
7373
let layout = bx.layout_of(ty);
7474

75-
if layout.is_zst() {
76-
return OperandRef::new_zst(bx, layout);
77-
}
78-
7975
let val = match val {
8076
ConstValue::Scalar(x) => {
8177
let Abi::Scalar(scalar) = layout.abi else {
@@ -84,10 +80,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
8480
let llval = bx.scalar_to_backend(x, scalar, bx.immediate_backend_type(layout));
8581
OperandValue::Immediate(llval)
8682
}
87-
ConstValue::ZeroSized => {
88-
let llval = bx.zst_to_backend(bx.immediate_backend_type(layout));
89-
OperandValue::Immediate(llval)
90-
}
83+
ConstValue::ZeroSized => return OperandRef::new_zst(bx, layout),
9184
ConstValue::Slice { data, start, end } => {
9285
let Abi::ScalarPair(a_scalar, _) = layout.abi else {
9386
bug!("from_const: invalid ScalarPair layout: {:#?}", layout);

compiler/rustc_codegen_ssa/src/traits/consts.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub trait ConstMethods<'tcx>: BackendTypes {
2929
fn const_data_from_alloc(&self, alloc: ConstAllocation<'tcx>) -> Self::Value;
3030

3131
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: Self::Type) -> Self::Value;
32-
fn zst_to_backend(&self, llty: Self::Type) -> Self::Value;
3332
fn from_const_alloc(
3433
&self,
3534
layout: TyAndLayout<'tcx>,

compiler/rustc_passes/src/check_attr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,7 @@ impl CheckAttrVisitor<'_> {
16511651
E0552,
16521652
"unrecognized representation hint"
16531653
)
1654+
.help("valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`")
16541655
.emit();
16551656

16561657
continue;

library/std/src/sys/windows/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ impl File {
403403
mem::size_of::<c::FILE_ATTRIBUTE_TAG_INFO>().try_into().unwrap(),
404404
))?;
405405
if attr_tag.FileAttributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0 {
406-
reparse_tag = attr_tag.ReparseTag;
406+
attr.reparse_tag = attr_tag.ReparseTag;
407407
}
408408
}
409409
Ok(attr)

src/librustdoc/html/static/css/rustdoc.css

-9
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,6 @@ h2.location a {
609609
text-align: center;
610610
}
611611

612-
#results > table {
613-
width: 100%;
614-
table-layout: fixed;
615-
}
616-
617612
.content > .example-wrap pre.line-numbers {
618613
position: relative;
619614
-webkit-user-select: none;
@@ -770,10 +765,6 @@ pre, .rustdoc.source .example-wrap {
770765
margin-left: 24px;
771766
}
772767

773-
.sub-variant > div > .item-info {
774-
margin-top: initial;
775-
}
776-
777768
.content .impl-items .docblock, .content .impl-items .item-info {
778769
margin-bottom: .6em;
779770
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// revisions: rpass1 rpass2
2+
3+
pub fn foo() {
4+
bar();
5+
baz::<()>();
6+
}
7+
8+
fn bar()
9+
where
10+
<() as Table>::AllColumns:,
11+
{
12+
}
13+
14+
fn baz<W>()
15+
where
16+
W: AsQuery,
17+
<W as AsQuery>::Query:,
18+
{
19+
}
20+
21+
trait AsQuery {
22+
type Query;
23+
}
24+
25+
trait UnimplementedTrait {}
26+
27+
impl<T> AsQuery for T
28+
where
29+
T: UnimplementedTrait,
30+
{
31+
type Query = ();
32+
}
33+
34+
struct Wrapper<Expr>(Expr);
35+
36+
impl<Ret> AsQuery for Wrapper<Ret> {
37+
type Query = ();
38+
}
39+
40+
impl AsQuery for ()
41+
where
42+
Wrapper<<() as Table>::AllColumns>: AsQuery,
43+
{
44+
type Query = ();
45+
}
46+
47+
trait Table {
48+
type AllColumns;
49+
}
50+
51+
#[cfg(rpass1)]
52+
impl Table for () {
53+
type AllColumns = Checksum1;
54+
}
55+
#[cfg(rpass1)]
56+
struct Checksum1;
57+
58+
#[cfg(rpass2)]
59+
impl Table for () {
60+
type AllColumns = Checksum2;
61+
}
62+
#[cfg(rpass2)]
63+
struct Checksum2;
64+
65+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0277]: the trait bound `(): AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not satisfied
2+
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:13
3+
|
4+
LL | fn ice() -> impl AsRef<Fn(&())> {
5+
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not implemented for `()`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0782]: trait objects must include the `dyn` keyword
2+
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:24
3+
|
4+
LL | fn ice() -> impl AsRef<Fn(&())> {
5+
| ^^^^^^^
6+
|
7+
help: add `dyn` keyword before this trait
8+
|
9+
LL - fn ice() -> impl AsRef<Fn(&())> {
10+
LL + fn ice() -> impl AsRef<dyn Fn(&())> {
11+
|
12+
13+
error[E0277]: the trait bound `(): AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not satisfied
14+
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:13
15+
|
16+
LL | fn ice() -> impl AsRef<Fn(&())> {
17+
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not implemented for `()`
18+
19+
error: aborting due to 2 previous errors
20+
21+
Some errors have detailed explanations: E0277, E0782.
22+
For more information about an error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// revisions: edition2015 edition2021
2+
//[edition2021]edition:2021
3+
4+
#![allow(warnings)]
5+
6+
fn ice() -> impl AsRef<Fn(&())> {
7+
//~^ ERROR: the trait bound `(): AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not satisfied [E0277]
8+
//[edition2021]~| ERROR: trait objects must include the `dyn` keyword [E0782]
9+
todo!()
10+
}
11+
12+
fn main() {}

src/test/ui/issues/issue-43988.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ error[E0552]: unrecognized representation hint
3131
|
3232
LL | #[repr(nothing)]
3333
| ^^^^^^^
34+
|
35+
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
3436

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

4145
error[E0518]: attribute should be applied to function or closure
4246
--> $DIR/issue-43988.rs:30:5
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![crate_type = "lib"]
2+
3+
#[repr(uwu)] //~ERROR: unrecognized representation hint
4+
pub struct OwO;
5+
6+
#[repr(uwu = "a")] //~ERROR: unrecognized representation hint
7+
pub struct OwO2(i32);
8+
9+
#[repr(uwu(4))] //~ERROR: unrecognized representation hint
10+
pub struct OwO3 {
11+
x: i32,
12+
}
13+
14+
#[repr(uwu, u8)] //~ERROR: unrecognized representation hint
15+
pub enum OwO4 {
16+
UwU = 1,
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
error[E0552]: unrecognized representation hint
2+
--> $DIR/invalid_repr_list_help.rs:3:8
3+
|
4+
LL | #[repr(uwu)]
5+
| ^^^
6+
|
7+
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
8+
9+
error[E0552]: unrecognized representation hint
10+
--> $DIR/invalid_repr_list_help.rs:6:8
11+
|
12+
LL | #[repr(uwu = "a")]
13+
| ^^^^^^^^^
14+
|
15+
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
16+
17+
error[E0552]: unrecognized representation hint
18+
--> $DIR/invalid_repr_list_help.rs:9:8
19+
|
20+
LL | #[repr(uwu(4))]
21+
| ^^^^^^
22+
|
23+
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
24+
25+
error[E0552]: unrecognized representation hint
26+
--> $DIR/invalid_repr_list_help.rs:14:8
27+
|
28+
LL | #[repr(uwu, u8)]
29+
| ^^^
30+
|
31+
= help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
32+
33+
error: aborting due to 4 previous errors
34+
35+
For more information about this error, try `rustc --explain E0552`.

0 commit comments

Comments
 (0)