Skip to content

Commit 80f0651

Browse files
committed
Auto merge of #42445 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 4 pull requests - Successful merges: #42304, #42415, #42429, #42438 - Failed merges:
2 parents d015610 + fd48c3a commit 80f0651

24 files changed

+298
-56
lines changed

src/bootstrap/compile.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
276276
if build.is_rust_llvm(target) {
277277
cargo.env("LLVM_RUSTLLVM", "1");
278278
}
279+
if let Some(ref cfg_file) = build.flags.config {
280+
let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
281+
cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
282+
}
279283
cargo.env("LLVM_CONFIG", build.llvm_config(target));
280284
let target_config = build.config.target_config.get(target);
281285
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {

src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub trait Unsize<T: ?Sized> {
205205
/// but not `Copy`.
206206
///
207207
/// [`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement
208-
/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation need only return `*self`
208+
/// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`
209209
/// (see the example above).
210210
///
211211
/// ## When can my type be `Copy`?

src/librustc/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ fn takes_u8(_: u8) {}
16311631
16321632
fn main() {
16331633
unsafe { takes_u8(::std::mem::transmute(0u16)); }
1634-
// error: transmute called with differently sized types
1634+
// error: transmute called with types of different sizes
16351635
}
16361636
```
16371637

src/librustc/middle/intrinsicck.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,16 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> {
8686
// Special-case transmutting from `typeof(function)` and
8787
// `Option<typeof(function)>` to present a clearer error.
8888
let from = unpack_option_like(self.tcx.global_tcx(), from);
89-
match (&from.sty, sk_to) {
90-
(&ty::TyFnDef(..), SizeSkeleton::Known(size_to))
91-
if size_to == Pointer.size(self.tcx) => {
89+
if let (&ty::TyFnDef(..), SizeSkeleton::Known(size_to)) = (&from.sty, sk_to) {
90+
if size_to == Pointer.size(self.tcx) {
9291
struct_span_err!(self.tcx.sess, span, E0591,
93-
"`{}` is zero-sized and can't be transmuted to `{}`",
94-
from, to)
95-
.span_note(span, "cast with `as` to a pointer instead")
92+
"can't transmute zero-sized type")
93+
.note(&format!("source type: {}", from))
94+
.note(&format!("target type: {}", to))
95+
.help("cast with `as` to a pointer instead")
9696
.emit();
9797
return;
9898
}
99-
_ => {}
10099
}
101100
}
102101

@@ -111,7 +110,7 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> {
111110
}
112111
Err(LayoutError::Unknown(bad)) => {
113112
if bad == ty {
114-
format!("size can vary")
113+
format!("this type's size can vary")
115114
} else {
116115
format!("size can vary because of {}", bad)
117116
}
@@ -121,14 +120,9 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> {
121120
};
122121

123122
struct_span_err!(self.tcx.sess, span, E0512,
124-
"transmute called with differently sized types: \
125-
{} ({}) to {} ({})",
126-
from, skeleton_string(from, sk_from),
127-
to, skeleton_string(to, sk_to))
128-
.span_label(span,
129-
format!("transmuting between {} and {}",
130-
skeleton_string(from, sk_from),
131-
skeleton_string(to, sk_to)))
123+
"transmute called with types of different sizes")
124+
.note(&format!("source type: {} ({})", from, skeleton_string(from, sk_from)))
125+
.note(&format!("target type: {} ({})", to, skeleton_string(to, sk_to)))
132126
.emit();
133127
}
134128
}

src/librustc/middle/resolve_lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
13631363
m.push_str(&(if n == 1 {
13641364
help_name
13651365
} else {
1366-
format!("one of {}'s {} elided {}lifetimes", help_name, n,
1366+
format!("one of {}'s {} {}lifetimes", help_name, n,
13671367
if have_bound_regions { "free " } else { "" } )
13681368
})[..]);
13691369

src/librustc_llvm/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ fn main() {
6161

6262
println!("cargo:rerun-if-changed={}", llvm_config.display());
6363

64+
if let Some(cfg_toml) = env::var_os("CFG_LLVM_TOML") {
65+
let cfg_path = PathBuf::from(cfg_toml);
66+
println!("cargo:rerun-if-changed={}", cfg_path.display());
67+
}
68+
6469
// Test whether we're cross-compiling LLVM. This is a pretty rare case
6570
// currently where we're producing an LLVM for a different platform than
6671
// what this build script is currently running on.

src/test/compile-fail/E0512.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ fn takes_u8(_: u8) {}
1212

1313
fn main() {
1414
unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512
15-
//~| transmuting between 16 bits and 8 bits
1615
}

src/test/compile-fail/issue-21174.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait Trait<'a> {
1515

1616
fn foo<'a, T: Trait<'a>>(value: T::A) {
1717
let new: T::B = unsafe { std::mem::transmute(value) };
18-
//~^ ERROR: transmute called with differently sized types
18+
//~^ ERROR: transmute called with types of different sizes
1919
}
2020

2121
fn main() { }

src/test/compile-fail/issue-26638.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
fn parse_type(iter: Box<Iterator<Item=&str>+'static>) -> &str { iter.next() }
1212
//~^ ERROR missing lifetime specifier [E0106]
13-
//~^^ HELP 2 elided lifetimes
13+
//~^^ HELP 2 lifetimes
1414

1515
fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
1616
//~^ ERROR missing lifetime specifier [E0106]

src/test/compile-fail/issue-28625.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct ArrayPeano<T: Bar> {
1717
}
1818

1919
fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar {
20-
unsafe { std::mem::transmute(a) } //~ ERROR transmute called with differently sized types
20+
unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
2121
}
2222

2323
impl Bar for () {

0 commit comments

Comments
 (0)