-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollup of 6 pull requests #30782
Rollup of 6 pull requests #30782
Conversation
steveklabnik
commented
Jan 8, 2016
- Successful merges: Add new help messages for E0425 #30584, Reenable MIR test #30747, Some minor docs improvements for TRPL #30755, Move os_str docs to OsString in order to be visible in HTML #30758, Nomicon: Vec insert/remove prefix len by self #30760, Link Nomicon in PhantomData's docs #30769
- Failed merges: Remove many instances of 'just' #30766
Or more specifically, after running early lints. Closes rust-lang#28142
Small typo. vectors -> vector.
`auto_ref()` currently returns an Rvalue datum for the ref'd value, which is fine for thin pointers, but for fat pointers this means that once the pointer is moved out of that datum, its memory will be marked as dead. And because there is not necessarily an intermediate temporary involved we can end up marking memory as dead that is actually still used. As I don't want to break the micro-optimization for thin pointers by always returning an Lvalue datum, I decided to only do so for fat pointers. Fix rust-lang#30478
…l422 Didn't build/test the change, but if that one-character fix isn't correct, I'll eat my hat. :-) Found this reading the book over the last week or two since Mozlando -- much enjoying the book so far.
the old code was *so terrible*.
I forgot about it in the previous commit
the old code was *so terrible*. r? @eddyb
`auto_ref()` currently returns an Rvalue datum for the ref'd value, which is fine for thin pointers, but for fat pointers this means that once the pointer is moved out of that datum, its memory will be marked as dead. And because there is not necessarily an intermediate temporary involved we can end up marking memory as dead that is actually still used. As I don't want to break the micro-optimization for thin pointers by always returning an Lvalue datum, I decided to only do so for fat pointers. Fix rust-lang#30478
A dumb mistake on my part from previous PR fixing unit enums in MIR.
To disable, pass `-C disable-gold`
This moves back (essentially reverts rust-lang#30265) into MIR-specific translation code, but keeps the funcition split out, since it is expected to eventually become recursive.
There's no need for us to redeclare it in an extern block. We should probably put the syscall number constants in libc too.
@ubsan brought up this relatively poor error message. This adds a help message hinting when the problem actually is, and how to fix it.
…r=Manishearth Fixes rust-lang#30203. This is my first time writing Rust, and I think this code could be a bit better. Any suggestions?
…this section of the book is correct.
…omatsakis `TypeFoldable`s can currently be visited inefficiently with an identity folder that is run only for its side effects. This creates a more efficient visitor for `TypeFoldable`s and uses it to implement `RegionEscape` and `HasProjectionTypes`, fixing cleanup issue rust-lang#20298. This is a pure refactoring.
* Put `const` in front of every `ConstVal`. * Pretty-print bytestrings as they appear in Rust source. * Pretty-print `ConstVal::{Struct, Tuple, Array, Repeat}` by pretty-printing the `ast::NodeId`. This is a temporary measure, and probably not perfect, but I'm avoiding anything more complex since I hear the const evaluator might not be AST-based in the near future. ```rust struct Point { x: i32, y: i32, } fn consts() { let _float = 3.14159; let _non_const_int = -42; const INT: i32 = -42; let _int = INT; let _uint = 42u32; let _str = "a string"; let _bytestr = b"a bytes\xFF\n\ttri\'\"\\ng"; let _bool = true; const STRUCT: Point = Point { x: 42, y: 42 }; let _struct = STRUCT; const EXTERNAL_STRUCT: std::sync::atomic::AtomicUsize = std::sync::atomic::ATOMIC_USIZE_INIT; let _external_struct = EXTERNAL_STRUCT; const TUPLE: (i32, &'static str, &'static [u8; 5]) = (1, "two", b"three"); let _tuple = TUPLE; const FUNC: fn() = consts; let _function = FUNC; let _non_const_function = consts; const ARRAY: [&'static str; 3] = ["a", "b", "c"]; let _array = ARRAY; const REPEAT: [&'static [u8; 3]; 10] = [b"foo"; 10]; let _repeat = REPEAT; } ``` ```diff --- consts-old.mir 2016-01-05 23:23:14.163807017 -0600 +++ consts-new.mir 2016-01-05 23:04:51.121386151 -0600 @@ -1,45 +1,45 @@ fn() -> () { let var0: f64; // _float let var1: i32; // _non_const_int let var2: i32; // _int let var3: u32; // _uint let var4: &str; // _str let var5: &[u8; 18]; // _bytestr let var6: bool; // _bool let var7: Point; // _struct let var8: core::sync::atomic::AtomicUsize; // _external_struct let var9: (i32, &str, &[u8; 5]); // _tuple let var10: fn(); // _function let var11: fn() {consts}; // _non_const_function let var12: [&str; 3]; // _array let var13: [&[u8; 3]; 10]; // _repeat let mut tmp0: (); bb0: { - var0 = 3.14159; - var1 = Neg(42); - var2 = -42; - var3 = 42; - var4 = Str("a string"); - var5 = ByteStr[97, 32, 98, 121, 116, 101, 115, 255, 10, 9, 116, 114, 105, 39, 34, 92, 110, 103]; - var6 = true; - var7 = Struct(51); + var0 = const 3.14159; + var1 = Neg(const 42); + var2 = const -42; + var3 = const 42; + var4 = const "a string"; + var5 = const b"a bytes\xff\n\ttri\'\"\\ng"; + var6 = const true; + var7 = const expr Point{x: 42, y: 42,}; var8 = consts::EXTERNAL_STRUCT; - var9 = Tuple(78); - var10 = Function(DefId { krate: 0, node: DefIndex(7) => consts }); + var9 = const expr (1, "two", b"three"); + var10 = const consts; var11 = consts; - var12 = Array(105, 3); - var13 = Repeat(122, 10); + var12 = const expr ["a", "b", "c"]; + var13 = const expr [b"foo"; 10]; drop var8; drop var7; goto -> bb1; } bb1: { return; } bb2: { diverge; } } ```
…lt, r=dotdash finish enabling `-C rpath` by default in rustc. See rust-lang#30353.
r? @nikomatsakis (Related issue about `debug_tuple` at rust-lang/rfcs#1448.) ```rust fn main() { let _x = (); } ``` ```diff --- empty_tuple-old.mir 2016-01-06 16:04:24.206409186 -0600 +++ empty_tuple-new.mir 2016-01-06 14:26:17.324888585 -0600 @@ -1,13 +1,13 @@ fn() -> () { let var0: (); // _x let mut tmp0: (); bb0: { - var0 = ; + var0 = (); Some(goto -> bb1); } bb1: { Some(return); } } ```
… r=jroesch After a call to `visit_def_id()` missing in `mir::visit::Visitor` but not `mir::visit::MutVisitor` has caused me a couple hours of error hunting, I decided I'd take the time to get rid of the code duplication between the two implementations. cc @rust-lang/compiler
…sakis Fixes rust-lang#30674 The test seems to work fine and assertion passes. The test seems to also be generated from MIR (LLVM IR has footprint of MIR translator), thus I’m reenabling it.
I'm working my way through TRPL beginning at "Syntax and Semantics" as was recommended in a previous version. I'm expecting the chapter to incrementally build up my knowledge of the language section by section, assuming no prior Rust experience. So it was a bit of a speed-bump to encounter references and the vector type in a code example long before they had been defined and explained. Another commit in this PR tries to make consistent what is a "chapter" of TRPL versus a "section." Just a nit-pick, but not thinking about that stuff keeps my focus on the important material. My background: Python programmer since ~2000, with moderate exposure to C, C++, assembly, operating systems, and system architecture in university several years ago. For your kind consideration, feel welcome to use or drop or rework any part of this.
(fixes rust-lang#30743) Not sure if the "Note" should be kept.
…_len, r=apasel422 len needs to be prefixed by self for this to work. That is something which trips me up all the time. It's reassuring to see that happening to seasoned Rust programmers.
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors: r+ p=1 |
📌 Commit 926eb83 has been approved by |
💔 Test failed - auto-mac-64-nopt-t |
@bors retry |
⚡ Previous build results for auto-linux-32-nopt-t, auto-linux-32-opt, auto-linux-64-debug-opt, auto-linux-64-nopt-t, auto-linux-64-opt, auto-linux-64-x-android-t, auto-linux-musl-64-opt, auto-mac-32-opt, auto-mac-64-opt, auto-win-gnu-32-nopt-t, auto-win-gnu-32-opt, auto-win-gnu-64-nopt-t, auto-win-gnu-64-opt, auto-win-msvc-32-opt are reusable. Rebuilding only auto-linux-cross-opt, auto-mac-64-nopt-t, auto-win-msvc-64-opt... |