Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 23744c8

Browse files
committed
Auto merge of rust-lang#74342 - Manishearth:rollup-l63pesj, r=Manishearth
Rollup of 11 pull requests Successful merges: - rust-lang#73759 (Add missing Stdin and StdinLock examples) - rust-lang#74211 (Structured suggestion when not using struct pattern) - rust-lang#74228 (Provide structured suggestion on unsized fields and fn params) - rust-lang#74252 (Don't allow `DESTDIR` to influence LLVM builds) - rust-lang#74263 (Slight reorganization of sys/(fast_)thread_local) - rust-lang#74271 (process_unix: prefer i32::*_be_bytes over manually shifting bytes) - rust-lang#74272 (pprust: support multiline comments within lines) - rust-lang#74332 (Update cargo) - rust-lang#74334 (bootstrap: Improve wording on docs for `verbose-tests`) - rust-lang#74336 (typeck: use `item_name` in cross-crate packed diag) - rust-lang#74340 (lint: use `transparent_newtype_field` to avoid ICE) Failed merges: r? @ghost
2 parents 2002eba + dbe7ed3 commit 23744c8

File tree

189 files changed

+1068
-703
lines changed

Some content is hidden

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

189 files changed

+1068
-703
lines changed

config.toml.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,7 @@
391391
# desired in distributions, for example.
392392
#rpath = true
393393

394-
# Emits extraneous output from tests to ensure that failures of the test
395-
# harness are debuggable just from logfiles.
394+
# Emits extra output from tests so test failures are debuggable just from logfiles.
396395
#verbose-tests = false
397396

398397
# Flag indicating whether tests are compiled with optimizations (the -O flag).

src/bootstrap/native.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ fn configure_cmake(
347347
// LLVM and LLD builds can produce a lot of those and hit CI limits on log size.
348348
cfg.define("CMAKE_INSTALL_MESSAGE", "LAZY");
349349

350+
// Do not allow the user's value of DESTDIR to influence where
351+
// LLVM will install itself. LLVM must always be installed in our
352+
// own build directories.
353+
cfg.env("DESTDIR", "");
354+
350355
if builder.config.ninja {
351356
cfg.generator("Ninja");
352357
}

src/libcore/marker.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,8 @@ impl<T: ?Sized> !Send for *mut T {}
8484
#[stable(feature = "rust1", since = "1.0.0")]
8585
#[lang = "sized"]
8686
#[rustc_on_unimplemented(
87-
on(parent_trait = "std::path::Path", label = "borrow the `Path` instead"),
8887
message = "the size for values of type `{Self}` cannot be known at compilation time",
89-
label = "doesn't have a size known at compile-time",
90-
note = "to learn more, visit <https://doc.rust-lang.org/book/\
91-
ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>"
88+
label = "doesn't have a size known at compile-time"
9289
)]
9390
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
9491
#[rustc_specialization_trait]

src/librustc_ast_lowering/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
526526
Ident::with_dummy_span(sym::_task_context),
527527
hir::BindingAnnotation::Mutable,
528528
);
529-
let param = hir::Param { attrs: &[], hir_id: self.next_id(), pat, span };
529+
let param = hir::Param { attrs: &[], hir_id: self.next_id(), pat, ty_span: span, span };
530530
let params = arena_vec![self; param];
531531

532532
let body_id = self.lower_body(move |this| {

src/librustc_ast_lowering/item.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
972972
attrs: self.lower_attrs(&param.attrs),
973973
hir_id: self.lower_node_id(param.id),
974974
pat: self.lower_pat(&param.pat),
975+
ty_span: param.ty.span,
975976
span: param.span,
976977
}
977978
}
@@ -1098,6 +1099,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10981099
attrs: parameter.attrs,
10991100
hir_id: parameter.hir_id,
11001101
pat: new_parameter_pat,
1102+
ty_span: parameter.ty_span,
11011103
span: parameter.span,
11021104
};
11031105

src/librustc_ast_pretty/pprust.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,20 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
450450
fn print_comment(&mut self, cmnt: &comments::Comment) {
451451
match cmnt.style {
452452
comments::Mixed => {
453-
assert_eq!(cmnt.lines.len(), 1);
454453
self.zerobreak();
455-
self.word(cmnt.lines[0].clone());
454+
if let Some((last, lines)) = cmnt.lines.split_last() {
455+
self.ibox(0);
456+
457+
for line in lines {
458+
self.word(line.clone());
459+
self.hardbreak()
460+
}
461+
462+
self.word(last.clone());
463+
self.space();
464+
465+
self.end();
466+
}
456467
self.zerobreak()
457468
}
458469
comments::Isolated => {

src/librustc_hir/hir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,7 @@ pub struct Param<'hir> {
21482148
pub attrs: &'hir [Attribute],
21492149
pub hir_id: HirId,
21502150
pub pat: &'hir Pat<'hir>,
2151+
pub ty_span: Span,
21512152
pub span: Span,
21522153
}
21532154

src/librustc_lint/types.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -531,23 +531,23 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
531531
match ty.kind {
532532
ty::FnPtr(_) => true,
533533
ty::Ref(..) => true,
534-
ty::Adt(field_def, substs) if field_def.repr.transparent() && !field_def.is_union() => {
535-
for field in field_def.all_fields() {
536-
let field_ty = self.cx.tcx.normalize_erasing_regions(
537-
self.cx.param_env,
538-
field.ty(self.cx.tcx, substs),
539-
);
540-
if field_ty.is_zst(self.cx.tcx, field.did) {
541-
continue;
542-
}
534+
ty::Adt(def, substs) if def.repr.transparent() && !def.is_union() => {
535+
let guaranteed_nonnull_optimization = self
536+
.cx
537+
.tcx
538+
.get_attrs(def.did)
539+
.iter()
540+
.any(|a| a.check_name(sym::rustc_nonnull_optimization_guaranteed));
541+
542+
if guaranteed_nonnull_optimization {
543+
return true;
544+
}
543545

544-
let attrs = self.cx.tcx.get_attrs(field_def.did);
545-
if attrs
546-
.iter()
547-
.any(|a| a.check_name(sym::rustc_nonnull_optimization_guaranteed))
548-
|| self.ty_is_known_nonnull(field_ty)
549-
{
550-
return true;
546+
for variant in &def.variants {
547+
if let Some(field) = variant.transparent_newtype_field(self.cx.tcx) {
548+
if self.ty_is_known_nonnull(field.ty(self.cx.tcx, substs)) {
549+
return true;
550+
}
551551
}
552552
}
553553

src/librustc_middle/traits/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ pub enum ObligationCauseCode<'tcx> {
215215
/// Type of each variable must be `Sized`.
216216
VariableType(hir::HirId),
217217
/// Argument type must be `Sized`.
218-
SizedArgumentType,
218+
SizedArgumentType(Option<Span>),
219219
/// Return type must be `Sized`.
220220
SizedReturnType,
221221
/// Yield type must be `Sized`.
@@ -229,6 +229,7 @@ pub enum ObligationCauseCode<'tcx> {
229229
/// Types of fields (other than the last, except for packed structs) in a struct must be sized.
230230
FieldSized {
231231
adt_kind: AdtKind,
232+
span: Span,
232233
last: bool,
233234
},
234235

src/librustc_middle/traits/structural_impls.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,14 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
151151
super::VariableType(id) => Some(super::VariableType(id)),
152152
super::ReturnValue(id) => Some(super::ReturnValue(id)),
153153
super::ReturnType => Some(super::ReturnType),
154-
super::SizedArgumentType => Some(super::SizedArgumentType),
154+
super::SizedArgumentType(sp) => Some(super::SizedArgumentType(sp)),
155155
super::SizedReturnType => Some(super::SizedReturnType),
156156
super::SizedYieldType => Some(super::SizedYieldType),
157157
super::InlineAsmSized => Some(super::InlineAsmSized),
158158
super::RepeatVec(suggest_flag) => Some(super::RepeatVec(suggest_flag)),
159-
super::FieldSized { adt_kind, last } => Some(super::FieldSized { adt_kind, last }),
159+
super::FieldSized { adt_kind, span, last } => {
160+
Some(super::FieldSized { adt_kind, span, last })
161+
}
160162
super::ConstSized => Some(super::ConstSized),
161163
super::ConstPatternStructural => Some(super::ConstPatternStructural),
162164
super::SharedStatic => Some(super::SharedStatic),

0 commit comments

Comments
 (0)