Skip to content

Commit ec7679b

Browse files
authored
Auto merge of #36764 - jonathandturner:rollup, r=jonathandturner
Rollup of 14 pull requests - Successful merges: #36563, #36574, #36586, #36662, #36663, #36669, #36676, #36721, #36723, #36727, #36729, #36742, #36754, #36756 - Failed merges:
2 parents d0623cf + e832762 commit ec7679b

Some content is hidden

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

68 files changed

+1710
-1061
lines changed

configure

+8
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,10 @@ case $CFG_OSTYPE in
437437
CFG_CPUTYPE=$(isainfo -n)
438438
;;
439439

440+
Haiku)
441+
CFG_OSTYPE=unknown-haiku
442+
;;
443+
440444
MINGW*)
441445
# msys' `uname` does not print gcc configuration, but prints msys
442446
# configuration. so we cannot believe `uname -m`:
@@ -532,6 +536,10 @@ case $CFG_CPUTYPE in
532536
CFG_CPUTYPE=x86_64
533537
;;
534538

539+
BePC)
540+
CFG_CPUTYPE=i686
541+
;;
542+
535543
*)
536544
err "unknown CPU type: $CFG_CPUTYPE"
537545
esac

mk/cfg/i686-unknown-haiku.mk

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# i686-unknown-haiku configuration
2+
CROSS_PREFIX_i686-unknown-haiku=i586-pc-haiku-
3+
CC_i686-unknown-haiku=$(CC)
4+
CXX_i686-unknown-haiku=$(CXX)
5+
CPP_i686-unknown-haiku=$(CPP)
6+
AR_i686-unknown-haiku=$(AR)
7+
CFG_LIB_NAME_i686-unknown-haiku=lib$(1).so
8+
CFG_STATIC_LIB_NAME_i686-unknown-haiku=lib$(1).a
9+
CFG_LIB_GLOB_i686-unknown-haiku=lib$(1)-*.so
10+
CFG_LIB_DSYM_GLOB_i686-unknown-haiku=lib$(1)-*.dylib.dSYM
11+
CFG_CFLAGS_i686-unknown-haiku := -m32 $(CFLAGS)
12+
CFG_GCCISH_CFLAGS_i686-unknown-haiku := -Wall -Werror -g -fPIC -m32 $(CFLAGS)
13+
CFG_GCCISH_CXXFLAGS_i686-unknown-haiku := -fno-rtti $(CXXFLAGS)
14+
CFG_GCCISH_LINK_FLAGS_i686-unknown-haiku := -shared -fPIC -ldl -pthread -lrt -g -m32
15+
CFG_GCCISH_PRE_LIB_FLAGS_i686-unknown-haiku := -Wl,-whole-archive
16+
CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-haiku := -Wl,-no-whole-archive
17+
CFG_DEF_SUFFIX_i686-unknown-haiku := .linux.def
18+
CFG_LLC_FLAGS_i686-unknown-haiku :=
19+
CFG_INSTALL_NAME_i686-unknown-haiku =
20+
CFG_EXE_SUFFIX_i686-unknown-haiku =
21+
CFG_WINDOWSY_i686-unknown-haiku :=
22+
CFG_UNIXY_i686-unknown-haiku := 1
23+
CFG_PATH_MUNGE_i686-unknown-haiku := true
24+
CFG_LDPATH_i686-unknown-haiku :=
25+
CFG_RUN_i686-unknown-haiku=$(2)
26+
CFG_RUN_TARG_i686-unknown-haiku=$(call CFG_RUN_i686-unknown-haiku,,$(2))
27+
CFG_GNU_TRIPLE_i686-unknown-haiku := i686-unknown-haiku

mk/cfg/x86_64-unknown-haiku.mk

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# x86_64-unknown-haiku configuration
2+
CROSS_PREFIX_x86_64-unknown-haiku=x86_64-unknown-haiku-
3+
CC_x86_64-unknown-haiku=$(CC)
4+
CXX_x86_64-unknown-haiku=$(CXX)
5+
CPP_x86_64-unknown-haiku=$(CPP)
6+
AR_x86_64-unknown-haiku=$(AR)
7+
CFG_LIB_NAME_x86_64-unknown-haiku=lib$(1).so
8+
CFG_STATIC_LIB_NAME_x86_64-unknown-haiku=lib$(1).a
9+
CFG_LIB_GLOB_x86_64-unknown-haiku=lib$(1)-*.so
10+
CFG_LIB_DSYM_GLOB_x86_64-unknown-haiku=lib$(1)-*.dylib.dSYM
11+
CFG_CFLAGS_x86_64-unknown-haiku := -m64 $(CFLAGS)
12+
CFG_GCCISH_CFLAGS_x86_64-unknown-haiku := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
13+
CFG_GCCISH_CXXFLAGS_x86_64-unknown-haiku := -fno-rtti $(CXXFLAGS)
14+
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-haiku := -shared -fPIC -ldl -pthread -lrt -g -m64
15+
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-whole-archive
16+
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-no-whole-archive
17+
CFG_DEF_SUFFIX_x86_64-unknown-haiku := .linux.def
18+
CFG_LLC_FLAGS_x86_64-unknown-haiku :=
19+
CFG_INSTALL_NAME_x86_64-unknown-haiku =
20+
CFG_EXE_SUFFIX_x86_64-unknown-haiku =
21+
CFG_WINDOWSY_x86_64-unknown-haiku :=
22+
CFG_UNIXY_x86_64-unknown-haiku := 1
23+
CFG_PATH_MUNGE_x86_64-unknown-haiku := true
24+
CFG_LDPATH_x86_64-unknown-haiku :=
25+
CFG_RUN_x86_64-unknown-haiku=$(2)
26+
CFG_RUN_TARG_x86_64-unknown-haiku=$(call CFG_RUN_x86_64-unknown-haiku,,$(2))
27+
CFG_GNU_TRIPLE_x86_64-unknown-haiku := x86_64-unknown-haiku

mk/main.mk

+4
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,14 @@ ifeq ($$(OSTYPE_$(3)),apple-darwin)
512512
else
513513
ifeq ($$(CFG_WINDOWSY_$(3)),1)
514514
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
515+
else
516+
ifeq ($$(OSTYPE_$(3)),unknown-haiku)
517+
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LIBRARY_PATH
515518
else
516519
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
517520
endif
518521
endif
522+
endif
519523

520524
LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
521525
$$(CURDIR)/$$(HLIB$(1)_H_$(3)):$$(CFG_LLVM_INST_DIR_$(3))/lib

src/bootstrap/lib.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,14 @@ impl Build {
243243
// Almost all of these are simple one-liners that shell out to the
244244
// corresponding functionality in the extra modules, where more
245245
// documentation can be found.
246-
for target in step::all(self) {
246+
let steps = step::all(self);
247+
248+
self.verbose("bootstrap build plan:");
249+
for step in &steps {
250+
self.verbose(&format!("{:?}", step));
251+
}
252+
253+
for target in steps {
247254
let doc_out = self.out.join(&target.target).join("doc");
248255
match target.src {
249256
Llvm { _dummy } => {

src/bootstrap/step.rs

+3
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ targets!(define_source);
171171
/// into a topologically sorted list which when executed left-to-right will
172172
/// correctly sequence the entire build.
173173
pub fn all(build: &Build) -> Vec<Step> {
174+
build.verbose("inferred build steps:");
175+
174176
let mut ret = Vec::new();
175177
let mut all = HashSet::new();
176178
for target in top_level(build) {
@@ -184,6 +186,7 @@ pub fn all(build: &Build) -> Vec<Step> {
184186
set: &mut HashSet<Step<'a>>) {
185187
if set.insert(target.clone()) {
186188
for dep in target.deps(build) {
189+
build.verbose(&format!("{:?}\n -> {:?}", target, dep));
187190
fill(build, &dep, ret, set);
188191
}
189192
ret.push(target.clone());

src/doc/book/getting-started.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,13 @@ $ cd hello_world
230230
231231
## Writing and Running a Rust Program
232232

233-
Next, make a new source file and call it *main.rs*. Rust files always end
234-
in a *.rs* extension. If you’re using more than one word in your filename, use
235-
an underscore to separate them; for example, you'd use *hello_world.rs* rather
236-
than *helloworld.rs*.
233+
We need to create a source file for our Rust program. Rust files always end
234+
in a *.rs* extension. If you are using more than one word in your filename,
235+
use an underscore to separate them; for example, you would use
236+
*my_program.rs* rather than *myprogram.rs*.
237237

238-
Now open the *main.rs* file you just created, and type the following code:
238+
Now, make a new file and call it *main.rs*. Open the file and type
239+
the following code:
239240

240241
```rust
241242
fn main() {

src/etc/local_stage0.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LIB_PREFIX=lib
1818

1919
OS=`uname -s`
2020
case $OS in
21-
("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS")
21+
("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS"|"Haiku")
2222
BIN_SUF=
2323
LIB_SUF=.so
2424
;;

src/librustc/middle/intrinsicck.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,16 @@ impl<'a, 'gcx, 'tcx> ExprVisitor<'a, 'gcx, 'tcx> {
103103
}
104104
};
105105

106-
span_err!(self.infcx.tcx.sess, span, E0512,
106+
struct_span_err!(self.infcx.tcx.sess, span, E0512,
107107
"transmute called with differently sized types: \
108108
{} ({}) to {} ({})",
109109
from, skeleton_string(from, sk_from),
110-
to, skeleton_string(to, sk_to));
110+
to, skeleton_string(to, sk_to))
111+
.span_label(span,
112+
&format!("transmuting between {} and {}",
113+
skeleton_string(from, sk_from),
114+
skeleton_string(to, sk_to)))
115+
.emit();
111116
}
112117
}
113118

src/librustc/session/config.rs

+10
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ macro_rules! options {
605605
pub const parse_opt_bool: Option<&'static str> =
606606
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
607607
pub const parse_string: Option<&'static str> = Some("a string");
608+
pub const parse_string_push: Option<&'static str> = Some("a string");
608609
pub const parse_opt_string: Option<&'static str> = Some("a string");
609610
pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
610611
pub const parse_opt_list: Option<&'static str> = Some("a space-separated list of strings");
@@ -667,6 +668,13 @@ macro_rules! options {
667668
}
668669
}
669670

671+
fn parse_string_push(slot: &mut Vec<String>, v: Option<&str>) -> bool {
672+
match v {
673+
Some(s) => { slot.push(s.to_string()); true },
674+
None => false,
675+
}
676+
}
677+
670678
fn parse_list(slot: &mut Vec<String>, v: Option<&str>)
671679
-> bool {
672680
match v {
@@ -742,6 +750,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
742750
"tool to assemble archives with"),
743751
linker: Option<String> = (None, parse_opt_string, [UNTRACKED],
744752
"system linker to link outputs with"),
753+
link_arg: Vec<String> = (vec![], parse_string_push, [UNTRACKED],
754+
"a single extra argument to pass to the linker (can be used several times)"),
745755
link_args: Option<Vec<String>> = (None, parse_opt_list, [UNTRACKED],
746756
"extra arguments to pass to the linker (space separated)"),
747757
link_dead_code: bool = (false, parse_bool, [UNTRACKED],
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::TargetOptions;
12+
use std::default::Default;
13+
14+
pub fn opts() -> TargetOptions {
15+
TargetOptions {
16+
linker: "cc".to_string(),
17+
dynamic_linking: true,
18+
executables: true,
19+
has_rpath: true,
20+
linker_is_gnu: true,
21+
.. Default::default()
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::{Target, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let mut base = super::haiku_base::opts();
15+
base.cpu = "pentium4".to_string();
16+
base.max_atomic_width = 64;
17+
base.pre_link_args.push("-m32".to_string());
18+
19+
Ok(Target {
20+
llvm_target: "i686-unknown-haiku".to_string(),
21+
target_endian: "little".to_string(),
22+
target_pointer_width: "32".to_string(),
23+
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
24+
arch: "x86".to_string(),
25+
target_os: "haiku".to_string(),
26+
target_env: "".to_string(),
27+
target_vendor: "unknown".to_string(),
28+
options: base,
29+
})
30+
}

src/librustc_back/target/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ mod apple_ios_base;
5656
mod bitrig_base;
5757
mod dragonfly_base;
5858
mod freebsd_base;
59+
mod haiku_base;
5960
mod linux_base;
6061
mod linux_musl_base;
6162
mod openbsd_base;
@@ -165,6 +166,9 @@ supported_targets! {
165166
("x86_64-unknown-netbsd", x86_64_unknown_netbsd),
166167
("x86_64-rumprun-netbsd", x86_64_rumprun_netbsd),
167168

169+
("i686_unknown_haiku", i686_unknown_haiku),
170+
("x86_64_unknown_haiku", x86_64_unknown_haiku),
171+
168172
("x86_64-apple-darwin", x86_64_apple_darwin),
169173
("i686-apple-darwin", i686_apple_darwin),
170174

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::{Target, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let mut base = super::haiku_base::opts();
15+
base.cpu = "x86-64".to_string();
16+
base.max_atomic_width = 64;
17+
base.pre_link_args.push("-m64".to_string());
18+
19+
Ok(Target {
20+
llvm_target: "x86_64-unknown-haiku".to_string(),
21+
target_endian: "little".to_string(),
22+
target_pointer_width: "64".to_string(),
23+
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
24+
arch: "x86_64".to_string(),
25+
target_os: "haiku".to_string(),
26+
target_env: "".to_string(),
27+
target_vendor: "unknown".to_string(),
28+
options: base,
29+
})
30+
}

src/librustc_data_structures/flock.rs

+21
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,27 @@ mod imp {
9494
pub const F_SETLKW: libc::c_int = 9;
9595
}
9696

97+
#[cfg(target_os = "haiku")]
98+
mod os {
99+
use libc;
100+
101+
pub struct flock {
102+
pub l_type: libc::c_short,
103+
pub l_whence: libc::c_short,
104+
pub l_start: libc::off_t,
105+
pub l_len: libc::off_t,
106+
pub l_pid: libc::pid_t,
107+
108+
// not actually here, but brings in line with freebsd
109+
pub l_sysid: libc::c_int,
110+
}
111+
112+
pub const F_UNLCK: libc::c_short = 0x0200;
113+
pub const F_WRLCK: libc::c_short = 0x0400;
114+
pub const F_SETLK: libc::c_int = 0x0080;
115+
pub const F_SETLKW: libc::c_int = 0x0100;
116+
}
117+
97118
#[cfg(any(target_os = "macos", target_os = "ios"))]
98119
mod os {
99120
use libc;

src/librustc_trans/back/link.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ fn link_args(cmd: &mut Linker,
754754
let empty_vec = Vec::new();
755755
let empty_str = String::new();
756756
let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec);
757-
let mut args = args.iter().chain(used_link_args.iter());
757+
let more_args = &sess.opts.cg.link_arg;
758+
let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter());
758759
let relocation_model = sess.opts.cg.relocation_model.as_ref()
759760
.unwrap_or(&empty_str);
760761
if (t.options.relocation_model == "pic" || *relocation_model == "pic")
@@ -844,6 +845,7 @@ fn link_args(cmd: &mut Linker,
844845
if let Some(ref args) = sess.opts.cg.link_args {
845846
cmd.args(args);
846847
}
848+
cmd.args(&sess.opts.cg.link_arg);
847849
cmd.args(&used_link_args);
848850
}
849851

src/librustc_typeck/check/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1525,9 +1525,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
15251525
match self.locals.borrow().get(&nid) {
15261526
Some(&t) => t,
15271527
None => {
1528-
span_err!(self.tcx.sess, span, E0513,
1529-
"no type for local variable {}",
1530-
nid);
1528+
struct_span_err!(self.tcx.sess, span, E0513,
1529+
"no type for local variable {}",
1530+
self.tcx.map.node_to_string(nid))
1531+
.span_label(span, &"no type for variable")
1532+
.emit();
15311533
self.tcx.types.err
15321534
}
15331535
}

0 commit comments

Comments
 (0)