about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-14 01:29:58 +0000
committerbors <bors@rust-lang.org>2022-08-14 01:29:58 +0000
commitb76fec3ca89ba255316c010065f1fcf4d7cbfc9c (patch)
treecba22d8a87a62adfc69df8238b4658bcae39c783 /compiler
parent75b7e52e92c3b00fc891b47f5b2efdff0a2be55a (diff)
parent860e093efb78ff67ae7f2cb9bbb69637295214a4 (diff)
downloadrust-b76fec3ca89ba255316c010065f1fcf4d7cbfc9c.tar.gz
rust-b76fec3ca89ba255316c010065f1fcf4d7cbfc9c.zip
Auto merge of #100511 - compiler-errors:rollup-vrte4w5, r=compiler-errors
Rollup of 11 pull requests

Successful merges:

 - #100355 (rustdoc: Rename ``@has` FILE PATTERN` to ``@hasraw` FILE PATTERN`)
 - #100407 (avoid some int2ptr casts in thread_local_key tests)
 - #100434 (Fix HIR pretty printing of let else)
 - #100438 (Erase regions better in `promote_candidate`)
 - #100445 (adapt test for msan message change)
 - #100447 (Remove more Clean trait implementations)
 - #100464 (Make `[rust] use-lld=true` work on windows)
 - #100475 (Give a helpful diagnostic when the next struct field has an attribute)
 - #100490 (wf: correctly `shallow_resolve` consts)
 - #100501 (nicer Miri backtraces for from_exposed_addr)
 - #100509 (merge two test directories that mean the same thing)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_const_eval/src/transform/promote_consts.rs9
-rw-r--r--compiler/rustc_hir_pretty/src/lib.rs4
-rw-r--r--compiler/rustc_parse/src/parser/item.rs8
-rw-r--r--compiler/rustc_trait_selection/src/traits/wf.rs16
4 files changed, 19 insertions, 18 deletions
diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs
index ed4d8c95d1e..161c89e3242 100644
--- a/compiler/rustc_const_eval/src/transform/promote_consts.rs
+++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs
@@ -839,17 +839,12 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
             let mut promoted_operand = |ty, span| {
                 promoted.span = span;
                 promoted.local_decls[RETURN_PLACE] = LocalDecl::new(ty, span);
+                let substs = tcx.erase_regions(InternalSubsts::identity_for_item(tcx, def.did));
                 let _const = tcx.mk_const(ty::ConstS {
                     ty,
                     kind: ty::ConstKind::Unevaluated(ty::Unevaluated {
                         def,
-                        substs: InternalSubsts::for_item(tcx, def.did, |param, _| {
-                            if let ty::GenericParamDefKind::Lifetime = param.kind {
-                                tcx.lifetimes.re_erased.into()
-                            } else {
-                                tcx.mk_param_from_def(param)
-                            }
-                        }),
+                        substs,
                         promoted: Some(promoted_id),
                     }),
                 });
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index e0179bd3ed1..c7966b662de 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -911,6 +911,10 @@ impl<'a> State<'a> {
         if let Some(els) = els {
             self.nbsp();
             self.word_space("else");
+            // containing cbox, will be closed by print-block at `}`
+            self.cbox(0);
+            // head-box, will be closed by print-block after `{`
+            self.ibox(0);
             self.print_block(els);
         }
 
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 197c0384898..ac55aee9883 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -1544,8 +1544,12 @@ impl<'a> Parser<'a> {
                     }
                 }
 
-                if self.token.is_ident() {
-                    // This is likely another field; emit the diagnostic and keep going
+                if self.token.is_ident()
+                    || (self.token.kind == TokenKind::Pound
+                        && (self.look_ahead(1, |t| t == &token::OpenDelim(Delimiter::Bracket))))
+                {
+                    // This is likely another field, TokenKind::Pound is used for `#[..]` attribute for next field,
+                    // emit the diagnostic and keep going
                     err.span_suggestion(
                         sp,
                         "try adding a comma",
diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs
index 414857f0acc..7a5e67ff74b 100644
--- a/compiler/rustc_trait_selection/src/traits/wf.rs
+++ b/compiler/rustc_trait_selection/src/traits/wf.rs
@@ -31,9 +31,9 @@ pub fn obligations<'a, 'tcx>(
                     if resolved_ty == ty {
                         // No progress, bail out to prevent "livelock".
                         return None;
+                    } else {
+                        resolved_ty
                     }
-
-                    resolved_ty
                 }
                 _ => ty,
             }
@@ -41,16 +41,14 @@ pub fn obligations<'a, 'tcx>(
         }
         GenericArgKind::Const(ct) => {
             match ct.kind() {
-                ty::ConstKind::Infer(infer) => {
-                    let resolved = infcx.shallow_resolve(infer);
-                    if resolved == infer {
+                ty::ConstKind::Infer(_) => {
+                    let resolved = infcx.shallow_resolve(ct);
+                    if resolved == ct {
                         // No progress.
                         return None;
+                    } else {
+                        resolved
                     }
-
-                    infcx
-                        .tcx
-                        .mk_const(ty::ConstS { kind: ty::ConstKind::Infer(resolved), ty: ct.ty() })
                 }
                 _ => ct,
             }