This is meant to be a summary of the current status and the questions around integer fallback and type names. It's meant to be an objective overview so we can discuss at the work week and have the same starting point. (Obviously I have an opinion here, so it might not be totally objective but I'll try).
| // I think this is every possible way to call a method in Rust. | |
| struct Foo; | |
| impl Foo { | |
| fn m1() { | |
| println!("Hello! m1"); | |
| } | |
| fn m2(&self) { |
| execve("/usr/local/bin/cargo", ["cargo", "rustc", "--", "-Ztime-passes"], [/* 24 vars */]) = 0 | |
| brk(0) = 0x7ff9443f7000 | |
| access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) | |
| mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff941c74000 | |
| access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
| open("/root/rust/x86_64-unknown-linux-gnu/stage2/lib/tls/x86_64/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
| stat("/root/rust/x86_64-unknown-linux-gnu/stage2/lib/tls/x86_64", 0x7fffac27ac00) = -1 ENOENT (No such file or directory) | |
| open("/root/rust/x86_64-unknown-linux-gnu/stage2/lib/tls/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
| stat("/root/rust/x86_64-unknown-linux-gnu/stage2/lib/tls", 0x7fffac27ac00) = -1 ENOENT (No such file or directory) | |
| open("/root/rust/x86_64-unknown-linux-gnu/stage2/lib/x86_64/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file |
| time: 0.013; rss: 62MB parsing | |
| time: 0.003; rss: 62MB configuration 1 | |
| time: 0.000; rss: 62MB recursion limit | |
| time: 0.000; rss: 62MB crate injection | |
| time: 0.023; rss: 96MB macro loading | |
| time: 0.001; rss: 98MB plugin loading | |
| time: 0.000; rss: 98MB plugin registration | |
| time: 0.213; rss: 106MB expansion | |
| time: 0.021; rss: 106MB configuration 2 | |
| time: 0.000; rss: 106MB gated configuration checking |
| // Copyright 2015 The Rust Project Developers. See the COPYRIGHT | |
| // file at the top-level directory of this distribution and at | |
| // http://rust-lang.org/COPYRIGHT. | |
| // | |
| // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
| // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
| // option. This file may not be copied, modified, or distributed | |
| // except according to those terms. |
| // Copyright 2015 The Rust Project Developers. See the COPYRIGHT | |
| // file at the top-level directory of this distribution and at | |
| // http://rust-lang.org/COPYRIGHT. | |
| // | |
| // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
| // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
| // option. This file may not be copied, modified, or distributed | |
| // except according to those terms. |
| >>>>>>>>>>>>>>>>>>>>>>> | |
| Teaching an IDE to understand Rust | |
| >>>>>>>>>>>>>>>>>>>>>>> | |
| Abstract | |
| (A concise, engaging description for the public program. Limited to 600 characters.) | |
| IDE support is one of Rust's most requested features. From the 2017 State of Rust Survey: | |
| roughly 30% of Rust users are looking forward to IDE support more than any other feature in 2017 and for 22% of | |
| non-users, lack of IDE support is their main reason for not using Rust. Thankfully, the Rust Language Server is here now and it gets smarter and | |
| more capable every day. |
| Differences spotted in "Utilities for formatting and printing `String`s\n\nThis module contains the runtime support for the [`format!`] syntax extension.\nThis macro is implemented in the compiler to emit calls to this module in\norder to format arguments at runtime into strings.\n\n# Usage\n\nThe [`format!`] macro is intended to be familiar to those coming from C\'s\n`printf`/`fprintf` functions or Python\'s `str.format` function.\n\nSome examples of the [`format!`] extension are:\n\n```\nformat!(\"Hello\"); // => \"Hello\"\nformat!(\"Hello, {}!\", \"world\"); // => \"Hello, world!\"\nformat!(\"The number is {}\", 1); // => \"The number is 1\"\nformat!(\"{:?}\", (3, 4)); // => \"(3, 4)\"\nformat!(\"{value}\", value=4); // => \"4\"\nformat!(\"{} {}\", 1, 2); // => \"1 2\"\nformat!(\"{:04}\", 42); // => \"0042\" with leading zeros\n```\n\nFrom these, you can see that the first argument is a format string. It is\nrequired by the compiler for this to be a s |
| WARNING: documentation for this crate may be rendered differently using the new Pulldown renderer. | |
| See https://github.com/rust-lang/rust/issues/44229 for details. | |
| WARNING: rendering difference in `Constructs a `Layout` from a given `size` and `align`,...` | |
| --> src/liballoc/allocator.rs:79:4 | |
| /html[0]/body[1]/ul[1]/li[1]/p[0] Text differs: | |
| expected: `must not exceed 2^31 (i.e.` | |
| found: `must not exceed 2` | |
| /html[0]/body[1]/ul[1]/li[1]/p[0] Tags differ: expected: `code`, found: `sup` | |
| /html[0]/body[1]/ul[1]/li[1]/p[0] Text differs: | |
| expected: `),` |
When converting from a smart pointer type to a borrowed reference, you need to 'cross-borrow' data. This requires writing &*expr or &**expr, etc. This is usually just annoying - it doesn't help to read or write the code. When writing, you play 'type Tetris', inserting *s until the compiler is happy. When reading it is just line noise. At best, if you are passing a value to a function, it tells you that you are passing a borrowed reference, not owned data. Alternatively, that you are passing by reference, not value.
So, we would like to spare the programmer this burden. The question is how. There have been a few proposals (rust-lang/rfcs#226, rust-lang/rfcs#241, rust-lang/rfcs#248). A central question when evaluating these proposals is whether the programmer should care first about the borrowed-ness of data or about the amount of indirection to the user. I am starting to lean more towards the position of making ownership/borrowing s