forked from abdul124/rust-core_io
Add try_patch shell function and update glue for latest nightlies
This commit is contained in:
parent
0ad4c19f7e
commit
64dd163434
@ -17,7 +17,7 @@ prompt_changes() {
|
|||||||
GIT_DIR="$MAIN_GIT_DIR" git_commits_ordered '%H %cd' $(get_patch_commits) $IO_COMMIT | \
|
GIT_DIR="$MAIN_GIT_DIR" git_commits_ordered '%H %cd' $(get_patch_commits) $IO_COMMIT | \
|
||||||
grep --color=always -1 $IO_COMMIT | sed /$IO_COMMIT/'s/$/ <=== your commit/'
|
grep --color=always -1 $IO_COMMIT | sed /$IO_COMMIT/'s/$/ <=== your commit/'
|
||||||
echo
|
echo
|
||||||
bold_arrow; echo -e "Try applying one of those using: \e[1;36mpatch -p1 < ../../patches/COMMIT.patch\e[0m"
|
bold_arrow; echo -e "Try applying one of those using: \e[1;36mtry_patch COMMIT\e[0m"
|
||||||
bold_arrow; echo -e "Remember to test your changes with: \e[1;36mcargo build\e[0m"
|
bold_arrow; echo -e "Remember to test your changes with: \e[1;36mcargo build\e[0m"
|
||||||
bold_arrow; echo -e "Make your changes now (\e[1;36mctrl-D\e[0m when finished)"
|
bold_arrow; echo -e "Make your changes now (\e[1;36mctrl-D\e[0m when finished)"
|
||||||
bash_diff_loop "No changes were made"
|
bash_diff_loop "No changes were made"
|
||||||
|
10
build.rs
10
build.rs
@ -36,17 +36,25 @@ impl Sub<Mapping> for Vec<Mapping> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let ver=rustc_version::version_meta();
|
||||||
|
|
||||||
let io_commit=match env::var("CORE_IO_COMMIT") {
|
let io_commit=match env::var("CORE_IO_COMMIT") {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(env::VarError::NotUnicode(_)) => panic!("Invalid commit specified in CORE_IO_COMMIT"),
|
Err(env::VarError::NotUnicode(_)) => panic!("Invalid commit specified in CORE_IO_COMMIT"),
|
||||||
Err(env::VarError::NotPresent) => {
|
Err(env::VarError::NotPresent) => {
|
||||||
let mappings=include!("mapping.rs");
|
let mappings=include!("mapping.rs");
|
||||||
|
|
||||||
let compiler=rustc_version::version_meta().commit_hash.expect("Couldn't determine compiler version");
|
let compiler=ver.commit_hash.expect("Couldn't determine compiler version");
|
||||||
mappings.iter().find(|&&Mapping(elem,_)|elem==compiler).expect("Unknown compiler version, upgrade core_io?").1.to_owned()
|
mappings.iter().find(|&&Mapping(elem,_)|elem==compiler).expect("Unknown compiler version, upgrade core_io?").1.to_owned()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if ver.commit_date.as_ref().map_or(false,|d| &**d<"2016-12-15") {
|
||||||
|
println!("cargo:rustc-cfg=rustc_unicode");
|
||||||
|
} else if ver.commit_date.as_ref().map_or(false,|d| &**d<"2017-03-03") {
|
||||||
|
println!("cargo:rustc-cfg=std_unicode");
|
||||||
|
}
|
||||||
|
|
||||||
let mut dest_path=PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
let mut dest_path=PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||||
dest_path.push("io.rs");
|
dest_path.push("io.rs");
|
||||||
let mut f=File::create(&dest_path).unwrap();
|
let mut f=File::create(&dest_path).unwrap();
|
||||||
|
16
functions.sh
16
functions.sh
@ -41,7 +41,9 @@ get_patch_commits() {
|
|||||||
prepare_version() {
|
prepare_version() {
|
||||||
mkdir src/$IO_COMMIT
|
mkdir src/$IO_COMMIT
|
||||||
git_extract src/libstd/io/
|
git_extract src/libstd/io/
|
||||||
if git_file_exists src/libstd/sys/common/memchr.rs; then
|
if git_file_exists src/libstd/sys_common/memchr.rs; then
|
||||||
|
git_extract src/libstd/sys_common/memchr.rs
|
||||||
|
elif git_file_exists src/libstd/sys/common/memchr.rs; then
|
||||||
git_extract src/libstd/sys/common/memchr.rs
|
git_extract src/libstd/sys/common/memchr.rs
|
||||||
else
|
else
|
||||||
git_extract src/libstd/memchr.rs
|
git_extract src/libstd/memchr.rs
|
||||||
@ -53,8 +55,18 @@ bold_arrow() {
|
|||||||
echo -ne '\e[1;36m==> \e[0m'
|
echo -ne '\e[1;36m==> \e[0m'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
custom_bashrc() {
|
||||||
|
echo '
|
||||||
|
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
|
||||||
|
|
||||||
|
try_patch() {
|
||||||
|
patch -p1 < ../../patches/$1.patch
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
bash_diff_loop() {
|
bash_diff_loop() {
|
||||||
bash <> /dev/stderr
|
bash --rcfile <(custom_bashrc) <> /dev/stderr
|
||||||
while git diff --exit-code > /dev/null; do
|
while git diff --exit-code > /dev/null; do
|
||||||
bold_arrow; echo "$1"
|
bold_arrow; echo "$1"
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -3,13 +3,16 @@
|
|||||||
//! the [std documentation](https://doc.rust-lang.org/nightly/std/io/index.html)
|
//! the [std documentation](https://doc.rust-lang.org/nightly/std/io/index.html)
|
||||||
//! for a full description of the functionality.
|
//! for a full description of the functionality.
|
||||||
#![allow(stable_features,unused_features)]
|
#![allow(stable_features,unused_features)]
|
||||||
#![feature(question_mark,const_fn,collections,alloc,unicode,copy_from_slice,str_char,try_from)]
|
#![feature(question_mark,const_fn,collections,alloc,unicode,copy_from_slice,str_char,try_from,str_internals)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
#[cfg_attr(feature="collections",macro_use)]
|
#[cfg_attr(feature="collections",macro_use)]
|
||||||
#[cfg(feature="collections")] extern crate collections;
|
#[cfg(feature="collections")] extern crate collections;
|
||||||
#[cfg(feature="alloc")] extern crate alloc;
|
#[cfg(feature="alloc")] extern crate alloc;
|
||||||
|
#[cfg(rustc_unicode)]
|
||||||
extern crate rustc_unicode;
|
extern crate rustc_unicode;
|
||||||
|
#[cfg(std_unicode)]
|
||||||
|
extern crate std_unicode;
|
||||||
|
|
||||||
#[cfg(not(feature="collections"))]
|
#[cfg(not(feature="collections"))]
|
||||||
pub type ErrorString = &'static str;
|
pub type ErrorString = &'static str;
|
||||||
|
Loading…
Reference in New Issue
Block a user