Skip to content

Commit 5f2b325

Browse files
committedJul 7, 2018
Auto merge of #52134 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
Stable release 1.27.1 r? @alexcrichton
2 parents 3eda71b + fdbe5b4 commit 5f2b325

File tree

8 files changed

+79
-7
lines changed

8 files changed

+79
-7
lines changed
 

‎RELEASES.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
Version 1.27.1 (2018-07-10)
2+
===========================
3+
4+
Security Notes
5+
--------------
6+
7+
- rustdoc would execute plugins in the /tmp/rustdoc/plugins directory
8+
when running, which enabled executing code as some other user on a
9+
given machine. This release fixes that vulnerability; you can read
10+
more about this on the [blog][rustdoc-sec].
11+
12+
Thank you to Red Hat for responsibily disclosing this vulnerability to us.
13+
14+
Compatibility Notes
15+
-------------------
16+
17+
- The borrow checker was fixed to avoid an additional potential unsoundness when using
18+
match ergonomics: [#51415][51415], [#49534][49534].
19+
20+
[51415]: https://github.com/rust-lang/rust/issues/51415
21+
[49534]: https://github.com/rust-lang/rust/issues/49534
22+
[rustdoc-sec]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html
23+
124
Version 1.27.0 (2018-06-21)
225
==========================
326

‎src/bootstrap/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use Build;
2424
use config::Config;
2525

2626
// The version number
27-
pub const CFG_RELEASE_NUM: &str = "1.27.0";
27+
pub const CFG_RELEASE_NUM: &str = "1.27.1";
2828

2929
pub struct GitInfo {
3030
inner: Option<Info>,

‎src/librustc/middle/expr_use_visitor.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
313313
debug!("consume_body(body={:?})", body);
314314

315315
for arg in &body.arguments {
316-
let arg_ty = return_if_err!(self.mc.node_ty(arg.pat.hir_id));
316+
let arg_ty = return_if_err!(self.mc.pat_ty_adjusted(&arg.pat));
317+
debug!("consume_body: arg_ty = {:?}", arg_ty);
317318

318319
let fn_body_scope_r =
319320
self.tcx().mk_region(ty::ReScope(region::Scope::Node(body.value.hir_id.local_id)));

‎src/librustc/middle/mem_categorization.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
517517
/// implicit deref patterns attached (e.g., it is really
518518
/// `&Some(x)`). In that case, we return the "outermost" type
519519
/// (e.g., `&Option<T>).
520-
fn pat_ty(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
520+
pub fn pat_ty_adjusted(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
521521
// Check for implicit `&` types wrapping the pattern; note
522522
// that these are never attached to binding patterns, so
523523
// actually this is somewhat "disjoint" from the code below
@@ -1283,7 +1283,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
12831283
};
12841284

12851285
for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
1286-
let subpat_ty = self.pat_ty(&subpat)?; // see (*2)
1286+
let subpat_ty = self.pat_ty_adjusted(&subpat)?; // see (*2)
12871287
let interior = InteriorField(FieldIndex(i, Name::intern(&i.to_string())));
12881288
let subcmt = Rc::new(self.cat_imm_interior(pat, cmt.clone(), subpat_ty, interior));
12891289
self.cat_pattern_(subcmt, &subpat, op)?;
@@ -1306,7 +1306,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13061306
};
13071307

13081308
for fp in field_pats {
1309-
let field_ty = self.pat_ty(&fp.node.pat)?; // see (*2)
1309+
let field_ty = self.pat_ty_adjusted(&fp.node.pat)?; // see (*2)
13101310
let f_index = self.tcx.field_index(fp.node.id, self.tables);
13111311
let cmt_field =
13121312
Rc::new(self.cat_field(pat, cmt.clone(), f_index, fp.node.name, field_ty));
@@ -1325,7 +1325,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13251325
ref ty => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty),
13261326
};
13271327
for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
1328-
let subpat_ty = self.pat_ty(&subpat)?; // see (*2)
1328+
let subpat_ty = self.pat_ty_unadjusted(&subpat)?; // see (*2)
13291329
let interior = InteriorField(FieldIndex(i, Name::intern(&i.to_string())));
13301330
let subcmt = Rc::new(self.cat_imm_interior(pat, cmt.clone(), subpat_ty, interior));
13311331
self.cat_pattern_(subcmt, &subpat, op)?;

‎src/librustdoc/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,14 @@ where R: 'static + Send,
681681
}
682682
}
683683

684+
if !plugins.is_empty() && plugin_path.is_none() {
685+
eprintln!("ERROR: You must pass --plugin-path to use --plugins");
686+
std::process::exit(1);
687+
}
688+
689+
684690
// Load all plugins/passes into a PluginManager
685-
let path = plugin_path.unwrap_or("/tmp/rustdoc/plugins".to_string());
691+
let path = plugin_path.unwrap_or("/usr/lib64/rustdoc/plugins".to_string());
686692
let mut pm = plugins::PluginManager::new(PathBuf::from(path));
687693
for pass in &passes {
688694
let plugin = match passes::PASSES.iter()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0507]: cannot move out of borrowed content
2+
--> $DIR/issue-51415.rs:16:47
3+
|
4+
LL | let opt = a.iter().enumerate().find(|(_, &s)| {
5+
| ^ cannot move out of borrowed content
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0507`.

‎src/test/ui/borrowck/issue-51415.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Regression test for #51415: match default bindings were failing to
12+
// see the "move out" implied by `&s` below.
13+
14+
fn main() {
15+
let a = vec![String::from("a")];
16+
let opt = a.iter().enumerate().find(|(_, &s)| {
17+
//~^ ERROR cannot move out
18+
*s == String::from("d")
19+
}).map(|(i, _)| i);
20+
println!("{:?}", opt);
21+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0507]: cannot move out of borrowed content
2+
--> $DIR/issue-51415.rs:16:46
3+
|
4+
LL | let opt = a.iter().enumerate().find(|(_, &s)| {
5+
| ^-
6+
| ||
7+
| |hint: to prevent move, use `ref s` or `ref mut s`
8+
| cannot move out of borrowed content
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0507`.

0 commit comments

Comments
 (0)
Please sign in to comment.