Skip to content

Commit c0d40a1

Browse files
committed
Auto merge of #45192 - steveklabnik:rollup, r=steveklabnik
Rollup of 5 pull requests - Successful merges: #45071, #45139, #45148, #45171, #45180 - Failed merges: #45121
2 parents 264aafe + 4a90366 commit c0d40a1

File tree

6 files changed

+229
-20
lines changed

6 files changed

+229
-20
lines changed

Diff for: RELEASES.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ Version 1.21.0 (2017-10-12)
33

44
Language
55
--------
6-
- [Relaxed path syntax. You can now add type parameters to values][43540]
7-
Example:
8-
```rust
9-
my_macro!(Vec<i32>::new); // Always worked
10-
my_macro!(Vec::<i32>::new); // Now works
11-
```
126
- [You can now use static references for literals.][43838]
137
Example:
148
```rust
159
fn main() {
1610
let x: &'static u32 = &0;
1711
}
1812
```
13+
- [Relaxed path syntax. Optional `::` before `<` is now allowed in all contexts.][43540]
14+
Example:
15+
```rust
16+
my_macro!(Vec<i32>::new); // Always worked
17+
my_macro!(Vec::<i32>::new); // Now works
18+
```
1919

2020
Compiler
2121
--------

Diff for: src/bootstrap/configure.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,6 @@ def configure_section(lines, config):
407407
contents = contents.replace("$(CFG_PYTHON)", sys.executable)
408408
f.write(contents)
409409

410-
# Finally, clean up with a bit of a help message
411-
relpath = os.path.dirname(__file__)
412-
if relpath == '':
413-
relpath = '.'
414-
415410
p("")
416-
p("run `python {}/x.py --help`".format(relpath))
411+
p("run `python {}/x.py --help`".format(rust_dir))
417412
p("")

Diff for: src/etc/gdb_rust_pretty_printing.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ def __init__(self, val):
248248
def to_string(self):
249249
(length, data_ptr) = rustpp.extract_length_and_ptr_from_slice(self.__val)
250250
raw_ptr = data_ptr.get_wrapped_value()
251-
return '"%s"' % raw_ptr.string(encoding="utf-8", length=length)
251+
return raw_ptr.lazy_string(encoding="utf-8", length=length)
252+
253+
def display_hint(self):
254+
return "string"
252255

253256

254257
class RustStdVecPrinter(object):
@@ -278,9 +281,11 @@ def __init__(self, val):
278281
def to_string(self):
279282
vec = self.__val.get_child_at_index(0)
280283
(length, data_ptr, cap) = rustpp.extract_length_ptr_and_cap_from_std_vec(vec)
281-
return '"%s"' % data_ptr.get_wrapped_value().string(encoding="utf-8",
282-
length=length)
284+
return data_ptr.get_wrapped_value().lazy_string(encoding="utf-8",
285+
length=length)
283286

287+
def display_hint(self):
288+
return "string"
284289

285290
class RustOsStringPrinter(object):
286291
def __init__(self, val):
@@ -294,8 +299,10 @@ def to_string(self):
294299

295300
(length, data_ptr, cap) = rustpp.extract_length_ptr_and_cap_from_std_vec(
296301
vec)
297-
return '"%s"' % data_ptr.get_wrapped_value().string(length=length)
302+
return data_ptr.get_wrapped_value().lazy_string(length=length)
298303

304+
def display_hint(self):
305+
return "string"
299306

300307
class RustCStyleVariantPrinter(object):
301308
def __init__(self, val):

Diff for: src/librustc/ty/maps/plumbing.rs

+47-4
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,49 @@ macro_rules! define_provider_struct {
603603
};
604604
}
605605

606+
607+
/// The red/green evaluation system will try to mark a specific DepNode in the
608+
/// dependency graph as green by recursively trying to mark the dependencies of
609+
/// that DepNode as green. While doing so, it will sometimes encounter a DepNode
610+
/// where we don't know if it is red or green and we therefore actually have
611+
/// to recompute its value in order to find out. Since the only piece of
612+
/// information that we have at that point is the DepNode we are trying to
613+
/// re-evaluate, we need some way to re-run a query from just that. This is what
614+
/// `force_from_dep_node()` implements.
615+
///
616+
/// In the general case, a DepNode consists of a DepKind and an opaque
617+
/// GUID/fingerprint that will uniquely identify the node. This GUID/fingerprint
618+
/// is usually constructed by computing a stable hash of the query-key that the
619+
/// DepNode corresponds to. Consequently, it is not in general possible to go
620+
/// back from hash to query-key (since hash functions are not reversible). For
621+
/// this reason `force_from_dep_node()` is expected to fail from time to time
622+
/// because we just cannot find out, from the DepNode alone, what the
623+
/// corresponding query-key is and therefore cannot re-run the query.
624+
///
625+
/// The system deals with this case letting `try_mark_green` fail which forces
626+
/// the root query to be re-evaluated.
627+
///
628+
/// Now, if force_from_dep_node() would always fail, it would be pretty useless.
629+
/// Fortunately, we can use some contextual information that will allow us to
630+
/// reconstruct query-keys for certain kinds of DepNodes. In particular, we
631+
/// enforce by construction that the GUID/fingerprint of certain DepNodes is a
632+
/// valid DefPathHash. Since we also always build a huge table that maps every
633+
/// DefPathHash in the current codebase to the corresponding DefId, we have
634+
/// everything we need to re-run the query.
635+
///
636+
/// Take the `mir_validated` query as an example. Like many other queries, it
637+
/// just has a single parameter: the DefId of the item it will compute the
638+
/// validated MIR for. Now, when we call `force_from_dep_node()` on a dep-node
639+
/// with kind `MirValidated`, we know that the GUID/fingerprint of the dep-node
640+
/// is actually a DefPathHash, and can therefore just look up the corresponding
641+
/// DefId in `tcx.def_path_hash_to_def_id`.
642+
///
643+
/// When you implement a new query, it will likely have a corresponding new
644+
/// DepKind, and you'll have to support it here in `force_from_dep_node()`. As
645+
/// a rule of thumb, if your query takes a DefId or DefIndex as sole parameter,
646+
/// then `force_from_dep_node()` should not fail for it. Otherwise, you can just
647+
/// add it to the "We don't have enough information to reconstruct..." group in
648+
/// the match below.
606649
pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
607650
dep_node: &DepNode)
608651
-> bool {
@@ -687,16 +730,16 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
687730
DepKind::Hir |
688731

689732
// This are anonymous nodes
733+
DepKind::TraitSelect |
734+
735+
// We don't have enough information to reconstruct the query key of
736+
// these
690737
DepKind::IsCopy |
691738
DepKind::IsSized |
692739
DepKind::IsFreeze |
693740
DepKind::NeedsDrop |
694741
DepKind::Layout |
695-
DepKind::TraitSelect |
696742
DepKind::ConstEval |
697-
698-
// We don't have enough information to reconstruct the query key of
699-
// these
700743
DepKind::InstanceSymbolName |
701744
DepKind::MirShim |
702745
DepKind::BorrowCheckKrate |

Diff for: src/test/debuginfo/pretty-std.rs

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
// gdb-command: print some_string
4545
// gdb-check:$8 = Some = {"IAMA optional string!"}
4646

47+
// gdb-command: set print length 5
48+
// gdb-command: print some_string
49+
// gdb-check:$8 = Some = {"IAMA "...}
50+
4751

4852
// === LLDB TESTS ==================================================================================
4953

0 commit comments

Comments
 (0)