Skip to content
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 8 pull requests #65196

Merged
merged 30 commits into from
Oct 8, 2019
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3754691
Reorder methods of Cell
sinkuu Oct 3, 2019
0b0aeac
Suggest dereferencing boolean reference when used in 'if' or 'while'
XiangQingW Oct 6, 2019
5880ce3
Fix const arguments not displaying in types mismatch diagnostic.
skinnyBat Oct 6, 2019
8a164ac
Suggest dereferencing boolean reference when used in 'if' or 'while'
XiangQingW Oct 6, 2019
bbb69d1
Suggest dereferencing boolean reference when used in 'if' or 'while'
XiangQingW Oct 6, 2019
b7091e4
rewrite documentation for unimplemented!
andrewbanchich Sep 24, 2019
e0fe4be
syntax: cleanup associated const parsing.
Centril Oct 1, 2019
3bdbfbe
syntax: de-dups in item parsing.
Centril Oct 1, 2019
090f3fd
syntax: further item parsing cleanup
Centril Oct 1, 2019
7f9638d
syntax: unify trait parsing a bit.
Centril Oct 1, 2019
a7ba754
syntax: unify and simplify fn signature parsing.
Centril Oct 3, 2019
9c6582a
syntax: use `parse_extern_abi` more.
Centril Oct 7, 2019
6b23c22
syntax: refactor with new `fn parse_use_tree_glob_or_nested`.
Centril Oct 7, 2019
74eac92
Test diagnostic output of type mismatches for types that have const
skinnyBat Oct 7, 2019
4bf7eea
Add long error explanation for E0561
GuillaumeGomez Oct 4, 2019
8dd0008
Update ui tests
GuillaumeGomez Oct 4, 2019
25d04f8
make type-flags exhaustive
nikomatsakis Oct 7, 2019
0b58d9d
correct bug in the "has escaping regions" visitor
nikomatsakis Oct 7, 2019
bec0902
avoid ICE when extracting closure-kind-ty from a canonicalized value
nikomatsakis Oct 7, 2019
1dba4b0
fix ICE from debug output by using `kind_ty` in dumping closure
nikomatsakis Oct 7, 2019
08c0e84
add `debug!` to evaluate_obligation
nikomatsakis Oct 7, 2019
45f7186
use 'invalid argument' for vxWorks
BaoshanPang Oct 7, 2019
2f0618d
Rollup merge of #64726 - andrewbanchich:unimplemented, r=rkruppe
Centril Oct 8, 2019
4737095
Rollup merge of #65040 - Centril:items-cleanup, r=estebank
Centril Oct 8, 2019
a9777b3
Rollup merge of #65046 - sinkuu:cell_reorder, r=shepmaster
Centril Oct 8, 2019
73685ec
Rollup merge of #65098 - GuillaumeGomez:long-err-explanation-E0561, r…
Centril Oct 8, 2019
5422ed7
Rollup merge of #65150 - XiangQingW:master, r=estebank
Centril Oct 8, 2019
ecdb5e9
Rollup merge of #65154 - skinny121:const-arg-diagnostic, r=varkor
Centril Oct 8, 2019
f23c9f4
Rollup merge of #65181 - nikomatsakis:lazy-norm-anon-const-push-1, r=…
Centril Oct 8, 2019
bc7df81
Rollup merge of #65187 - Wind-River:master_before_merge, r=rkruppe
Centril Oct 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 32 additions & 15 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
@@ -519,54 +519,71 @@ macro_rules! unreachable {
});
}

/// Indicates unfinished code.
/// Indicates unfinished code by panicking with a message of "not yet implemented".
///
/// This can be useful if you are prototyping and are just looking to have your
/// code type-check, or if you're implementing a trait that requires multiple
/// methods, and you're only planning on using one of them.
/// This allows the your code to type-check, which is useful if you are prototyping or
/// implementing a trait that requires multiple methods which you don't plan of using all of.
///
/// # Panics
///
/// This will always [panic!](macro.panic.html)
/// This will always [panic!](macro.panic.html) because `unimplemented!` is just a
/// shorthand for `panic!` with a fixed, specific message.
///
/// Like `panic!`, this macro has a second form for displaying custom values.
///
/// # Examples
///
/// Here's an example of some in-progress code. We have a trait `Foo`:
///
/// ```
/// trait Foo {
/// fn bar(&self);
/// fn bar(&self) -> u8;
/// fn baz(&self);
/// fn qux(&self) -> Result<u64, ()>;
/// }
/// ```
///
/// We want to implement `Foo` on one of our types, but we also want to work on
/// just `bar()` first. In order for our code to compile, we need to implement
/// `baz()`, so we can use `unimplemented!`:
/// We want to implement `Foo` for 'MyStruct', but so far we only know how to
/// implement the `bar()` function. `baz()` and `qux()` will still need to be defined
/// in our implementation of `Foo`, but we can use `unimplemented!` in their definitions
/// to allow our code to compile.
///
/// In the meantime, we want to have our program stop running once these
/// unimplemented functions are reached.
///
/// ```
/// # trait Foo {
/// # fn bar(&self);
/// # fn bar(&self) -> u8;
/// # fn baz(&self);
/// # fn qux(&self) -> Result<u64, ()>;
/// # }
/// struct MyStruct;
///
/// impl Foo for MyStruct {
/// fn bar(&self) {
/// // implementation goes here
/// fn bar(&self) -> u8 {
/// 1 + 1
/// }
///
/// fn baz(&self) {
/// // let's not worry about implementing baz() for now
/// // We aren't sure how to even start writing baz yet,
/// // so we have no logic here at all.
/// // This will display "thread 'main' panicked at 'not yet implemented'".
/// unimplemented!();
/// }
///
/// fn qux(&self) -> Result<u64, ()> {
/// let n = self.bar();
/// // We have some logic here,
/// // so we can use unimplemented! to display what we have so far.
/// // This will display:
/// // "thread 'main' panicked at 'not yet implemented: we need to divide by 2'".
/// unimplemented!("we need to divide by {}", n);
/// }
/// }
///
/// fn main() {
/// let s = MyStruct;
/// s.bar();
///
/// // we aren't even using baz() yet, so this is fine.
/// }
/// ```
#[macro_export]