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 12 pull requests #48399

Merged
merged 42 commits into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
96157ef
Derive std::cmp::Reverse as Copy or Clone
da-x Jan 12, 2018
20dcc72
inform type annotations
csmoe Feb 14, 2018
0be2dc8
fix stderr
csmoe Feb 17, 2018
2cf683e
Merge branch 'master' into inform_type_annotations
csmoe Feb 17, 2018
b3d6597
move manual "extern crate" statements outside auto "fn main" in doctests
QuietMisdreavus Feb 9, 2018
d8d4c58
fix E0260 error index doctest
QuietMisdreavus Feb 12, 2018
472dcdb
Fix broken documentation link.
frewsxcv Feb 18, 2018
4370a58
fix tyvar_behind_raw_pointer error code
csmoe Feb 18, 2018
872c782
Mark doc examples w/ `extern` blocks as `ignore`.
frewsxcv Feb 18, 2018
6728f21
Generate documentation for auto-trait impls
Aaron1011 Nov 22, 2017
9d7165f
Fix merge conflicts
Aaron1011 Feb 1, 2018
1531fbe
Cleanup formatting
Aaron1011 Feb 10, 2018
0bfbe24
More formatting fixes
Aaron1011 Feb 10, 2018
94fd4f3
More formatting fixups
Aaron1011 Feb 15, 2018
64a1f6f
Fix inlining
Aaron1011 Feb 15, 2018
298d703
Remove extra whitespace
Aaron1011 Feb 16, 2018
0c6ad46
Don't generate auto trait impls for type aliases
Aaron1011 Feb 17, 2018
2aead59
Remove extra space in test
Aaron1011 Feb 18, 2018
8788179
Fix submodule ref
Aaron1011 Feb 19, 2018
6818551
bump pulldown
Manishearth Feb 18, 2018
f60aeec
Include shortcut links in markdown_links
Manishearth Feb 18, 2018
1d0ae9f
Generate shortcut links
Manishearth Feb 18, 2018
a04c124
Add test
Manishearth Feb 18, 2018
5fdc10c
Filter out non-macros in resolve_macro
Manishearth Feb 18, 2018
5651297
Update .mailmap with my real name
jakubadamw Feb 19, 2018
f0a968e
Add missing link
m0ppers Feb 19, 2018
3f93151
Fix count usize link typo in docs
redcape Feb 19, 2018
44d07df
Sort synthetic impls bounds before rendering
Aaron1011 Feb 20, 2018
5cbf9ae
Fix rustdoc test ICE
GuillaumeGomez Feb 20, 2018
7e51e7d
Take 2^5 as examples in document of pow() (fixes #48396)
ordovicia Feb 21, 2018
2a32060
Rollup merge of #47379 - da-x:master, r=sfackler
GuillaumeGomez Feb 21, 2018
aec6535
Rollup merge of #47833 - Aaron1011:final_auto_trait, r=GuillaumeGomez
GuillaumeGomez Feb 21, 2018
f0343cb
Rollup merge of #48106 - QuietMisdreavus:teleporting-crates, r=Guilla…
GuillaumeGomez Feb 21, 2018
ad83b47
Rollup merge of #48198 - csmoe:inform_type_annotations, r=estebank
GuillaumeGomez Feb 21, 2018
cb618ea
Rollup merge of #48314 - frewsxcv:frewsxcv-broken-link, r=GuillaumeGomez
GuillaumeGomez Feb 21, 2018
27c6ff5
Rollup merge of #48325 - frewsxcv:frewxcv-ignore, r=steveklabnik
GuillaumeGomez Feb 21, 2018
fe1293f
Rollup merge of #48335 - Manishearth:shortcut-links, r=QuietMisdreavus
GuillaumeGomez Feb 21, 2018
3746327
Rollup merge of #48352 - JakubAdamWieczorek:mailmap, r=petrochenkov
GuillaumeGomez Feb 21, 2018
d6e649a
Rollup merge of #48354 - m0ppers:add-read-until-link, r=aidanhs
GuillaumeGomez Feb 21, 2018
d9f5eeb
Rollup merge of #48360 - redcape:redcape-count-doc-fix, r=cramertj
GuillaumeGomez Feb 21, 2018
c118d37
Rollup merge of #48382 - GuillaumeGomez:fix-rustdoc-test-panic, r=est…
GuillaumeGomez Feb 21, 2018
24c17cb
Rollup merge of #48397 - ordovicia:pow_doc, r=GuillaumeGomez
GuillaumeGomez Feb 21, 2018
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
6 changes: 3 additions & 3 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ Herman J. Radtke III <[email protected]> Herman J. Radtke III <hermanradtk
Ilyong Cho <[email protected]>
Ivan Ivaschenko <[email protected]>
J. J. Weber <[email protected]>
Jakub Bukaj <[email protected]>
Jakub Bukaj <jakub@jakub.cc> <[email protected]>
Jakub Bukaj <jakub@jakub.cc> Jakub Bukaj <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <jakub[email protected]> <[email protected]>
Jakub Adam Wieczorek <jakub[email protected]> <[email protected]>
James Deng <[email protected]> <[email protected]>
James Miller <[email protected]> <[email protected]>
James Perry <[email protected]>
Expand Down
8 changes: 4 additions & 4 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl Ordering {
/// v.sort_by_key(|&num| (num > 3, Reverse(num)));
/// assert_eq!(v, vec![3, 2, 1, 6, 5, 4]);
/// ```
#[derive(PartialEq, Eq, Debug)]
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
pub struct Reverse<T>(#[stable(feature = "reverse_cmp_key", since = "1.19.0")] pub T);

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub trait Iterator {
/// This function might panic if the iterator has more than [`usize::MAX`]
/// elements.
///
/// [`usize::MAX`]: ../../std/isize/constant.MAX.html
/// [`usize::MAX`]: ../../std/usize/constant.MAX.html
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ Basic usage:
```
", $Feature, "let x: ", stringify!($SelfT), " = 2; // or any other integer type

assert_eq!(x.pow(4), 16);",
assert_eq!(x.pow(5), 32);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -2364,7 +2364,7 @@ assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $E
Basic usage:

```
", $Feature, "assert_eq!(2", stringify!($SelfT), ".pow(4), 16);", $EndFeature, "
", $Feature, "assert_eq!(2", stringify!($SelfT), ".pow(5), 32);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand Down
4 changes: 4 additions & 0 deletions src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ impl DefPathTable {
index
}

pub fn next_id(&self, address_space: DefIndexAddressSpace) -> DefIndex {
DefIndex::from_array_index(self.index_to_key[address_space.index()].len(), address_space)
}

#[inline(always)]
pub fn def_key(&self, index: DefIndex) -> DefKey {
self.index_to_key[index.address_space().index()]
Expand Down
13 changes: 11 additions & 2 deletions src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
// for each body-id in this map, which will process the
// obligations within. This is expected to be done 'late enough'
// that all type inference variables have been bound and so forth.
region_obligations: RefCell<Vec<(ast::NodeId, RegionObligation<'tcx>)>>,
pub region_obligations: RefCell<Vec<(ast::NodeId, RegionObligation<'tcx>)>>,
}

/// A map returned by `skolemize_late_bound_regions()` indicating the skolemized
Expand Down Expand Up @@ -1555,11 +1555,20 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
InferOk { value, obligations }
}

fn borrow_region_constraints(&self) -> RefMut<'_, RegionConstraintCollector<'tcx>> {
pub fn borrow_region_constraints(&self) -> RefMut<'_, RegionConstraintCollector<'tcx>> {
RefMut::map(
self.region_constraints.borrow_mut(),
|c| c.as_mut().expect("region constraints already solved"))
}

/// Clears the selection, evaluation, and projection cachesThis is useful when
/// repeatedly attemping to select an Obligation while changing only
/// its ParamEnv, since FulfillmentContext doesn't use 'probe'
pub fn clear_caches(&self) {
self.selection_cache.clear();
self.evaluation_cache.clear();
self.projection_cache.borrow_mut().clear();
}
}

impl<'a, 'gcx, 'tcx> TypeTrace<'tcx> {
Expand Down
10 changes: 7 additions & 3 deletions src/librustc/infer/region_constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub type VarOrigins = IndexVec<RegionVid, RegionVariableOrigin>;
/// Describes constraints between the region variables and other
/// regions, as well as other conditions that must be verified, or
/// assumptions that can be made.
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct RegionConstraintData<'tcx> {
/// Constraints of the form `A <= B`, where either `A` or `B` can
/// be a region variable (or neither, as it happens).
Expand Down Expand Up @@ -142,7 +142,7 @@ pub enum Constraint<'tcx> {
/// outlive `RS`. Therefore verify that `R <= RS[i]` for some
/// `i`. Inference variables may be involved (but this verification
/// step doesn't influence inference).
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Verify<'tcx> {
pub kind: GenericKind<'tcx>,
pub origin: SubregionOrigin<'tcx>,
Expand All @@ -159,7 +159,7 @@ pub enum GenericKind<'tcx> {
/// When we introduce a verification step, we wish to test that a
/// particular region (let's call it `'min`) meets some bound.
/// The bound is described the by the following grammar:
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum VerifyBound<'tcx> {
/// B = exists {R} --> some 'r in {R} must outlive 'min
///
Expand Down Expand Up @@ -288,6 +288,10 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
&self.var_origins
}

pub fn region_constraint_data(&self) -> &RegionConstraintData<'tcx> {
&self.data
}

/// Once all the constraints have been gathered, extract out the final data.
///
/// Not legal during a snapshot.
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ use syntax_pos::{Span, DUMMY_SP};
pub use self::coherence::{orphan_check, overlapping_impls, OrphanCheckErr, OverlapResult};
pub use self::fulfill::FulfillmentContext;
pub use self::project::MismatchedProjectionTypes;
pub use self::project::{normalize, normalize_projection_type, Normalized};
pub use self::project::{ProjectionCache, ProjectionCacheSnapshot, Reveal};
pub use self::project::{normalize, normalize_projection_type, poly_project_and_unify_type};
pub use self::project::{ProjectionCache, ProjectionCacheSnapshot, Reveal, Normalized};
pub use self::object_safety::ObjectSafetyViolation;
pub use self::object_safety::MethodViolationCode;
pub use self::on_unimplemented::{OnUnimplementedDirective, OnUnimplementedNote};
Expand Down
4 changes: 4 additions & 0 deletions src/librustc/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,10 @@ impl<'tcx> ProjectionCache<'tcx> {
}
}

pub fn clear(&mut self) {
self.map.clear();
}

pub fn snapshot(&mut self) -> ProjectionCacheSnapshot {
ProjectionCacheSnapshot { snapshot: self.map.snapshot() }
}
Expand Down
31 changes: 30 additions & 1 deletion src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ pub struct SelectionContext<'cx, 'gcx: 'cx+'tcx, 'tcx: 'cx> {
inferred_obligations: SnapshotVec<InferredObligationsSnapshotVecDelegate<'tcx>>,

intercrate_ambiguity_causes: Option<Vec<IntercrateAmbiguityCause>>,

/// Controls whether or not to filter out negative impls when selecting.
/// This is used in librustdoc to distinguish between the lack of an impl
/// and a negative impl
allow_negative_impls: bool
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -424,6 +429,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
intercrate: None,
inferred_obligations: SnapshotVec::new(),
intercrate_ambiguity_causes: None,
allow_negative_impls: false,
}
}

Expand All @@ -436,6 +442,20 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
intercrate: Some(mode),
inferred_obligations: SnapshotVec::new(),
intercrate_ambiguity_causes: None,
allow_negative_impls: false,
}
}

pub fn with_negative(infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
allow_negative_impls: bool) -> SelectionContext<'cx, 'gcx, 'tcx> {
debug!("with_negative({:?})", allow_negative_impls);
SelectionContext {
infcx,
freshener: infcx.freshener(),
intercrate: None,
inferred_obligations: SnapshotVec::new(),
intercrate_ambiguity_causes: None,
allow_negative_impls,
}
}

Expand Down Expand Up @@ -1086,7 +1106,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
fn filter_negative_impls(&self, candidate: SelectionCandidate<'tcx>)
-> SelectionResult<'tcx, SelectionCandidate<'tcx>> {
if let ImplCandidate(def_id) = candidate {
if self.tcx().impl_polarity(def_id) == hir::ImplPolarity::Negative {
if !self.allow_negative_impls &&
self.tcx().impl_polarity(def_id) == hir::ImplPolarity::Negative {
return Err(Unimplemented)
}
}
Expand Down Expand Up @@ -3337,6 +3358,10 @@ impl<'tcx> SelectionCache<'tcx> {
hashmap: RefCell::new(FxHashMap())
}
}

pub fn clear(&self) {
*self.hashmap.borrow_mut() = FxHashMap()
}
}

impl<'tcx> EvaluationCache<'tcx> {
Expand All @@ -3345,6 +3370,10 @@ impl<'tcx> EvaluationCache<'tcx> {
hashmap: RefCell::new(FxHashMap())
}
}

pub fn clear(&self) {
*self.hashmap.borrow_mut() = FxHashMap()
}
}

impl<'o,'tcx> TraitObligationStack<'o,'tcx> {
Expand Down
5 changes: 5 additions & 0 deletions src/librustc_data_structures/snapshot_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ impl<K, V> SnapshotMap<K, V>
}
}

pub fn clear(&mut self) {
self.map.clear();
self.undo_log.clear();
}

pub fn insert(&mut self, key: K, value: V) -> bool {
match self.map.insert(key.clone(), value) {
None => {
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ Erroneous code example:
extern crate core;

struct core;

fn main() {}
```

There are two possible solutions:
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
lint::builtin::TYVAR_BEHIND_RAW_POINTER,
scope_expr_id,
span,
&format!("the type of this value must be known in this context"));
&format!("type annotations needed"));
}
} else {
let t = self.structurally_resolved_type(span, final_ty);
Expand Down
4 changes: 1 addition & 3 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5052,9 +5052,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
ty
} else {
if !self.is_tainted_by_errors() {
type_error_struct!(self.tcx.sess, sp, ty, E0619,
"the type of this value must be known in this context")
.emit();
self.need_type_info((**self).body_id, sp, ty);
}
self.demand_suptype(sp, self.tcx.types.err, ty);
self.tcx.types.err
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4368,12 +4368,13 @@ i_am_a_function();
"##,

E0619: r##"
#### Note: this error code is no longer emitted by the compiler.
The type-checker needed to know the type of an expression, but that type had not
yet been inferred.

Erroneous code example:

```compile_fail,E0619
```compile_fail
let mut x = vec![];
match x.pop() {
Some(v) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ path = "lib.rs"
doctest = false

[dependencies]
pulldown-cmark = { version = "0.1.0", default-features = false }
pulldown-cmark = { version = "0.1.2", default-features = false }
tempdir = "0.3"
Loading